1*5084Sjohnlev /* 2*5084Sjohnlev * CDDL HEADER START 3*5084Sjohnlev * 4*5084Sjohnlev * The contents of this file are subject to the terms of the 5*5084Sjohnlev * Common Development and Distribution License (the "License"). 6*5084Sjohnlev * You may not use this file except in compliance with the License. 7*5084Sjohnlev * 8*5084Sjohnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5084Sjohnlev * or http://www.opensolaris.org/os/licensing. 10*5084Sjohnlev * See the License for the specific language governing permissions 11*5084Sjohnlev * and limitations under the License. 12*5084Sjohnlev * 13*5084Sjohnlev * When distributing Covered Code, include this CDDL HEADER in each 14*5084Sjohnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5084Sjohnlev * If applicable, add the following below this CDDL HEADER, with the 16*5084Sjohnlev * fields enclosed by brackets "[]" replaced with your own identifying 17*5084Sjohnlev * information: Portions Copyright [yyyy] [name of copyright owner] 18*5084Sjohnlev * 19*5084Sjohnlev * CDDL HEADER END 20*5084Sjohnlev */ 21*5084Sjohnlev /* 22*5084Sjohnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*5084Sjohnlev * Use is subject to license terms. 24*5084Sjohnlev */ 25*5084Sjohnlev 26*5084Sjohnlev #pragma ident "%Z%%M% %I% %E% SMI" 27*5084Sjohnlev 28*5084Sjohnlev #include <regex.h> 29*5084Sjohnlev #include <devfsadm.h> 30*5084Sjohnlev #include <stdio.h> 31*5084Sjohnlev #include <strings.h> 32*5084Sjohnlev #include <stdlib.h> 33*5084Sjohnlev #include <limits.h> 34*5084Sjohnlev #include <sys/privcmd_impl.h> 35*5084Sjohnlev #include <sys/domcaps_impl.h> 36*5084Sjohnlev #include <sys/balloon.h> 37*5084Sjohnlev 38*5084Sjohnlev /* 39*5084Sjohnlev * Handle miscellaneous children of xendev 40*5084Sjohnlev */ 41*5084Sjohnlev static int devxen(di_minor_t, di_node_t); 42*5084Sjohnlev 43*5084Sjohnlev static devfsadm_create_t xen_cbt[] = { 44*5084Sjohnlev { "xendev", DDI_PSEUDO, "xenbus", 45*5084Sjohnlev TYPE_EXACT | DRV_EXACT, ILEVEL_0, devxen, 46*5084Sjohnlev }, 47*5084Sjohnlev { "xendev", DDI_PSEUDO, PRIVCMD_DRIVER_NAME, 48*5084Sjohnlev TYPE_EXACT | DRV_EXACT, ILEVEL_0, devxen, 49*5084Sjohnlev }, 50*5084Sjohnlev { "xendev", DDI_PSEUDO, "evtchn", 51*5084Sjohnlev TYPE_EXACT | DRV_EXACT, ILEVEL_0, devxen, 52*5084Sjohnlev }, 53*5084Sjohnlev { "xendev", DDI_PSEUDO, DOMCAPS_DRIVER_NAME, 54*5084Sjohnlev TYPE_EXACT | DRV_EXACT, ILEVEL_0, devxen, 55*5084Sjohnlev }, 56*5084Sjohnlev { "xendev", DDI_PSEUDO, BALLOON_DRIVER_NAME, 57*5084Sjohnlev TYPE_EXACT | DRV_EXACT, ILEVEL_0, devxen, 58*5084Sjohnlev }, 59*5084Sjohnlev }; 60*5084Sjohnlev 61*5084Sjohnlev DEVFSADM_CREATE_INIT_V0(xen_cbt); 62*5084Sjohnlev 63*5084Sjohnlev static devfsadm_remove_t xen_remove_cbt[] = { 64*5084Sjohnlev { "xendev", "^" "xen/xenbus" "$", RM_ALWAYS | RM_PRE | RM_HOT, 65*5084Sjohnlev ILEVEL_0, devfsadm_rm_all 66*5084Sjohnlev }, 67*5084Sjohnlev { "xendev", "^" PRIVCMD_PATHNAME "$", RM_ALWAYS | RM_PRE | RM_HOT, 68*5084Sjohnlev ILEVEL_0, devfsadm_rm_all 69*5084Sjohnlev }, 70*5084Sjohnlev { "xendev", "^" "xen/evtchn" "$", RM_ALWAYS | RM_PRE | RM_HOT, 71*5084Sjohnlev ILEVEL_0, devfsadm_rm_all 72*5084Sjohnlev }, 73*5084Sjohnlev { "xendev", "^" DOMCAPS_PATHNAME "$", RM_ALWAYS | RM_PRE | RM_HOT, 74*5084Sjohnlev ILEVEL_0, devfsadm_rm_all 75*5084Sjohnlev }, 76*5084Sjohnlev { "xendev", "^" BALLOON_PATHNAME "$", RM_ALWAYS | RM_PRE | RM_HOT, 77*5084Sjohnlev ILEVEL_0, devfsadm_rm_all 78*5084Sjohnlev }, 79*5084Sjohnlev }; 80*5084Sjohnlev 81*5084Sjohnlev DEVFSADM_REMOVE_INIT_V0(xen_remove_cbt); 82*5084Sjohnlev 83*5084Sjohnlev /* 84*5084Sjohnlev * /dev/xen/<foo> -> /devices/xendev/<whatever>:<foo> 85*5084Sjohnlev */ 86*5084Sjohnlev static int 87*5084Sjohnlev devxen(di_minor_t minor, di_node_t node) 88*5084Sjohnlev { 89*5084Sjohnlev char buf[256]; 90*5084Sjohnlev 91*5084Sjohnlev (void) snprintf(buf, sizeof (buf), "xen/%s", di_minor_name(minor)); 92*5084Sjohnlev (void) devfsadm_mklink(buf, node, minor, 0); 93*5084Sjohnlev 94*5084Sjohnlev return (DEVFSADM_CONTINUE); 95*5084Sjohnlev } 96