diff options
Diffstat (limited to 'usr/src')
36 files changed, 210 insertions, 2564 deletions
diff --git a/usr/src/cmd/devfsadm/devfsadm.c b/usr/src/cmd/devfsadm/devfsadm.c index 2720576884..b1baf57b86 100644 --- a/usr/src/cmd/devfsadm/devfsadm.c +++ b/usr/src/cmd/devfsadm/devfsadm.c @@ -228,17 +228,12 @@ static char *packaged_dirs[] = {"dsk", "rdsk", "term", NULL}; /* Devname globals */ -static int devname_debug_msg = 1; -static nvlist_t *devname_maps = NULL; -static int devname_first_call = 1; -static int load_devname_nsmaps = FALSE; static int lookup_door_fd = -1; static char *lookup_door_path; static void load_dev_acl(void); static void update_drvconf(major_t); static void check_reconfig_state(void); -static void devname_setup_nsmaps(void); static int s_stat(const char *, struct stat *); static int is_blank(char *); @@ -745,7 +740,7 @@ parse_args(int argc, char *argv[]) devlinktab_file = DEVLINKTAB_FILE; while ((opt = getopt(argc, argv, - "a:Cc:deIi:l:mnp:PR:r:sSt:vV:x:")) != EOF) { + "a:Cc:deIi:l:np:PR:r:sSt:vV:x:")) != EOF) { if (opt == 'I' || opt == 'P' || opt == 'S') { if (public_mode) usage(); @@ -798,9 +793,6 @@ parse_args(int argc, char *argv[]) /* specify an alternate module load path */ module_dirs = s_strdup(optarg); break; - case 'm': - load_devname_nsmaps = TRUE; - break; case 'n': /* prevent driver loading and deferred attach */ load_attach_drv = FALSE; @@ -909,12 +901,6 @@ parse_args(int argc, char *argv[]) devfsadm_exit(0); /*NOTREACHED*/ } - - if (load_devname_nsmaps == TRUE) { - devname_setup_nsmaps(); - devfsadm_exit(0); - /*NOTREACHED*/ - } } @@ -1339,8 +1325,6 @@ retry: /* pass down the door name to kernel for door_ki_open */ if (devname_kcall(MODDEVNAME_LOOKUPDOOR, (void *)door_file) != 0) err_print(DEVNAME_CONTACT_FAILED, strerror(errno)); - else - devname_setup_nsmaps(); vprint(CHATTY_MID, "%spausing\n", fcn); for (;;) { @@ -8430,25 +8414,8 @@ static int devname_kcall(int subcmd, void *args) { int error = 0; - char *nvlbuf = NULL; - size_t nvlsize; switch (subcmd) { - case MODDEVNAME_NSMAPS: - error = nvlist_pack((nvlist_t *)args, &nvlbuf, &nvlsize, 0, 0); - if (error) { - err_print("packing MODDEVNAME_NSMAPS failed\n"); - break; - } - error = modctl(MODDEVNAME, subcmd, nvlbuf, nvlsize); - if (error) { - vprint(INFO_MID, "modctl(MODDEVNAME, " - "MODDEVNAME_NSMAPS) failed - %s\n", - strerror(errno)); - } - free(nvlbuf); - nvlist_free(args); - break; case MODDEVNAME_LOOKUPDOOR: error = modctl(MODDEVNAME, subcmd, (uintptr_t)args); if (error) { @@ -8464,93 +8431,6 @@ devname_kcall(int subcmd, void *args) return (error); } -static void -devname_setup_nsmaps(void) -{ - int error = 0; - - if (devname_first_call) { - devname_first_call = 0; - } - - error = di_devname_get_mapinfo(DEVNAME_MASTER_MAP, &devname_maps); - - if (error) { - vprint(DEVNAME_MID, "devname_setup_nsmaps: non-existing/empty" - "%s\n", DEVNAME_MASTER_MAP); - } else { - di_devname_print_mapinfo(devname_maps); - - /* pass down the existing map names to kernel */ - (void) devname_kcall(MODDEVNAME_NSMAPS, (void *)devname_maps); - } -} - -static void -devname_ns_services(uint8_t cmd, char *key, char *map) -{ - nvlist_t *nvl = NULL; - int32_t error = 0; - sdev_door_res_t res; - - vprint(DEVNAME_MID, "devname_ns_services: cmd %d key %s map %s\n", - cmd, key, map); - - switch (cmd) { - case DEVFSADMD_NS_LOOKUP: - vprint(DEVNAME_MID, "calling di_devname_get_mapent\n"); - error = di_devname_get_mapent(key, map, &nvl); - if (nvl == NULL) { - error = DEVFSADM_NS_FAILED; - goto done; - } - - if (error) { - nvlist_free(nvl); - goto done; - } - - if (devname_debug_msg) - di_devname_print_mapinfo(nvl); - - vprint(DEVNAME_MID, "calling di_devname_action_on_key for %d\n", - cmd); - error = di_devname_action_on_key(nvl, cmd, key, (void *)&res); - nvlist_free(nvl); - break; - case DEVFSADMD_NS_READDIR: - vprint(DEVNAME_MID, "calling di_devname_get_mapinfo for cmd %d" - "\n", cmd); - error = di_devname_get_mapinfo(map, &nvl); - if (nvl == NULL) { - error = DEVFSADM_NS_FAILED; - goto done; - } - - if (error) { - nvlist_free(nvl); - goto done; - } - - if (devname_debug_msg) - di_devname_print_mapinfo(nvl); - - vprint(DEVNAME_MID, "calling di_devname_action_on_key\n"); - error = di_devname_action_on_key(nvl, cmd, key, (void *)&res); - nvlist_free(nvl); - break; - default: - error = DEVFSADM_RUN_NOTSUP; - break; - } - -done: - vprint(DEVNAME_MID, "error %d\n", error); - res.devfsadm_error = error; - (void) door_return((char *)&res, sizeof (struct sdev_door_res), - NULL, 0); -} - /* ARGSUSED */ static void devname_lookup_handler(void *cookie, char *argp, size_t arg_size, @@ -8560,7 +8440,6 @@ devname_lookup_handler(void *cookie, char *argp, size_t arg_size, door_cred_t dcred; struct dca_impl dci; uint8_t cmd; - char *ns_map, *ns_name; sdev_door_res_t res; sdev_door_arg_t *args; @@ -8582,19 +8461,6 @@ devname_lookup_handler(void *cookie, char *argp, size_t arg_size, vprint(DEVNAME_MID, "devname_lookup_handler: cmd %d\n", cmd); switch (cmd) { - case DEVFSADMD_NS_LOOKUP: - case DEVFSADMD_NS_READDIR: - ns_name = s_strdup(args->ns_hdl.ns_name); - ns_map = s_strdup(args->ns_hdl.ns_map); - - vprint(DEVNAME_MID, " ns_name %s ns_map %s\n", ns_name, ns_map); - if (ns_name == NULL || ns_map == NULL) { - error = DEVFSADM_RUN_INVALID; - goto done; - } - - devname_ns_services(cmd, ns_name, ns_map); - return; case DEVFSADMD_RUN_ALL: /* * run "devfsadm" diff --git a/usr/src/cmd/devfsadm/devfsadm.h b/usr/src/cmd/devfsadm/devfsadm.h index 5d540ce78d..ce26e43375 100644 --- a/usr/src/cmd/devfsadm/devfsadm.h +++ b/usr/src/cmd/devfsadm/devfsadm.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _DEVFSADM_H #define _DEVFSADM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <libdevinfo.h> #include <sys/devinfo_impl.h> @@ -96,9 +94,6 @@ extern "C" { #define DEVFSADM_SERVICE_DOOR "/etc/sysevent/devfsadm_event_channel" #define DEVNAME_LOOKUP_DOOR ".devname_lookup_door" -/* /dev device name binding rule locations */ -#define DEVNAME_MASTER_MAP "/etc/dev/devname_master" - /* File of reserved devnames */ #define ENUMERATE_RESERVED "/etc/dev/reserved_devnames" diff --git a/usr/src/cmd/devfsadm/devfsadm_impl.h b/usr/src/cmd/devfsadm/devfsadm_impl.h index 4f27eb1b3a..b33caa1a4d 100644 --- a/usr/src/cmd/devfsadm/devfsadm_impl.h +++ b/usr/src/cmd/devfsadm/devfsadm_impl.h @@ -18,7 +18,7 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -71,7 +71,7 @@ extern "C" { #include <sys/sysevent/dev.h> #include <libzonecfg.h> #include <device_info.h> -#include <sys/fs/sdev_node.h> +#include <sys/fs/sdev_impl.h> #include <sys/syscall.h> #include <rpcsvc/ypclnt.h> #include <sys/sysevent/eventdefs.h> diff --git a/usr/src/lib/libdevinfo/Makefile.com b/usr/src/lib/libdevinfo/Makefile.com index 7c10f0ba47..6d010b8053 100644 --- a/usr/src/lib/libdevinfo/Makefile.com +++ b/usr/src/lib/libdevinfo/Makefile.com @@ -19,17 +19,15 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# LIBRARY= libdevinfo.a VERS= .1 OBJECTS= devfsinfo.o devinfo.o devinfo_prop_decode.o devinfo_devlink.o \ - devinfo_devperm.o devfsmap.o devinfo_devname.o \ + devinfo_devperm.o devfsmap.o devinfo_profile.o \ devinfo_finddev.o devinfo_dli.o devinfo_dim.o \ devinfo_realpath.o devinfo_retire.o diff --git a/usr/src/lib/libdevinfo/devinfo_devname.c b/usr/src/lib/libdevinfo/devinfo_devname.c deleted file mode 100644 index 379c156627..0000000000 --- a/usr/src/lib/libdevinfo/devinfo_devname.c +++ /dev/null @@ -1,701 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <strings.h> -#include <unistd.h> -#include <stdarg.h> -#include <fcntl.h> -#include <stdlib.h> -#include <libnvpair.h> -#include <libdevinfo.h> -#include <syslog.h> -#include <sys/param.h> -#include <errno.h> -#include <assert.h> -#include <sys/systeminfo.h> -#include <sys/modctl.h> -#include <sys/fs/sdev_node.h> - - -#define LINEMAX 1024 -#define SPC " \t\n" -#define QUOTES "\'\"" - -/* - * This is for local file supports of DBNR configurations. - */ -static int di_devname_getmapent_files(char *, char *, nvlist_t **); -static int di_devname_get_mapinfo_files(char *, nvlist_t **); -static int parse_mapinfo_file(FILE *, nvlist_t **); -static FILE *open_local_map(char *); -static void unquote(char *, char *); - -static int msglog = 1; -typedef enum { - DBG_ERR = 1, - DBG_INFO, - DBG_STEP, - DBG_ALL -} debug_level_t; -static int devname_debug = 1; -static void dprintf(debug_level_t, const char *, ...); - -extern int isspace(int); - -/* exported interfaces */ -void di_devname_print_mapinfo(nvlist_t *); -int di_devname_get_mapinfo(char *, nvlist_t **); -int di_devname_get_mapent(char *, char *, nvlist_t **); -int di_devname_action_on_key(nvlist_t *, uint8_t, char *, void *); - -/* - * Returns 0 and the valid maplist, otherwise errno. - */ -int -di_devname_get_mapinfo_files(char *mapname, nvlist_t **maplist) -{ - FILE *fp; - int rval = 0; - nvlist_t *nvl = NULL; - - fp = open_local_map(mapname); - if (fp == NULL) { - dprintf(DBG_INFO, "di_devname_get_mapinfo_files: file %s does" - "not exist\n", mapname); - return (ENOENT); - } - - rval = parse_mapinfo_file(fp, &nvl); - if (rval == 0) { - *maplist = nvl; - } - (void) fclose(fp); - - return (rval); -} - -static FILE * -open_local_map(char *mapname) -{ - char filename[LINEMAX]; - - if (*mapname != '/') { - (void) snprintf(filename, sizeof (filename), "/etc/dev/%s", - mapname); - } else { - (void) snprintf(filename, sizeof (filename), "%s", mapname); - } - - return (fopen(filename, "r")); -} - -static void -unquote(char *str, char *qbuf) -{ - register int escaped, inquote, quoted; - register char *ip, *bp, *qp; - char buf[LINEMAX]; - - escaped = inquote = quoted = 0; - - for (ip = str, bp = buf, qp = qbuf; *ip; ip++) { - if (!escaped) { - if (*ip == '\\') { - escaped = 1; - quoted ++; - continue; - } else if (*ip == '"') { - inquote = !inquote; - quoted ++; - continue; - } - } - - *bp++ = *ip; - *qp++ = (inquote || escaped) ? '^' : ' '; - escaped = 0; - } - *bp = '\0'; - *qp = '\0'; - if (quoted) - (void) strcpy(str, buf); -} - -/* - * gets the qualified characters in *p into w, which has space allocated - * already - */ -static int -getword(char *w, char *wq, char **p, char **pq, char delim, int wordsz) -{ - char *tmp = w; - char *tmpq = wq; - int count = wordsz; - - if (wordsz <= 0) { - return (-1); - } - - while ((delim == ' ' ? isspace(**p) : **p == delim) && **pq == ' ') { - (*p)++; - (*pq)++; - } - - while (**p && - !((delim == ' ' ? isspace(**p) : **p == delim) && - **pq == ' ')) { - if (--count <= 0) { - *tmp = '\0'; - *tmpq = '\0'; - dprintf(DBG_INFO, "maximum word length %d exceeded\n", - wordsz); - return (-1); - } - *w++ = *(*p)++; - *wq++ = *(*pq)++; - } - *w = '\0'; - *wq = '\0'; - return (0); -} - -static int -parse_mapinfo_file(FILE *fp, nvlist_t **ret_nvlp) -{ - int error = 0; - nvlist_t *nvl = NULL, *attrs = NULL; - char line[LINEMAX], lineq[LINEMAX]; - char word[MAXPATHLEN+1], wordq[MAXPATHLEN+1]; - char *lp, *lq; - - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) { - return (EFAULT); - } - - while (fgets(line, sizeof (line), fp)) { - char *name, *key, *val; - - lp = (char *)line; - lq = (char *)lineq; - unquote(lp, lq); - if ((getword(word, wordq, &lp, &lq, ' ', - sizeof (word)) == -1) || (word[0] == '\0')) - continue; - - if (word[0] == '#') - continue; - - name = strtok(line, SPC); - if (name == NULL) - continue; - - (void) dprintf(DBG_INFO, "get a line for %s\n", name); - key = strtok(NULL, "="); - if (key == NULL) { - (void) dprintf(DBG_INFO, "no attributes specified for " - "%s\n", name); - continue; - } - - attrs = NULL; - if (nvlist_alloc(&attrs, NV_UNIQUE_NAME, 0) != 0) { - error = EFAULT; - goto fail1; - } - - while (key && *key) { - char *rest; - rest = strtok(NULL, "\n"); - if (rest == NULL) { - (void) dprintf(DBG_INFO, "no value for key " - "%s\n", key); - break; - } - if (rest[0] == ';') { - val = strdup("devname_null"); - rest++; - } else { - val = strtok(rest, ";"); - rest = strtok(NULL, ""); - } - (void) dprintf(DBG_INFO, "parse_map_info: one entry " - "key=%s val=%s\n", key, val); - if (nvlist_add_string(attrs, key, val) != 0) { - error = EFAULT; - goto fail; - } - - key = strtok(rest, "="); - } - (void) dprintf(DBG_INFO, "parse_map_info: add entry name=%s\n", - name); - if (nvlist_add_nvlist(nvl, name, attrs) != 0) { - error = EFAULT; - goto fail; - } - } - -done: - *ret_nvlp = nvl; - return (0); - -fail: - nvlist_free(attrs); -fail1: - nvlist_free(nvl); - return (error); -} - -void -di_devname_print_mapinfo(nvlist_t *nvl) -{ - char *name, *key, *val; - nvlist_t *attrs; - nvpair_t *nvp, *kvp; - - nvp = nvlist_next_nvpair(nvl, NULL); - while (nvp) { - name = nvpair_name(nvp); - (void) nvpair_value_nvlist(nvp, &attrs); - (void) printf("name = %s, binding attributes:\n", name); - kvp = nvlist_next_nvpair(attrs, NULL); - while (kvp) { - key = nvpair_name(kvp); - (void) nvpair_value_string(kvp, &val); - (void) printf("\t%s = %s\n", key, val); - kvp = nvlist_next_nvpair(attrs, kvp); - } - nvp = nvlist_next_nvpair(nvl, nvp); - } -} - -static int -action_mklink(char *target, char *source) -{ - (void) dprintf(DBG_INFO, "mklink for source %s target %s\n", - source, target); - return (symlink(source, target)); -} - -static struct actions { - char *key; - devname_spec_t spec; - int (*action)(char *, char *); -} actions[] = { - {"devices-path", DEVNAME_NS_PATH, action_mklink}, - {"dev-path", DEVNAME_NS_DEV, action_mklink}, - {NULL, DEVNAME_NS_NONE, NULL} -}; - -static int -action_on_key(uint_t cmd, char *dir_name, char *devname, nvpair_t *attr, - uint32_t *nsmapcount, char **devfsadm_link, devname_spec_t *devfsadm_spec) -{ - int i = 0; - int error = 0; - char *attrname, *attrval; - int len = 0; - char *path = NULL; - - attrname = nvpair_name(attr); - (void) nvpair_value_string(attr, &attrval); - (void) dprintf(DBG_INFO, "key = %s; value = %s\n", attrname, attrval); - - while (actions[i].key) { - if (strcmp(actions[i].key, attrname) == 0) { - switch (cmd) { - case DEVFSADMD_NS_READDIR: - len = strlen(dir_name) + strlen(devname) + 2; - path = malloc(len); - (void) snprintf(path, len, "%s/%s", dir_name, - devname); - error = actions[i].action(path, attrval); - free(path); - if (error) { - (void) dprintf(DBG_INFO, "action " - "failed %d\n", error); - return (error); - } else { - (*nsmapcount)++; - (void) dprintf(DBG_INFO, - "mapcount %d\n", *nsmapcount); - } - break; - case DEVFSADMD_NS_LOOKUP: - *devfsadm_link = strdup(attrval); - *devfsadm_spec = actions[i].spec; - break; - default: - break; - } - } - i++; - } - return (0); -} - -int -di_devname_action_on_key(nvlist_t *map, uint8_t cmd, char *dir_name, void *hdl) -{ - char *name = NULL; - nvpair_t *entry; - nvlist_t *attrs; - int32_t error = 0; - uint32_t ns_mapcount = 0; - char *devfsadm_link = NULL; - devname_spec_t devfsadm_spec = DEVNAME_NS_NONE; - sdev_door_res_t *resp; - - entry = nvlist_next_nvpair(map, NULL); - while (entry) { - nvpair_t *attr; - name = nvpair_name(entry); - (void) dprintf(DBG_INFO, "di_devname_action_on_key: name %s\n", - name); - (void) nvpair_value_nvlist(entry, &attrs); - - attr = nvlist_next_nvpair(attrs, NULL); - while (attr) { - error = action_on_key(cmd, dir_name, name, attr, - &ns_mapcount, &devfsadm_link, &devfsadm_spec); - - /* do not continue if encountered the first error */ - if (error) { - (void) dprintf(DBG_INFO, "error %d\n", error); - return ((int32_t)error); - } - attr = nvlist_next_nvpair(attrs, attr); - } - entry = nvlist_next_nvpair(map, entry); - } - - resp = (sdev_door_res_t *)hdl; - (void) dprintf(DBG_INFO, "cmd is %d\n", cmd); - switch (cmd) { - case DEVFSADMD_NS_READDIR: - resp->ns_rdr_hdl.ns_mapcount = (uint32_t)ns_mapcount; - (void) dprintf(DBG_INFO, "mapcount is %d\n", ns_mapcount); - break; - case DEVFSADMD_NS_LOOKUP: - if (devfsadm_link && devfsadm_spec != DEVNAME_NS_NONE) { - (void) dprintf(DBG_INFO, "devfsadm_link is %s\n", - devfsadm_link); - (void) snprintf(resp->ns_lkp_hdl.devfsadm_link, - strlen(devfsadm_link) + 1, "%s", devfsadm_link); - resp->ns_lkp_hdl.devfsadm_spec = devfsadm_spec; - } else { - (void) dprintf(DBG_INFO, "error out\n"); - return (1); - } - break; - default: - (void) dprintf(DBG_INFO, "error NOTSUP out\n"); - return (ENOTSUP); - } - - return (0); -} - - -static nvlist_t * -getent_mapinfo_file(FILE *fp, char *match) -{ - nvlist_t *nvl, *attrs; - char line[LINEMAX], lineq[LINEMAX]; - char word[MAXPATHLEN+1], wordq[MAXPATHLEN+1]; - int count = 0; - char *lp, *lq; - - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) - return (NULL); - - while (fgets(line, sizeof (line), fp)) { - char *name, *key, *val; - - if (line[0] == '#') - continue; - - dprintf(DBG_INFO, "getent_mapinfo_file: get a line %s\n", line); - lp = (char *)line; - lq = (char *)lineq; - unquote(lp, lq); - if ((getword(word, wordq, &lp, &lq, ' ', sizeof (word)) - == -1) || (word[0] == '\0')) - continue; - - name = strtok(line, SPC); - if (name == NULL) - continue; - - dprintf(DBG_INFO, "macthing with the key %s match %s\n", - name, match); - /* bypass the non-related entries */ - if (strcmp(name, match) != 0) - continue; - - /* get a matched entry */ - key = strtok(NULL, "="); - if (key == NULL) { - (void) dprintf(DBG_INFO, "no attributes specified " - "for %s\n", name); - goto fail1; - } - - attrs = NULL; - if (nvlist_alloc(&attrs, NV_UNIQUE_NAME, 0) != 0) - goto fail1; - while (key && *key) { - char *rest; - rest = strtok(NULL, "\n"); - if (rest == NULL) { - (void) dprintf(DBG_INFO, "no value for key " - "%s\n", key); - goto fail; - } - if (rest[0] == ';') { - val = strdup("devname_null"); - rest++; - } else { - val = strtok(rest, ";"); - rest = strtok(NULL, ""); - } - (void) dprintf(DBG_INFO, "found entry %s %s for %s\n", - key, val, name); - if (nvlist_add_string(attrs, key, val) != 0) - goto fail; - - key = strtok(rest, "="); - } - (void) dprintf(DBG_INFO, "adding nvlist for %s\n", name); - if (nvlist_add_nvlist(nvl, name, attrs) != 0) - goto fail; - count++; - break; - } - - if (count == 0) - goto fail1; - - return (nvl); - -fail: - nvlist_free(attrs); -fail1: - nvlist_free(nvl); - errno = EFAULT; - return (NULL); -} - -static int -di_devname_getmapent_files(char *key, char *mapname, nvlist_t **map) -{ - FILE *fp; - int rval = 0; - nvlist_t *nvl = NULL; - - fp = open_local_map(mapname); - if (fp == NULL) - return (1); - - nvl = getent_mapinfo_file(fp, key); - if (nvl != NULL) { - *map = nvl; - } else { - rval = errno; - } - (void) fclose(fp); - - return (rval); -} - -int -di_devname_get_mapent(char *key, char *mapname, nvlist_t **map) -{ - dprintf(DBG_INFO, "di_devname_get_mapent: called for %s in %s\n", - key, mapname); - - return (di_devname_getmapent_files(key, mapname, map)); - -} - -int -di_devname_get_mapinfo(char *mapname, nvlist_t **maps) -{ - dprintf(DBG_INFO, "di_devname_get_mapinfo: called for %s\n", mapname); - - return (di_devname_get_mapinfo_files(mapname, maps)); -} - -static void -debug_print(debug_level_t msglevel, const char *fmt, va_list ap) -{ - if (devname_debug < msglevel) - return; - - /* Print a distinctive label for error msgs */ - if (msglevel == DBG_ERR) { - (void) fprintf(stderr, "[ERROR]: "); - } - - if (msglog == TRUE) { - (void) vsyslog(LOG_NOTICE, fmt, ap); - } else { - (void) vfprintf(stderr, fmt, ap); - } -} - -/* ARGSUSED */ -/* PRINTFLIKE2 */ -static void -dprintf(debug_level_t msglevel, const char *fmt, ...) -{ - va_list ap; - - assert(msglevel > 0); - - if (!devname_debug) - return; - - va_start(ap, fmt); - debug_print(msglevel, fmt, ap); - va_end(ap); -} - - -/* - * Private interfaces for non-global /dev profile - */ - -/* - * Allocate opaque data structure for passing profile to the kernel for - * the given mount point. - * - * Note that this interface returns an empty, initialized, profile. - * It does not return what may have been previously committed. - */ -int -di_prof_init(const char *mountpt, di_prof_t *profp) -{ - nvlist_t *nvl; - - if (nvlist_alloc(&nvl, 0, 0)) - return (-1); - - if (nvlist_add_string(nvl, SDEV_NVNAME_MOUNTPT, mountpt)) { - nvlist_free(nvl); - return (-1); - } - - *profp = (di_prof_t)nvl; - return (0); -} - -/* - * Free space allocated by di_prof_init(). - */ -void -di_prof_fini(di_prof_t prof) -{ - nvlist_free((nvlist_t *)prof); -} - -/* - * Sends profile to the kernel. - */ -int -di_prof_commit(di_prof_t prof) -{ - char *buf = NULL; - size_t buflen = 0; - int rv; - - if (nvlist_pack((nvlist_t *)prof, &buf, &buflen, NV_ENCODE_NATIVE, 0)) - return (-1); - rv = modctl(MODDEVNAME, MODDEVNAME_PROFILE, buf, buflen); - free(buf); - return (rv); -} - -/* - * Add a device or directory to profile's include list. - * - * Note that there is no arbitration between conflicting - * include and exclude profile entries, most recent - * is the winner. - */ -int -di_prof_add_dev(di_prof_t prof, const char *dev) -{ - if (nvlist_add_string((nvlist_t *)prof, SDEV_NVNAME_INCLUDE, dev)) - return (-1); - return (0); -} - -/* - * Add a device or directory to profile's exclude list. - * This can effectively remove a previously committed device. - */ -int -di_prof_add_exclude(di_prof_t prof, const char *dev) -{ - if (nvlist_add_string((nvlist_t *)prof, SDEV_NVNAME_EXCLUDE, dev)) - return (-1); - return (0); -} - -/* - * Add a symlink to profile. - */ -int -di_prof_add_symlink(di_prof_t prof, const char *linkname, const char *target) -{ - nvlist_t *nvl = (nvlist_t *)prof; - char *syml[2]; - - syml[0] = (char *)linkname; /* 1st entry must be the symlink */ - syml[1] = (char *)target; /* 2nd entry must be the target */ - if (nvlist_add_string_array(nvl, SDEV_NVNAME_SYMLINK, syml, 2)) - return (-1); - return (0); -} - -/* - * Add a name mapping to profile. - */ -int -di_prof_add_map(di_prof_t prof, const char *source, const char *target) -{ - nvlist_t *nvl = (nvlist_t *)prof; - char *map[2]; - - map[0] = (char *)source; /* 1st entry must be the source */ - map[1] = (char *)target; /* 2nd entry must be the target */ - if (nvlist_add_string_array(nvl, SDEV_NVNAME_MAP, map, 2)) - return (-1); - return (0); -} diff --git a/usr/src/lib/libdevinfo/devinfo_profile.c b/usr/src/lib/libdevinfo/devinfo_profile.c new file mode 100644 index 0000000000..36ed1ee519 --- /dev/null +++ b/usr/src/lib/libdevinfo/devinfo_profile.c @@ -0,0 +1,153 @@ +/* + * 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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <strings.h> +#include <unistd.h> +#include <stdarg.h> +#include <fcntl.h> +#include <stdlib.h> +#include <libnvpair.h> +#include <libdevinfo.h> +#include <syslog.h> +#include <sys/param.h> +#include <errno.h> +#include <assert.h> +#include <sys/systeminfo.h> +#include <sys/modctl.h> +#include <sys/fs/sdev_impl.h> + +/* + * Private interfaces for non-global /dev profile + */ + +/* + * Allocate opaque data structure for passing profile to the kernel for + * the given mount point. + * + * Note that this interface returns an empty, initialized, profile. + * It does not return what may have been previously committed. + */ +int +di_prof_init(const char *mountpt, di_prof_t *profp) +{ + nvlist_t *nvl; + + if (nvlist_alloc(&nvl, 0, 0)) + return (-1); + + if (nvlist_add_string(nvl, SDEV_NVNAME_MOUNTPT, mountpt)) { + nvlist_free(nvl); + return (-1); + } + + *profp = (di_prof_t)nvl; + return (0); +} + +/* + * Free space allocated by di_prof_init(). + */ +void +di_prof_fini(di_prof_t prof) +{ + nvlist_free((nvlist_t *)prof); +} + +/* + * Sends profile to the kernel. + */ +int +di_prof_commit(di_prof_t prof) +{ + char *buf = NULL; + size_t buflen = 0; + int rv; + + if (nvlist_pack((nvlist_t *)prof, &buf, &buflen, NV_ENCODE_NATIVE, 0)) + return (-1); + rv = modctl(MODDEVNAME, MODDEVNAME_PROFILE, buf, buflen); + free(buf); + return (rv); +} + +/* + * Add a device or directory to profile's include list. + * + * Note that there is no arbitration between conflicting + * include and exclude profile entries, most recent + * is the winner. + */ +int +di_prof_add_dev(di_prof_t prof, const char *dev) +{ + if (nvlist_add_string((nvlist_t *)prof, SDEV_NVNAME_INCLUDE, dev)) + return (-1); + return (0); +} + +/* + * Add a device or directory to profile's exclude list. + * This can effectively remove a previously committed device. + */ +int +di_prof_add_exclude(di_prof_t prof, const char *dev) +{ + if (nvlist_add_string((nvlist_t *)prof, SDEV_NVNAME_EXCLUDE, dev)) + return (-1); + return (0); +} + +/* + * Add a symlink to profile. + */ +int +di_prof_add_symlink(di_prof_t prof, const char *linkname, const char *target) +{ + nvlist_t *nvl = (nvlist_t *)prof; + char *syml[2]; + + syml[0] = (char *)linkname; /* 1st entry must be the symlink */ + syml[1] = (char *)target; /* 2nd entry must be the target */ + if (nvlist_add_string_array(nvl, SDEV_NVNAME_SYMLINK, syml, 2)) + return (-1); + return (0); +} + +/* + * Add a name mapping to profile. + */ +int +di_prof_add_map(di_prof_t prof, const char *source, const char *target) +{ + nvlist_t *nvl = (nvlist_t *)prof; + char *map[2]; + + map[0] = (char *)source; /* 1st entry must be the source */ + map[1] = (char *)target; /* 2nd entry must be the target */ + if (nvlist_add_string_array(nvl, SDEV_NVNAME_MAP, map, 2)) + return (-1); + return (0); +} diff --git a/usr/src/lib/libdevinfo/libdevinfo.h b/usr/src/lib/libdevinfo/libdevinfo.h index 0bea41674c..8103c3407f 100644 --- a/usr/src/lib/libdevinfo/libdevinfo.h +++ b/usr/src/lib/libdevinfo/libdevinfo.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _LIBDEVINFO_H #define _LIBDEVINFO_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -487,14 +485,6 @@ extern int di_dli_openw(char *); extern void di_dli_close(int); /* - * Private interface for parsing devname binding info - */ -extern void di_devname_print_mapinfo(nvlist_t *); -extern int di_devname_get_mapinfo(char *, nvlist_t **); -extern int di_devname_get_mapent(char *, char *, nvlist_t **); -extern int di_devname_action_on_key(nvlist_t *, uint8_t, char *, void *); - -/* * Private interface for parsing path_to_inst binding file */ extern int devfs_parse_binding_file(const char *, diff --git a/usr/src/lib/libdevinfo/mapfile-vers b/usr/src/lib/libdevinfo/mapfile-vers index 64b15bd9f5..b1d9b5a9e8 100644 --- a/usr/src/lib/libdevinfo/mapfile-vers +++ b/usr/src/lib/libdevinfo/mapfile-vers @@ -187,10 +187,6 @@ SUNWprivate_1.1 { di_devlink_type; di_devlink_update; di_devlink_walk; - di_devname_action_on_key; - di_devname_get_mapent; - di_devname_get_mapinfo; - di_devname_print_mapinfo; di_devperm_login; di_devperm_logout; di_dim_fini; diff --git a/usr/src/pkgdefs/SUNWckr/prototype_com b/usr/src/pkgdefs/SUNWckr/prototype_com index cd6b805a3a..f69ddf9391 100644 --- a/usr/src/pkgdefs/SUNWckr/prototype_com +++ b/usr/src/pkgdefs/SUNWckr/prototype_com @@ -150,5 +150,4 @@ f manifest var/svc/manifest/system/dumpadm.xml 0444 root sys f manifest var/svc/manifest/system/fmd.xml 0444 root sys f manifest var/svc/manifest/system/intrd.xml 0444 root sys f manifest var/svc/manifest/system/scheduler.xml 0444 root sys -d none kernel/devname 755 root sys d none kernel/kiconv 755 root sys diff --git a/usr/src/pkgdefs/SUNWckr/prototype_i386 b/usr/src/pkgdefs/SUNWckr/prototype_i386 index cb167cab22..c36ca4dd08 100644 --- a/usr/src/pkgdefs/SUNWckr/prototype_i386 +++ b/usr/src/pkgdefs/SUNWckr/prototype_i386 @@ -63,7 +63,6 @@ f none kernel/crypto/sha1 755 root sys f none kernel/crypto/sha2 755 root sys f none kernel/crypto/swrand 755 root sys f none kernel/dacf/net_dacf 755 root sys -f none kernel/devname/sdev_nsconfig_mod 755 root sys f none kernel/drv/aggr 755 root sys f none kernel/drv/arp 755 root sys f none kernel/drv/acpi_drv 755 root sys @@ -291,8 +290,6 @@ f none kernel/crypto/amd64/sha2 755 root sys f none kernel/crypto/amd64/swrand 755 root sys d none kernel/dacf/amd64 755 root sys f none kernel/dacf/amd64/net_dacf 755 root sys -d none kernel/devname/amd64 755 root sys -f none kernel/devname/amd64/sdev_nsconfig_mod 755 root sys d none kernel/drv/amd64 755 root sys f none kernel/drv/amd64/aggr 755 root sys f none kernel/drv/amd64/arp 755 root sys diff --git a/usr/src/pkgdefs/SUNWckr/prototype_sparc b/usr/src/pkgdefs/SUNWckr/prototype_sparc index f367b3544a..b87c24d06e 100644 --- a/usr/src/pkgdefs/SUNWckr/prototype_sparc +++ b/usr/src/pkgdefs/SUNWckr/prototype_sparc @@ -262,8 +262,6 @@ f none kernel/sys/sparcv9/pset 755 root sys l none kernel/sys/sparcv9/rpcmod=../../../kernel/strmod/sparcv9/rpcmod f none kernel/sys/sparcv9/semsys 755 root sys f none kernel/sys/sparcv9/shmsys 755 root sys -d none kernel/devname/sparcv9 755 root sys -f none kernel/devname/sparcv9/sdev_nsconfig_mod 755 root sys d none kernel/kiconv/sparcv9 755 root sys f none kernel/kiconv/sparcv9/kiconv_emea 755 root sys f none kernel/kiconv/sparcv9/kiconv_ja 755 root sys diff --git a/usr/src/pkgdefs/SUNWhea/prototype_com b/usr/src/pkgdefs/SUNWhea/prototype_com index d42c483393..e37b3b78a9 100644 --- a/usr/src/pkgdefs/SUNWhea/prototype_com +++ b/usr/src/pkgdefs/SUNWhea/prototype_com @@ -861,7 +861,6 @@ f none usr/include/sys/fs/cachefs_dlog.h 644 root bin f none usr/include/sys/fs/cachefs_ioctl.h 644 root bin f none usr/include/sys/fs/decomp.h 644 root bin f none usr/include/sys/fs/dv_node.h 644 root bin -f none usr/include/sys/fs/sdev_node.h 644 root bin f none usr/include/sys/fs/sdev_impl.h 644 root bin f none usr/include/sys/fs/fifonode.h 644 root bin f none usr/include/sys/fs/hsfs_isospec.h 644 root bin diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh index 0f12828143..1f3962b9de 100644 --- a/usr/src/tools/scripts/bfu.sh +++ b/usr/src/tools/scripts/bfu.sh @@ -6053,6 +6053,8 @@ mondo_loop() { find $root/kernel/drv -name zvol 2> /dev/null | xargs rm -f rm -f $root/kernel/drv/zvol.conf + rm -rf $root/kernel/devname + rm -f $usr/include/sys/fs/sdev_node.h # # Remove /usr/lib/old_libthread since support for it has diff --git a/usr/src/uts/Makefile.targ b/usr/src/uts/Makefile.targ index 970ff4d033..f05cac59d6 100644 --- a/usr/src/uts/Makefile.targ +++ b/usr/src/uts/Makefile.targ @@ -207,9 +207,6 @@ $(ROOT_FONT_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC $(ROOT_MAC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC $(INS.file) -$(ROOT_DEVNAME_DIR)/%: $(OBJS_DIR)/% $(ROOT_DEVNAME_DIR) FRC - $(INS.file) - $(USR_DRV_DIR)/%: $(OBJS_DIR)/% $(USR_DRV_DIR) FRC $(INS.file) @@ -237,9 +234,6 @@ $(USR_DACF_DIR)/%: $(OBJS_DIR)/% $(USR_DACF_DIR) FRC $(USR_PCBE_DIR)/%: $(OBJS_DIR)/% $(USR_PCBE_DIR) FRC $(INS.file) -$(USR_DEVNAME_DIR)/%: $(OBJS_DIR)/% $(USR_DEVNAME_DIR) FRC - $(INS.file) - $(USR_DTRACE_DIR)/%: $(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC $(INS.file) diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts index 922e8c79e5..c5d1afa22d 100644 --- a/usr/src/uts/Makefile.uts +++ b/usr/src/uts/Makefile.uts @@ -431,7 +431,6 @@ ROOT_FONT_DIR_32 = $(ROOT_MOD_DIR)/fonts ROOT_DACF_DIR_32 = $(ROOT_MOD_DIR)/dacf ROOT_CRYPTO_DIR_32 = $(ROOT_MOD_DIR)/crypto ROOT_MAC_DIR_32 = $(ROOT_MOD_DIR)/mac -ROOT_DEVNAME_DIR_32 = $(ROOT_MOD_DIR)/devname ROOT_KICONV_DIR_32 = $(ROOT_MOD_DIR)/kiconv ROOT_KERN_DIR_64 = $(ROOT_MOD_DIR)/$(SUBDIR64) @@ -458,7 +457,6 @@ ROOT_FONT_DIR_64 = $(ROOT_MOD_DIR)/fonts/$(SUBDIR64) ROOT_DACF_DIR_64 = $(ROOT_MOD_DIR)/dacf/$(SUBDIR64) ROOT_CRYPTO_DIR_64 = $(ROOT_MOD_DIR)/crypto/$(SUBDIR64) ROOT_MAC_DIR_64 = $(ROOT_MOD_DIR)/mac/$(SUBDIR64) -ROOT_DEVNAME_DIR_64 = $(ROOT_MOD_DIR)/devname/$(SUBDIR64) ROOT_KICONV_DIR_64 = $(ROOT_MOD_DIR)/kiconv/$(SUBDIR64) ROOT_KERN_DIR = $(ROOT_KERN_DIR_$(CLASS)) @@ -485,7 +483,6 @@ ROOT_FONT_DIR = $(ROOT_FONT_DIR_$(CLASS)) ROOT_DACF_DIR = $(ROOT_DACF_DIR_$(CLASS)) ROOT_CRYPTO_DIR = $(ROOT_CRYPTO_DIR_$(CLASS)) ROOT_MAC_DIR = $(ROOT_MAC_DIR_$(CLASS)) -ROOT_DEVNAME_DIR = $(ROOT_DEVNAME_DIR_$(CLASS)) ROOT_KICONV_DIR = $(ROOT_KICONV_DIR_$(CLASS)) ROOT_MOD_DIRS_32 = $(ROOT_BRAND_DIR_32) $(ROOT_DRV_DIR_32) @@ -502,7 +499,7 @@ ROOT_MOD_DIRS_32 += $(ROOT_EMLXS_FW_DIR_32) ROOT_MOD_DIRS_32 += $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32) ROOT_MOD_DIRS_32 += $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32) ROOT_MOD_DIRS_32 += $(ROOT_CRYPTO_DIR_32) $(ROOT_MAC_DIR_32) -ROOT_MOD_DIRS_32 += $(ROOT_DEVNAME_DIR_32) $(ROOT_KICONV_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_KICONV_DIR_32) USR_MOD_DIR = $(ROOT)/usr/kernel @@ -516,7 +513,6 @@ USR_SYS_DIR_32 = $(USR_MOD_DIR)/sys USR_MISC_DIR_32 = $(USR_MOD_DIR)/misc USR_DACF_DIR_32 = $(USR_MOD_DIR)/dacf USR_PCBE_DIR_32 = $(USR_MOD_DIR)/pcbe -USR_DEVNAME_DIR_32 = $(USR_MOD_DIR)/devname USR_DTRACE_DIR_32 = $(USR_MOD_DIR)/dtrace USR_BRAND_DIR_32 = $(USR_MOD_DIR)/brand @@ -530,7 +526,6 @@ USR_SYS_DIR_64 = $(USR_MOD_DIR)/sys/$(SUBDIR64) USR_MISC_DIR_64 = $(USR_MOD_DIR)/misc/$(SUBDIR64) USR_DACF_DIR_64 = $(USR_MOD_DIR)/dacf/$(SUBDIR64) USR_PCBE_DIR_64 = $(USR_MOD_DIR)/pcbe/$(SUBDIR64) -USR_DEVNAME_DIR_64 = $(USR_MOD_DIR)/devname/$(SUBDIR64) USR_DTRACE_DIR_64 = $(USR_MOD_DIR)/dtrace/$(SUBDIR64) USR_BRAND_DIR_64 = $(USR_MOD_DIR)/brand/$(SUBDIR64) @@ -544,7 +539,6 @@ USR_SYS_DIR = $(USR_SYS_DIR_$(CLASS)) USR_MISC_DIR = $(USR_MISC_DIR_$(CLASS)) USR_DACF_DIR = $(USR_DACF_DIR_$(CLASS)) USR_PCBE_DIR = $(USR_PCBE_DIR_$(CLASS)) -USR_DEVNAME_DIR = $(USR_DEVNAME_DIR_$(CLASS)) USR_DTRACE_DIR = $(USR_DTRACE_DIR_$(CLASS)) USR_BRAND_DIR = $(USR_BRAND_DIR_$(CLASS)) @@ -552,7 +546,7 @@ USR_MOD_DIRS_32 = $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32) USR_MOD_DIRS_32 += $(USR_FS_DIR_32) $(USR_SCHED_DIR_32) USR_MOD_DIRS_32 += $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32) USR_MOD_DIRS_32 += $(USR_MISC_DIR_32) $(USR_DACF_DIR_32) -USR_MOD_DIRS_32 += $(USR_PCBE_DIR_32) $(USR_DEVNAME_DIR_32) +USR_MOD_DIRS_32 += $(USR_PCBE_DIR_32) USR_MOD_DIRS_32 += $(USR_DTRACE_DIR_32) $(USR_BRAND_DIR_32) # @@ -604,7 +598,7 @@ PARALLEL_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) $(IPP_KMODS) \ $(CRYPTO_KMODS) $(PCBE_KMODS) \ $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ - $(DEVNAME_KMODS) $(BRAND_KMODS) $(KICONV_KMODS) \ + $(BRAND_KMODS) $(KICONV_KMODS) \ $(SOCKET_KMODS) KMODS = $(GENUNIX_KMODS) $(PARALLEL_KMODS) @@ -618,7 +612,7 @@ $(CLOSED_BUILD)CLOSED_KMODS = $(CLOSED_DRV_KMODS) $(CLOSED_TOD_KMODS) \ LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \ $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \ - $(CRYPTO_KMODS) $(PCBE_KMODS) $(DEVNAME_KMODS) \ + $(CRYPTO_KMODS) $(PCBE_KMODS) \ $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ $(BRAND_KMODS) $(KICONV_KMODS) $(SOCKET_KMODS) diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index 4201a1c0f3..f26b8412b2 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -999,8 +999,6 @@ NV_SATA_OBJS += nv_sata.o SI3124_OBJS += si3124.o -NSCONFIG_DEVNAME_OBJS += sdev_nsconfig_mod.o - AHCI_OBJS += ahci.o PCIIDE_OBJS += pci-ide.o diff --git a/usr/src/uts/common/fs/dev/sdev_comm.c b/usr/src/uts/common/fs/dev/sdev_comm.c index 428a5c4273..226e323149 100644 --- a/usr/src/uts/common/fs/dev/sdev_comm.c +++ b/usr/src/uts/common/fs/dev/sdev_comm.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * routines to invoke user level name lookup services */ @@ -59,7 +57,6 @@ #include <sys/fs/snode.h> #include <sys/fs/dv_node.h> #include <sys/fs/sdev_impl.h> -#include <sys/fs/sdev_node.h> #include <sys/sunndi.h> #include <sys/sunddi.h> #include <sys/sunmdi.h> @@ -77,7 +74,6 @@ volatile uint_t devfsadm_state; static kmutex_t devfsadm_lock; static kcondvar_t devfsadm_cv; -int devname_nsmaps_loaded = 0; static int dev_node_wait_timeout = DEV_NODE_WAIT_TIMEOUT; static int dev_devfsadm_startup = DEV_DEVFSADM_STARTUP; @@ -89,19 +85,9 @@ static char *sdev_door_upcall_filename = NULL; static int sdev_upcall_door_revoked = 0; static int sdev_door_upcall_filename_size; -static void sdev_devfsadmd_nsrdr(sdev_nsrdr_work_t *); static int sdev_devfsadm_revoked(void); static int sdev_ki_call_devfsadmd(sdev_door_arg_t *, sdev_door_res_t *); -/* - * nsmap_readdir processing thread - */ -static uint_t sdev_nsrdr_thread_created = 0; -static kmutex_t sdev_nsrdr_thread_lock; -static kcondvar_t sdev_nsrdr_thread_cv; -static sdev_nsrdr_work_t *sdev_nsrdr_thread_workq = NULL; -static sdev_nsrdr_work_t *sdev_nsrdr_thread_tail = NULL; - void sdev_devfsadm_lockinit(void) { @@ -164,7 +150,7 @@ sdev_wait4lookup(struct sdev_node *dv, int cmd) } else if ((rv == -1) && (ddi_get_lbolt() >= expire)) { sdcmn_err6(("%s: wait time is up\n", - dv->sdev_name)); + dv->sdev_name)); break; } sdcmn_err6(("%s: wait " @@ -463,16 +449,13 @@ sdev_devfsadmd_thread(struct sdev_node *ddv, struct sdev_node *dv, } int -devname_filename_register(int cmd, char *name) +devname_filename_register(char *name) { int error = 0; char *strbuf; char *namep; int n; - ASSERT(cmd == MODDEVNAME_LOOKUPDOOR || - cmd == MODDEVNAME_DEVFSADMNODE); - strbuf = kmem_zalloc(MOD_MAXPATH, KM_SLEEP); if (copyinstr(name, strbuf, MOD_MAXPATH, 0)) { @@ -480,272 +463,20 @@ devname_filename_register(int cmd, char *name) error = EFAULT; } else { sdcmn_err6(("file %s is registering\n", strbuf)); - switch (cmd) { - case MODDEVNAME_LOOKUPDOOR: - /* handling the daemon re-start situations */ - n = strlen(strbuf) + 1; - namep = i_ddi_strdup(strbuf, KM_SLEEP); - mutex_enter(&devfsadm_lock); - sdev_release_door(); - sdev_door_upcall_filename_size = n; - sdev_door_upcall_filename = namep; - sdcmn_err6(("size %d file name %s\n", - sdev_door_upcall_filename_size, - sdev_door_upcall_filename)); - cv_broadcast(&devfsadm_cv); - mutex_exit(&devfsadm_lock); - break; - case MODDEVNAME_DEVFSADMNODE: - break; - } + /* handling the daemon re-start situations */ + n = strlen(strbuf) + 1; + namep = i_ddi_strdup(strbuf, KM_SLEEP); + mutex_enter(&devfsadm_lock); + sdev_release_door(); + sdev_door_upcall_filename_size = n; + sdev_door_upcall_filename = namep; + sdcmn_err6(("size %d file name %s\n", + sdev_door_upcall_filename_size, + sdev_door_upcall_filename)); + cv_broadcast(&devfsadm_cv); + mutex_exit(&devfsadm_lock); } kmem_free(strbuf, MOD_MAXPATH); return (error); } -static void -sdev_nsrdr_thread(void) -{ - sdev_nsrdr_work_t *work; - - for (;;) { - mutex_enter(&sdev_nsrdr_thread_lock); - if (sdev_nsrdr_thread_workq == NULL) { - cv_wait(&sdev_nsrdr_thread_cv, &sdev_nsrdr_thread_lock); - } - work = sdev_nsrdr_thread_workq; - sdev_nsrdr_thread_workq = work->next; - if (sdev_nsrdr_thread_tail == work) - sdev_nsrdr_thread_tail = work->next; - mutex_exit(&sdev_nsrdr_thread_lock); - sdev_devfsadmd_nsrdr(work); - } - /*NOTREACHED*/ -} - -int -devname_nsmaps_register(char *nvlbuf, size_t nvlsize) -{ - int error = 0; - nvlist_t *nvl, *attrs; - nvpair_t *nvp = NULL; - nvpair_t *kvp = NULL; - char *buf; - char *key; - char *dirname = NULL; - char *dirmodule = NULL; - char *dirmap = NULL; - char *orig_module; - char *orig_map; - int len = 0; - char *tmpmap; - int mapcount = 0; - - buf = kmem_zalloc(nvlsize, KM_SLEEP); - if ((error = ddi_copyin(nvlbuf, buf, nvlsize, 0)) != 0) { - kmem_free(buf, nvlsize); - return (error); - } - - ASSERT(buf); - sdcmn_err6(("devname_nsmaps_register: nsmap buf %p\n", (void *)buf)); - nvl = NULL; - error = nvlist_unpack(buf, nvlsize, &nvl, KM_SLEEP); - kmem_free(buf, nvlsize); - if (error || (nvl == NULL)) - return (error); - - /* invalidate all the nsmaps */ - mutex_enter(&devname_nsmaps_lock); - sdev_invalidate_nsmaps(); - for (nvp = nvlist_next_nvpair(nvl, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvl, nvp)) { - dirname = nvpair_name(nvp); - if (dirname == NULL) { - nvlist_free(nvl); - mutex_exit(&devname_nsmaps_lock); - return (-1); - } - - sdcmn_err6(("dirname %s\n", dirname)); - (void) nvpair_value_nvlist(nvp, &attrs); - for (kvp = nvlist_next_nvpair(attrs, NULL); kvp; - kvp = nvlist_next_nvpair(attrs, kvp)) { - key = nvpair_name(kvp); - sdcmn_err6(("key %s\n", key)); - if (strcmp(key, "module") == 0) { - (void) nvpair_value_string(kvp, &orig_module); - sdcmn_err6(("module %s\n", orig_module)); - dirmodule = i_ddi_strdup(orig_module, KM_SLEEP); - if (strcmp(dirmodule, "devname_null") == 0) - dirmodule = NULL; - } - - if (strcmp(key, "nsconfig") == 0) { - (void) nvpair_value_string(kvp, &orig_map); - sdcmn_err6(("dirmap %s\n", orig_map)); - dirmap = i_ddi_strdup(orig_map, KM_SLEEP); - if (strcmp(dirmap, "devname_null") == 0) - dirmap = NULL; - else if (dirmap[0] != '/') { - len = strlen(dirmap) + - strlen(ETC_DEV_DIR) + 2; - tmpmap = i_ddi_strdup(dirmap, KM_SLEEP); - (void) snprintf(dirmap, len, "%s/%s", - ETC_DEV_DIR, tmpmap); - kmem_free(tmpmap, strlen(tmpmap) + 1); - } - } - } - - if (dirmodule == NULL && dirmap == NULL) { - nvlist_free(nvl); - mutex_exit(&devname_nsmaps_lock); - return (-1); - } - - sdcmn_err6(("sdev_nsmaps_register: dir %s module %s map %s\n", - dirname, dirmodule, dirmap)); - sdev_insert_nsmap(dirname, dirmodule, dirmap); - mapcount++; - } - - if (mapcount > 0) - devname_nsmaps_loaded = 1; - - /* clean up obsolete nsmaps */ - sdev_validate_nsmaps(); - mutex_exit(&devname_nsmaps_lock); - if (nvl) - nvlist_free(nvl); - - if (sdev_nsrdr_thread_created) { - return (0); - } - - mutex_init(&sdev_nsrdr_thread_lock, NULL, MUTEX_DEFAULT, NULL); - cv_init(&sdev_nsrdr_thread_cv, NULL, CV_DEFAULT, NULL); - (void) thread_create(NULL, 0, (void (*)())sdev_nsrdr_thread, NULL, 0, - &p0, TS_RUN, minclsyspri); - sdev_nsrdr_thread_created = 1; - - return (0); -} - -void -sdev_dispatch_to_nsrdr_thread(struct sdev_node *ddv, char *dir_map, - devname_rdr_result_t *result) -{ - sdev_nsrdr_work_t *new_work; - - new_work = kmem_zalloc(sizeof (sdev_nsrdr_work_t), KM_SLEEP); - new_work->dir_name = i_ddi_strdup(ddv->sdev_name, KM_SLEEP); - new_work->dir_map = i_ddi_strdup(dir_map, KM_SLEEP); - new_work->dir_dv = ddv; - new_work->result = &result; - mutex_enter(&sdev_nsrdr_thread_lock); - if (sdev_nsrdr_thread_workq == NULL) { - sdev_nsrdr_thread_workq = new_work; - sdev_nsrdr_thread_tail = new_work; - new_work->next = NULL; - } else { - sdev_nsrdr_thread_tail->next = new_work; - sdev_nsrdr_thread_tail = new_work; - new_work->next = NULL; - } - cv_signal(&sdev_nsrdr_thread_cv); - mutex_exit(&sdev_nsrdr_thread_lock); -} - -static void -sdev_devfsadmd_nsrdr(sdev_nsrdr_work_t *work) -{ - int32_t error; - struct sdev_door_arg *argp; - struct sdev_door_res res; - struct sdev_node *ddv = work->dir_dv; - uint32_t mapcount; - - argp = kmem_zalloc(sizeof (sdev_door_arg_t), KM_SLEEP); - argp->devfsadm_cmd = DEVFSADMD_NS_READDIR; - - (void) snprintf(argp->ns_hdl.ns_name, - strlen(work->dir_dv->sdev_path) + 1, "%s", work->dir_dv->sdev_path); - (void) snprintf(argp->ns_hdl.ns_map, strlen(work->dir_map) + 1, "%s", - work->dir_map); - - sdcmn_err6(("sdev_devfsadmd_nsrdr: ns_name %s, ns_map %s\n", - argp->ns_hdl.ns_name, argp->ns_hdl.ns_map)); - error = sdev_ki_call_devfsadmd(argp, &res); - sdcmn_err6(("sdev_devfsadmd_nsrdr error %d\n", error)); - if (error == 0) { - error = res.devfsadm_error; - if (error) { - goto out; - } - - mapcount = (uint32_t)res.ns_rdr_hdl.ns_mapcount; - sdcmn_err6(("nsmapcount %d\n", mapcount)); - if (mapcount > 0) { - struct devname_nsmap *map = - ddv->sdev_mapinfo; - ASSERT(map && map->dir_map); - rw_enter(&map->dir_lock, RW_WRITER); - map->dir_maploaded = 1; - rw_exit(&map->dir_lock); - } - } - -out: - mutex_enter(&ddv->sdev_lookup_lock); - SDEV_UNBLOCK_OTHERS(ddv, SDEV_READDIR); - mutex_exit(&ddv->sdev_lookup_lock); - - kmem_free(argp, sizeof (sdev_door_arg_t)); -} - - -int -devname_nsmap_lookup(devname_lkp_arg_t *args, devname_lkp_result_t **result) -{ - int32_t error = 0; - struct sdev_door_arg *argp; - struct sdev_door_res resp; - char *link; - devname_spec_t spec; - - argp = kmem_zalloc(sizeof (sdev_door_arg_t), KM_SLEEP); - argp->devfsadm_cmd = DEVFSADMD_NS_LOOKUP; - - (void) snprintf(argp->ns_hdl.ns_name, strlen(args->devname_name) + 1, - "%s", args->devname_name); - (void) snprintf(argp->ns_hdl.ns_map, strlen(args->devname_map) + 1, - "%s", args->devname_map); - - error = sdev_ki_call_devfsadmd(argp, &resp); - if (error == 0) { - error = resp.devfsadm_error; - sdcmn_err6(("devfsadm: error %d\n", error)); - if (error) { - goto done; - } - link = resp.ns_lkp_hdl.devfsadm_link; - if (link == NULL) { - error = ENOENT; - goto done; - } - spec = resp.ns_lkp_hdl.devfsadm_spec; - sdcmn_err6(("devfsadm_link %s spec %d\n", - link, (int)spec)); - - - (*result)->devname_spec = (devname_spec_t)spec; - (*result)->devname_link = i_ddi_strdup(link, KM_SLEEP); - } else { - (*result)->devname_spec = DEVNAME_NS_NONE; - (*result)->devname_link = NULL; - } -done: - kmem_free(argp, sizeof (sdev_door_arg_t)); - return (error); -} diff --git a/usr/src/uts/common/fs/dev/sdev_ncache.c b/usr/src/uts/common/fs/dev/sdev_ncache.c index 21ed62064b..9bdf6f7bbc 100644 --- a/usr/src/uts/common/fs/dev/sdev_ncache.c +++ b/usr/src/uts/common/fs/dev/sdev_ncache.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * negative cache handling for the /dev fs */ @@ -54,7 +52,7 @@ #include <sys/mount.h> #include <sys/fs/snode.h> #include <sys/fs/dv_node.h> -#include <sys/fs/sdev_node.h> +#include <sys/fs/sdev_impl.h> #include <sys/sunndi.h> #include <sys/sunmdi.h> #include <sys/ddi.h> @@ -195,9 +193,9 @@ sdev_nvp_free(nvp_devname_t *dp) kmem_free(*p, strlen(*p)+1); } kmem_free(dp->nvp_paths, - dp->nvp_npaths * sizeof (char *)); + dp->nvp_npaths * sizeof (char *)); kmem_free(dp->nvp_expirecnts, - dp->nvp_npaths * sizeof (int)); + dp->nvp_npaths * sizeof (int)); } kmem_free(dp, sizeof (nvp_devname_t)); @@ -297,7 +295,7 @@ sdev_ncache_pack_list(nvf_handle_t fd, nvlist_t **ret_nvl) rval = nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP); if (rval != 0) { nvf_error("%s: nvlist alloc error %d\n", - nvf_cache_name(fd), rval); + nvf_cache_name(fd), rval); return (DDI_FAILURE); } @@ -308,7 +306,7 @@ sdev_ncache_pack_list(nvf_handle_t fd, nvlist_t **ret_nvl) rval = nvlist_alloc(&sub_nvl, NV_UNIQUE_NAME, KM_SLEEP); if (rval != 0) { nvf_error("%s: nvlist alloc error %d\n", - nvf_cache_name(fd), rval); + nvf_cache_name(fd), rval); sub_nvl = NULL; goto err; } @@ -706,7 +704,7 @@ sdev_lookup_failed(sdev_node_t *dv, char *nm, int failed_flags) !SDEV_IS_NO_NCACHE(dv) && ((failed_flags & SLF_NO_NCACHE) == 0) && ((sdev_reconfig_boot && - (sdev_boot_state != SDEV_BOOT_STATE_COMPLETE)) || + (sdev_boot_state != SDEV_BOOT_STATE_COMPLETE)) || (!sdev_reconfig_boot && ((failed_flags & SLF_REBUILT))))) { sdev_nc_addname(sdev_ncache, dv, nm, NCN_SRC_CURRENT|NCN_ACTIVE); @@ -818,7 +816,7 @@ sdev_nc_addname(sdev_nc_list_t *ncl, sdev_node_t *dv, char *nm, int flags) n = strlen(dv->sdev_path) + strlen(nm) + 2; lp->ncn_name = kmem_alloc(n, KM_SLEEP); (void) sprintf(lp->ncn_name, "%s/%s", - dv->sdev_path, nm); + dv->sdev_path, nm); lp->ncn_flags = flags; lp->ncn_expirecnt = sdev_nc_expirecnt; sdev_nc_insertnode(ncl, lp); diff --git a/usr/src/uts/common/fs/dev/sdev_nsconfig_mod.c b/usr/src/uts/common/fs/dev/sdev_nsconfig_mod.c deleted file mode 100644 index 476eb2472d..0000000000 --- a/usr/src/uts/common/fs/dev/sdev_nsconfig_mod.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * this module implements the devname_ops to fetch - * a specific entry from a /etc/dev/devname_map file or - * a name service map. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/errno.h> -#include <sys/stat.h> -#include <sys/cmn_err.h> -#include <sys/sunddi.h> -#include <sys/sunndi.h> -#include <sys/modctl.h> -#include <sys/debug.h> -#include <sys/fs/sdev_impl.h> -#include <sys/fs/sdev_node.h> - -static int devname_lookup(char *, devname_handle_t *, struct cred *); -static int devname_remove(devname_handle_t *); -static int devname_rename(devname_handle_t *, char *); -static int devname_readdir(devname_handle_t *, struct cred *); -static int devname_getattr(devname_handle_t *, struct vattr *, - struct cred *); -static void devname_inactive(devname_handle_t *, struct cred *); - -static struct devname_ops devname_ops = { - DEVNOPS_REV, /* devnops_rev, */ - devname_lookup, /* devnops_lookup */ - devname_remove, /* devnops_remove */ - devname_rename, /* devnops_rename */ - devname_getattr, /* devnops_getattr */ - devname_readdir, /* devname_readdir */ - devname_inactive /* devname_inactive */ -}; - -/* - * Module linkage information for the kernel. - */ -static struct modldev modldev = { - &mod_devfsops, - "devname name service mod 1.0", - &devname_ops, -}; - -static struct modlinkage modlinkage = { - MODREV_1, &modldev, NULL -}; - -int -_init(void) -{ - return (mod_install(&modlinkage)); -} - -int -_fini(void) -{ - return (mod_remove(&modlinkage)); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&modlinkage, modinfop)); -} - -/*ARGSUSED2*/ -static int -devname_lookup(char *nm, devname_handle_t *dhl, struct cred *cred) -{ - int error = 0; - char *dir = NULL; - devname_lkp_arg_t *args = NULL; - devname_lkp_result_t *result = NULL; - struct devname_nsmap *map = NULL; - - args = kmem_zalloc(sizeof (struct devname_lkp_arg), KM_SLEEP); - if (args == NULL) { - error = ENOENT; - goto errout; - } - - args->devname_name = i_ddi_strdup(nm, KM_SLEEP); - error = devname_get_dir_path(dhl, &dir); - if (error) { - error = ENOENT; - goto errout; - } - - args->devname_dir = i_ddi_strdup(dir, KM_SLEEP); - error = devname_get_dir_nsmap(dhl, &map); - if (map && map->dir_map) - args->devname_map = i_ddi_strdup(map->dir_map, KM_SLEEP); - - result = kmem_zalloc(sizeof (struct devname_lkp_result), KM_SLEEP); - if (result == NULL) { - error = ENOENT; - goto errout; - } - - - error = devname_nsmap_lookup(args, &result); - if (error) { - error = ENOENT; - goto errout; - } - - devname_set_nodetype(dhl, (void *)result->devname_link, - (int)result->devname_spec); - -errout: - if (args->devname_name) - kmem_free(args->devname_name, strlen(args->devname_name) + 1); - if (args->devname_dir) - kmem_free(args->devname_dir, strlen(args->devname_dir) + 1); - if (args->devname_map) - kmem_free(args->devname_map, strlen(args->devname_map) + 1); - if (args) - kmem_free(args, sizeof (struct devname_lkp_arg)); - if (result) - kmem_free(result, sizeof (struct devname_lkp_result)); - return (error); -} - -/*ARGSUSED*/ -static int -devname_readdir(devname_handle_t *hdl, struct cred *cred) -{ - char *entry; - char *dir; - - (void) devname_get_name(hdl, &entry); - (void) devname_get_dir_name(hdl, &dir); - - /* do not waste to do the map check */ - return (0); -} - -/*ARGSUSED*/ -static int -devname_remove(devname_handle_t *hdl) -{ - char *entry; - - (void) devname_get_name(hdl, &entry); - return (EROFS); -} - -/*ARGSUSED*/ -static int -devname_rename(devname_handle_t *ohdl, char *new_name) -{ - char *oname; - - (void) devname_get_name(ohdl, &oname); - return (ENOTSUP); -} - -/*ARGSUSED*/ -static int -devname_getattr(devname_handle_t *hdl, vattr_t *vap, struct cred *cred) -{ - return (0); -} - -/*ARGSUSED*/ -static void -devname_inactive(devname_handle_t *hdl, struct cred *cred) -{ -} diff --git a/usr/src/uts/common/fs/dev/sdev_subr.c b/usr/src/uts/common/fs/dev/sdev_subr.c index 9134a4d7ae..b06143030b 100644 --- a/usr/src/uts/common/fs/dev/sdev_subr.c +++ b/usr/src/uts/common/fs/dev/sdev_subr.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -55,7 +55,6 @@ #include <sys/fs/snode.h> #include <sys/fs/dv_node.h> #include <sys/fs/sdev_impl.h> -#include <sys/fs/sdev_node.h> #include <sys/sunndi.h> #include <sys/sunmdi.h> #include <sys/conf.h> @@ -151,17 +150,9 @@ vattr_t sdev_vattr_chr = { kmem_cache_t *sdev_node_cache; /* sdev_node cache */ int devtype; /* fstype */ -struct devname_ops *devname_ns_ops; /* default name service directory ops */ -kmutex_t devname_nsmaps_lock; /* protect devname_nsmaps */ - /* static */ -static struct devname_nsmap *devname_nsmaps = NULL; - /* contents from /etc/dev/devname_master */ -static int devname_nsmaps_invalidated = 0; /* "devfsadm -m" has run */ - static struct vnodeops *sdev_get_vop(struct sdev_node *); static void sdev_set_no_nocache(struct sdev_node *); -static int sdev_get_moduleops(struct sdev_node *); static fs_operation_def_t *sdev_merge_vtab(const fs_operation_def_t []); static void sdev_free_vtab(fs_operation_def_t *); @@ -335,10 +326,8 @@ sdev_nodeinit(struct sdev_node *ddv, char *nm, struct sdev_node **newdv, cv_init(&dv->sdev_lookup_cv, NULL, CV_DEFAULT, NULL); if (SDEV_IS_GLOBAL(ddv)) { dv->sdev_flags |= SDEV_GLOBAL; - dv->sdev_mapinfo = NULL; dhl = &(dv->sdev_handle); dhl->dh_data = dv; - dhl->dh_spec = DEVNAME_NS_NONE; dhl->dh_args = NULL; sdev_set_no_nocache(dv); dv->sdev_gdir_gen = 0; @@ -380,7 +369,6 @@ sdev_nodeready(struct sdev_node *dv, struct vattr *vap, struct vnode *avp, dv->sdev_flags &= ~SDEV_PERSIST; dv->sdev_flags &= ~SDEV_DYNAMIC; vn_setops(vp, sdev_get_vop(dv)); /* from internal vtab */ - error = sdev_get_moduleops(dv); /* from plug-in module */ ASSERT(dv->sdev_dotdot); ASSERT(SDEVTOV(dv->sdev_dotdot)->v_type == VDIR); vp->v_rdev = SDEVTOV(dv->sdev_dotdot)->v_rdev; @@ -484,8 +472,6 @@ sdev_mkroot(struct vfs *vfsp, dev_t devdev, struct vnode *mvp, mutex_init(&dv->sdev_lookup_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&dv->sdev_lookup_cv, NULL, CV_DEFAULT, NULL); if (strcmp(dv->sdev_name, "/dev") == 0) { - mutex_init(&devname_nsmaps_lock, NULL, MUTEX_DEFAULT, NULL); - dv->sdev_mapinfo = NULL; dv->sdev_flags = SDEV_BUILD|SDEV_GLOBAL|SDEV_PERSIST; bzero(&dv->sdev_handle, sizeof (dv->sdev_handle)); dv->sdev_gdir_gen = 0; @@ -509,84 +495,6 @@ sdev_mkroot(struct vfs *vfsp, dev_t devdev, struct vnode *mvp, return (dv); } -/* - * 1. load the module - * 2. modload invokes sdev_module_register, which in turn sets - * the dv->sdev_mapinfo->dir_ops - * - * note: locking order: - * dv->sdev_contents -> map->dir_lock - */ -static int -sdev_get_moduleops(struct sdev_node *dv) -{ - int error = 0; - struct devname_nsmap *map = NULL; - char *module; - char *path; - int load = 1; - - ASSERT(SDEVTOV(dv)->v_type == VDIR); - - if (devname_nsmaps == NULL) - return (0); - - if (!sdev_nsmaps_loaded() && !sdev_nsmaps_reloaded()) - return (0); - - - path = dv->sdev_path; - if ((map = sdev_get_nsmap_by_dir(path, 0))) { - rw_enter(&map->dir_lock, RW_READER); - if (map->dir_invalid) { - if (map->dir_module && map->dir_newmodule && - (strcmp(map->dir_module, - map->dir_newmodule) == 0)) { - load = 0; - } - sdev_replace_nsmap(map, map->dir_newmodule, - map->dir_newmap); - } - - module = map->dir_module; - if (module && load) { - sdcmn_err6(("sdev_get_moduleops: " - "load module %s", module)); - rw_exit(&map->dir_lock); - error = modload("devname", module); - sdcmn_err6(("sdev_get_moduleops: error %d\n", error)); - if (error < 0) { - return (-1); - } - } else if (module == NULL) { - /* - * loading the module ops for name services - */ - if (devname_ns_ops == NULL) { - sdcmn_err6(( - "sdev_get_moduleops: modload default\n")); - error = modload("devname", DEVNAME_NSCONFIG); - sdcmn_err6(( - "sdev_get_moduleops: error %d\n", error)); - if (error < 0) { - return (-1); - } - } - - if (!rw_tryupgrade(&map->dir_lock)) { - rw_exit(&map->dir_lock); - rw_enter(&map->dir_lock, RW_WRITER); - } - ASSERT(devname_ns_ops); - map->dir_ops = devname_ns_ops; - rw_exit(&map->dir_lock); - } - } - - dv->sdev_mapinfo = map; - return (0); -} - /* directory dependent vop table */ struct sdev_vop_table { char *vt_name; /* subdirectory name */ @@ -1419,25 +1327,6 @@ sdev_to_vp(struct sdev_node *dv, struct vnode **vpp) } /* - * loopback into sdev_lookup() - */ -static struct vnode * -devname_find_by_devpath(char *devpath, struct vattr *vattr) -{ - int error = 0; - struct vnode *vp; - - error = lookupname(devpath, UIO_SYSSPACE, NO_FOLLOW, NULLVPP, &vp); - if (error) { - return (NULL); - } - - if (vattr) - (void) VOP_GETATTR(vp, vattr, 0, kcred, NULL); - return (vp); -} - -/* * the junction between devname and devfs */ static struct vnode * @@ -1838,92 +1727,6 @@ sdev_call_devfsadmd(struct sdev_node *ddv, struct sdev_node *dv, char *nm) return (error); } -static int -sdev_call_modulelookup(struct sdev_node *ddv, struct sdev_node **dvp, char *nm, - int (*fn)(char *, devname_handle_t *, struct cred *), struct cred *cred) -{ - struct vnode *rvp = NULL; - int error = 0; - struct vattr *vap; - devname_spec_t spec; - devname_handle_t *hdl; - void *args = NULL; - struct sdev_node *dv = *dvp; - - ASSERT(dv && ddv); - hdl = &(dv->sdev_handle); - ASSERT(hdl->dh_data == dv); - mutex_enter(&dv->sdev_lookup_lock); - SDEV_BLOCK_OTHERS(dv, SDEV_LOOKUP); - mutex_exit(&dv->sdev_lookup_lock); - error = (*fn)(nm, hdl, cred); - if (error) { - return (error); - } - - spec = hdl->dh_spec; - args = hdl->dh_args; - ASSERT(args); - - switch (spec) { - case DEVNAME_NS_PATH: - /* - * symlink of: - * /dev/dir/nm -> /device/... - */ - rvp = devname_configure_by_path((char *)args, NULL); - break; - case DEVNAME_NS_DEV: - /* - * symlink of: - * /dev/dir/nm -> /dev/... - */ - rvp = devname_find_by_devpath((char *)args, NULL); - break; - default: - if (args) - kmem_free((char *)args, strlen(args) + 1); - return (ENOENT); - - } - - if (rvp == NULL) { - if (args) - kmem_free((char *)args, strlen(args) + 1); - return (ENOENT); - } else { - vap = sdev_getdefault_attr(VLNK); - ASSERT(RW_READ_HELD(&ddv->sdev_contents)); - /* - * Could sdev_mknode return a different dv_node - * once the lock is dropped? - */ - if (!rw_tryupgrade(&ddv->sdev_contents)) { - rw_exit(&ddv->sdev_contents); - rw_enter(&ddv->sdev_contents, RW_WRITER); - } - error = sdev_mknode(ddv, nm, &dv, vap, NULL, args, cred, - SDEV_READY); - rw_downgrade(&ddv->sdev_contents); - if (error) { - if (args) - kmem_free((char *)args, strlen(args) + 1); - return (error); - } else { - mutex_enter(&dv->sdev_lookup_lock); - SDEV_UNBLOCK_OTHERS(dv, SDEV_LOOKUP); - mutex_exit(&dv->sdev_lookup_lock); - error = 0; - } - } - - if (args) - kmem_free((char *)args, strlen(args) + 1); - - *dvp = dv; - return (0); -} - /* * Support for specialized device naming construction mechanisms */ @@ -2129,9 +1932,6 @@ devname_lookup_func(struct sdev_node *ddv, char *nm, struct vnode **vpp, struct sdev_node *dv = NULL; int retried = 0; int error = 0; - struct devname_nsmap *map = NULL; - struct devname_ops *dirops = NULL; - int (*fn)(char *, devname_handle_t *, struct cred *) = NULL; struct vattr vattr; char *lookup_thread = curproc->p_user.u_comm; int failed_flags = 0; @@ -2356,16 +2156,10 @@ lookup_create_node: failed_flags |= SLF_NO_NCACHE; } - if (SDEV_IS_GLOBAL(ddv)) { - map = sdev_get_map(ddv, 1); - dirops = map ? map->dir_ops : NULL; - fn = dirops ? dirops->devnops_lookup : NULL; - } - /* * (b1) invoking devfsadm once per life time for devfsadm nodes */ - if ((fn == NULL) && !callback) { + if (!callback) { if (sdev_reconfig_boot || !i_ddi_io_initialized() || SDEV_IS_DYNAMIC(ddv) || SDEV_IS_NO_NCACHE(dv) || @@ -2424,15 +2218,7 @@ lookup_create_node: * * note: module vnode ops take precedence than the build-in ones */ - if (fn) { - error = sdev_call_modulelookup(ddv, &dv, nm, fn, cred); - if (error) { - SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); - goto notfound; - } else { - goto found; - } - } else if (callback) { + if (callback) { error = sdev_call_dircallback(ddv, &dv, nm, callback, flags, cred); if (error == 0) { @@ -2493,11 +2279,6 @@ found: } } - if ((SDEVTOV(dv)->v_type == VDIR) && SDEV_IS_GLOBAL(dv)) { - rw_enter(&dv->sdev_contents, RW_READER); - (void) sdev_get_map(dv, 1); - rw_exit(&dv->sdev_contents); - } rw_exit(&ddv->sdev_contents); rv = sdev_to_vp(dv, vpp); sdcmn_err3(("devname_lookup_func: returning vp %p v_count %d state %d " @@ -2743,9 +2524,6 @@ devname_readdir_func(vnode_t *vp, uio_t *uiop, cred_t *cred, int *eofp, offset_t diroff; offset_t soff; int this_reclen; - struct devname_nsmap *map = NULL; - struct devname_ops *dirops = NULL; - int (*fn)(devname_handle_t *, struct cred *) = NULL; int (*vtor)(struct sdev_node *) = NULL; struct vattr attr; timestruc_t now; @@ -2783,32 +2561,8 @@ devname_readdir_func(vnode_t *vp, uio_t *uiop, cred_t *cred, int *eofp, goto get_cache; if (SDEV_IS_GLOBAL(ddv)) { - map = sdev_get_map(ddv, 0); - dirops = map ? map->dir_ops : NULL; - fn = dirops ? dirops->devnops_readdir : NULL; - if (map && map->dir_map) { - /* - * load the name mapping rule database - * through invoking devfsadm and symlink - * all the entries in the map - */ - devname_rdr_result_t rdr_result; - int do_thread = 0; - - rw_enter(&map->dir_lock, RW_READER); - do_thread = map->dir_maploaded ? 0 : 1; - rw_exit(&map->dir_lock); - - if (do_thread) { - mutex_enter(&ddv->sdev_lookup_lock); - SDEV_BLOCK_OTHERS(ddv, SDEV_READDIR); - mutex_exit(&ddv->sdev_lookup_lock); - - sdev_dispatch_to_nsrdr_thread(ddv, - map->dir_map, &rdr_result); - } - } else if ((sdev_boot_state == SDEV_BOOT_STATE_COMPLETE) && + if ((sdev_boot_state == SDEV_BOOT_STATE_COMPLETE) && !sdev_reconfig_boot && (flags & SDEV_BROWSE) && !SDEV_IS_DYNAMIC(ddv) && !SDEV_IS_NO_NCACHE(ddv) && ((moddebug & MODDEBUG_FINI_EBUSY) == 0) && @@ -2937,19 +2691,6 @@ get_cache: } } - /* - * call back into the module for the validity/bookkeeping - * of this entry - */ - if (fn) { - error = (*fn)(&(dv->sdev_handle), cred); - if (error) { - sdcmn_err4(("sdev_readdir: module did not " - "validate %s\n", dv->sdev_name)); - continue; - } - } - namelen = strlen(dv->sdev_name); reclen = DIRENT64_RECLEN(namelen); if (outcount + reclen > alloc_count) { @@ -3279,306 +3020,6 @@ sdev_modctl_devexists(const char *path) return (error); } -void -sdev_update_newnsmap(struct devname_nsmap *map, char *module, char *mapname) -{ - rw_enter(&map->dir_lock, RW_WRITER); - if (module) { - ASSERT(map->dir_newmodule == NULL); - map->dir_newmodule = i_ddi_strdup(module, KM_SLEEP); - } - if (mapname) { - ASSERT(map->dir_newmap == NULL); - map->dir_newmap = i_ddi_strdup(mapname, KM_SLEEP); - } - - map->dir_invalid = 1; - rw_exit(&map->dir_lock); -} - -void -sdev_replace_nsmap(struct devname_nsmap *map, char *module, char *mapname) -{ - char *old_module = NULL; - char *old_map = NULL; - - ASSERT(RW_LOCK_HELD(&map->dir_lock)); - if (!rw_tryupgrade(&map->dir_lock)) { - rw_exit(&map->dir_lock); - rw_enter(&map->dir_lock, RW_WRITER); - } - - old_module = map->dir_module; - if (module) { - if (old_module && strcmp(old_module, module) != 0) { - kmem_free(old_module, strlen(old_module) + 1); - } - map->dir_module = module; - map->dir_newmodule = NULL; - } - - old_map = map->dir_map; - if (mapname) { - if (old_map && strcmp(old_map, mapname) != 0) { - kmem_free(old_map, strlen(old_map) + 1); - } - - map->dir_map = mapname; - map->dir_newmap = NULL; - } - map->dir_maploaded = 0; - map->dir_invalid = 0; - rw_downgrade(&map->dir_lock); -} - -/* - * dir_name should have at least one attribute, - * dir_module - * or dir_map - * or both - * caller holds the devname_nsmaps_lock - */ -void -sdev_insert_nsmap(char *dir_name, char *dir_module, char *dir_map) -{ - struct devname_nsmap *map; - int len = 0; - - ASSERT(dir_name); - ASSERT(dir_module || dir_map); - ASSERT(MUTEX_HELD(&devname_nsmaps_lock)); - - if (map = sdev_get_nsmap_by_dir(dir_name, 1)) { - sdev_update_newnsmap(map, dir_module, dir_map); - return; - } - - map = (struct devname_nsmap *)kmem_zalloc(sizeof (*map), KM_SLEEP); - map->dir_name = i_ddi_strdup(dir_name, KM_SLEEP); - if (dir_module) { - map->dir_module = i_ddi_strdup(dir_module, KM_SLEEP); - } - - if (dir_map) { - if (dir_map[0] != '/') { - len = strlen(ETC_DEV_DIR) + strlen(dir_map) + 2; - map->dir_map = kmem_zalloc(len, KM_SLEEP); - (void) snprintf(map->dir_map, len, "%s/%s", ETC_DEV_DIR, - dir_map); - } else { - map->dir_map = i_ddi_strdup(dir_map, KM_SLEEP); - } - } - - map->dir_ops = NULL; - map->dir_maploaded = 0; - map->dir_invalid = 0; - rw_init(&map->dir_lock, NULL, RW_DEFAULT, NULL); - - map->next = devname_nsmaps; - map->prev = NULL; - if (devname_nsmaps) { - devname_nsmaps->prev = map; - } - devname_nsmaps = map; -} - -struct devname_nsmap * -sdev_get_nsmap_by_dir(char *dir_path, int locked) -{ - struct devname_nsmap *map = NULL; - - if (!locked) - mutex_enter(&devname_nsmaps_lock); - for (map = devname_nsmaps; map; map = map->next) { - sdcmn_err6(("sdev_get_nsmap_by_dir: dir %s\n", map->dir_name)); - if (strcmp(map->dir_name, dir_path) == 0) { - if (!locked) - mutex_exit(&devname_nsmaps_lock); - return (map); - } - } - if (!locked) - mutex_exit(&devname_nsmaps_lock); - return (NULL); -} - -struct devname_nsmap * -sdev_get_nsmap_by_module(char *mod_name) -{ - struct devname_nsmap *map = NULL; - - mutex_enter(&devname_nsmaps_lock); - for (map = devname_nsmaps; map; map = map->next) { - sdcmn_err7(("sdev_get_nsmap_by_module: module %s\n", - map->dir_module)); - if (map->dir_module && strcmp(map->dir_module, mod_name) == 0) { - mutex_exit(&devname_nsmaps_lock); - return (map); - } - } - mutex_exit(&devname_nsmaps_lock); - return (NULL); -} - -void -sdev_invalidate_nsmaps() -{ - struct devname_nsmap *map = NULL; - - ASSERT(MUTEX_HELD(&devname_nsmaps_lock)); - - if (devname_nsmaps == NULL) - return; - - for (map = devname_nsmaps; map; map = map->next) { - rw_enter(&map->dir_lock, RW_WRITER); - map->dir_invalid = 1; - rw_exit(&map->dir_lock); - } - devname_nsmaps_invalidated = 1; -} - - -int -sdev_nsmaps_loaded() -{ - int ret = 0; - - mutex_enter(&devname_nsmaps_lock); - if (devname_nsmaps_loaded) - ret = 1; - - mutex_exit(&devname_nsmaps_lock); - return (ret); -} - -int -sdev_nsmaps_reloaded() -{ - int ret = 0; - - mutex_enter(&devname_nsmaps_lock); - if (devname_nsmaps_invalidated) - ret = 1; - - mutex_exit(&devname_nsmaps_lock); - return (ret); -} - -static void -sdev_free_nsmap(struct devname_nsmap *map) -{ - ASSERT(map); - if (map->dir_name) - kmem_free(map->dir_name, strlen(map->dir_name) + 1); - if (map->dir_module) - kmem_free(map->dir_module, strlen(map->dir_module) + 1); - if (map->dir_map) - kmem_free(map->dir_map, strlen(map->dir_map) + 1); - rw_destroy(&map->dir_lock); - kmem_free(map, sizeof (*map)); -} - -void -sdev_validate_nsmaps() -{ - struct devname_nsmap *map = NULL; - struct devname_nsmap *oldmap = NULL; - - ASSERT(MUTEX_HELD(&devname_nsmaps_lock)); - map = devname_nsmaps; - while (map) { - rw_enter(&map->dir_lock, RW_READER); - if ((map->dir_invalid == 1) && (map->dir_newmodule == NULL) && - (map->dir_newmap == NULL)) { - oldmap = map; - rw_exit(&map->dir_lock); - if (map->prev) - map->prev->next = oldmap->next; - if (map == devname_nsmaps) - devname_nsmaps = oldmap->next; - - map = oldmap->next; - if (map) - map->prev = oldmap->prev; - sdev_free_nsmap(oldmap); - oldmap = NULL; - } else { - rw_exit(&map->dir_lock); - map = map->next; - } - } - devname_nsmaps_invalidated = 0; -} - -static int -sdev_map_is_invalid(struct devname_nsmap *map) -{ - int ret = 0; - - ASSERT(map); - rw_enter(&map->dir_lock, RW_READER); - if (map->dir_invalid) - ret = 1; - rw_exit(&map->dir_lock); - return (ret); -} - -static int -sdev_check_map(struct devname_nsmap *map) -{ - struct devname_nsmap *mapp; - - mutex_enter(&devname_nsmaps_lock); - if (devname_nsmaps == NULL) { - mutex_exit(&devname_nsmaps_lock); - return (1); - } - - for (mapp = devname_nsmaps; mapp; mapp = mapp->next) { - if (mapp == map) { - mutex_exit(&devname_nsmaps_lock); - return (0); - } - } - - mutex_exit(&devname_nsmaps_lock); - return (1); - -} - -struct devname_nsmap * -sdev_get_map(struct sdev_node *dv, int validate) -{ - struct devname_nsmap *map; - int error; - - ASSERT(RW_READ_HELD(&dv->sdev_contents)); - map = dv->sdev_mapinfo; - if (map && sdev_check_map(map)) { - if (!rw_tryupgrade(&dv->sdev_contents)) { - rw_exit(&dv->sdev_contents); - rw_enter(&dv->sdev_contents, RW_WRITER); - } - dv->sdev_mapinfo = NULL; - rw_downgrade(&dv->sdev_contents); - return (NULL); - } - - if (validate && (!map || (map && sdev_map_is_invalid(map)))) { - if (!rw_tryupgrade(&dv->sdev_contents)) { - rw_exit(&dv->sdev_contents); - rw_enter(&dv->sdev_contents, RW_WRITER); - } - error = sdev_get_moduleops(dv); - if (!error) - map = dv->sdev_mapinfo; - rw_downgrade(&dv->sdev_contents); - } - return (map); -} - extern int sdev_vnodeops_tbl_size; /* @@ -3619,115 +3060,6 @@ sdev_free_vtab(fs_operation_def_t *new) kmem_free(new, sdev_vnodeops_tbl_size); } -void -devname_get_vnode(devname_handle_t *hdl, vnode_t **vpp) -{ - struct sdev_node *dv = hdl->dh_data; - - ASSERT(dv); - - rw_enter(&dv->sdev_contents, RW_READER); - *vpp = SDEVTOV(dv); - rw_exit(&dv->sdev_contents); -} - -int -devname_get_path(devname_handle_t *hdl, char **path) -{ - struct sdev_node *dv = hdl->dh_data; - - ASSERT(dv); - - rw_enter(&dv->sdev_contents, RW_READER); - *path = dv->sdev_path; - rw_exit(&dv->sdev_contents); - return (0); -} - -int -devname_get_name(devname_handle_t *hdl, char **entry) -{ - struct sdev_node *dv = hdl->dh_data; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_READER); - *entry = dv->sdev_name; - rw_exit(&dv->sdev_contents); - return (0); -} - -void -devname_get_dir_vnode(devname_handle_t *hdl, vnode_t **vpp) -{ - struct sdev_node *dv = hdl->dh_data->sdev_dotdot; - - ASSERT(dv); - - rw_enter(&dv->sdev_contents, RW_READER); - *vpp = SDEVTOV(dv); - rw_exit(&dv->sdev_contents); -} - -int -devname_get_dir_path(devname_handle_t *hdl, char **path) -{ - struct sdev_node *dv = hdl->dh_data->sdev_dotdot; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_READER); - *path = dv->sdev_path; - rw_exit(&dv->sdev_contents); - return (0); -} - -int -devname_get_dir_name(devname_handle_t *hdl, char **entry) -{ - struct sdev_node *dv = hdl->dh_data->sdev_dotdot; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_READER); - *entry = dv->sdev_name; - rw_exit(&dv->sdev_contents); - return (0); -} - -int -devname_get_dir_nsmap(devname_handle_t *hdl, struct devname_nsmap **map) -{ - struct sdev_node *dv = hdl->dh_data->sdev_dotdot; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_READER); - *map = dv->sdev_mapinfo; - rw_exit(&dv->sdev_contents); - return (0); -} - -int -devname_get_dir_handle(devname_handle_t *hdl, devname_handle_t **dir_hdl) -{ - struct sdev_node *dv = hdl->dh_data->sdev_dotdot; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_READER); - *dir_hdl = &(dv->sdev_handle); - rw_exit(&dv->sdev_contents); - return (0); -} - -void -devname_set_nodetype(devname_handle_t *hdl, void *args, int spec) -{ - struct sdev_node *dv = hdl->dh_data; - - ASSERT(dv); - rw_enter(&dv->sdev_contents, RW_WRITER); - hdl->dh_spec = (devname_spec_t)spec; - hdl->dh_args = (void *)i_ddi_strdup((char *)args, KM_SLEEP); - rw_exit(&dv->sdev_contents); -} - /* * a generic setattr() function * @@ -3841,6 +3173,7 @@ devname_setattr_func(struct vnode *vp, struct vattr *vap, int flags, /* * a generic inactive() function */ +/*ARGSUSED*/ void devname_inactive_func(struct vnode *vp, struct cred *cred, void (*callback)(struct vnode *)) @@ -3849,9 +3182,6 @@ devname_inactive_func(struct vnode *vp, struct cred *cred, struct sdev_node *dv = VTOSDEV(vp); struct sdev_node *ddv = dv->sdev_dotdot; int state; - struct devname_nsmap *map = NULL; - struct devname_ops *dirops = NULL; - void (*fn)(devname_handle_t *, struct cred *) = NULL; rw_enter(&ddv->sdev_contents, RW_WRITER); state = dv->sdev_state; @@ -3872,12 +3202,6 @@ devname_inactive_func(struct vnode *vp, struct cred *cred, */ if (clean) { ASSERT(ddv); - if (SDEV_IS_GLOBAL(dv)) { - map = ddv->sdev_mapinfo; - dirops = map ? map->dir_ops : NULL; - if (dirops && (fn = dirops->devnops_inactive)) - (*fn)(&(dv->sdev_handle), cred); - } ddv->sdev_nlink--; if (vp->v_type == VDIR) { diff --git a/usr/src/uts/common/fs/dev/sdev_vfsops.c b/usr/src/uts/common/fs/dev/sdev_vfsops.c index f45a6c92ef..ea9cb6374a 100644 --- a/usr/src/uts/common/fs/dev/sdev_vfsops.c +++ b/usr/src/uts/common/fs/dev/sdev_vfsops.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -52,7 +52,6 @@ #include <sys/mkdev.h> #include <fs/fs_subr.h> #include <sys/fs/sdev_impl.h> -#include <sys/fs/sdev_node.h> #include <sys/fs/snode.h> #include <sys/fs/dv_node.h> #include <sys/sunndi.h> @@ -466,26 +465,6 @@ sdev_statvfs(struct vfs *vfsp, struct statvfs64 *sbp) return (0); } -int -sdev_module_register(char *mod_name, struct devname_ops *dev_ops) -{ - struct devname_nsmap *map = NULL; - - if (strcmp(mod_name, DEVNAME_NSCONFIG) == 0) { - devname_ns_ops = dev_ops; - return (0); - } - - map = sdev_get_nsmap_by_module(mod_name); - if (map == NULL) - return (EFAULT); - - rw_enter(&map->dir_lock, RW_WRITER); - map->dir_ops = dev_ops; - rw_exit(&map->dir_lock); - return (0); -} - static void sdev_insert_mntinfo(struct sdev_data *data) { diff --git a/usr/src/uts/common/fs/dev/sdev_vnops.c b/usr/src/uts/common/fs/dev/sdev_vnops.c index 11d4b66a84..6b5be1d7a9 100644 --- a/usr/src/uts/common/fs/dev/sdev_vnops.c +++ b/usr/src/uts/common/fs/dev/sdev_vnops.c @@ -70,7 +70,6 @@ #include <fs/fs_subr.h> #include <sys/fs/dv_node.h> #include <sys/fs/sdev_impl.h> -#include <sys/fs/sdev_node.h> /*ARGSUSED*/ static int @@ -208,18 +207,11 @@ sdev_getattr(struct vnode *vp, struct vattr *vap, int flags, int error = 0; struct sdev_node *dv = VTOSDEV(vp); struct sdev_node *parent = dv->sdev_dotdot; - struct devname_nsmap *map = NULL; - struct devname_ops *dirops = NULL; - int (*fn)(devname_handle_t *, struct vattr *, struct cred *); ASSERT(parent); rw_enter(&parent->sdev_contents, RW_READER); ASSERT(dv->sdev_attr || dv->sdev_attrvp); - if (SDEV_IS_GLOBAL(dv) && (dv->sdev_state != SDEV_ZOMBIE)) { - map = sdev_get_map(parent, 0); - dirops = map ? map->dir_ops : NULL; - } /* * search order: @@ -230,10 +222,6 @@ sdev_getattr(struct vnode *vp, struct vattr *vap, int flags, rw_exit(&parent->sdev_contents); error = VOP_GETATTR(dv->sdev_attrvp, vap, flags, cr, ct); sdev_vattr_merge(dv, vap); - } else if (dirops && (fn = dirops->devnops_getattr)) { - sdev_vattr_merge(dv, vap); - rw_exit(&parent->sdev_contents); - error = (*fn)(&(dv->sdev_handle), vap, cr); } else { ASSERT(dv->sdev_attr); *vap = *dv->sdev_attr; @@ -522,9 +510,6 @@ sdev_remove(struct vnode *dvp, char *nm, struct cred *cred, struct sdev_node *parent = (struct sdev_node *)VTOSDEV(dvp); struct vnode *vp = NULL; struct sdev_node *dv = NULL; - struct devname_nsmap *map = NULL; - struct devname_ops *dirops = NULL; - int (*fn)(devname_handle_t *); int len; int bkstore = 0; @@ -573,18 +558,6 @@ sdev_remove(struct vnode *dvp, char *nm, struct cred *cred, return (error); } - /* the module may record/reject removing a device node */ - map = sdev_get_map(parent, 0); - dirops = map ? map->dir_ops : NULL; - if (dirops && ((fn = dirops->devnops_remove) != NULL)) { - error = (*fn)(&(dv->sdev_handle)); - if (error) { - rw_exit(&parent->sdev_contents); - VN_RELE(vp); - return (error); - } - } - /* * sdev_dirdelete does the real job of: * - make sure no open ref count @@ -653,12 +626,6 @@ sdev_rename(struct vnode *odvp, char *onm, struct vnode *ndvp, char *nnm, struct vnode *nvp = NULL; /* destination vnode */ int samedir = 0; /* set if odvp == ndvp */ struct vnode *realvp; - int len; - char nnm_path[MAXPATHLEN]; - struct devname_nsmap *omap = NULL; - struct devname_ops *odirops = NULL; - int (*fn)(devname_handle_t *, char *); - int (*rmfn)(devname_handle_t *); int error = 0; dev_t fsid; int bkstore = 0; @@ -782,30 +749,6 @@ sdev_rename(struct vnode *odvp, char *onm, struct vnode *ndvp, char *nnm, fromdv = VTOSDEV(ovp); ASSERT(fromdv); - /* check with the plug-in modules for the source directory */ - rw_enter(&fromparent->sdev_contents, RW_READER); - omap = sdev_get_map(fromparent, 0); - rw_exit(&fromparent->sdev_contents); - odirops = omap ? omap->dir_ops : NULL; - if (odirops && ((fn = odirops->devnops_rename) != NULL)) { - if (samedir) { - error = (*fn)(&(fromdv->sdev_handle), nnm); - } else { - len = strlen(nnm) + strlen(toparent->sdev_name) + 2; - (void) snprintf(nnm_path, len, "%s/%s", - toparent->sdev_name, nnm); - error = (*fn)(&(fromdv->sdev_handle), nnm); - } - - if (error) { - mutex_exit(&sdev_lock); - sdcmn_err2(("sdev_rename: DBNR doesn't " - "allow rename, error %d", error)); - VN_RELE(ovp); - return (error); - } - } - /* destination file exists */ if (nvp) { todv = VTOSDEV(nvp); @@ -826,11 +769,6 @@ sdev_rename(struct vnode *odvp, char *onm, struct vnode *ndvp, char *nnm, return (error); } - /* notify the DBNR module the node is going away */ - if (odirops && ((rmfn = odirops->devnops_remove) != NULL)) { - (void) (*rmfn)(&(fromdv->sdev_handle)); - } - /* * unlink from source */ diff --git a/usr/src/uts/common/os/devcfg.c b/usr/src/uts/common/os/devcfg.c index 0d56e9bd01..2403c79f69 100644 --- a/usr/src/uts/common/os/devcfg.c +++ b/usr/src/uts/common/os/devcfg.c @@ -52,6 +52,7 @@ #include <sys/reboot.h> #include <sys/sysmacros.h> #include <sys/systm.h> +#include <sys/fs/sdev_impl.h> #include <sys/sunldi.h> #include <sys/sunldi_impl.h> diff --git a/usr/src/uts/common/os/modconf.c b/usr/src/uts/common/os/modconf.c index cf25d86183..c96d792aff 100644 --- a/usr/src/uts/common/os/modconf.c +++ b/usr/src/uts/common/os/modconf.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,7 +56,6 @@ #include <sys/brand.h> #include <sys/cpc_pcbe.h> #include <sys/kstat.h> -#include <sys/fs/sdev_node.h> #include <sys/socketvar.h> #include <sys/kiconv.h> @@ -229,17 +228,6 @@ struct mod_ops mod_dacfops = { }; /* - * /dev fs modules - */ -static int mod_infodev(struct modldev *, struct modlinkage *, int *); -static int mod_installdev(struct modldev *, struct modlinkage *); -static int mod_removedev(struct modldev *, struct modlinkage *); - -struct mod_ops mod_devfsops = { - mod_installdev, mod_removedev, mod_infodev -}; - -/* * PCBE (Performance Counter BackEnd) modules. */ static int mod_installpcbe(struct modlpcbe *, struct modlinkage *); @@ -545,42 +533,6 @@ mod_removebrand(struct modlbrand *modl, struct modlinkage *modlp) } /* - * manage /dev fs modules - */ -/*ARGSUSED*/ -static int -mod_infodev(struct modldev *modl, struct modlinkage *modlp, int *p0) -{ - if (mod_getctl(modlp) == NULL) { - *p0 = -1; - return (0); /* module is not yet installed */ - } - - *p0 = 0; - return (0); -} - -static int -mod_installdev(struct modldev *modl, struct modlinkage *modlp) -{ - struct modctl *mcp; - - if ((mcp = mod_getctl(modlp)) == NULL) - return (EINVAL); - return (sdev_module_register(mcp->mod_modname, modl->dev_ops)); -} - -/* - * /dev modules are not unloadable. - */ -/*ARGSUSED*/ -static int -mod_removedev(struct modldev *modl, struct modlinkage *modlp) -{ - return (EBUSY); -} - -/* * Install a new driver */ static int diff --git a/usr/src/uts/common/os/modctl.c b/usr/src/uts/common/os/modctl.c index 4b5a3685d7..d21d601c90 100644 --- a/usr/src/uts/common/os/modctl.c +++ b/usr/src/uts/common/os/modctl.c @@ -76,7 +76,7 @@ #include <ipp/ipp_impl.h> #include <sys/fs/dv_node.h> #include <sys/strsubr.h> -#include <sys/fs/sdev_node.h> +#include <sys/fs/sdev_impl.h> static int mod_circdep(struct modctl *); static int modinfo(modid_t, struct modinfo *); @@ -2247,11 +2247,7 @@ modctl_moddevname(int subcmd, uintptr_t a1, uintptr_t a2) switch (subcmd) { case MODDEVNAME_LOOKUPDOOR: - case MODDEVNAME_DEVFSADMNODE: - error = devname_filename_register(subcmd, (char *)a1); - break; - case MODDEVNAME_NSMAPS: - error = devname_nsmaps_register((char *)a1, (size_t)a2); + error = devname_filename_register((char *)a1); break; case MODDEVNAME_PROFILE: error = devname_profile_update((char *)a1, (size_t)a2); diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile index c70979cef8..ef6cd77e27 100644 --- a/usr/src/uts/common/sys/Makefile +++ b/usr/src/uts/common/sys/Makefile @@ -798,7 +798,6 @@ FSHDRS= \ decomp.h \ dv_node.h \ sdev_impl.h \ - sdev_node.h \ fifonode.h \ hsfs_isospec.h \ hsfs_node.h \ diff --git a/usr/src/uts/common/sys/fs/dv_node.h b/usr/src/uts/common/sys/fs/dv_node.h index da6d18f368..ff9b4f98b6 100644 --- a/usr/src/uts/common/sys/fs/dv_node.h +++ b/usr/src/uts/common/sys/fs/dv_node.h @@ -40,7 +40,7 @@ #include <sys/sunddi.h> #include <sys/devops.h> #include <sys/ddi_impldefs.h> -#include <sys/fs/sdev_node.h> +#include <sys/fs/sdev_impl.h> #include <sys/devpolicy.h> #include <sys/avl.h> diff --git a/usr/src/uts/common/sys/fs/sdev_impl.h b/usr/src/uts/common/sys/fs/sdev_impl.h index 10ac3b60b6..3291ca7f1c 100644 --- a/usr/src/uts/common/sys/fs/sdev_impl.h +++ b/usr/src/uts/common/sys/fs/sdev_impl.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -69,17 +69,6 @@ struct sdev_mountargs { * supported devfsadm_cmd */ #define DEVFSADMD_RUN_ALL 1 -#define DEVFSADMD_NS_LOOKUP 2 -#define DEVFSADMD_NS_READDIR 3 - -/* - * supported protocols - */ -typedef enum devname_spec { - DEVNAME_NS_NONE = 0, - DEVNAME_NS_PATH, /* physical /devices path */ - DEVNAME_NS_DEV /* /dev path */ -} devname_spec_t; /* * devfsadm_error codes @@ -87,35 +76,16 @@ typedef enum devname_spec { #define DEVFSADM_RUN_INVALID 1 #define DEVFSADM_RUN_EPERM 2 #define DEVFSADM_RUN_NOTSUP 3 -#define DEVFSADM_NS_FAILED 4 - -typedef struct sdev_ns_handle { - char ns_name[MAXPATHLEN]; /* device to be looked up */ - char ns_map[MAXPATHLEN]; -} sdev_ns_handle_t; - -typedef struct sdev_lkp_handle { - devname_spec_t devfsadm_spec; /* returned path property */ - char devfsadm_link[MAXPATHLEN]; /* symlink destination */ -} sdev_lkp_handle_t; - -typedef struct sdev_rdr_handle { - uint32_t ns_mapcount; /* number of entries in the map */ - uint32_t maplist_size; -} sdev_rdr_handle_t; /* * devfsadm/devname door data structures */ typedef struct sdev_door_arg { uint8_t devfsadm_cmd; /* what to do for devfsadm[d] */ - sdev_ns_handle_t ns_hdl; } sdev_door_arg_t; typedef struct sdev_door_res { int32_t devfsadm_error; - sdev_lkp_handle_t ns_lkp_hdl; - sdev_rdr_handle_t ns_rdr_hdl; } sdev_door_res_t; #ifdef _KERNEL @@ -134,7 +104,6 @@ struct sdev_dprof { */ struct devname_handle { struct sdev_node *dh_data; /* the sdev_node */ - devname_spec_t dh_spec; void *dh_args; }; typedef struct devname_handle devname_handle_t; @@ -145,7 +114,6 @@ typedef struct devname_handle devname_handle_t; */ typedef struct sdev_global_data { struct devname_handle sdev_ghandle; - struct devname_nsmap *sdev_gmapinfo; /* VDIR name service info */ ulong_t sdev_dir_ggen; /* name space generation # */ } sdev_global_data_t; @@ -200,7 +168,6 @@ typedef struct sdev_node { #define sdev_gdata sdev_instance_data.sdev_globaldata #define sdev_handle sdev_gdata.sdev_ghandle -#define sdev_mapinfo sdev_gdata.sdev_gmapinfo #define sdev_gdir_gen sdev_gdata.sdev_dir_ggen #define sdev_ldir_gen sdev_ldata.sdev_dir_lgen @@ -353,7 +320,7 @@ extern int devname_setattr_func(struct vnode *, struct vattr *, int, /* * devname_inactive_func() */ -extern void devname_inactive_func(struct vnode *, struct cred *, +extern void devname_inactive_func(struct vnode *, struct cred *cred, void (*)(struct vnode *)); /* @@ -418,7 +385,7 @@ extern void sdev_unblock_others(struct sdev_node *, uint_t); } extern int sdev_wait4lookup(struct sdev_node *, int); -extern int devname_filename_register(int, char *); +extern int devname_filename_register(char *); extern int devname_nsmaps_register(char *, size_t); extern void sdev_devfsadm_lockinit(void); extern void sdev_devfsadm_lockdestroy(void); @@ -432,13 +399,6 @@ extern struct vnodeops *devpts_getvnodeops(void); extern struct vnodeops *devvt_getvnodeops(void); /* - * Directory Based Device Naming (DBNR) defines - */ - -#define ETC_DEV_DIR "/etc/dev" -#define DEVNAME_NSCONFIG "sdev_nsconfig_mod" - -/* * directory name rule */ struct devname_nsmap { @@ -447,7 +407,6 @@ struct devname_nsmap { char *dir_name; /* /dev subdir name, e.g. /dev/disk */ char *dir_module; /* devname module impl the operations */ char *dir_map; /* dev naming rules, e.g. /etc/dev/disks */ - struct devname_ops *dir_ops; /* directory specific vnode ops */ char *dir_newmodule; /* to be reloaded */ char *dir_newmap; /* to be reloaded */ int dir_invalid; /* map entry obsolete */ @@ -466,15 +425,6 @@ typedef struct devname_lkp_arg { } devname_lkp_arg_t; /* - * name-value-property restured - */ -typedef struct devname_lkp_result { - devname_spec_t devname_spec; /* link to /devices or /dev */ - char *devname_link; /* the source path */ - int reserved; -} devname_lkp_result_t; - -/* * directory name-value populating results */ typedef struct devname_rdr_result { @@ -559,25 +509,6 @@ typedef struct nvp_devname { * name service globals and prototypes */ -extern struct devname_ops *devname_ns_ops; -extern int devname_nsmaps_loaded; -extern kmutex_t devname_nsmaps_lock; - -extern void sdev_invalidate_nsmaps(void); -extern void sdev_validate_nsmaps(void); -extern int sdev_module_register(char *, struct devname_ops *); -extern struct devname_nsmap *sdev_get_nsmap_by_dir(char *, int); -extern struct devname_nsmap *sdev_get_nsmap_by_module(char *); -extern void sdev_dispatch_to_nsrdr_thread(struct sdev_node *, char *, - devname_rdr_result_t *); -extern void sdev_insert_nsmap(char *, char *, char *); -extern int devname_nsmap_lookup(devname_lkp_arg_t *, devname_lkp_result_t **); -extern struct devname_nsmap *sdev_get_map(struct sdev_node *, int); -extern int sdev_nsmaps_loaded(void); -extern void sdev_replace_nsmap(struct devname_nsmap *, char *, char *); -extern int sdev_nsmaps_reloaded(void); -extern int devname_get_dir_nsmap(devname_handle_t *, struct devname_nsmap **); - /* * vnodeops and vfsops helpers */ @@ -632,13 +563,6 @@ extern int devvt_validate(struct sdev_node *dv); extern void *sdev_get_vtor(struct sdev_node *dv); /* - * devinfo helpers - */ -extern int sdev_modctl_readdir(const char *, char ***, int *, int *, int); -extern void sdev_modctl_readdir_free(char **, int, int); -extern int sdev_modctl_devexists(const char *); - -/* * ncache handlers */ @@ -651,6 +575,13 @@ extern void sdev_nc_path_exists(sdev_nc_list_t *, char *); extern void sdev_modctl_dump_files(void); /* + * devinfo helpers + */ +extern int sdev_modctl_readdir(const char *, char ***, int *, int *, int); +extern void sdev_modctl_readdir_free(char **, int, int); +extern int sdev_modctl_devexists(const char *); + +/* * globals */ extern kmutex_t sdev_lock; diff --git a/usr/src/uts/common/sys/fs/sdev_node.h b/usr/src/uts/common/sys/fs/sdev_node.h deleted file mode 100644 index 96c4733545..0000000000 --- a/usr/src/uts/common/sys/fs/sdev_node.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_SDEV_NODE_H -#define _SYS_SDEV_NODE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <sys/fs/sdev_impl.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _KERNEL - -#define DEVNOPS_REV 1 - -/* - * directory vnode ops implemented in a loadable module - */ -struct devname_ops { - int devnops_rev; /* module build version */ - int (*devnops_lookup)(char *, devname_handle_t *, struct cred *); - int (*devnops_remove)(devname_handle_t *); - int (*devnops_rename)(devname_handle_t *, char *); - int (*devnops_getattr)(devname_handle_t *, struct vattr *, - struct cred *); - int (*devnops_readdir)(devname_handle_t *, struct cred *); - void (*devnops_inactive)(devname_handle_t *, struct cred *); -}; - -/* - * supported protocols - */ -#define DEVNAME_NS_PATH 1 -#define DEVNAME_NS_DEV 2 - -/* - * default devname_ops for a /dev directory - * that has a device name binding rule map - */ -extern void devname_set_nodetype(devname_handle_t *, void *, int); -extern void devname_get_vnode(devname_handle_t *, vnode_t **); -extern int devname_get_path(devname_handle_t *, char **); -extern int devname_get_name(devname_handle_t *, char **); -extern int devname_get_dir_handle(devname_handle_t *, devname_handle_t **); -extern void devname_get_dir_vnode(devname_handle_t *, vnode_t **); -extern int devname_get_dir_path(devname_handle_t *, char **); -extern int devname_get_dir_name(devname_handle_t *, char **); - -#endif /* _KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_SDEV_NODE_H */ diff --git a/usr/src/uts/common/sys/modctl.h b/usr/src/uts/common/sys/modctl.h index 592b3d11fe..91ee93d916 100644 --- a/usr/src/uts/common/sys/modctl.h +++ b/usr/src/uts/common/sys/modctl.h @@ -78,7 +78,6 @@ extern struct mod_ops mod_syscallops32; extern struct mod_ops mod_dacfops; extern struct mod_ops mod_ippops; extern struct mod_ops mod_pcbeops; -extern struct mod_ops mod_devfsops; extern struct mod_ops mod_kiconvops; #endif /* _KERNEL */ @@ -183,13 +182,6 @@ struct modlbrand { struct brand *brand_branddef; }; -/* for devname fs */ -struct modldev { - struct mod_ops *dev_modops; - char *dev_linkinfo; - struct devname_ops *dev_ops; -}; - /* For socket Modules. */ struct modlsockmod { struct mod_ops *sockmod_modops; @@ -293,8 +285,6 @@ struct modlinkage { * devname subcmds for MODDEVNAME */ #define MODDEVNAME_LOOKUPDOOR 0 -#define MODDEVNAME_DEVFSADMNODE 1 -#define MODDEVNAME_NSMAPS 2 #define MODDEVNAME_PROFILE 3 #define MODDEVNAME_RECONFIG 4 #define MODDEVNAME_SYSAVAIL 5 diff --git a/usr/src/uts/intel/Makefile.intel.shared b/usr/src/uts/intel/Makefile.intel.shared index bc76eab8d5..b3236ff65b 100644 --- a/usr/src/uts/intel/Makefile.intel.shared +++ b/usr/src/uts/intel/Makefile.intel.shared @@ -710,11 +710,6 @@ MAC_KMODS += mac_wifi MAC_KMODS += mac_ib # -# 'Devname' Modules (kernel/devname) -# -DEVNAME_KMODS += sdev_nsconfig_mod - -# # socketmod (kernel/socketmod) # SOCKET_KMODS += socksctp diff --git a/usr/src/uts/intel/ia32/ml/modstubs.s b/usr/src/uts/intel/ia32/ml/modstubs.s index 91c1422416..5164c277d3 100644 --- a/usr/src/uts/intel/ia32/ml/modstubs.s +++ b/usr/src/uts/intel/ia32/ml/modstubs.s @@ -424,9 +424,7 @@ fcnname/**/_info: \ NO_UNLOAD_STUB(dev, sdev_modctl_readdir_free, nomod_minus_one); NO_UNLOAD_STUB(dev, devname_filename_register, nomod_minus_one); NO_UNLOAD_STUB(dev, sdev_modctl_devexists, nomod_minus_one); - NO_UNLOAD_STUB(dev, devname_nsmaps_register, nomod_minus_one); NO_UNLOAD_STUB(dev, devname_profile_update, nomod_minus_one); - NO_UNLOAD_STUB(dev, sdev_module_register, nomod_minus_one); NO_UNLOAD_STUB(dev, sdev_devstate_change, nomod_minus_one); NO_UNLOAD_STUB(dev, devvt_getvnodeops, nomod_minus_one); NO_UNLOAD_STUB(dev, devpts_getvnodeops, nomod_zero); diff --git a/usr/src/uts/intel/sdev_nsconfig_mod/Makefile b/usr/src/uts/intel/sdev_nsconfig_mod/Makefile deleted file mode 100644 index 9f7d2215e2..0000000000 --- a/usr/src/uts/intel/sdev_nsconfig_mod/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# uts/intel/sdev_nsconfig_mod/Makefile -# - -#pragma ident "%Z%%M% %I% %E% SMI" - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -# -# Define the module and object file sets. -# -MODULE = sdev_nsconfig_mod -OBJECTS = $(NSCONFIG_DEVNAME_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NSCONFIG_DEVNAME_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_DEVNAME_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/intel/Makefile.intel - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# Override defaults to build a unique, local modstubs.o. -# -MODSTUBS_DIR = $(OBJS_DIR) -CLEANFILES += $(MODSTUBS_O) - -# -# depends on fs/dev module -# -LDFLAGS += -dy -Nfs/dev - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -# -# Include common targets. -# -include $(UTSBASE)/intel/Makefile.targ - diff --git a/usr/src/uts/sparc/Makefile.sparc.shared b/usr/src/uts/sparc/Makefile.sparc.shared index cfe5896534..6eb18db8d6 100644 --- a/usr/src/uts/sparc/Makefile.sparc.shared +++ b/usr/src/uts/sparc/Makefile.sparc.shared @@ -493,11 +493,6 @@ MAC_KMODS += mac_wifi MAC_KMODS += mac_ib # -# 'Devname' Modules (kernel/devname) -# -DEVNAME_KMODS += sdev_nsconfig_mod - -# # socketmod (kernel/socketmod) # SOCKET_KMODS += socksctp diff --git a/usr/src/uts/sparc/ml/modstubs.s b/usr/src/uts/sparc/ml/modstubs.s index adbadc76ff..c598ad923d 100644 --- a/usr/src/uts/sparc/ml/modstubs.s +++ b/usr/src/uts/sparc/ml/modstubs.s @@ -312,9 +312,7 @@ stubs_base: NO_UNLOAD_STUB(dev, sdev_modctl_readdir_free, nomod_minus_one); NO_UNLOAD_STUB(dev, devname_filename_register, nomod_minus_one); NO_UNLOAD_STUB(dev, sdev_modctl_devexists, nomod_minus_one); - NO_UNLOAD_STUB(dev, devname_nsmaps_register, nomod_minus_one); NO_UNLOAD_STUB(dev, devname_profile_update, nomod_minus_one); - NO_UNLOAD_STUB(dev, sdev_module_register, nomod_minus_one); NO_UNLOAD_STUB(dev, sdev_devstate_change, nomod_minus_one); NO_UNLOAD_STUB(dev, devvt_getvnodeops, nomod_minus_one); NO_UNLOAD_STUB(dev, devpts_getvnodeops, nomod_zero); diff --git a/usr/src/uts/sparc/sdev_nsconfig_mod/Makefile b/usr/src/uts/sparc/sdev_nsconfig_mod/Makefile deleted file mode 100644 index dcf823f89b..0000000000 --- a/usr/src/uts/sparc/sdev_nsconfig_mod/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 -# -# uts/sparc/sdev_nsconfig_mod/Makefile -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives production of devname/sdev_nsconfig_mod module. -# -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -# -# Define the module and object file sets. -# -MODULE = sdev_nsconfig_mod -OBJECTS = $(NSCONFIG_DEVNAME_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NSCONFIG_DEVNAME_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_DEVNAME_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sparc/Makefile.sparc - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# -# Dependencies -# -LDFLAGS += -dy -Nfs/dev - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - - -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -# -# Include common targets. -# -include $(UTSBASE)/sparc/Makefile.targ |