xref: /illumos-gate/usr/src/uts/common/sys/hwconf.h (revision fafb665d337b69015870e0bcdb516fd2f869693f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_HWCONF_H
28 #define	_SYS_HWCONF_H
29 
30 #include <sys/dditypes.h>
31 #include <sys/ddipropdefs.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	MAX_HWC_LINESIZE 1024
38 
39 struct hwc_class {
40 	struct hwc_class *class_next;
41 	char *class_exporter;
42 	char *class_name;
43 };
44 
45 struct hwc_spec {
46 	struct hwc_spec *hwc_next;
47 	char		*hwc_parent_name;
48 	char		*hwc_class_name;
49 	char		*hwc_devi_name;
50 	ddi_prop_t	*hwc_devi_sys_prop_ptr;
51 	/* For hashing */
52 	struct hwc_spec	*hwc_hash_next;
53 	major_t		hwc_major;
54 };
55 
56 /*
57  * used to create sorted linked lists of hwc_spec structs for loading parents
58  */
59 struct par_list {
60 	struct par_list	*par_next;
61 	struct hwc_spec	*par_specs;		/* List of prototype nodes */
62 	major_t		par_major;		/* Simple name of parent */
63 };
64 
65 struct bind {
66 	struct bind 	*b_next;
67 	char		*b_name;
68 	char		*b_bind_name;
69 	int		b_num;
70 };
71 
72 typedef struct mperm {
73 	struct mperm	*mp_next;
74 	char		*mp_minorname;
75 	mode_t		mp_mode;
76 	uid_t		mp_uid;
77 	gid_t		mp_gid;
78 #ifndef _KERNEL
79 	char		*mp_drvname;
80 	char		*mp_owner;
81 	char		*mp_group;
82 #endif	/* !_KERNEL */
83 } mperm_t;
84 
85 #ifdef _KERNEL
86 
87 extern struct bind *mb_hashtab[];
88 extern struct bind *sb_hashtab[];
89 
90 extern int hwc_parse(char *, struct par_list **, ddi_prop_t **);
91 extern struct par_list *impl_make_parlist(major_t);
92 extern int impl_free_parlist(major_t);
93 extern void impl_delete_par_list(struct par_list *);
94 extern int impl_parlist_to_major(struct par_list *, char []);
95 extern struct hwc_spec *hwc_get_child_spec(dev_info_t *, major_t);
96 extern void hwc_free_spec_list(struct hwc_spec *);
97 
98 #endif	/* _KERNEL */
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _SYS_HWCONF_H */
105