xref: /titanic_50/usr/src/uts/common/sys/hwconf.h (revision eab227978ccdaa5a7cc9fd92ace768915dae3a2b)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/dditypes.h>
33 #include <sys/ddipropdefs.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	MAX_HWC_LINESIZE 1024
40 
41 struct hwc_class {
42 	struct hwc_class *class_next;
43 	char *class_exporter;
44 	char *class_name;
45 };
46 
47 struct hwc_spec {
48 	struct hwc_spec *hwc_next;
49 	char		*hwc_parent_name;
50 	char		*hwc_class_name;
51 	char		*hwc_devi_name;
52 	ddi_prop_t	*hwc_devi_sys_prop_ptr;
53 	/* For hashing */
54 	struct hwc_spec	*hwc_hash_next;
55 	major_t		hwc_major;
56 };
57 
58 /*
59  * used to create sorted linked lists of hwc_spec structs for loading parents
60  */
61 struct par_list {
62 	struct par_list	*par_next;
63 	struct hwc_spec	*par_specs;		/* List of prototype nodes */
64 	major_t		par_major;		/* Simple name of parent */
65 };
66 
67 struct bind {
68 	struct bind 	*b_next;
69 	char		*b_name;
70 	char		*b_bind_name;
71 	int		b_num;
72 };
73 
74 typedef struct mperm {
75 	struct mperm	*mp_next;
76 	char		*mp_minorname;
77 	mode_t		mp_mode;
78 	uid_t		mp_uid;
79 	gid_t		mp_gid;
80 #ifndef _KERNEL
81 	char		*mp_drvname;
82 	char		*mp_owner;
83 	char		*mp_group;
84 #endif	/* !_KERNEL */
85 } mperm_t;
86 
87 #ifdef _KERNEL
88 
89 extern struct bind *mb_hashtab[];
90 extern struct bind *sb_hashtab[];
91 
92 extern int hwc_parse(char *, struct par_list **, ddi_prop_t **);
93 extern struct par_list *impl_make_parlist(major_t);
94 extern int impl_free_parlist(major_t);
95 extern void impl_delete_par_list(struct par_list *);
96 extern int impl_parlist_to_major(struct par_list *, char []);
97 extern struct hwc_spec *hwc_get_child_spec(dev_info_t *, major_t);
98 extern void hwc_free_spec_list(struct hwc_spec *);
99 
100 #endif	/* _KERNEL */
101 
102 #ifdef	__cplusplus
103 }
104 #endif
105 
106 #endif	/* _SYS_HWCONF_H */
107