4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/privcmd_impl.h>
35 #include <sys/domcaps_impl.h>
36 #include <sys/balloon.h>
39 * Handle miscellaneous children of xendev
41 static int devxen(di_minor_t
, di_node_t
);
42 static int xdt(di_minor_t minor
, di_node_t node
);
44 static devfsadm_create_t xen_cbt
[] = {
45 { "xendev", DDI_PSEUDO
, "xenbus",
46 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, devxen
,
48 { "xendev", DDI_PSEUDO
, PRIVCMD_DRIVER_NAME
,
49 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, devxen
,
51 { "xendev", DDI_PSEUDO
, "evtchn",
52 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, devxen
,
54 { "xendev", DDI_PSEUDO
, DOMCAPS_DRIVER_NAME
,
55 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, devxen
,
57 { "xendev", DDI_PSEUDO
, BALLOON_DRIVER_NAME
,
58 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, devxen
,
60 { "pseudo", DDI_PSEUDO
, "xdt",
61 TYPE_EXACT
| DRV_EXACT
, ILEVEL_0
, xdt
65 DEVFSADM_CREATE_INIT_V0(xen_cbt
);
67 static devfsadm_remove_t xen_remove_cbt
[] = {
68 { "xendev", "^" "xen/xenbus" "$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
69 ILEVEL_0
, devfsadm_rm_all
71 { "xendev", "^" PRIVCMD_PATHNAME
"$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
72 ILEVEL_0
, devfsadm_rm_all
74 { "xendev", "^" "xen/evtchn" "$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
75 ILEVEL_0
, devfsadm_rm_all
77 { "xendev", "^" DOMCAPS_PATHNAME
"$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
78 ILEVEL_0
, devfsadm_rm_all
80 { "xendev", "^" BALLOON_PATHNAME
"$", RM_ALWAYS
| RM_PRE
| RM_HOT
,
81 ILEVEL_0
, devfsadm_rm_all
85 DEVFSADM_REMOVE_INIT_V0(xen_remove_cbt
);
88 * /dev/xen/<foo> -> /devices/xendev/<whatever>:<foo>
91 devxen(di_minor_t minor
, di_node_t node
)
95 (void) snprintf(buf
, sizeof (buf
), "xen/%s", di_minor_name(minor
));
96 (void) devfsadm_mklink(buf
, node
, minor
, 0);
98 return (DEVFSADM_CONTINUE
);
102 xdt(di_minor_t minor
, di_node_t node
)
104 char *mname
= di_minor_name(minor
);
105 char path
[MAXPATHLEN
];
107 (void) snprintf(path
, sizeof (path
), "dtrace/provider/%s", mname
);
108 (void) devfsadm_mklink(path
, node
, minor
, 0);
110 return (DEVFSADM_CONTINUE
);