1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include <devfsadm.h> 30 #include <strings.h> 31 #include <stdio.h> 32 #include <sys/lx_ptm.h> 33 #include <sys/lx_audio.h> 34 35 static int lx_ptm(di_minor_t minor, di_node_t node); 36 static int lx_audio(di_minor_t minor, di_node_t node); 37 static int lx_systrace(di_minor_t minor, di_node_t node); 38 39 static devfsadm_create_t lx_create_cbt[] = { 40 { "pseudo", "ddi_pseudo", LX_PTM_DRV, 41 TYPE_EXACT | DRV_EXACT, ILEVEL_0, lx_ptm }, 42 { "pseudo", "ddi_pseudo", LX_AUDIO_DRV, 43 TYPE_EXACT | DRV_EXACT, ILEVEL_0, lx_audio }, 44 { "pseudo", "ddi_pseudo", "lx_systrace", 45 TYPE_EXACT | DRV_EXACT, ILEVEL_0, lx_systrace }, 46 }; 47 48 DEVFSADM_CREATE_INIT_V0(lx_create_cbt); 49 50 static int 51 lx_ptm(di_minor_t minor, di_node_t node) 52 { 53 char *mname = di_minor_name(minor); 54 55 if (strcmp(LX_PTM_MINOR_NODE, mname) == 0) 56 (void) devfsadm_mklink("brand/lx/ptmx", node, minor, 0); 57 58 return (DEVFSADM_CONTINUE); 59 } 60 61 static int 62 lx_audio(di_minor_t minor, di_node_t node) 63 { 64 char *mname = di_minor_name(minor); 65 66 if (strcmp(LXA_MINORNAME_DEVCTL, mname) == 0) 67 (void) devfsadm_mklink("brand/lx/audio_devctl", node, minor, 0); 68 if (strcmp(LXA_MINORNAME_DSP, mname) == 0) 69 (void) devfsadm_mklink("brand/lx/dsp", node, minor, 0); 70 if (strcmp(LXA_MINORNAME_MIXER, mname) == 0) 71 (void) devfsadm_mklink("brand/lx/mixer", node, minor, 0); 72 73 return (DEVFSADM_CONTINUE); 74 } 75 76 static int 77 lx_systrace(di_minor_t minor, di_node_t node) 78 { 79 char *mname = di_minor_name(minor); 80 char path[MAXPATHLEN]; 81 82 (void) snprintf(path, sizeof (path), "dtrace/provider/%s", mname); 83 (void) devfsadm_mklink(path, node, minor, 0); 84 85 return (DEVFSADM_CONTINUE); 86 }