1*6407Sjm199354 /*
2*6407Sjm199354 * CDDL HEADER START
3*6407Sjm199354 *
4*6407Sjm199354 * The contents of this file are subject to the terms of the
5*6407Sjm199354 * Common Development and Distribution License (the "License").
6*6407Sjm199354 * You may not use this file except in compliance with the License.
7*6407Sjm199354 *
8*6407Sjm199354 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*6407Sjm199354 * or http://www.opensolaris.org/os/licensing.
10*6407Sjm199354 * See the License for the specific language governing permissions
11*6407Sjm199354 * and limitations under the License.
12*6407Sjm199354 *
13*6407Sjm199354 * When distributing Covered Code, include this CDDL HEADER in each
14*6407Sjm199354 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*6407Sjm199354 * If applicable, add the following below this CDDL HEADER, with the
16*6407Sjm199354 * fields enclosed by brackets "[]" replaced with your own identifying
17*6407Sjm199354 * information: Portions Copyright [yyyy] [name of copyright owner]
18*6407Sjm199354 *
19*6407Sjm199354 * CDDL HEADER END
20*6407Sjm199354 */
21*6407Sjm199354 /*
22*6407Sjm199354 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23*6407Sjm199354 * Use is subject to license terms.
24*6407Sjm199354 */
25*6407Sjm199354
26*6407Sjm199354 #pragma ident "%Z%%M% %I% %E% SMI"
27*6407Sjm199354
28*6407Sjm199354 #include <devfsadm.h>
29*6407Sjm199354 #include <strings.h>
30*6407Sjm199354 #include <stdio.h>
31*6407Sjm199354 #include <sys/vscan.h>
32*6407Sjm199354
33*6407Sjm199354 static int vscan(di_minor_t minor, di_node_t node);
34*6407Sjm199354
35*6407Sjm199354 static devfsadm_create_t vscan_create_cbt[] = {
36*6407Sjm199354 { "pseudo", "ddi_pseudo", "vscan",
37*6407Sjm199354 TYPE_EXACT | DRV_EXACT, ILEVEL_0, vscan },
38*6407Sjm199354 };
39*6407Sjm199354 DEVFSADM_CREATE_INIT_V0(vscan_create_cbt);
40*6407Sjm199354
41*6407Sjm199354 static devfsadm_remove_t vscan_remove_cbt[] = {
42*6407Sjm199354 { "vscan", "^vscan/vscan[0-9]+$", RM_HOT | RM_POST,
43*6407Sjm199354 ILEVEL_0, devfsadm_rm_all
44*6407Sjm199354 }
45*6407Sjm199354 };
46*6407Sjm199354 DEVFSADM_REMOVE_INIT_V0(vscan_remove_cbt);
47*6407Sjm199354
48*6407Sjm199354 static int
vscan(di_minor_t minor,di_node_t node)49*6407Sjm199354 vscan(di_minor_t minor, di_node_t node)
50*6407Sjm199354 {
51*6407Sjm199354 char *mname = di_minor_name(minor);
52*6407Sjm199354 char path[MAXPATHLEN];
53*6407Sjm199354
54*6407Sjm199354 (void) snprintf(path, sizeof (path), "vscan/%s", mname);
55*6407Sjm199354 (void) devfsadm_mklink(path, node, minor, 0);
56*6407Sjm199354
57*6407Sjm199354 return (DEVFSADM_CONTINUE);
58*6407Sjm199354 }
59