/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <regex.h>
#include <devfsadm.h>
#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <syslog.h>
#include <bsm/devalloc.h>
#include <sys/soundcard.h>
#include <unistd.h>
extern int system_labeled;
const char *primary_link_format);
},
{ "pseudo", "ddi_pseudo", "audio",
},
};
/*
* the following can't be one big RE with a bunch of alterations "|"
* because recurse_dev_re() would not work.
*/
/*
* Secondary links.
*/
{ "audio", "^audio$",
},
{ "audio", "^audioctl$",
},
{ "audio", "^dsp$",
},
{ "audio", "^mixer",
},
{ "audio", "^sndstat$",
},
{ "audio", "^mixer[0-9]+$",
},
{ "audio", "^dsp[0-9]+$",
},
{ "audio", "^sound/[0-9]+$",
},
{ "audio", "^sound/[0-9]+ctl$",
},
};
int
minor_init(void)
{
return (DEVFSADM_SUCCESS);
}
int
minor_fini(void)
{
return (DEVFSADM_SUCCESS);
}
static void
{
/*
* This is not safe with -r.
*/
return;
if (device_exists(buf)) {
int fd;
return;
}
}
static int
{
char *mn;
/*
*/
}
return (DEVFSADM_CONTINUE);
}
/*
* This function is called for every audio node.
* Calls enumerate to assign a logical unit id, and then
* devfsadm_mklink to make the link.
*/
static int
{
int flags = 0;
char *buf;
char *mn;
char *tmp;
char *ep;
long num;
long inst;
int i;
char *driver;
if (system_labeled)
return (DEVFSADM_CONTINUE);
}
devfsadm_errprint("SUNW_audio_link: "
"can't find match for'%s'\n", mn);
return (DEVFSADM_CONTINUE);
}
/* strlen("sound,") */
/* if driver name override in minor name */
*tmp = '\0';
}
/* skip past "audio" portion of the minor name */
}
/* parse the instance number */
break;
}
mn[i] = 0; /* lop off the instance number */
/*
* Note that "instance numbers" used by the audio framework
* are guaranteed to be unique for each driver.
*/
/*
* The rest of this logic is a gross simplification that is
* made possible by the fact that each audio node will have
* several different minors associated with it. Rather than
* processing each node separately, we just create the links
* all at once.
*
* This reduces the chances of the various links being out of
* sync with each other.
*/
return (DEVFSADM_CONTINUE);
}
/*
* Its the control node, so create the various
* secondary links.
*/
/*
* We want a match against the physical path
* without the minor name component.
*/
/*
* enumerate finds the logical audio id, and stuffs
* it in buf
*/
return (DEVFSADM_CONTINUE);
}
/* Send control number */
return (DEVFSADM_CONTINUE);
}
static void
{
int i;
int flags = 0;
/* if link is present, return */
return;
}
if (system_labeled)
for (i = 0; i < MAX_AUDIO_LINK; i++) {
/* we read link to get it to the master "real" link */
(void) devfsadm_secondary_link(secondary,
break;
}
}
}