bfc848c632c9eacb2a640246d96e198f1b185c03jm/*
bfc848c632c9eacb2a640246d96e198f1b185c03jm * CDDL HEADER START
bfc848c632c9eacb2a640246d96e198f1b185c03jm *
bfc848c632c9eacb2a640246d96e198f1b185c03jm * The contents of this file are subject to the terms of the
bfc848c632c9eacb2a640246d96e198f1b185c03jm * Common Development and Distribution License (the "License").
bfc848c632c9eacb2a640246d96e198f1b185c03jm * You may not use this file except in compliance with the License.
bfc848c632c9eacb2a640246d96e198f1b185c03jm *
bfc848c632c9eacb2a640246d96e198f1b185c03jm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bfc848c632c9eacb2a640246d96e198f1b185c03jm * or http://www.opensolaris.org/os/licensing.
bfc848c632c9eacb2a640246d96e198f1b185c03jm * See the License for the specific language governing permissions
bfc848c632c9eacb2a640246d96e198f1b185c03jm * and limitations under the License.
bfc848c632c9eacb2a640246d96e198f1b185c03jm *
bfc848c632c9eacb2a640246d96e198f1b185c03jm * When distributing Covered Code, include this CDDL HEADER in each
bfc848c632c9eacb2a640246d96e198f1b185c03jm * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bfc848c632c9eacb2a640246d96e198f1b185c03jm * If applicable, add the following below this CDDL HEADER, with the
bfc848c632c9eacb2a640246d96e198f1b185c03jm * fields enclosed by brackets "[]" replaced with your own identifying
bfc848c632c9eacb2a640246d96e198f1b185c03jm * information: Portions Copyright [yyyy] [name of copyright owner]
bfc848c632c9eacb2a640246d96e198f1b185c03jm *
bfc848c632c9eacb2a640246d96e198f1b185c03jm * CDDL HEADER END
bfc848c632c9eacb2a640246d96e198f1b185c03jm */
bfc848c632c9eacb2a640246d96e198f1b185c03jm/*
bfc848c632c9eacb2a640246d96e198f1b185c03jm * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
bfc848c632c9eacb2a640246d96e198f1b185c03jm * Use is subject to license terms.
bfc848c632c9eacb2a640246d96e198f1b185c03jm */
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm#pragma ident "%Z%%M% %I% %E% SMI"
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm#include <devfsadm.h>
bfc848c632c9eacb2a640246d96e198f1b185c03jm#include <strings.h>
bfc848c632c9eacb2a640246d96e198f1b185c03jm#include <stdio.h>
bfc848c632c9eacb2a640246d96e198f1b185c03jm#include <sys/vscan.h>
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jmstatic int vscan(di_minor_t minor, di_node_t node);
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jmstatic devfsadm_create_t vscan_create_cbt[] = {
bfc848c632c9eacb2a640246d96e198f1b185c03jm { "pseudo", "ddi_pseudo", "vscan",
bfc848c632c9eacb2a640246d96e198f1b185c03jm TYPE_EXACT | DRV_EXACT, ILEVEL_0, vscan },
bfc848c632c9eacb2a640246d96e198f1b185c03jm};
bfc848c632c9eacb2a640246d96e198f1b185c03jmDEVFSADM_CREATE_INIT_V0(vscan_create_cbt);
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jmstatic devfsadm_remove_t vscan_remove_cbt[] = {
bfc848c632c9eacb2a640246d96e198f1b185c03jm { "vscan", "^vscan/vscan[0-9]+$", RM_HOT | RM_POST,
bfc848c632c9eacb2a640246d96e198f1b185c03jm ILEVEL_0, devfsadm_rm_all
bfc848c632c9eacb2a640246d96e198f1b185c03jm }
bfc848c632c9eacb2a640246d96e198f1b185c03jm};
bfc848c632c9eacb2a640246d96e198f1b185c03jmDEVFSADM_REMOVE_INIT_V0(vscan_remove_cbt);
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jmstatic int
bfc848c632c9eacb2a640246d96e198f1b185c03jmvscan(di_minor_t minor, di_node_t node)
bfc848c632c9eacb2a640246d96e198f1b185c03jm{
bfc848c632c9eacb2a640246d96e198f1b185c03jm char *mname = di_minor_name(minor);
bfc848c632c9eacb2a640246d96e198f1b185c03jm char path[MAXPATHLEN];
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm (void) snprintf(path, sizeof (path), "vscan/%s", mname);
bfc848c632c9eacb2a640246d96e198f1b185c03jm (void) devfsadm_mklink(path, node, minor, 0);
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm return (DEVFSADM_CONTINUE);
bfc848c632c9eacb2a640246d96e198f1b185c03jm}