diff options
Diffstat (limited to 'usr/src')
24 files changed, 189 insertions, 174 deletions
diff --git a/usr/src/uts/common/fs/devfs/devfs_subr.c b/usr/src/uts/common/fs/devfs/devfs_subr.c index 2acd964d04..897ba4455f 100644 --- a/usr/src/uts/common/fs/devfs/devfs_subr.c +++ b/usr/src/uts/common/fs/devfs/devfs_subr.c @@ -891,7 +891,7 @@ dv_clone_mknod(struct dv_node *ddv, char *drvname) * relatively cheap. */ major = ddi_name_to_major(drvname); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (NULL); if (ddi_hold_driver(major) == NULL) diff --git a/usr/src/uts/common/fs/devfs/devfs_vfsops.c b/usr/src/uts/common/fs/devfs/devfs_vfsops.c index c6a6a2a896..2d9e12041f 100644 --- a/usr/src/uts/common/fs/devfs/devfs_vfsops.c +++ b/usr/src/uts/common/fs/devfs/devfs_vfsops.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -162,7 +162,7 @@ devfsinit(int fstype, char *name) /* * Invent a dev_t (sigh). */ - if ((dev = getudev()) == (major_t)-1) { + if ((dev = getudev()) == DDI_MAJOR_T_NONE) { cmn_err(CE_NOTE, "%s: can't get unique dev", devfs_vfssw.name); dev = 0; } @@ -404,7 +404,7 @@ devfs_clean(dev_info_t *dip, char *devnm, uint_t flags) struct dv_node *dvp; dcmn_err(("devfs_unconfigure: dip = 0x%p, flags = 0x%x", - (void *)dip, flags)); + (void *)dip, flags)); /* avoid recursion back into the device tree */ (void) tsd_set(devfs_clean_key, (void *)1); diff --git a/usr/src/uts/common/io/consconfig_dacf.c b/usr/src/uts/common/io/consconfig_dacf.c index 079d4cabf6..933f2c98ae 100644 --- a/usr/src/uts/common/io/consconfig_dacf.c +++ b/usr/src/uts/common/io/consconfig_dacf.c @@ -1595,7 +1595,7 @@ kb_ms_config(dacf_infohdl_t minor_hdl, dacf_arghdl_t arg_hdl, int type) dip = dacf_devinfo_node(minor_hdl); major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); minor = dacf_minor_number(minor_hdl); dev = makedevice(major, minor); ASSERT(dev != NODEV); @@ -1676,7 +1676,7 @@ kb_ms_unconfig(dacf_infohdl_t minor_hdl, dacf_arghdl_t arg_hdl) dip = dacf_devinfo_node(minor_hdl); major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); minor = dacf_minor_number(minor_hdl); dev = makedevice(major, minor); ASSERT(dev != NODEV); diff --git a/usr/src/uts/common/io/devinfo.c b/usr/src/uts/common/io/devinfo.c index 25bc639c64..97556719bd 100644 --- a/usr/src/uts/common/io/devinfo.c +++ b/usr/src/uts/common/io/devinfo.c @@ -1197,7 +1197,8 @@ di_dkey_cmp(struct di_dkey *dk1, struct di_dkey *dk2) if (dk1->dk_dip != dk2->dk_dip) return (dk1->dk_dip > dk2->dk_dip ? 1 : -1); - if (dk1->dk_major != (major_t)-1 && dk2->dk_major != (major_t)-1) { + if (dk1->dk_major != DDI_MAJOR_T_NONE && + dk2->dk_major != DDI_MAJOR_T_NONE) { if (dk1->dk_major != dk2->dk_major) return (dk1->dk_major > dk2->dk_major ? 1 : -1); @@ -2314,8 +2315,8 @@ i_lnode_walker(mod_hash_key_t key, mod_hash_val_t *val, void *arg) me->self = i_lnode->self; if (i_lnode->devt == DDI_DEV_T_NONE) { - me->dev_major = (major_t)-1; - me->dev_minor = (minor_t)-1; + me->dev_major = DDI_MAJOR_T_NONE; + me->dev_minor = DDI_MAJOR_T_NONE; } else { me->dev_major = getmajor(i_lnode->devt); me->dev_minor = getminor(i_lnode->devt); diff --git a/usr/src/uts/common/io/openprom.c b/usr/src/uts/common/io/openprom.c index f01dd0b033..eb5bb0ab59 100644 --- a/usr/src/uts/common/io/openprom.c +++ b/usr/src/uts/common/io/openprom.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * 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. @@ -20,10 +19,9 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4 */ /* @@ -371,15 +369,15 @@ opromioctl_cb(void *avp, int has_changed) sizeof (uint_t) + 1, KM_SLEEP); opp->oprom_size = valsize; if (copyout(opp, (void *)arg, (sizeof (uint_t))) != 0) - error = EFAULT; + error = EFAULT; kmem_free(opp, sizeof (uint_t) + 1); break; case OPROMLISTKEYS: valsize = prom_asr_list_keys_len(); if (copyin((void *)arg, &userbufsize, sizeof (uint_t)) != 0) - return (EFAULT); + return (EFAULT); if (valsize > userbufsize) - return (EINVAL); + return (EINVAL); valbuf = (char *)kmem_zalloc(valsize + 1, KM_SLEEP); if (prom_asr_list_keys((caddr_t)valbuf) == -1) { kmem_free(valbuf, valsize + 1); @@ -390,16 +388,16 @@ opromioctl_cb(void *avp, int has_changed) opp->oprom_size = valsize; bcopy(valbuf, opp->oprom_array, valsize); if (copyout(opp, (void *)arg, (valsize + sizeof (uint_t))) != 0) - error = EFAULT; + error = EFAULT; kmem_free(valbuf, valsize + 1); kmem_free(opp, valsize + sizeof (uint_t) + 1); break; case OPROMEXPORT: valsize = prom_asr_export_len(); if (copyin((void *)arg, &userbufsize, sizeof (uint_t)) != 0) - return (EFAULT); + return (EFAULT); if (valsize > userbufsize) - return (EINVAL); + return (EINVAL); valbuf = (char *)kmem_zalloc(valsize + 1, KM_SLEEP); if (prom_asr_export((caddr_t)valbuf) == -1) { kmem_free(valbuf, valsize + 1); @@ -410,7 +408,7 @@ opromioctl_cb(void *avp, int has_changed) opp->oprom_size = valsize; bcopy(valbuf, opp->oprom_array, valsize); if (copyout(opp, (void *)arg, (valsize + sizeof (uint_t))) != 0) - error = EFAULT; + error = EFAULT; kmem_free(valbuf, valsize + 1); kmem_free(opp, valsize + sizeof (uint_t) + 1); break; @@ -420,7 +418,7 @@ opromioctl_cb(void *avp, int has_changed) sizeof (uint_t) + 1, KM_SLEEP); opp->oprom_size = valsize; if (copyout(opp, (void *)arg, (sizeof (uint_t))) != 0) - error = EFAULT; + error = EFAULT; kmem_free(opp, sizeof (uint_t) + 1); break; #endif @@ -709,7 +707,8 @@ opromioctl_cb(void *avp, int has_changed) if (copyout(opp, (void *)arg, valsize + sizeof (uint_t)) != 0) error = EFAULT; - } break; + break; + } /* * convert a prom device path to an equivalent devfs path @@ -743,7 +742,8 @@ opromioctl_cb(void *avp, int has_changed) error = EFAULT; kmem_free(dev_name, MAXPATHLEN); - } break; + break; + } /* * Convert a prom device path name to a driver name @@ -764,7 +764,7 @@ opromioctl_cb(void *avp, int has_changed) * convert path to a driver binding name */ maj = path_to_major((char *)opp->oprom_array); - if (maj == (major_t)-1) { + if (maj == DDI_MAJOR_T_NONE) { error = EINVAL; break; } @@ -782,7 +782,8 @@ opromioctl_cb(void *avp, int has_changed) if (copyout(opp, (void *)arg, sizeof (uint_t) + opp->oprom_size + 1) != 0) error = EFAULT; - } break; + break; + } case OPROMGETVERSION: /* @@ -874,7 +875,8 @@ opromioctl_cb(void *avp, int has_changed) if (copyout(opp, (void *)arg, sizeof (uint_t) + valsize) != 0) error = EFAULT; - } break; + break; + } case OPROMSETOPT: case OPROMSETOPT2: { @@ -923,7 +925,8 @@ opromioctl_cb(void *avp, int has_changed) valbuf, valsize) < 0) error = EINVAL; - } break; + break; + } case OPROMREADY64: { struct openprom_opr64 *opr = diff --git a/usr/src/uts/common/io/ptms_conf.c b/usr/src/uts/common/io/ptms_conf.c index 841826860f..16ead0e9b6 100644 --- a/usr/src/uts/common/io/ptms_conf.c +++ b/usr/src/uts/common/io/ptms_conf.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -313,7 +313,7 @@ ptms_attach_slave(void) major_t ptms_slave_attached(void) { - major_t maj = (major_t)-1; + major_t maj = DDI_MAJOR_T_NONE; mutex_enter(&ptms_lock); if (pts_dip) diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index 903f1b8c30..84ecb68fd8 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -2148,7 +2148,7 @@ _init(void) int err; /* establish driver name from module name */ - sd_label = mod_modname(&modlinkage); + sd_label = (char *)mod_modname(&modlinkage); err = ddi_soft_state_init(&sd_state, sizeof (struct sd_lun), SD_MAXUNIT); diff --git a/usr/src/uts/common/io/scsi/targets/sgen.c b/usr/src/uts/common/io/scsi/targets/sgen.c index 3003e5412c..dc64e9d87d 100644 --- a/usr/src/uts/common/io/scsi/targets/sgen.c +++ b/usr/src/uts/common/io/scsi/targets/sgen.c @@ -43,6 +43,9 @@ #include <sys/scsi/scsi.h> #include <sys/scsi/targets/sgendef.h> +/* The name of the driver, established from the module name in _init. */ +static char *sgen_label = NULL; + #define DDI_NT_SGEN "ddi_generic:scsi" static char *sgen_devtypes[] = { @@ -206,6 +209,9 @@ _init(void) { int err; + /* establish driver name from module name */ + sgen_label = (char *)mod_modname(&modlinkage); + sgen_log(NULL, SGEN_DIAG2, "in sgen_init()"); if ((err = ddi_soft_state_init(&sgen_soft_state, sizeof (sgen_state_t), SGEN_ESTIMATED_NUM_DEVS)) != 0) { @@ -780,7 +786,8 @@ sgen_create_errstats(sgen_state_t *sg_state, int instance) char kstatname[KSTAT_STRLEN]; struct sgen_errstats *stp; - (void) snprintf(kstatname, KSTAT_STRLEN, "sgen%d,err", instance); + (void) snprintf(kstatname, KSTAT_STRLEN, "%s%d,err", + sgen_label, instance); sg_state->sgen_kstats = kstat_create("sgenerr", instance, kstatname, "device_error", KSTAT_TYPE_NAMED, sizeof (struct sgen_errstats) / sizeof (kstat_named_t), @@ -2017,7 +2024,7 @@ sgen_log(sgen_state_t *sg_state, int level, const char *fmt, ...) if (sg_state == (sgen_state_t *)NULL) { cmn_err(level, "%s", buf); } else { - scsi_log(sg_state->sgen_devinfo, "sgen", level, + scsi_log(sg_state->sgen_devinfo, sgen_label, level, "%s", buf); } break; @@ -2026,9 +2033,9 @@ sgen_log(sgen_state_t *sg_state, int level, const char *fmt, ...) case SGEN_DIAG3: default: if (sg_state == (sgen_state_t *)NULL) { - scsi_log(NULL, "sgen", CE_CONT, "%s", buf); + scsi_log(NULL, sgen_label, CE_CONT, "%s", buf); } else { - scsi_log(sg_state->sgen_devinfo, "sgen", CE_CONT, + scsi_log(sg_state->sgen_devinfo, sgen_label, CE_CONT, "%s", buf); } } diff --git a/usr/src/uts/common/os/autoconf.c b/usr/src/uts/common/os/autoconf.c index 2953ce3975..c50107c9b0 100644 --- a/usr/src/uts/common/os/autoconf.c +++ b/usr/src/uts/common/os/autoconf.c @@ -90,7 +90,7 @@ setup_ddi(void) log_event_init(); fm_init(); - (void) i_ddi_load_drvconf((major_t)-1); + (void) i_ddi_load_drvconf(DDI_MAJOR_T_NONE); ldi_init(); @@ -132,7 +132,7 @@ impl_create_root_class(void) * The name for the root nexus is exactly as the manufacturer * placed it in the prom name property. No translation. */ - if ((major = ddi_name_to_major("rootnex")) == (major_t)-1) + if ((major = ddi_name_to_major("rootnex")) == DDI_MAJOR_T_NONE) panic("Couldn't find major number for 'rootnex'"); /* @@ -376,7 +376,7 @@ create_devinfo_tree(void) * This code is special because root node has no parent */ major = ddi_name_to_major("rootnex"); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); DEVI(top_devinfo)->devi_major = major; devnamesp[major].dn_head = top_devinfo; i_ddi_set_binding_name(top_devinfo, rootname); diff --git a/usr/src/uts/common/os/devcfg.c b/usr/src/uts/common/os/devcfg.c index 80492cb39c..3157b26411 100644 --- a/usr/src/uts/common/os/devcfg.c +++ b/usr/src/uts/common/os/devcfg.c @@ -248,7 +248,7 @@ i_ddi_alloc_node(dev_info_t *pdip, char *node_name, pnode_t nodeid, /* default binding name is node name */ devi->devi_binding_name = devi->devi_node_name; - devi->devi_major = (major_t)-1; /* unbound by default */ + devi->devi_major = DDI_MAJOR_T_NONE; /* unbound by default */ /* * Make a copy of system property @@ -712,7 +712,7 @@ static int bind_node(dev_info_t *dip) { char *p = NULL; - major_t major = (major_t)(major_t)-1; + major_t major = DDI_MAJOR_T_NONE; struct dev_info *devi = DEVI(dip); dev_info_t *parent = ddi_get_parent(dip); @@ -730,7 +730,7 @@ bind_node(dev_info_t *dip) /* find the driver with most specific binding using compatible */ major = ddi_compatible_driver_major(dip, &p); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (DDI_FAILURE); devi->devi_major = major; @@ -763,7 +763,7 @@ static int unbind_node(dev_info_t *dip) { ASSERT(DEVI(dip)->devi_node_state == DS_BOUND); - ASSERT(DEVI(dip)->devi_major != (major_t)-1); + ASSERT(DEVI(dip)->devi_major != DDI_MAJOR_T_NONE); /* check references */ if (DEVI(dip)->devi_ref) @@ -774,7 +774,7 @@ unbind_node(dev_info_t *dip) unlink_from_driver_list(dip); - DEVI(dip)->devi_major = (major_t)-1; + DEVI(dip)->devi_major = DDI_MAJOR_T_NONE; DEVI(dip)->devi_binding_name = DEVI(dip)->devi_node_name; return (DDI_SUCCESS); } @@ -871,7 +871,7 @@ init_node(dev_info_t *dip) * to add a path-oriented alias for both paths. */ major = ddi_name_to_major(path); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED) && (major != DEVI(dip)->devi_major) && (ndi_dev_is_persistent_node(dip) || driver_conf_allow_path_alias)) { @@ -2091,7 +2091,7 @@ find_sibling(dev_info_t *head, char *cname, char *caddr, uint_t flag, if (by == FIND_NODE_BY_DRIVER) { major = ddi_name_to_major(cname); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (NULL); } @@ -2432,7 +2432,7 @@ i_ddi_load_drvconf(major_t major) major_t low, high, m; - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { low = 0; high = devcnt - 1; } else { @@ -2581,7 +2581,7 @@ ndi_merge_wildcard_node(dev_info_t *dip) /* never attempt to merge a hw node */ ASSERT(ndi_dev_is_persistent_node(dip) == 0); /* must be bound to a driver major number */ - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); /* * Walk the child list to find all nodes bound to major @@ -2639,7 +2639,7 @@ ddi_compatible_driver_major(dev_info_t *dip, char **formp) void *compat; size_t len; char *p = NULL; - major_t major = (major_t)-1; + major_t major = DDI_MAJOR_T_NONE; if (formp) *formp = NULL; @@ -2656,7 +2656,7 @@ ddi_compatible_driver_major(dev_info_t *dip, char **formp) if (devi->devi_flags & DEVI_REBIND) { p = devi->devi_rebinding_name; major = ddi_name_to_major(p); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED)) { if (formp) *formp = p; @@ -2680,7 +2680,7 @@ ddi_compatible_driver_major(dev_info_t *dip, char **formp) /* find the highest precedence compatible form with a driver binding */ while ((p = prom_decode_composite_string(compat, len, p)) != NULL) { major = ddi_name_to_major(p); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED)) { if (formp) *formp = p; @@ -2693,12 +2693,12 @@ ddi_compatible_driver_major(dev_info_t *dip, char **formp) * the node name has a driver binding. */ major = ddi_name_to_major(ddi_node_name(dip)); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED)) return (major); /* no driver */ - return ((major_t)-1); + return (DDI_MAJOR_T_NONE); } /* @@ -2811,7 +2811,7 @@ link_to_driver_list(dev_info_t *dip) major_t major = DEVI(dip)->devi_major; struct devnames *dnp; - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); /* * Remove from orphan list @@ -2834,7 +2834,7 @@ unlink_from_driver_list(dev_info_t *dip) major_t major = DEVI(dip)->devi_major; struct devnames *dnp; - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); /* * Remove from per-driver list @@ -2967,7 +2967,7 @@ add_global_props(dev_info_t *dip) ddi_prop_list_t *plist; ASSERT(DEVI(dip)->devi_global_prop_list == NULL); - ASSERT(DEVI(dip)->devi_major != (major_t)-1); + ASSERT(DEVI(dip)->devi_major != DDI_MAJOR_T_NONE); dnp = &devnamesp[DEVI(dip)->devi_major]; LOCK_DEV_OPS(&dnp->dn_lock); @@ -2999,7 +2999,7 @@ remove_global_props(dev_info_t *dip) struct devnames *dnp; major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); dnp = &devnamesp[major]; LOCK_DEV_OPS(&dnp->dn_lock); i_ddi_prop_list_rele(proplist, dnp); @@ -3482,7 +3482,7 @@ e_ddi_walk_driver(char *drv, int (*f)(dev_info_t *, void *), void *arg) dev_info_t *dip; major = ddi_name_to_major(drv); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return; dnp = &devnamesp[major]; @@ -3608,7 +3608,7 @@ child_path_to_driver(dev_info_t *parent, char *child_name, char *unit_address) kmem_free(p, MAXPATHLEN); - if (maj != (major_t)-1) + if (maj != DDI_MAJOR_T_NONE) drvname = ddi_major_to_name(maj); if (drvname == NULL) drvname = child_name; @@ -3992,14 +3992,14 @@ bind_dip(dev_info_t *dip, void *arg) path = kmem_alloc(MAXPATHLEN, KM_SLEEP); (void) ddi_pathname(dip, path); pmajor = ddi_name_to_major(path); - if ((pmajor != (major_t)-1) && + if ((pmajor != DDI_MAJOR_T_NONE) && !(devnamesp[pmajor].dn_flags & DN_DRIVER_REMOVED)) major = pmajor; kmem_free(path, MAXPATHLEN); } /* attempt unbind if current driver is incorrect */ - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED) && (major != DEVI(dip)->devi_major)) (void) ndi_devi_unbind_driver(dip); @@ -4076,7 +4076,7 @@ init_spec_child(dev_info_t *pdip, struct hwc_spec *specp, uint_t flags) char *node_name; if (((node_name = specp->hwc_devi_name) == NULL) || - (ddi_name_to_major(node_name) == (major_t)-1)) { + (ddi_name_to_major(node_name) == DDI_MAJOR_T_NONE)) { char *tmp = node_name; if (tmp == NULL) tmp = "<none>"; @@ -4116,7 +4116,7 @@ i_ndi_make_spec_children(dev_info_t *pdip, uint_t flags) return (DDI_SUCCESS); } - list = hwc_get_child_spec(pdip, (major_t)-1); + list = hwc_get_child_spec(pdip, DDI_MAJOR_T_NONE); for (spec = list; spec != NULL; spec = spec->hwc_next) { init_spec_child(pdip, spec, flags); } @@ -4671,7 +4671,7 @@ devi_unconfig_branch(dev_info_t *dip, dev_info_t **dipp, int flags, flags |= NDI_BRANCH_EVENT_OP; if (flags & NDI_BRANCH_EVENT_OP) { - rval = devi_unconfig_common(dip, dipp, flags, (major_t)-1, + rval = devi_unconfig_common(dip, dipp, flags, DDI_MAJOR_T_NONE, brevqp); if (rval != NDI_SUCCESS && (*brevqp)) { @@ -4679,7 +4679,7 @@ devi_unconfig_branch(dev_info_t *dip, dev_info_t **dipp, int flags, *brevqp = NULL; } } else - rval = devi_unconfig_common(dip, dipp, flags, (major_t)-1, + rval = devi_unconfig_common(dip, dipp, flags, DDI_MAJOR_T_NONE, NULL); return (rval); @@ -4796,7 +4796,7 @@ config_immediate_children(dev_info_t *pdip, uint_t flags, major_t major) * Configure all nexus nodes or leaf nodes with * matching driver major */ - if ((major == (major_t)-1) || + if ((major == DDI_MAJOR_T_NONE) || (major == ddi_driver_major(child)) || ((flags & NDI_CONFIG) && (is_leaf_node(child) == 0))) (void) devi_attach_node(child, flags); @@ -4845,7 +4845,7 @@ devi_config_common(dev_info_t *dip, int flags, major_t major) error = config_immediate_children(dip, flags, major); } else { /* call bus_config entry point */ - ddi_bus_config_op_t bus_op = (major == (major_t)-1) ? + ddi_bus_config_op_t bus_op = (major == DDI_MAJOR_T_NONE) ? BUS_CONFIG_ALL : BUS_CONFIG_DRIVER; error = (*f)(dip, flags, bus_op, (void *)(uintptr_t)major, NULL, 0); @@ -4881,7 +4881,7 @@ ndi_devi_config(dev_info_t *dip, int flags) "ndi_devi_config: par = %s%d (%p), flags = 0x%x\n", ddi_driver_name(dip), ddi_get_instance(dip), (void *)dip, flags)); - return (devi_config_common(dip, flags, (major_t)-1)); + return (devi_config_common(dip, flags, DDI_MAJOR_T_NONE)); } /* @@ -4891,7 +4891,7 @@ int ndi_devi_config_driver(dev_info_t *dip, int flags, major_t major) { /* don't abuse this function */ - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); NDI_CONFIG_DEBUG((CE_CONT, "ndi_devi_config_driver: par = %s%d (%p), flags = 0x%x\n", @@ -5118,7 +5118,7 @@ ndi_devi_config_one(dev_info_t *dip, char *devnm, dev_info_t **dipp, int flags) */ ASSERT(*dipp); - error = devi_config_common(*dipp, flags, (major_t)-1); + error = devi_config_common(*dipp, flags, DDI_MAJOR_T_NONE); pm_post_config(dip, devnm); @@ -5456,7 +5456,7 @@ unconfig_immediate_children( for (child = ddi_get_child(dip); child; child = ddi_get_next_sibling(child)) { /* skip same nodes we skip below */ - if (((major != (major_t)-1) && + if (((major != DDI_MAJOR_T_NONE) && (major != ddi_driver_major(child))) || ((flags & NDI_AUTODETACH) && !is_leaf_node(child))) continue; @@ -5483,7 +5483,7 @@ unconfig_immediate_children( while (child) { next = ddi_get_next_sibling(child); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && (major != ddi_driver_major(child))) { child = next; continue; @@ -5613,7 +5613,7 @@ devi_unconfig_common( * call bus_unconfig entry point * It should reset nexus flags if unconfigure succeeds. */ - bus_op = (major == (major_t)-1) ? + bus_op = (major == DDI_MAJOR_T_NONE) ? BUS_UNCONFIG_ALL : BUS_UNCONFIG_DRIVER; rv = (*f)(dip, flags, bus_op, (void *)(uintptr_t)major); } @@ -5648,7 +5648,7 @@ ndi_devi_unconfig(dev_info_t *dip, int flags) "ndi_devi_unconfig: par = %s%d (%p), flags = 0x%x\n", ddi_driver_name(dip), ddi_get_instance(dip), (void *)dip, flags)); - return (devi_unconfig_common(dip, NULL, flags, (major_t)-1, NULL)); + return (devi_unconfig_common(dip, NULL, flags, DDI_MAJOR_T_NONE, NULL)); } int @@ -5658,7 +5658,7 @@ e_ddi_devi_unconfig(dev_info_t *dip, dev_info_t **dipp, int flags) "e_ddi_devi_unconfig: par = %s%d (%p), flags = 0x%x\n", ddi_driver_name(dip), ddi_get_instance(dip), (void *)dip, flags)); - return (devi_unconfig_common(dip, dipp, flags, (major_t)-1, NULL)); + return (devi_unconfig_common(dip, dipp, flags, DDI_MAJOR_T_NONE, NULL)); } /* @@ -6143,7 +6143,7 @@ reset_nexus_flags(dev_info_t *dip, void *arg) * for platforms that can't do this (ie: x86 or any platform that * does not have prom_finddevice functionality, which matches * nodenames and unit-addresses without the drivers participation) - * is to return (major_t)-1. + * is to return DDI_MAJOR_T_NONE. * * Used in loadrootmodules() in the swapgeneric module to * associate a given pathname with a given leaf driver. @@ -6159,7 +6159,7 @@ path_to_major(char *path) /* check for path-oriented alias */ major = ddi_name_to_major(path); - if ((major != (major_t)-1) && + if ((major != DDI_MAJOR_T_NONE) && !(devnamesp[major].dn_flags & DN_DRIVER_REMOVED)) { NDI_CONFIG_DEBUG((CE_NOTE, "path_to_major: %s path bound %s\n", path, ddi_major_to_name(major))); @@ -6182,7 +6182,7 @@ path_to_major(char *path) if (dip == NULL) { NDI_CONFIG_DEBUG((CE_WARN, "path_to_major: can't bind <%s>\n", path)); - return ((major_t)-1); + return (DDI_MAJOR_T_NONE); } /* @@ -6440,7 +6440,7 @@ ddi_install_driver(char *name) { major_t major = ddi_name_to_major(name); - if ((major == (major_t)-1) || + if ((major == DDI_MAJOR_T_NONE) || (ddi_hold_installed_driver(major) == NULL)) { return (DDI_FAILURE); } @@ -6539,7 +6539,7 @@ i_ddi_attach_hw_nodes(char *driver) major_t major; major = ddi_name_to_major(driver); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (DDI_FAILURE); return (attach_driver_nodes(major)); @@ -6561,7 +6561,7 @@ i_ddi_attach_pseudo_node(char *driver) dev_info_t *dip; major = ddi_name_to_major(driver); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (NULL); if (attach_driver_nodes(major) != DDI_SUCCESS) @@ -6583,7 +6583,7 @@ diplist_to_parent_major(dev_info_t *head, char parents[]) pdip = ddi_get_parent(dip); ASSERT(pdip); /* disallow rootnex.conf nodes */ major = ddi_driver_major(pdip); - if ((major != (major_t)-1) && parents[major] == 0) + if ((major != DDI_MAJOR_T_NONE) && parents[major] == 0) parents[major] = 1; } } @@ -6777,7 +6777,7 @@ ndi_busop_bus_config(dev_info_t *pdip, uint_t flags, ddi_bus_config_op_t op, */ ASSERT(timeout < SEC_TO_TICK(1800)); - major = (major_t)-1; + major = DDI_MAJOR_T_NONE; switch (op) { case BUS_CONFIG_ONE: NDI_DEBUG(flags, (CE_CONT, "%s%d: bus config %s timeout=%ld\n", @@ -6817,7 +6817,7 @@ ndi_busop_bus_unconfig(dev_info_t *pdip, uint_t flags, ddi_bus_config_op_t op, { major_t major; - major = (major_t)-1; + major = DDI_MAJOR_T_NONE; switch (op) { case BUS_UNCONFIG_ONE: NDI_DEBUG(flags, (CE_CONT, "%s%d: bus unconfig %s\n", @@ -6857,7 +6857,7 @@ is_leaf_node(dev_info_t *dip) { major_t major = ddi_driver_major(dip); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (0); return (devnamesp[major].dn_flags & DN_LEAF_DRIVER); @@ -6876,7 +6876,7 @@ mt_config_init(dev_info_t *pdip, dev_info_t **dipp, int flags, cv_init(&hdl->mtc_cv, NULL, CV_DEFAULT, NULL); hdl->mtc_pdip = pdip; hdl->mtc_fdip = dipp; - hdl->mtc_parmajor = (major_t)-1; + hdl->mtc_parmajor = DDI_MAJOR_T_NONE; hdl->mtc_flags = flags; hdl->mtc_major = major; hdl->mtc_thr_count = 0; @@ -6996,7 +6996,7 @@ mt_config_thread(void *arg) if ((rv != NDI_SUCCESS) && (hdl->mtc_error == 0)) { hdl->mtc_error = rv; #ifdef DEBUG - if ((ddidebug & DDI_DEBUG) && (major != (major_t)-1)) { + if ((ddidebug & DDI_DEBUG) && (major != DDI_MAJOR_T_NONE)) { char *path = kmem_alloc(MAXPATHLEN, KM_SLEEP); (void) ddi_pathname(dip, path); @@ -7094,8 +7094,9 @@ mt_config_children(struct mt_config_handle *hdl) * Switch a 'driver' operation to an 'all' operation below a * node bound to the driver. */ - if ((major == (major_t)-1) || (major == ddi_driver_major(dip))) - mcd->mtc_major = (major_t)-1; + if ((major == DDI_MAJOR_T_NONE) || + (major == ddi_driver_major(dip))) + mcd->mtc_major = DDI_MAJOR_T_NONE; else mcd->mtc_major = major; @@ -7157,8 +7158,8 @@ mt_config_driver(struct mt_config_handle *hdl) gethrestime(&end_time); hdl->total_time += time_diff_in_msec(hdl->start_time, end_time); #endif - ASSERT(par_major != (major_t)-1); - ASSERT(major != (major_t)-1); + ASSERT(par_major != DDI_MAJOR_T_NONE); + ASSERT(major != DDI_MAJOR_T_NONE); LOCK_DEV_OPS(&dnp->dn_lock); dip = devnamesp[par_major].dn_head; diff --git a/usr/src/uts/common/os/devid_cache.c b/usr/src/uts/common/os/devid_cache.c index 77efe41817..c451caeb8a 100644 --- a/usr/src/uts/common/os/devid_cache.c +++ b/usr/src/uts/common/os/devid_cache.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -264,7 +264,7 @@ devid_cache_unpack_nvlist(nvf_handle_t fd, nvlist_t *nvl, char *name) * check path for a devid */ rval = nvlist_lookup_byte_array(nvl, - DP_DEVID_ID, (uchar_t **)&devidp, &n); + DP_DEVID_ID, (uchar_t **)&devidp, &n); if (rval == 0) { if (ddi_devid_valid(devidp) == DDI_SUCCESS) { ASSERT(n == ddi_devid_sizeof(devidp)); @@ -303,26 +303,26 @@ devid_cache_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); } listp = nvf_list(fd); for (np = list_head(listp); np; np = list_next(listp, np)) { if (np->nvp_devid == NULL) - continue; + continue; NVP_DEVID_DEBUG_PATH(np->nvp_devpath); 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; } rval = nvlist_add_byte_array(sub_nvl, DP_DEVID_ID, - (uchar_t *)np->nvp_devid, - ddi_devid_sizeof(np->nvp_devid)); + (uchar_t *)np->nvp_devid, + ddi_devid_sizeof(np->nvp_devid)); if (rval == 0) { NVP_DEVID_DEBUG_DEVID(np->nvp_devid); } else { @@ -419,14 +419,14 @@ e_ddi_devid_hold_installed_driver(ddi_devid_t devid) /* search for the devid using the hint driver */ hint_major = ddi_name_to_major(hint); - if (hint_major != (major_t)-1) { + if (hint_major != DDI_MAJOR_T_NONE) { e_ddi_devid_hold_by_major(hint_major); } drvp = e_ddi_devid_hold_driver_list; for (i = 0; i < N_DRIVERS_TO_HOLD; i++, drvp++) { major = ddi_name_to_major(*drvp); - if (major != (major_t)-1 && major != hint_major) { + if (major != DDI_MAJOR_T_NONE && major != hint_major) { e_ddi_devid_hold_by_major(major); } } @@ -523,10 +523,9 @@ e_devid_cache_register(dev_info_t *dip, ddi_devid_t devid) DEVID_DEBUG2((CE_CONT, "register: %s path match\n", path)); if (np->nvp_devid == NULL) { - replace: - np->nvp_devid = new_devid; +replace: np->nvp_devid = new_devid; np->nvp_flags |= - NVP_DEVID_DIP | NVP_DEVID_REGISTERED; + NVP_DEVID_DIP | NVP_DEVID_REGISTERED; np->nvp_dip = dip; if (!devid_cache_write_disable) { nvf_mark_dirty(dcfd_handle); @@ -562,7 +561,7 @@ e_devid_cache_register(dev_info_t *dip, ddi_devid_t devid) DEVID_DEBUG2((CE_CONT, "devid register: %s devid match\n", path)); np->nvp_flags |= - NVP_DEVID_DIP | NVP_DEVID_REGISTERED; + NVP_DEVID_DIP | NVP_DEVID_REGISTERED; np->nvp_dip = dip; rw_exit(nvf_lock(dcfd_handle)); kmem_free(new_nvp, sizeof (nvp_devid_t)); @@ -621,7 +620,7 @@ e_devid_cache_unregister(dev_info_t *dip) continue; if ((np->nvp_flags & NVP_DEVID_DIP) && np->nvp_dip == dip) { DEVID_LOG_UNREG((CE_CONT, - "unregister: %s\n", np->nvp_devpath)); + "unregister: %s\n", np->nvp_devpath)); np->nvp_flags &= ~NVP_DEVID_DIP; np->nvp_dip = NULL; break; @@ -650,7 +649,7 @@ devid_cache_cleanup(void) continue; if ((np->nvp_flags & NVP_DEVID_REGISTERED) == 0) { DEVID_LOG_REMOVE((CE_CONT, - "cleanup: %s\n", np->nvp_devpath)); + "cleanup: %s\n", np->nvp_devpath)); if (!devid_cache_write_disable) { nvf_mark_dirty(dcfd_handle); is_dirty = 0; @@ -841,7 +840,7 @@ e_devid_cache_to_devt_list(ddi_devid_t devid, char *minor_name, rw_enter(nvf_lock(dcfd_handle), RW_READER); n = e_devid_cache_devi_path_lists(devid, nalloced, - &ndevis, devis, &npaths, paths); + &ndevis, devis, &npaths, paths); if (n <= nalloced) break; rw_exit(nvf_lock(dcfd_handle)); @@ -873,7 +872,7 @@ restart: ASSERT(!DEVI_IS_ATTACHING(devis[i])); ASSERT(!DEVI_IS_DETACHING(devis[i])); e_devid_minor_to_devlist(devis[i], minor_name, - ndevts_alloced, &ndevts, devts); + ndevts_alloced, &ndevts, devts); if (ndevts > ndevts_alloced) { kmem_free(devts, ndevts_alloced * sizeof (dev_t)); ndevts_alloced += 128; @@ -910,7 +909,7 @@ restart: ddi_devid_free(match_devid); e_devid_minor_to_devlist(devi, minor_name, - ndevts_alloced, &ndevts, devts); + ndevts_alloced, &ndevts, devts); ddi_release_devi(devi); if (ndevts > ndevts_alloced) { kmem_free(devts, diff --git a/usr/src/uts/common/os/driver_lyr.c b/usr/src/uts/common/os/driver_lyr.c index 66e9f58e35..b08efe132d 100644 --- a/usr/src/uts/common/os/driver_lyr.c +++ b/usr/src/uts/common/os/driver_lyr.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3490,7 +3490,7 @@ ldi_ev_notify(dev_info_t *dip, minor_t minor, int spec_type, } major = ddi_driver_major(dip); - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { char *path = kmem_alloc(MAXPATHLEN, KM_SLEEP); (void) ddi_pathname(dip, path); cmn_err(CE_WARN, "ldi_ev_notify: cannot derive major number " @@ -3649,7 +3649,7 @@ ldi_ev_finalize(dev_info_t *dip, minor_t minor, int spec_type, int ldi_result, LDI_EVDBG((CE_NOTE, "ldi_ev_finalize: entered: dip=%p", (void *)dip)); major = ddi_driver_major(dip); - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { char *path = kmem_alloc(MAXPATHLEN, KM_SLEEP); (void) ddi_pathname(dip, path); cmn_err(CE_WARN, "ldi_ev_finalize: cannot derive major number " diff --git a/usr/src/uts/common/os/instance.c b/usr/src/uts/common/os/instance.c index 7134d93c56..8fd596b00c 100644 --- a/usr/src/uts/common/os/instance.c +++ b/usr/src/uts/common/os/instance.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -559,7 +559,7 @@ e_ddi_assign_instance(dev_info_t *dip) dp = in_alloc_drv(bname); ASSERT(dp != NULL); major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); in_endrv(np, dp); in_set_instance(dip, dp, major); dp->ind_state = IN_PROVISIONAL; @@ -653,7 +653,7 @@ in_next_instance_block(major_t major, int block_size) int hole; dnp = &devnamesp[major]; - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); ASSERT(e_ddi_inst_state.ins_busy); ASSERT(block_size); @@ -731,7 +731,7 @@ e_ddi_free_instance(dev_info_t *dip, char *addr) name = (char *)ddi_driver_name(dip); major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); dnp = &devnamesp[major]; /* * Only one thread is allowed to change the state of the instance @@ -1212,7 +1212,7 @@ in_inuse(int instance, char *name) * XXX could do the weaker search through the nomajor list checking * XXX for the same name */ - if ((major = ddi_name_to_major(name)) == (major_t)-1) + if ((major = ddi_name_to_major(name)) == DDI_MAJOR_T_NONE) return (0); dnp = &devnamesp[major]; @@ -1233,7 +1233,8 @@ in_hashdrv(in_drv_t *dp) major_t major; /* hash to no major list */ - if ((major = ddi_name_to_major(dp->ind_driver_name)) == (major_t)-1) { + major = ddi_name_to_major(dp->ind_driver_name); + if (major == DDI_MAJOR_T_NONE) { dp->ind_next = e_ddi_inst_state.ins_no_major; e_ddi_inst_state.ins_no_major = dp; return; diff --git a/usr/src/uts/common/os/modconf.c b/usr/src/uts/common/os/modconf.c index 01b6af0df4..7c41975c48 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 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -397,7 +397,7 @@ mod_info(struct modlinkage *modlp, struct modinfo *modinfop) /* * Get module name. */ -char * +const char * mod_modname(struct modlinkage *modlp) { struct modctl *mcp; @@ -598,7 +598,7 @@ mod_installdrv(struct modldrv *modl, struct modlinkage *modlp) modname = mcp->mod_modname; /* Sanity check modname */ - if ((major = ddi_name_to_major(modname)) == (major_t)-1) { + if ((major = ddi_name_to_major(modname)) == DDI_MAJOR_T_NONE) { #ifdef DEBUG cmn_err(CE_WARN, "mod_installdrv: no major number for %s", modname); diff --git a/usr/src/uts/common/os/modctl.c b/usr/src/uts/common/os/modctl.c index d53528975f..3fd2700460 100644 --- a/usr/src/uts/common/os/modctl.c +++ b/usr/src/uts/common/os/modctl.c @@ -682,7 +682,7 @@ modctl_load_drvconf(major_t major) { int ret; - if (major != (major_t)-1) { + if (major != DDI_MAJOR_T_NONE) { ret = i_ddi_load_drvconf(major); if (ret == 0) i_ddi_bind_devs(); @@ -698,7 +698,7 @@ modctl_load_drvconf(major_t major) * boot performance. */ if (new_vfs_in_modpath()) { - (void) i_ddi_load_drvconf((major_t)-1); + (void) i_ddi_load_drvconf(DDI_MAJOR_T_NONE); /* * If we are still initializing io subsystem, * load drivers with ddi-forceattach property @@ -789,7 +789,7 @@ modctl_getmaj(char *uname, uint_t ulen, int *umajorp) if ((retval = copyinstr(uname, name, (ulen < 256) ? ulen : 256, 0)) != 0) return (retval); - if ((major = mod_name_to_major(name)) == (major_t)-1) + if ((major = mod_name_to_major(name)) == DDI_MAJOR_T_NONE) return (ENODEV); if (copyout(&major, umajorp, sizeof (major_t)) != 0) return (EFAULT); @@ -1692,7 +1692,7 @@ process_minorperm(int cmd, nvlist_t *nvl) is_clone = 0; (void) nvpair_value_string(nvp, &minor); major = ddi_name_to_major(name); - if (major != (major_t)-1) { + if (major != DDI_MAJOR_T_NONE) { mp = kmem_zalloc(sizeof (*mp), KM_SLEEP); if (minor == NULL || strlen(minor) == 0) { if (moddebug & MODDEBUG_MINORPERM) { @@ -1714,7 +1714,7 @@ process_minorperm(int cmd, nvlist_t *nvl) */ if (strcmp(name, "clone") == 0) { minmaj = ddi_name_to_major(minor); - if (minmaj != (major_t)-1) { + if (minmaj != DDI_MAJOR_T_NONE) { if (moddebug & MODDEBUG_MINORPERM) { cmn_err(CE_CONT, "mapping %s:%s to %s:*\n", @@ -3463,7 +3463,7 @@ detach_driver(char *name) return (0); major = ddi_name_to_major(name); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (0); error = ndi_devi_unconfig_driver(ddi_root_node(), @@ -4333,7 +4333,7 @@ dev_alias_minorperm(dev_info_t *dip, char *minor_name, mperm_t *rmp) major = ddi_name_to_major(minor_name); ASSERT(dip == clone_dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); /* * Attach the driver named by the minor node, then @@ -4427,7 +4427,7 @@ dev_minorperm(dev_info_t *dip, char *name, mperm_t *rmp) */ if (dip == clone_dip) { major = ddi_name_to_major(minor_name); - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { if (moddebug & MODDEBUG_MINORPERM) cmn_err(CE_CONT, "dev_minorperm: " "%s: no such driver\n", minor_name); @@ -4436,7 +4436,7 @@ dev_minorperm(dev_info_t *dip, char *name, mperm_t *rmp) is_clone = 1; } else { major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); } dnp = &devnamesp[major]; diff --git a/usr/src/uts/common/os/modsubr.c b/usr/src/uts/common/os/modsubr.c index 31d5501999..3466cedee4 100644 --- a/usr/src/uts/common/os/modsubr.c +++ b/usr/src/uts/common/os/modsubr.c @@ -157,7 +157,7 @@ mod_hold_dev_by_devi(dev_info_t *devi) char *name; name = ddi_get_name(devi); - if ((major = mod_name_to_major(name)) == (major_t)-1) + if ((major = mod_name_to_major(name)) == DDI_MAJOR_T_NONE) return (NULL); return (mod_hold_dev_by_major(major)); } @@ -169,7 +169,7 @@ mod_rele_dev_by_devi(dev_info_t *devi) char *name; name = ddi_get_name(devi); - if ((major = mod_name_to_major(name)) == (major_t)-1) + if ((major = mod_name_to_major(name)) == DDI_MAJOR_T_NONE) return; mod_rele_dev_by_major(major); } @@ -587,7 +587,7 @@ mod_name_to_major(char *name) if ((mbind = find_mbind(name, mb_hashtab)) != NULL) return ((major_t)mbind->b_num); - return ((major_t)-1); + return (DDI_MAJOR_T_NONE); } char * @@ -957,7 +957,7 @@ hwc_spec_add(struct hwc_spec **listp, struct hwc_spec *entry, while (entry) { struct hwc_spec *spec; - if ((match_major != (major_t)-1) && + if ((match_major != DDI_MAJOR_T_NONE) && (match_major != entry->hwc_major)) { entry = entry->hwc_hash_next; continue; diff --git a/usr/src/uts/common/os/modsysfile.c b/usr/src/uts/common/os/modsysfile.c index 2294f1793b..58e1b556b1 100644 --- a/usr/src/uts/common/os/modsysfile.c +++ b/usr/src/uts/common/os/modsysfile.c @@ -2161,7 +2161,7 @@ make_aliases(struct bind **bhash) return; state = AL_NEW; - major = (major_t)-1; + major = DDI_MAJOR_T_NONE; while (!done) { token = kobj_lex(file, tokbuf, sizeof (tokbuf)); switch (token) { @@ -2188,7 +2188,7 @@ make_aliases(struct bind **bhash) break; case AL_DRVNAME: major = mod_name_to_major(drvbuf); - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { kobj_find_eol(file); state = AL_NEW; } else { @@ -2238,7 +2238,7 @@ make_aliases(struct bind **bhash) kobj_newline(file); state = AL_NEW; - major = (major_t)-1; + major = DDI_MAJOR_T_NONE; break; default: kobj_file_err(CE_WARN, file, tok_err, tokbuf); @@ -2908,7 +2908,7 @@ impl_parlist_to_major(struct par_list *pl, char parents[]) } /* parent specs cannot be mapped to a driver */ - if (pl->par_major != (major_t)-1) + if (pl->par_major != DDI_MAJOR_T_NONE) continue; /* class spec */ @@ -2920,7 +2920,7 @@ impl_parlist_to_major(struct par_list *pl, char parents[]) if (strcmp(hwcp->hwc_class_name, hcl->class_name) != 0) continue; major = ddi_name_to_major(hcl->class_exporter); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); if (parents[major] == 0) { parents[major] = 1; nmajor++; @@ -3129,13 +3129,13 @@ append(struct hwc_spec *spec, struct par_list *par) static major_t get_major(char *parent) { - major_t major = (major_t)-1; + major_t major = DDI_MAJOR_T_NONE; char *tmp, *driver = NULL; if (*parent == '/') major = path_to_major(parent); - if (major != (major_t)-1) + if (major != DDI_MAJOR_T_NONE) return (major); /* extract the name between '/' and '@' */ @@ -3176,7 +3176,7 @@ add_spec(struct hwc_spec *spec, struct par_list **par) */ if (parent) { maj = get_major(parent); - if (maj == (major_t)-1) { + if (maj == DDI_MAJOR_T_NONE) { if ((*parent == '/') && (strncmp(parent, "/pseudo", 7) != 0)) { maj = (major_t)-2; @@ -3189,7 +3189,7 @@ add_spec(struct hwc_spec *spec, struct par_list **par) } } } else - maj = (major_t)-1; + maj = DDI_MAJOR_T_NONE; /* * Scan the list looking for a matching parent. When parent is @@ -3217,7 +3217,7 @@ add_spec(struct hwc_spec *spec, struct par_list **par) return; } /* put "class=" entries last (lower pri if dups) */ - if (maj == (major_t)-1) { + if (maj == DDI_MAJOR_T_NONE) { par_last->par_next = pl; return; } diff --git a/usr/src/uts/common/os/subr.c b/usr/src/uts/common/os/subr.c index 4753f1152a..0bcc6f3232 100644 --- a/usr/src/uts/common/os/subr.c +++ b/usr/src/uts/common/os/subr.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -130,7 +130,7 @@ getudev() UNLOCK_DEV_OPS(&devnamesp[i].dn_lock); ret = (major_t)i; } else { - ret = (major_t)-1; + ret = DDI_MAJOR_T_NONE; } } mutex_exit(&udevlock); diff --git a/usr/src/uts/common/os/sunddi.c b/usr/src/uts/common/os/sunddi.c index 8619288779..6996e2c92f 100644 --- a/usr/src/uts/common/os/sunddi.c +++ b/usr/src/uts/common/os/sunddi.c @@ -4878,7 +4878,7 @@ ddi_driver_name(dev_info_t *devi) { major_t major; - if ((major = ddi_driver_major(devi)) != (major_t)-1) + if ((major = ddi_driver_major(devi)) != DDI_MAJOR_T_NONE) return (ddi_major_to_name(major)); return (ddi_node_name(devi)); @@ -5969,7 +5969,7 @@ ddi_create_minor_common(dev_info_t *dip, char *name, int spec_type, /* dip must be bound and attached */ major = ddi_driver_major(dip); - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); /* * Default node_type to DDI_PSEUDO and issue notice in debug mode @@ -7394,7 +7394,7 @@ i_ddi_minorname_to_devtspectype(dev_info_t *dip, char *minor_name, */ major = ddi_name_to_major(minor_name); - if (major == (major_t)-1) + if (major == DDI_MAJOR_T_NONE) return (DDI_FAILURE); if (ddi_hold_driver(major) == NULL) @@ -7514,7 +7514,7 @@ i_ddi_devid_register(dev_info_t *dip, ddi_devid_t devid) major_t major; if ((dip == NULL) || - ((major = ddi_driver_major(dip)) == (major_t)-1)) + ((major = ddi_driver_major(dip)) == DDI_MAJOR_T_NONE)) return (DDI_FAILURE); /* verify that the devid is valid */ diff --git a/usr/src/uts/common/os/sunmdi.c b/usr/src/uts/common/os/sunmdi.c index 91e00cf82e..e384df5750 100644 --- a/usr/src/uts/common/os/sunmdi.c +++ b/usr/src/uts/common/os/sunmdi.c @@ -8663,7 +8663,8 @@ attach_phci_drivers(char *vhci_class) for (i = 0; i < cur_elements; i++) { if (modrootloaded || root_support_list[i]) { m = ddi_name_to_major(driver_list[i]); - if (m != (major_t)-1 && ddi_hold_installed_driver(m)) + if (m != DDI_MAJOR_T_NONE && + ddi_hold_installed_driver(m)) ddi_rele_driver(m); } } @@ -8705,7 +8706,7 @@ build_vhci_cache(mdi_vhci_t *vh) attach_phci_drivers(vh->vh_class); bus_config_all_phcis(vhcache, NDI_DRV_CONF_REPROBE | NDI_NO_EVENT, - BUS_CONFIG_ALL, (major_t)-1); + BUS_CONFIG_ALL, DDI_MAJOR_T_NONE); rw_enter(&vhcache->vhcache_lock, RW_WRITER); vhcache->vhcache_flags |= MDI_VHCI_CACHE_SETUP_DONE; @@ -8770,7 +8771,7 @@ vhcache_discover_paths(mdi_vhci_t *vh) if (vhcache_do_discovery(vhc)) { attach_phci_drivers(vh->vh_class); bus_config_all_phcis(vhcache, NDI_DRV_CONF_REPROBE | - NDI_NO_EVENT, BUS_CONFIG_ALL, (major_t)-1); + NDI_NO_EVENT, BUS_CONFIG_ALL, DDI_MAJOR_T_NONE); mutex_enter(&vhc->vhc_lock); vhc->vhc_path_discovery_cutoff_time = lbolt64 + diff --git a/usr/src/uts/common/os/sunpm.c b/usr/src/uts/common/os/sunpm.c index 40338e4fcf..d929b997c9 100644 --- a/usr/src/uts/common/os/sunpm.c +++ b/usr/src/uts/common/os/sunpm.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -7180,7 +7180,7 @@ pm_record_invol_path(char *path, int flags, int noinvolpm, int volpmd, * out its major. If we could hold the node by path, we would be much * happier here. */ - if (major == (major_t)-1) { + if (major == DDI_MAJOR_T_NONE) { np->ni_major = pm_path_to_major(path); } else { np->ni_major = major; @@ -7646,7 +7646,7 @@ pm_cfb_setup(const char *stdout_path) PMD(PMD_CFB, ("%s: pntd %s failed\n", pmf, devname)) pm_record_invol_path(devname, (PMC_CONSOLE_FB | PMC_NO_INVOL), 1, 0, 0, - (major_t)-1); + DDI_MAJOR_T_NONE); for (ep = strrchr(devname, '/'); ep != devname; ep = strrchr(devname, '/')) { PMD(PMD_CFB, ("%s: devname %s\n", pmf, devname)) @@ -7662,7 +7662,7 @@ pm_cfb_setup(const char *stdout_path) break; } else { pm_record_invol_path(devname, - PMC_NO_INVOL, 1, 0, 0, (major_t)-1); + PMC_NO_INVOL, 1, 0, 0, DDI_MAJOR_T_NONE); } } } @@ -8069,7 +8069,7 @@ i_path_to_major(char *path, char *leaf_name) extern major_t path_to_major(char *pathname); major_t maj; - if ((maj = path_to_major(path)) == (major_t)-1) { + if ((maj = path_to_major(path)) == DDI_MAJOR_T_NONE) { maj = ddi_name_to_major(leaf_name); } @@ -8109,7 +8109,7 @@ i_pm_driver_removed(major_t major) static void pm_noinvol_process_ancestors(char *); pm_noinvol_t *ip, *pp = NULL; int wasvolpmd; - ASSERT(major != (major_t)-1); + ASSERT(major != DDI_MAJOR_T_NONE); PMD(PMD_NOINVOL, ("%s: %s\n", pmf, ddi_major_to_name(major))) again: rw_enter(&pm_noinvol_rwlock, RW_WRITER); @@ -8191,7 +8191,7 @@ adjust_ancestors(char *path, int wasvolpmd) char *cp; pm_noinvol_t *lp; pm_noinvol_t *pp = NULL; - major_t locked = (major_t)UINT_MAX; + major_t locked = DDI_MAJOR_T_NONE; dev_info_t *dip; char *pathbuf; size_t pathbuflen = strlen(path) + 1; @@ -8217,7 +8217,7 @@ adjust_ancestors(char *path, int wasvolpmd) (void) pm_noinvol_update(PM_BP_NOINVOL_REMDRV, 0, wasvolpmd, path, dip); - if (locked != (major_t)UINT_MAX) + if (locked != DDI_MAJOR_T_NONE) ddi_release_devi(dip); } else { char *apath; diff --git a/usr/src/uts/common/os/swapgeneric.c b/usr/src/uts/common/os/swapgeneric.c index 011a6a3c4d..a8d6bc2b83 100644 --- a/usr/src/uts/common/os/swapgeneric.c +++ b/usr/src/uts/common/os/swapgeneric.c @@ -715,7 +715,7 @@ load_boot_driver(char *drv) int mlen; #endif /* sparc */ - if ((major = ddi_name_to_major(drv)) == (major_t)-1) { + if ((major = ddi_name_to_major(drv)) == DDI_MAJOR_T_NONE) { cmn_err(CE_CONT, "%s: no major number\n", drv); return (-1); } @@ -791,7 +791,7 @@ static int load_parent_drivers(dev_info_t *dip, char *path) { int rval = 0; - major_t major = (major_t)-1; + major_t major = DDI_MAJOR_T_NONE; char *drv; char *p; @@ -800,9 +800,9 @@ load_parent_drivers(dev_info_t *dip, char *path) if (path) major = ddi_name_to_major(path); else - major = (major_t)-1; + major = DDI_MAJOR_T_NONE; - if (major != (major_t)-1) + if (major != DDI_MAJOR_T_NONE) drv = ddi_major_to_name(major); else drv = ddi_binding_name(dip); @@ -950,7 +950,7 @@ load_boot_platform_modules(char *drv) char *drvname; int rval = 0; - if ((major = ddi_name_to_major(drv)) == (major_t)-1) { + if ((major = ddi_name_to_major(drv)) == DDI_MAJOR_T_NONE) { cmn_err(CE_CONT, "%s: no major number\n", drv); return (-1); } @@ -959,7 +959,7 @@ load_boot_platform_modules(char *drv) * resolve aliases */ drvname = ddi_major_to_name(major); - if ((major = ddi_name_to_major(drvname)) == (major_t)-1) + if ((major = ddi_name_to_major(drvname)) == DDI_MAJOR_T_NONE) return (-1); #ifdef DEBUG diff --git a/usr/src/uts/common/sys/ddipropdefs.h b/usr/src/uts/common/sys/ddipropdefs.h index f3bf66f042..c7dfce35c7 100644 --- a/usr/src/uts/common/sys/ddipropdefs.h +++ b/usr/src/uts/common/sys/ddipropdefs.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * 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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -273,13 +272,16 @@ typedef uint32_t prop_1275_cell_t; * DDI_DEV_T_NONE: When creating, property is not associated with * particular dev_t. * DDI_DEV_T_ANY: Wildcard dev_t when searching properties. + */ +#define DDI_DEV_T_NONE ((dev_t)-1) +#define DDI_DEV_T_ANY ((dev_t)-2) +/* * DDI_MAJOR_T_UNKNOWN Used when a driver does not know its dev_t during * a property create. + * DDI_MAJOR_T_NONE Used when a driver does not have a major number. */ - -#define DDI_DEV_T_NONE ((dev_t)-1) -#define DDI_DEV_T_ANY ((dev_t)-2) #define DDI_MAJOR_T_UNKNOWN ((major_t)0) +#define DDI_MAJOR_T_NONE ((major_t)-1) /* * Some DDI property names... diff --git a/usr/src/uts/common/sys/modctl.h b/usr/src/uts/common/sys/modctl.h index e8462ddce4..47a83b15d9 100644 --- a/usr/src/uts/common/sys/modctl.h +++ b/usr/src/uts/common/sys/modctl.h @@ -612,7 +612,7 @@ extern int mod_getsysnum(char *); extern char *mod_containing_pc(caddr_t); extern int mod_in_autounload(void); -extern char *mod_modname(struct modlinkage *); +extern const char *mod_modname(struct modlinkage *); extern int dev_minorperm(dev_info_t *, char *, mperm_t *); extern void dev_devices_cleanup(void); |