1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <regex.h> 30*7c478bd9Sstevel@tonic-gate #include <devfsadm.h> 31*7c478bd9Sstevel@tonic-gate #include <stdio.h> 32*7c478bd9Sstevel@tonic-gate #include <strings.h> 33*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 34*7c478bd9Sstevel@tonic-gate #include <limits.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/zone.h> 36*7c478bd9Sstevel@tonic-gate #include <sys/zcons.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/cpuid_drv.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate static int display(di_minor_t minor, di_node_t node); 40*7c478bd9Sstevel@tonic-gate static int parallel(di_minor_t minor, di_node_t node); 41*7c478bd9Sstevel@tonic-gate static int node_slash_minor(di_minor_t minor, di_node_t node); 42*7c478bd9Sstevel@tonic-gate static int driver_minor(di_minor_t minor, di_node_t node); 43*7c478bd9Sstevel@tonic-gate static int node_name(di_minor_t minor, di_node_t node); 44*7c478bd9Sstevel@tonic-gate static int minor_name(di_minor_t minor, di_node_t node); 45*7c478bd9Sstevel@tonic-gate static int conskbd(di_minor_t minor, di_node_t node); 46*7c478bd9Sstevel@tonic-gate static int consms(di_minor_t minor, di_node_t node); 47*7c478bd9Sstevel@tonic-gate static int power_button(di_minor_t minor, di_node_t node); 48*7c478bd9Sstevel@tonic-gate static int fc_port(di_minor_t minor, di_node_t node); 49*7c478bd9Sstevel@tonic-gate static int printer_create(di_minor_t minor, di_node_t node); 50*7c478bd9Sstevel@tonic-gate static int se_hdlc_create(di_minor_t minor, di_node_t node); 51*7c478bd9Sstevel@tonic-gate static int ppm(di_minor_t minor, di_node_t node); 52*7c478bd9Sstevel@tonic-gate static int gpio(di_minor_t minor, di_node_t node); 53*7c478bd9Sstevel@tonic-gate static int av_create(di_minor_t minor, di_node_t node); 54*7c478bd9Sstevel@tonic-gate static int tsalarm_create(di_minor_t minor, di_node_t node); 55*7c478bd9Sstevel@tonic-gate static int zcons_create(di_minor_t minor, di_node_t node); 56*7c478bd9Sstevel@tonic-gate static int cpuid(di_minor_t minor, di_node_t node); 57*7c478bd9Sstevel@tonic-gate static int glvc(di_minor_t minor, di_node_t node); 58*7c478bd9Sstevel@tonic-gate static int ses_callback(di_minor_t minor, di_node_t node); 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate static devfsadm_create_t misc_cbt[] = { 61*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "(^pts$)|(^sad$)", 62*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_slash_minor 63*7c478bd9Sstevel@tonic-gate }, 64*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "zsh", 65*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, driver_minor 66*7c478bd9Sstevel@tonic-gate }, 67*7c478bd9Sstevel@tonic-gate { "network", "ddi_network", NULL, 68*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, minor_name 69*7c478bd9Sstevel@tonic-gate }, 70*7c478bd9Sstevel@tonic-gate { "display", "ddi_display", NULL, 71*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, display 72*7c478bd9Sstevel@tonic-gate }, 73*7c478bd9Sstevel@tonic-gate { "parallel", "ddi_parallel", NULL, 74*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, parallel 75*7c478bd9Sstevel@tonic-gate }, 76*7c478bd9Sstevel@tonic-gate { "enclosure", DDI_NT_SCSI_ENCLOSURE, NULL, 77*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, ses_callback 78*7c478bd9Sstevel@tonic-gate }, 79*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "(^winlock$)|(^pm$)", 80*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_name 81*7c478bd9Sstevel@tonic-gate }, 82*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "conskbd", 83*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, conskbd 84*7c478bd9Sstevel@tonic-gate }, 85*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "consms", 86*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, consms 87*7c478bd9Sstevel@tonic-gate }, 88*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "rsm", 89*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name 90*7c478bd9Sstevel@tonic-gate }, 91*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 92*7c478bd9Sstevel@tonic-gate "(^lockstat$)|(^SUNW,rtvc$)|(^vol$)|(^log$)|(^sy$)|" 93*7c478bd9Sstevel@tonic-gate "(^ksyms$)|(^clone$)|(^tl$)|(^tnf$)|(^kstat$)|(^mdesc$)|" 94*7c478bd9Sstevel@tonic-gate "(^eeprom$)|(^ptsl$)|(^mm$)|(^wc$)|(^dump$)|(^cn$)|(^lo$)|(^ptm$)|" 95*7c478bd9Sstevel@tonic-gate "(^ptc$)|(^openeepr$)|(^poll$)|(^sysmsg$)|(^random$)|(^trapstat$)|" 96*7c478bd9Sstevel@tonic-gate "(^cryptoadm$)|(^crypto$)|(^pool$)|(^poolctl$)|(^bl$)|(^kmdb$)|" 97*7c478bd9Sstevel@tonic-gate "(^sysevent$)", 98*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name 99*7c478bd9Sstevel@tonic-gate }, 100*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 101*7c478bd9Sstevel@tonic-gate "(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|(^sctp$)|" 102*7c478bd9Sstevel@tonic-gate "(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|(^sctp6$)|" 103*7c478bd9Sstevel@tonic-gate "(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|" 104*7c478bd9Sstevel@tonic-gate "(^nca$)", 105*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name 106*7c478bd9Sstevel@tonic-gate }, 107*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 108*7c478bd9Sstevel@tonic-gate "(^pfil$)|(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|" 109*7c478bd9Sstevel@tonic-gate "(^ipsync$)|(^ipscan$)|(^iplookup$)", 110*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 111*7c478bd9Sstevel@tonic-gate }, 112*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", 113*7c478bd9Sstevel@tonic-gate "(^kdmouse$)|(^logi$)|(^rootprop$)|(^msm$)", 114*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, node_name 115*7c478bd9Sstevel@tonic-gate }, 116*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "tod", 117*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name 118*7c478bd9Sstevel@tonic-gate }, 119*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "envctrl(two)?", 120*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name, 121*7c478bd9Sstevel@tonic-gate }, 122*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "fcode", 123*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 124*7c478bd9Sstevel@tonic-gate }, 125*7c478bd9Sstevel@tonic-gate { "power_button", "ddi_power_button", NULL, 126*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, power_button, 127*7c478bd9Sstevel@tonic-gate }, 128*7c478bd9Sstevel@tonic-gate { "FC port", "ddi_ctl:devctl", "fp", 129*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, fc_port 130*7c478bd9Sstevel@tonic-gate }, 131*7c478bd9Sstevel@tonic-gate { "printer", "ddi_printer", NULL, 132*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, printer_create 133*7c478bd9Sstevel@tonic-gate }, 134*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "se", 135*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, se_hdlc_create 136*7c478bd9Sstevel@tonic-gate }, 137*7c478bd9Sstevel@tonic-gate { "ppm", "ddi_ppm", NULL, 138*7c478bd9Sstevel@tonic-gate TYPE_EXACT, ILEVEL_0, ppm 139*7c478bd9Sstevel@tonic-gate }, 140*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "gpio_87317", 141*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, gpio 142*7c478bd9Sstevel@tonic-gate }, 143*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "sckmdrv", 144*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name, 145*7c478bd9Sstevel@tonic-gate }, 146*7c478bd9Sstevel@tonic-gate { "av", "^ddi_av:(isoch|async)$", NULL, 147*7c478bd9Sstevel@tonic-gate TYPE_RE, ILEVEL_0, av_create, 148*7c478bd9Sstevel@tonic-gate }, 149*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "tsalarm", 150*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_RE, ILEVEL_0, tsalarm_create, 151*7c478bd9Sstevel@tonic-gate }, 152*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "daplt", 153*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name 154*7c478bd9Sstevel@tonic-gate }, 155*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "zcons", 156*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, zcons_create, 157*7c478bd9Sstevel@tonic-gate }, 158*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", CPUID_DRIVER_NAME, 159*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, cpuid, 160*7c478bd9Sstevel@tonic-gate }, 161*7c478bd9Sstevel@tonic-gate { "pseudo", "ddi_pseudo", "glvc", 162*7c478bd9Sstevel@tonic-gate TYPE_EXACT | DRV_EXACT, ILEVEL_0, glvc, 163*7c478bd9Sstevel@tonic-gate }, 164*7c478bd9Sstevel@tonic-gate }; 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate DEVFSADM_CREATE_INIT_V0(misc_cbt); 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate static devfsadm_remove_t misc_remove_cbt[] = { 169*7c478bd9Sstevel@tonic-gate { "pseudo", "^profile$", 170*7c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 171*7c478bd9Sstevel@tonic-gate }, 172*7c478bd9Sstevel@tonic-gate { "pseudo", "^rsm$", 173*7c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 174*7c478bd9Sstevel@tonic-gate }, 175*7c478bd9Sstevel@tonic-gate { "printer", "^printers/[0-9]+$", 176*7c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 177*7c478bd9Sstevel@tonic-gate }, 178*7c478bd9Sstevel@tonic-gate { "av", "^av/[0-9]+/(async|isoch)$", 179*7c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 180*7c478bd9Sstevel@tonic-gate }, 181*7c478bd9Sstevel@tonic-gate { "pseudo", "^daplt$", 182*7c478bd9Sstevel@tonic-gate RM_PRE | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 183*7c478bd9Sstevel@tonic-gate }, 184*7c478bd9Sstevel@tonic-gate { "pseudo", "^zcons/" ZONENAME_REGEXP "/(" ZCONS_MASTER_NAME "|" 185*7c478bd9Sstevel@tonic-gate ZCONS_SLAVE_NAME ")$", 186*7c478bd9Sstevel@tonic-gate RM_PRE | RM_HOT | RM_ALWAYS, ILEVEL_0, devfsadm_rm_all 187*7c478bd9Sstevel@tonic-gate }, 188*7c478bd9Sstevel@tonic-gate { "pseudo", "^cpu/self/cpuid$", RM_ALWAYS | RM_PRE | RM_HOT, 189*7c478bd9Sstevel@tonic-gate ILEVEL_0, devfsadm_rm_all 190*7c478bd9Sstevel@tonic-gate }, 191*7c478bd9Sstevel@tonic-gate { "enclosure", "^es/ses[0-9]+$", RM_POST, 192*7c478bd9Sstevel@tonic-gate ILEVEL_0, devfsadm_rm_all 193*7c478bd9Sstevel@tonic-gate } 194*7c478bd9Sstevel@tonic-gate }; 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate /* Rules for gpio devices */ 197*7c478bd9Sstevel@tonic-gate static devfsadm_enumerate_t gpio_rules[1] = 198*7c478bd9Sstevel@tonic-gate {"^gpio([0-9]+)$", 1, MATCH_ALL}; 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate DEVFSADM_REMOVE_INIT_V0(misc_remove_cbt); 201*7c478bd9Sstevel@tonic-gate 202*7c478bd9Sstevel@tonic-gate /* 203*7c478bd9Sstevel@tonic-gate * Handles minor node type "ddi_display". 204*7c478bd9Sstevel@tonic-gate * 205*7c478bd9Sstevel@tonic-gate * type=ddi_display fbs/\M0 fb\N0 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate static int 208*7c478bd9Sstevel@tonic-gate display(di_minor_t minor, di_node_t node) 209*7c478bd9Sstevel@tonic-gate { 210*7c478bd9Sstevel@tonic-gate char l_path[PATH_MAX + 1], contents[PATH_MAX + 1], *buf; 211*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^fb([0-9]+)$", 1, MATCH_ALL}; 212*7c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate /* create fbs/\M0 primary link */ 215*7c478bd9Sstevel@tonic-gate (void) strcpy(l_path, "fbs/"); 216*7c478bd9Sstevel@tonic-gate (void) strcat(l_path, mn); 217*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate /* create fb\N0 which links to fbs/\M0 */ 220*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(l_path, 0, &buf, rules, 1)) { 221*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 222*7c478bd9Sstevel@tonic-gate } 223*7c478bd9Sstevel@tonic-gate (void) strcpy(contents, l_path); 224*7c478bd9Sstevel@tonic-gate (void) strcpy(l_path, "fb"); 225*7c478bd9Sstevel@tonic-gate (void) strcat(l_path, buf); 226*7c478bd9Sstevel@tonic-gate free(buf); 227*7c478bd9Sstevel@tonic-gate (void) devfsadm_secondary_link(l_path, contents, 0); 228*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 229*7c478bd9Sstevel@tonic-gate } 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate /* 232*7c478bd9Sstevel@tonic-gate * Handles minor node type "ddi_parallel". 233*7c478bd9Sstevel@tonic-gate * type=ddi_parallel;name=mcpp mcpp\N0 234*7c478bd9Sstevel@tonic-gate */ 235*7c478bd9Sstevel@tonic-gate static int 236*7c478bd9Sstevel@tonic-gate parallel(di_minor_t minor, di_node_t node) 237*7c478bd9Sstevel@tonic-gate { 238*7c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1], *buf; 239*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"mcpp([0-9]+)$", 1, MATCH_ALL}; 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate if (strcmp(di_node_name(node), "mcpp") != 0) { 243*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 244*7c478bd9Sstevel@tonic-gate } 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate if (NULL == (buf = di_devfs_path(node))) { 247*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 248*7c478bd9Sstevel@tonic-gate } 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", 251*7c478bd9Sstevel@tonic-gate buf, di_minor_name(minor)); 252*7c478bd9Sstevel@tonic-gate 253*7c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 256*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 257*7c478bd9Sstevel@tonic-gate } 258*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "mcpp%s", buf); 259*7c478bd9Sstevel@tonic-gate free(buf); 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 262*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 263*7c478bd9Sstevel@tonic-gate } 264*7c478bd9Sstevel@tonic-gate 265*7c478bd9Sstevel@tonic-gate static int 266*7c478bd9Sstevel@tonic-gate ses_callback(di_minor_t minor, di_node_t node) 267*7c478bd9Sstevel@tonic-gate { 268*7c478bd9Sstevel@tonic-gate char l_path[PATH_MAX]; 269*7c478bd9Sstevel@tonic-gate char *buf; 270*7c478bd9Sstevel@tonic-gate char *devfspath; 271*7c478bd9Sstevel@tonic-gate char p_path[PATH_MAX]; 272*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t re[] = {"^es$/^ses([0-9]+)$", 1, MATCH_ALL}; 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gate /* find devices path -- need to free mem */ 275*7c478bd9Sstevel@tonic-gate if (NULL == (devfspath = di_devfs_path(node))) { 276*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 277*7c478bd9Sstevel@tonic-gate } 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate (void) snprintf(p_path, sizeof (p_path), "%s:%s", devfspath, 280*7c478bd9Sstevel@tonic-gate di_minor_name(minor)); 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate /* find next number to use; buf is an ascii number */ 284*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(p_path, 0, &buf, re, 1)) { 285*7c478bd9Sstevel@tonic-gate /* free memory */ 286*7c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 287*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 288*7c478bd9Sstevel@tonic-gate } 289*7c478bd9Sstevel@tonic-gate 290*7c478bd9Sstevel@tonic-gate (void) snprintf(l_path, sizeof (l_path), "es/ses%s", buf); 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 293*7c478bd9Sstevel@tonic-gate /* free memory */ 294*7c478bd9Sstevel@tonic-gate free(buf); 295*7c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 296*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate } 299*7c478bd9Sstevel@tonic-gate 300*7c478bd9Sstevel@tonic-gate static int 301*7c478bd9Sstevel@tonic-gate node_slash_minor(di_minor_t minor, di_node_t node) 302*7c478bd9Sstevel@tonic-gate { 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate (void) strcpy(path, di_node_name(node)); 307*7c478bd9Sstevel@tonic-gate (void) strcat(path, "/"); 308*7c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 309*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 310*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 311*7c478bd9Sstevel@tonic-gate } 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate static int 314*7c478bd9Sstevel@tonic-gate driver_minor(di_minor_t minor, di_node_t node) 315*7c478bd9Sstevel@tonic-gate { 316*7c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate (void) strcpy(path, di_driver_name(node)); 319*7c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 320*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 321*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 322*7c478bd9Sstevel@tonic-gate } 323*7c478bd9Sstevel@tonic-gate 324*7c478bd9Sstevel@tonic-gate /* 325*7c478bd9Sstevel@tonic-gate * Handles links of the form: 326*7c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=xyz \D 327*7c478bd9Sstevel@tonic-gate */ 328*7c478bd9Sstevel@tonic-gate static int 329*7c478bd9Sstevel@tonic-gate node_name(di_minor_t minor, di_node_t node) 330*7c478bd9Sstevel@tonic-gate { 331*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(di_node_name(node), node, minor, 0); 332*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 333*7c478bd9Sstevel@tonic-gate } 334*7c478bd9Sstevel@tonic-gate 335*7c478bd9Sstevel@tonic-gate /* 336*7c478bd9Sstevel@tonic-gate * Handles links of the form: 337*7c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=xyz \M0 338*7c478bd9Sstevel@tonic-gate */ 339*7c478bd9Sstevel@tonic-gate static int 340*7c478bd9Sstevel@tonic-gate minor_name(di_minor_t minor, di_node_t node) 341*7c478bd9Sstevel@tonic-gate { 342*7c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 345*7c478bd9Sstevel@tonic-gate if (strcmp(mn, "icmp") == 0) { 346*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("rawip", node, minor, 0); 347*7c478bd9Sstevel@tonic-gate } 348*7c478bd9Sstevel@tonic-gate if (strcmp(mn, "icmp6") == 0) { 349*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("rawip6", node, minor, 0); 350*7c478bd9Sstevel@tonic-gate } 351*7c478bd9Sstevel@tonic-gate if (strcmp(mn, "ipf") == 0) { 352*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("ipl", node, minor, 0); 353*7c478bd9Sstevel@tonic-gate } 354*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 355*7c478bd9Sstevel@tonic-gate } 356*7c478bd9Sstevel@tonic-gate 357*7c478bd9Sstevel@tonic-gate 358*7c478bd9Sstevel@tonic-gate static int 359*7c478bd9Sstevel@tonic-gate conskbd(di_minor_t minor, di_node_t node) 360*7c478bd9Sstevel@tonic-gate { 361*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("kbd", node, minor, 0); 362*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 363*7c478bd9Sstevel@tonic-gate } 364*7c478bd9Sstevel@tonic-gate 365*7c478bd9Sstevel@tonic-gate static int 366*7c478bd9Sstevel@tonic-gate consms(di_minor_t minor, di_node_t node) 367*7c478bd9Sstevel@tonic-gate { 368*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("mouse", node, minor, 0); 369*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 370*7c478bd9Sstevel@tonic-gate } 371*7c478bd9Sstevel@tonic-gate 372*7c478bd9Sstevel@tonic-gate static int 373*7c478bd9Sstevel@tonic-gate power_button(di_minor_t minor, di_node_t node) 374*7c478bd9Sstevel@tonic-gate { 375*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("power_button", node, minor, 0); 376*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 377*7c478bd9Sstevel@tonic-gate } 378*7c478bd9Sstevel@tonic-gate 379*7c478bd9Sstevel@tonic-gate static int 380*7c478bd9Sstevel@tonic-gate fc_port(di_minor_t minor, di_node_t node) 381*7c478bd9Sstevel@tonic-gate { 382*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"fc/fp([0-9]+)$", 1, MATCH_ALL}; 383*7c478bd9Sstevel@tonic-gate char *buf, path[PATH_MAX + 1]; 384*7c478bd9Sstevel@tonic-gate char *ptr; 385*7c478bd9Sstevel@tonic-gate 386*7c478bd9Sstevel@tonic-gate if (NULL == (ptr = di_devfs_path(node))) { 387*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 388*7c478bd9Sstevel@tonic-gate } 389*7c478bd9Sstevel@tonic-gate 390*7c478bd9Sstevel@tonic-gate (void) strcpy(path, ptr); 391*7c478bd9Sstevel@tonic-gate (void) strcat(path, ":"); 392*7c478bd9Sstevel@tonic-gate (void) strcat(path, di_minor_name(minor)); 393*7c478bd9Sstevel@tonic-gate 394*7c478bd9Sstevel@tonic-gate di_devfs_path_free(ptr); 395*7c478bd9Sstevel@tonic-gate 396*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1) != 0) { 397*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 398*7c478bd9Sstevel@tonic-gate } 399*7c478bd9Sstevel@tonic-gate 400*7c478bd9Sstevel@tonic-gate (void) strcpy(path, "fc/fp"); 401*7c478bd9Sstevel@tonic-gate (void) strcat(path, buf); 402*7c478bd9Sstevel@tonic-gate free(buf); 403*7c478bd9Sstevel@tonic-gate 404*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 405*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 406*7c478bd9Sstevel@tonic-gate } 407*7c478bd9Sstevel@tonic-gate 408*7c478bd9Sstevel@tonic-gate /* 409*7c478bd9Sstevel@tonic-gate * Handles: 410*7c478bd9Sstevel@tonic-gate * minor node type "ddi_printer". 411*7c478bd9Sstevel@tonic-gate * rules of the form: type=ddi_printer;name=bpp \M0 412*7c478bd9Sstevel@tonic-gate */ 413*7c478bd9Sstevel@tonic-gate static int 414*7c478bd9Sstevel@tonic-gate printer_create(di_minor_t minor, di_node_t node) 415*7c478bd9Sstevel@tonic-gate { 416*7c478bd9Sstevel@tonic-gate char *mn; 417*7c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1], *buf; 418*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^printers$/^([0-9]+)$", 1, MATCH_ALL}; 419*7c478bd9Sstevel@tonic-gate 420*7c478bd9Sstevel@tonic-gate mn = di_minor_name(minor); 421*7c478bd9Sstevel@tonic-gate 422*7c478bd9Sstevel@tonic-gate if (strcmp(di_driver_name(node), "bpp") == 0) { 423*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 424*7c478bd9Sstevel@tonic-gate } 425*7c478bd9Sstevel@tonic-gate 426*7c478bd9Sstevel@tonic-gate if (NULL == (buf = di_devfs_path(node))) { 427*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 428*7c478bd9Sstevel@tonic-gate } 429*7c478bd9Sstevel@tonic-gate 430*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", buf, mn); 431*7c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 432*7c478bd9Sstevel@tonic-gate 433*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 434*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 435*7c478bd9Sstevel@tonic-gate } 436*7c478bd9Sstevel@tonic-gate 437*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "printers/%s", buf); 438*7c478bd9Sstevel@tonic-gate free(buf); 439*7c478bd9Sstevel@tonic-gate 440*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 441*7c478bd9Sstevel@tonic-gate 442*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 443*7c478bd9Sstevel@tonic-gate } 444*7c478bd9Sstevel@tonic-gate 445*7c478bd9Sstevel@tonic-gate /* 446*7c478bd9Sstevel@tonic-gate * Handles links of the form: 447*7c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=se;minor2=hdlc se_hdlc\N0 448*7c478bd9Sstevel@tonic-gate * type=ddi_pseudo;name=serial;minor2=hdlc se_hdlc\N0 449*7c478bd9Sstevel@tonic-gate */ 450*7c478bd9Sstevel@tonic-gate static int 451*7c478bd9Sstevel@tonic-gate se_hdlc_create(di_minor_t minor, di_node_t node) 452*7c478bd9Sstevel@tonic-gate { 453*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^se_hdlc([0-9]+)$", 1, MATCH_ALL}; 454*7c478bd9Sstevel@tonic-gate char *buf, path[PATH_MAX + 1]; 455*7c478bd9Sstevel@tonic-gate char *ptr; 456*7c478bd9Sstevel@tonic-gate char *mn; 457*7c478bd9Sstevel@tonic-gate 458*7c478bd9Sstevel@tonic-gate mn = di_minor_name(minor); 459*7c478bd9Sstevel@tonic-gate 460*7c478bd9Sstevel@tonic-gate /* minor node should be of the form: "?,hdlc" */ 461*7c478bd9Sstevel@tonic-gate if (strcmp(mn + 1, ",hdlc") != 0) { 462*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 463*7c478bd9Sstevel@tonic-gate } 464*7c478bd9Sstevel@tonic-gate 465*7c478bd9Sstevel@tonic-gate if (NULL == (ptr = di_devfs_path(node))) { 466*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 467*7c478bd9Sstevel@tonic-gate } 468*7c478bd9Sstevel@tonic-gate 469*7c478bd9Sstevel@tonic-gate (void) strcpy(path, ptr); 470*7c478bd9Sstevel@tonic-gate (void) strcat(path, ":"); 471*7c478bd9Sstevel@tonic-gate (void) strcat(path, mn); 472*7c478bd9Sstevel@tonic-gate 473*7c478bd9Sstevel@tonic-gate di_devfs_path_free(ptr); 474*7c478bd9Sstevel@tonic-gate 475*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1) != 0) { 476*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 477*7c478bd9Sstevel@tonic-gate } 478*7c478bd9Sstevel@tonic-gate 479*7c478bd9Sstevel@tonic-gate (void) strcpy(path, "se_hdlc"); 480*7c478bd9Sstevel@tonic-gate (void) strcat(path, buf); 481*7c478bd9Sstevel@tonic-gate free(buf); 482*7c478bd9Sstevel@tonic-gate 483*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 484*7c478bd9Sstevel@tonic-gate 485*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 486*7c478bd9Sstevel@tonic-gate } 487*7c478bd9Sstevel@tonic-gate 488*7c478bd9Sstevel@tonic-gate static int 489*7c478bd9Sstevel@tonic-gate gpio(di_minor_t minor, di_node_t node) 490*7c478bd9Sstevel@tonic-gate { 491*7c478bd9Sstevel@tonic-gate char l_path[PATH_MAX], p_path[PATH_MAX], *buf, *devfspath; 492*7c478bd9Sstevel@tonic-gate char *minor_nm, *drvr_nm; 493*7c478bd9Sstevel@tonic-gate 494*7c478bd9Sstevel@tonic-gate 495*7c478bd9Sstevel@tonic-gate minor_nm = di_minor_name(minor); 496*7c478bd9Sstevel@tonic-gate drvr_nm = di_driver_name(node); 497*7c478bd9Sstevel@tonic-gate if ((minor_nm == NULL) || (drvr_nm == NULL)) { 498*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 499*7c478bd9Sstevel@tonic-gate } 500*7c478bd9Sstevel@tonic-gate 501*7c478bd9Sstevel@tonic-gate devfspath = di_devfs_path(node); 502*7c478bd9Sstevel@tonic-gate 503*7c478bd9Sstevel@tonic-gate (void) strcpy(p_path, devfspath); 504*7c478bd9Sstevel@tonic-gate (void) strcat(p_path, ":"); 505*7c478bd9Sstevel@tonic-gate (void) strcat(p_path, minor_nm); 506*7c478bd9Sstevel@tonic-gate di_devfs_path_free(devfspath); 507*7c478bd9Sstevel@tonic-gate 508*7c478bd9Sstevel@tonic-gate /* build the physical path from the components */ 509*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(p_path, 0, &buf, gpio_rules, 1)) { 510*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 511*7c478bd9Sstevel@tonic-gate } 512*7c478bd9Sstevel@tonic-gate 513*7c478bd9Sstevel@tonic-gate (void) snprintf(l_path, sizeof (l_path), "%s%s", "gpio", buf); 514*7c478bd9Sstevel@tonic-gate 515*7c478bd9Sstevel@tonic-gate free(buf); 516*7c478bd9Sstevel@tonic-gate 517*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(l_path, node, minor, 0); 518*7c478bd9Sstevel@tonic-gate 519*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 520*7c478bd9Sstevel@tonic-gate } 521*7c478bd9Sstevel@tonic-gate 522*7c478bd9Sstevel@tonic-gate /* 523*7c478bd9Sstevel@tonic-gate * Creates /dev/ppm nodes for Platform Specific PM module 524*7c478bd9Sstevel@tonic-gate */ 525*7c478bd9Sstevel@tonic-gate static int 526*7c478bd9Sstevel@tonic-gate ppm(di_minor_t minor, di_node_t node) 527*7c478bd9Sstevel@tonic-gate { 528*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("ppm", node, minor, 0); 529*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 530*7c478bd9Sstevel@tonic-gate } 531*7c478bd9Sstevel@tonic-gate 532*7c478bd9Sstevel@tonic-gate /* 533*7c478bd9Sstevel@tonic-gate * Handles: 534*7c478bd9Sstevel@tonic-gate * /dev/av/[0-9]+/(async|isoch) 535*7c478bd9Sstevel@tonic-gate */ 536*7c478bd9Sstevel@tonic-gate static int 537*7c478bd9Sstevel@tonic-gate av_create(di_minor_t minor, di_node_t node) 538*7c478bd9Sstevel@tonic-gate { 539*7c478bd9Sstevel@tonic-gate devfsadm_enumerate_t rules[1] = {"^av$/^([0-9]+)$", 1, MATCH_ADDR}; 540*7c478bd9Sstevel@tonic-gate char *minor_str; 541*7c478bd9Sstevel@tonic-gate char path[PATH_MAX + 1]; 542*7c478bd9Sstevel@tonic-gate char *buf; 543*7c478bd9Sstevel@tonic-gate 544*7c478bd9Sstevel@tonic-gate if ((buf = di_devfs_path(node)) == NULL) { 545*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 546*7c478bd9Sstevel@tonic-gate } 547*7c478bd9Sstevel@tonic-gate 548*7c478bd9Sstevel@tonic-gate minor_str = di_minor_name(minor); 549*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "%s:%s", buf, minor_str); 550*7c478bd9Sstevel@tonic-gate di_devfs_path_free(buf); 551*7c478bd9Sstevel@tonic-gate 552*7c478bd9Sstevel@tonic-gate if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { 553*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 554*7c478bd9Sstevel@tonic-gate } 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "av/%s/%s", buf, minor_str); 557*7c478bd9Sstevel@tonic-gate free(buf); 558*7c478bd9Sstevel@tonic-gate 559*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 560*7c478bd9Sstevel@tonic-gate 561*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 562*7c478bd9Sstevel@tonic-gate } 563*7c478bd9Sstevel@tonic-gate 564*7c478bd9Sstevel@tonic-gate /* 565*7c478bd9Sstevel@tonic-gate * Creates /dev/lom and /dev/tsalarm:ctl for tsalarm node 566*7c478bd9Sstevel@tonic-gate */ 567*7c478bd9Sstevel@tonic-gate static int 568*7c478bd9Sstevel@tonic-gate tsalarm_create(di_minor_t minor, di_node_t node) 569*7c478bd9Sstevel@tonic-gate { 570*7c478bd9Sstevel@tonic-gate char buf[PATH_MAX + 1]; 571*7c478bd9Sstevel@tonic-gate char *mn = di_minor_name(minor); 572*7c478bd9Sstevel@tonic-gate 573*7c478bd9Sstevel@tonic-gate (void) snprintf(buf, sizeof (buf), "%s%s", di_node_name(node), ":ctl"); 574*7c478bd9Sstevel@tonic-gate 575*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(mn, node, minor, 0); 576*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(buf, node, minor, 0); 577*7c478bd9Sstevel@tonic-gate 578*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 579*7c478bd9Sstevel@tonic-gate } 580*7c478bd9Sstevel@tonic-gate 581*7c478bd9Sstevel@tonic-gate static int 582*7c478bd9Sstevel@tonic-gate zcons_create(di_minor_t minor, di_node_t node) 583*7c478bd9Sstevel@tonic-gate { 584*7c478bd9Sstevel@tonic-gate char *minor_str; 585*7c478bd9Sstevel@tonic-gate char *zonename; 586*7c478bd9Sstevel@tonic-gate char path[MAXPATHLEN]; 587*7c478bd9Sstevel@tonic-gate 588*7c478bd9Sstevel@tonic-gate minor_str = di_minor_name(minor); 589*7c478bd9Sstevel@tonic-gate 590*7c478bd9Sstevel@tonic-gate if (di_prop_lookup_strings(DDI_DEV_T_ANY, node, "zonename", 591*7c478bd9Sstevel@tonic-gate &zonename) == -1) { 592*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 593*7c478bd9Sstevel@tonic-gate } 594*7c478bd9Sstevel@tonic-gate 595*7c478bd9Sstevel@tonic-gate (void) snprintf(path, sizeof (path), "zcons/%s/%s", zonename, 596*7c478bd9Sstevel@tonic-gate minor_str); 597*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(path, node, minor, 0); 598*7c478bd9Sstevel@tonic-gate 599*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 600*7c478bd9Sstevel@tonic-gate } 601*7c478bd9Sstevel@tonic-gate 602*7c478bd9Sstevel@tonic-gate /* 603*7c478bd9Sstevel@tonic-gate * /dev/cpu/self/cpuid -> /devices/pseudo/cpuid@0:self 604*7c478bd9Sstevel@tonic-gate */ 605*7c478bd9Sstevel@tonic-gate static int 606*7c478bd9Sstevel@tonic-gate cpuid(di_minor_t minor, di_node_t node) 607*7c478bd9Sstevel@tonic-gate { 608*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink(CPUID_SELF_NAME, node, minor, 0); 609*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 610*7c478bd9Sstevel@tonic-gate } 611*7c478bd9Sstevel@tonic-gate 612*7c478bd9Sstevel@tonic-gate /* 613*7c478bd9Sstevel@tonic-gate * For device 614*7c478bd9Sstevel@tonic-gate * /dev/spfma -> /devices/virtual-devices/fma@5:glvc 615*7c478bd9Sstevel@tonic-gate */ 616*7c478bd9Sstevel@tonic-gate static int 617*7c478bd9Sstevel@tonic-gate glvc(di_minor_t minor, di_node_t node) 618*7c478bd9Sstevel@tonic-gate { 619*7c478bd9Sstevel@tonic-gate char node_name[MAXNAMELEN + 1]; 620*7c478bd9Sstevel@tonic-gate 621*7c478bd9Sstevel@tonic-gate (void) strcpy(node_name, di_node_name(node)); 622*7c478bd9Sstevel@tonic-gate 623*7c478bd9Sstevel@tonic-gate if (strncmp(node_name, "fma", 3) == 0) { 624*7c478bd9Sstevel@tonic-gate /* Only one fma channel */ 625*7c478bd9Sstevel@tonic-gate (void) devfsadm_mklink("spfma", node, minor, 0); 626*7c478bd9Sstevel@tonic-gate } 627*7c478bd9Sstevel@tonic-gate return (DEVFSADM_CONTINUE); 628*7c478bd9Sstevel@tonic-gate } 629