xref: /titanic_51/usr/src/cmd/devfsadm/zut_link.c (revision e802abbda8c322f24d47835734f4a793ef15ddc8)
1*e802abbdSTim Haley /*
2*e802abbdSTim Haley  * CDDL HEADER START
3*e802abbdSTim Haley  *
4*e802abbdSTim Haley  * The contents of this file are subject to the terms of the
5*e802abbdSTim Haley  * Common Development and Distribution License (the "License").
6*e802abbdSTim Haley  * You may not use this file except in compliance with the License.
7*e802abbdSTim Haley  *
8*e802abbdSTim Haley  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*e802abbdSTim Haley  * or http://www.opensolaris.org/os/licensing.
10*e802abbdSTim Haley  * See the License for the specific language governing permissions
11*e802abbdSTim Haley  * and limitations under the License.
12*e802abbdSTim Haley  *
13*e802abbdSTim Haley  * When distributing Covered Code, include this CDDL HEADER in each
14*e802abbdSTim Haley  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*e802abbdSTim Haley  * If applicable, add the following below this CDDL HEADER, with the
16*e802abbdSTim Haley  * fields enclosed by brackets "[]" replaced with your own identifying
17*e802abbdSTim Haley  * information: Portions Copyright [yyyy] [name of copyright owner]
18*e802abbdSTim Haley  *
19*e802abbdSTim Haley  * CDDL HEADER END
20*e802abbdSTim Haley  */
21*e802abbdSTim Haley /*
22*e802abbdSTim Haley  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*e802abbdSTim Haley  * Use is subject to license terms.
24*e802abbdSTim Haley  */
25*e802abbdSTim Haley 
26*e802abbdSTim Haley #include <regex.h>
27*e802abbdSTim Haley #include <devfsadm.h>
28*e802abbdSTim Haley #include <stdio.h>
29*e802abbdSTim Haley #include <strings.h>
30*e802abbdSTim Haley #include <stdlib.h>
31*e802abbdSTim Haley #include <limits.h>
32*e802abbdSTim Haley #include <sys/mkdev.h>
33*e802abbdSTim Haley #include <sys/fs/zut.h>
34*e802abbdSTim Haley 
35*e802abbdSTim Haley /* zfs unit test driver */
36*e802abbdSTim Haley 
37*e802abbdSTim Haley static int zut(di_minor_t minor, di_node_t node);
38*e802abbdSTim Haley 
39*e802abbdSTim Haley /*
40*e802abbdSTim Haley  * devfs create callback register
41*e802abbdSTim Haley  */
42*e802abbdSTim Haley static devfsadm_create_t zut_create_cbt[] = {
43*e802abbdSTim Haley 	{ "pseudo", "ddi_pseudo", ZUT_DRIVER,
44*e802abbdSTim Haley 	    TYPE_EXACT | DRV_EXACT, ILEVEL_0, zut,
45*e802abbdSTim Haley 	},
46*e802abbdSTim Haley };
47*e802abbdSTim Haley DEVFSADM_CREATE_INIT_V0(zut_create_cbt);
48*e802abbdSTim Haley 
49*e802abbdSTim Haley /*
50*e802abbdSTim Haley  * For the zut control node:
51*e802abbdSTim Haley  *	/dev/zut -> /devices/pseudo/zut@0:zut
52*e802abbdSTim Haley  */
53*e802abbdSTim Haley static int
54*e802abbdSTim Haley zut(di_minor_t minor, di_node_t node)
55*e802abbdSTim Haley {
56*e802abbdSTim Haley 	if (strcmp(di_minor_name(minor), ZUT_DRIVER) == 0)
57*e802abbdSTim Haley 		(void) devfsadm_mklink(ZUT_DRIVER, node, minor, 0);
58*e802abbdSTim Haley 
59*e802abbdSTim Haley 	return (DEVFSADM_CONTINUE);
60*e802abbdSTim Haley }
61