diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2020-05-01 01:41:06 -0700 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2020-05-26 09:29:37 -0700 |
commit | 7bcaeddb7bbb778bc9a9c0e0c78b6bb8a3ea0540 (patch) | |
tree | 37d9bbb9ace44f0d183e552a41c57cd3bcaaf9e2 | |
parent | b325f34d6fd056178a119182f410f157d35a9ea6 (diff) | |
download | illumos-joyent-7bcaeddb7bbb778bc9a9c0e0c78b6bb8a3ea0540.tar.gz |
12685 ddi_create_minor_node() should take const char * values
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: Paul Winder <paul@winders.demon.co.uk>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/man/man9f/ddi_create_minor_node.9f | 24 | ||||
-rw-r--r-- | usr/src/man/man9f/ddi_remove_minor_node.9f | 13 | ||||
-rw-r--r-- | usr/src/uts/common/os/dacf.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/os/dacf_clnt.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/os/sunddi.c | 32 | ||||
-rw-r--r-- | usr/src/uts/common/sys/dacf_impl.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/sys/ddi_impldefs.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/sys/sunddi.h | 10 |
8 files changed, 34 insertions, 61 deletions
diff --git a/usr/src/man/man9f/ddi_create_minor_node.9f b/usr/src/man/man9f/ddi_create_minor_node.9f index 583cb7c313..b33ba2704b 100644 --- a/usr/src/man/man9f/ddi_create_minor_node.9f +++ b/usr/src/man/man9f/ddi_create_minor_node.9f @@ -3,27 +3,24 @@ .\" 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] -.TH DDI_CREATE_MINOR_NODE 9F "Dec 14, 2004" +.TH DDI_CREATE_MINOR_NODE 9F "May 01, 2020" .SH NAME ddi_create_minor_node \- Create a minor node for this device .SH SYNOPSIS -.LP .nf #include <sys/stat.h> #include <sys/sunddi.h> -\fBint\fR \fBddi_create_minor_node\fR(\fBdev_info_t *\fR\fIdip\fR, \fBchar *\fR\fIname\fR, \fBint\fR \fIspec_type\fR, - \fBminor_t\fR \fIminor_num\fR, \fBchar *\fR\fInode_type\fR, \fBint\fR \fIflag\fR); +\fBint\fR \fBddi_create_minor_node\fR(\fBdev_info_t *\fR\fIdip\fR, \fBconst char *\fR\fIname\fR, + \fBint\fR \fIspec_type\fR, \fBminor_t\fR \fIminor_num\fR, \fBconst char *\fR\fInode_type\fR, + \fBint\fR \fIflag\fR); .fi .SH INTERFACE LEVEL -.sp -.LP Solaris DDI specific (Solaris DDI). .SH PARAMETERS -.sp .ne 2 .na \fB\fIdip\fR \fR @@ -198,8 +195,6 @@ it is set to \fB0\fR. .RE .SH DESCRIPTION -.sp -.LP \fBddi_create_minor_node()\fR provides the necessary information to enable the system to create the \fB/dev\fR and \fB/devices\fR hierarchies. The \fIname\fR is used to create the minor name of the block or character special file under @@ -212,8 +207,6 @@ refers to the names in the \fB/devices\fR hierarchy. See \fBdisks\fR(1M), determines if this is a clone device or not, and what device class the node belongs to. .SH RETURN VALUES -.sp -.LP \fBddi_create_minor_node()\fR returns: .sp .ne 2 @@ -235,12 +228,9 @@ Minor node creation failed. .RE .SH CONTEXT -.sp -.LP The \fBddi_create_minor_node()\fR function can be called from user context. It is typically called from \fBattach\fR(9E) or \fBioctl\fR(9E). .SH EXAMPLES -.LP \fBExample 1 \fRCreate Data Structure Describing Minor Device with Minor Number of 0 .sp @@ -257,8 +247,6 @@ ddi_create_minor_node(dip, "foo", S_IFBLK, 0, DDI_NT_BLOCK, 0); .in -2 .SH SEE ALSO -.sp -.LP \fBadd_drv\fR(1M), \fBdevlinks\fR(1M), \fBdisks\fR(1M), \fBdrvconfig\fR(1M), \fBports\fR(1M), \fBtapes\fR(1M), \fBattach\fR(9E), \fBddi_remove_minor_node\fR(9F) @@ -266,8 +254,6 @@ ddi_create_minor_node(dip, "foo", S_IFBLK, 0, DDI_NT_BLOCK, 0); .LP \fIWriting Device Drivers\fR .SH NOTES -.sp -.LP If the driver is for a network device (\fInode_type\fR \fBDDI_NT_NET\fR), note that the driver name will undergo the driver name constraints identified in the NOTES section of \fBdlpi\fR(7P). Additionally, the minor name must match the @@ -288,7 +274,5 @@ that only supports style-2 minor nodes can use \fBddi_no_info\fR(9F) for its the results of a \fBmodunload\fR(1M) of the driver or a \fBcfgadm\fR(1M) remove of hardware controlled by the driver are undefined. .SH WARNING -.sp -.LP Drivers must remove references to GLOBAL_DEV, NODEBOUND_DEV, NODESPECIFIC_DEV, and ENUMERATED_DEV to compile under Solaris 10 and later versions. diff --git a/usr/src/man/man9f/ddi_remove_minor_node.9f b/usr/src/man/man9f/ddi_remove_minor_node.9f index 4761fae149..bf8cc9e709 100644 --- a/usr/src/man/man9f/ddi_remove_minor_node.9f +++ b/usr/src/man/man9f/ddi_remove_minor_node.9f @@ -3,21 +3,17 @@ .\" 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] -.TH DDI_REMOVE_MINOR_NODE 9F "Mar 10, 1992" +.TH DDI_REMOVE_MINOR_NODE 9F "May 01, 2020" .SH NAME ddi_remove_minor_node \- remove a minor node for this dev_info .SH SYNOPSIS -.LP .nf -\fBvoid\fR \fBddi_remove_minor_node\fR(\fBdev_info_t\fR \fI*dip\fR, \fBchar\fR \fI*name\fR); +\fBvoid\fR \fBddi_remove_minor_node\fR(\fBdev_info_t\fR \fI*dip\fR, \fBconst char\fR \fI*name\fR); .fi .SH INTERFACE LEVEL -.sp -.LP Solaris \fBDDI\fR specific (Solaris \fBDDI\fR). .SH PARAMETERS -.sp .ne 2 .na \fB\fIdip\fR \fR @@ -37,13 +33,10 @@ minor data structures from this \fBdev_info\fR. .RE .SH DESCRIPTION -.sp -.LP \fBddi_remove_minor_node()\fR removes a data structure from the linked list of minor data structures that is pointed to by the \fBdev_info\fR structure for this driver. .SH EXAMPLES -.LP \fBExample 1 \fRRemoving a minor node .sp .LP @@ -58,8 +51,6 @@ which is linked into the \fBdev_info\fR structure pointed to by \fBdip\fR: .in -2 .SH SEE ALSO -.sp -.LP \fBattach\fR(9E), \fBdetach\fR(9E), \fBddi_create_minor_node\fR(9F) .sp .LP diff --git a/usr/src/uts/common/os/dacf.c b/usr/src/uts/common/os/dacf.c index 8d4cd486d8..592b1cd570 100644 --- a/usr/src/uts/common/os/dacf.c +++ b/usr/src/uts/common/os/dacf.c @@ -642,7 +642,7 @@ dacf_arglist_delete(dacf_arg_t **list) * Match a device-spec to a rule. */ dacf_rule_t * -dacf_match(dacf_opid_t op, dacf_devspec_t ds, void *match_info) +dacf_match(dacf_opid_t op, dacf_devspec_t ds, const void *match_info) { dacf_rule_t *rule; diff --git a/usr/src/uts/common/os/dacf_clnt.c b/usr/src/uts/common/os/dacf_clnt.c index e40509d33b..fdb1696fb2 100644 --- a/usr/src/uts/common/os/dacf_clnt.c +++ b/usr/src/uts/common/os/dacf_clnt.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DACF (Device Autoconfiguration Framework) client code. * @@ -67,8 +65,8 @@ * for the operation to be invoked at post-attach and/or pre-detach time. */ void -dacfc_match_create_minor(char *name, char *node_type, dev_info_t *dip, - struct ddi_minor_data *dmdp, int flag) +dacfc_match_create_minor(const char *name, const char *node_type, + dev_info_t *dip, struct ddi_minor_data *dmdp, int flag) { dacf_rule_t *r; char *dev_path, *dev_pathp, *drv_mname = NULL; diff --git a/usr/src/uts/common/os/sunddi.c b/usr/src/uts/common/os/sunddi.c index eee666190f..f5a4551095 100644 --- a/usr/src/uts/common/os/sunddi.c +++ b/usr/src/uts/common/os/sunddi.c @@ -5614,7 +5614,7 @@ fail: * devfs event subclass names as device class names. */ static int -derive_devi_class(dev_info_t *dip, char *node_type, int flag) +derive_devi_class(dev_info_t *dip, const char *node_type, int flag) { int rv = DDI_SUCCESS; @@ -5659,10 +5659,10 @@ derive_devi_class(dev_info_t *dip, char *node_type, int flag) * exceed IFNAMSIZ (16) characters in length. */ static boolean_t -verify_name(char *name) +verify_name(const char *name) { - size_t len = strlen(name); - char *cp; + size_t len = strlen(name); + const char *cp; if (len == 0 || len > IFNAMSIZ) return (B_FALSE); @@ -5680,9 +5680,9 @@ verify_name(char *name) * attach it to the given devinfo node. */ -int -ddi_create_minor_common(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag, ddi_minor_type mtype, +static int +ddi_create_minor_common(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag, ddi_minor_type mtype, const char *read_priv, const char *write_priv, mode_t priv_mode) { struct ddi_minor_data *dmdp; @@ -5793,7 +5793,7 @@ ddi_create_minor_common(dev_info_t *dip, char *name, int spec_type, */ if (!(DEVI_IS_ATTACHING(dip) || DEVI_IS_DETACHING(dip)) && mtype != DDM_INTERNAL_PATH) { - (void) i_log_devfs_minor_create(dip, name); + (void) i_log_devfs_minor_create(dip, dmdp->ddm_name); } /* @@ -5804,16 +5804,16 @@ ddi_create_minor_common(dev_info_t *dip, char *name, int spec_type, } int -ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag) +ddi_create_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag) { return (ddi_create_minor_common(dip, name, spec_type, minor_num, node_type, flag, DDM_MINOR, NULL, NULL, 0)); } int -ddi_create_priv_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag, +ddi_create_priv_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag, const char *rdpriv, const char *wrpriv, mode_t priv_mode) { return (ddi_create_minor_common(dip, name, spec_type, minor_num, @@ -5821,8 +5821,8 @@ ddi_create_priv_minor_node(dev_info_t *dip, char *name, int spec_type, } int -ddi_create_default_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag) +ddi_create_default_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag) { return (ddi_create_minor_common(dip, name, spec_type, minor_num, node_type, flag, DDM_DEFAULT, NULL, NULL, 0)); @@ -5842,7 +5842,7 @@ ddi_create_internal_pathname(dev_info_t *dip, char *name, int spec_type, } void -ddi_remove_minor_node(dev_info_t *dip, char *name) +ddi_remove_minor_node(dev_info_t *dip, const char *name) { int circ; struct ddi_minor_data *dmdp, *dmdp1; @@ -8938,7 +8938,7 @@ i_ddi_devi_class(dev_info_t *dip) } int -i_ddi_set_devi_class(dev_info_t *dip, char *devi_class, int flag) +i_ddi_set_devi_class(dev_info_t *dip, const char *devi_class, int flag) { struct dev_info *devi = DEVI(dip); diff --git a/usr/src/uts/common/sys/dacf_impl.h b/usr/src/uts/common/sys/dacf_impl.h index 0d30ae061c..094e764c87 100644 --- a/usr/src/uts/common/sys/dacf_impl.h +++ b/usr/src/uts/common/sys/dacf_impl.h @@ -121,7 +121,7 @@ void dacf_rsrv_make(dacf_rsrvlist_t *, dacf_rule_t *, void *, void dacf_process_rsrvs(dacf_rsrvlist_t **, dacf_opid_t, int); void dacf_clr_rsrvs(dev_info_t *, dacf_opid_t); -dacf_rule_t *dacf_match(dacf_opid_t, dacf_devspec_t, void *); +dacf_rule_t *dacf_match(dacf_opid_t, dacf_devspec_t, const void *); /* * Failure codes from dacf_op_invoke, assigned to dacf_rsrvlist_t.rsrv_result @@ -147,7 +147,7 @@ extern int dacfdebug; * that utilize the dacf framework */ -void dacfc_match_create_minor(char *, char *, dev_info_t *, +void dacfc_match_create_minor(const char *, const char *, dev_info_t *, struct ddi_minor_data *, int); int dacfc_postattach(dev_info_t *); diff --git a/usr/src/uts/common/sys/ddi_impldefs.h b/usr/src/uts/common/sys/ddi_impldefs.h index 1012c904fd..d8ddb23579 100644 --- a/usr/src/uts/common/sys/ddi_impldefs.h +++ b/usr/src/uts/common/sys/ddi_impldefs.h @@ -623,7 +623,7 @@ struct dev_info { #define DEVI_SET_PCI(dip) (DEVI(dip)->devi_flags |= (DEVI_PCI_DEVICE)) char *i_ddi_devi_class(dev_info_t *); -int i_ddi_set_devi_class(dev_info_t *, char *, int); +int i_ddi_set_devi_class(dev_info_t *, const char *, int); /* * This structure represents one piece of bus space occupied by a given @@ -709,7 +709,7 @@ struct ddi_minor { dev_t dev; /* device number */ int spec_type; /* block or char */ int flags; /* access flags */ - char *node_type; /* block, byte, serial, network */ + const char *node_type; /* block, byte, serial, network */ struct devplcy *node_priv; /* privilege for this minor */ mode_t priv_mode; /* default apparent privilege mode */ }; diff --git a/usr/src/uts/common/sys/sunddi.h b/usr/src/uts/common/sys/sunddi.h index c15f2fde70..e7f55d00c0 100644 --- a/usr/src/uts/common/sys/sunddi.h +++ b/usr/src/uts/common/sys/sunddi.h @@ -1574,16 +1574,16 @@ void swab(void *src, void *dst, size_t nbytes); int -ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag); +ddi_create_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag); int -ddi_create_priv_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag, +ddi_create_priv_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag, const char *rdpriv, const char *wrpriv, mode_t priv_mode); void -ddi_remove_minor_node(dev_info_t *dip, char *name); +ddi_remove_minor_node(dev_info_t *dip, const char *name); int ddi_in_panic(void); |