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