Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/instance.h
+++ new/usr/src/uts/common/sys/instance.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 + *
22 24 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
23 25 */
24 26
25 27 #ifndef _SYS_INSTANCE_H
26 28 #define _SYS_INSTANCE_H
27 29
28 30 /*
29 31 * Instance number assignment data structures
30 32 */
31 33
32 34 #include <sys/types.h>
33 35 #include <sys/param.h>
34 36 #include <sys/dditypes.h>
35 37 #include <sys/list.h>
36 38
37 39 #ifdef __cplusplus
38 40 extern "C" {
39 41 #endif
40 42
41 43 #define INSTANCE_FILE "/etc/path_to_inst"
42 44 #define INSTANCE_FILE_SUFFIX ".old"
43 45
44 46
45 47 #if defined(_KERNEL) || defined(_KMEMUSER)
46 48
47 49 /*
48 50 * The form of a node; These form a tree that is parallel to the
49 51 * dev_info tree, but always fully populated. The tree is rooted in
50 52 * the in_softstate struct (e_ddi_inst_state.ins_root).
51 53 *
52 54 * Each node has one or more in_drv entries hanging from it.
53 55 * (It will have more than one if it has been driven by more than one driver
54 56 * over its lifetime. This can happen due to a generic name
55 57 * or to a "compatible" name giving a more specific driver).
56 58 */
57 59
58 60 typedef struct in_node {
59 61 char *in_node_name; /* devi_node_name of this node */
60 62 char *in_unit_addr; /* address part of name */
61 63 struct in_node *in_child; /* children of this node */
62 64 struct in_node *in_sibling; /* "peers" of this node */
63 65 struct in_drv *in_drivers; /* drivers bound to this node */
64 66 struct in_node *in_parent; /* parent of this node */
65 67 dev_info_t *in_devi; /* corresponding devinfo */
66 68 } in_node_t;
67 69
68 70 typedef struct in_drv {
69 71 char *ind_driver_name; /* canonical name of driver */
70 72 int ind_instance; /* current instance number */
71 73 int ind_state; /* see below */
72 74 /*
73 75 * The following field is used to link instance numbers for the
74 76 * same driver off of devnamesp or in_no_major or in_no_instance
75 77 */
76 78 struct in_drv *ind_next; /* next for this driver */
77 79 struct in_drv *ind_next_drv; /* next driver this node */
78 80 struct in_node *ind_node; /* node that these hang on */
79 81 } in_drv_t;
80 82
81 83 /*
82 84 * Values for in_state
83 85 */
84 86 #define IN_PROVISIONAL 0x1 /* provisional instance number assigned */
85 87 #define IN_PERMANENT 0x2 /* instance number has been confirmed */
86 88 #define IN_UNKNOWN 0x3 /* instance number not yet assigned */
87 89 #define IN_BORROWED 0x4 /* instance number from alias */
88 90
89 91
90 92 /*
91 93 * Guard for path to instance file
92 94 */
93 95 #define PTI_GUARD "#\n#\tCaution! This file contains critical kernel state\n#\n"
94 96
95 97
96 98 /*
97 99 * special value for dn_instance
98 100 */
99 101 #define IN_SEARCHME (-1)
100 102
101 103 #endif /* defined(_KERNEL) || defined(_KMEMUSER) */
102 104
103 105 #ifdef _KERNEL
104 106 void e_ddi_instance_init(void);
105 107 uint_t e_ddi_assign_instance(dev_info_t *dip);
106 108 void e_ddi_keep_instance(dev_info_t *dip);
107 109 void e_ddi_free_instance(dev_info_t *dip, char *addr);
108 110 int e_ddi_instance_majorinstance_to_path(major_t major,
109 111 uint_t instance, char *path);
110 112 void e_ddi_unorphan_instance_nos(void);
111 113 void e_ddi_enter_instance(void);
112 114 void e_ddi_exit_instance(void);
113 115 in_node_t *e_ddi_instance_root(void);
114 116 int e_ddi_instance_is_clean(void);
115 117 void e_ddi_instance_set_clean(void);
116 118
117 119 /* Platform instance override functions */
118 120 uint_t impl_assign_instance(dev_info_t *dip);
119 121 int impl_keep_instance(dev_info_t *dip);
120 122 int impl_free_instance(dev_info_t *dip);
121 123
122 124 /* walk the instance tree */
123 125 int e_ddi_walk_instances(int (*)(const char *,
124 126 in_node_t *, in_drv_t *, void *), void *);
125 127
126 128 /* for DDI-MP */
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
127 129 in_node_t *e_ddi_path_to_instance(char *path);
128 130 void e_ddi_borrow_instance(dev_info_t *cdip, in_node_t *cnp);
129 131 void e_ddi_return_instance(dev_info_t *cdip, char *addr, in_node_t *cnp);
130 132
131 133 /* return values from e_ddi_walk_instances callback */
132 134 #define INST_WALK_CONTINUE 0
133 135 #define INST_WALK_TERMINATE 1
134 136
135 137
136 138 #else /* _KERNEL */
137 -#ifdef __STDC__
138 139 extern int inst_sync(char *pathname, int flags);
139 -#else
140 -extern int inst_sync();
141 -#endif /* __STDC__ */
142 140 #endif /* _KERNEL */
143 141
144 142 #define INST_SYNC_IF_REQUIRED 0
145 143 #define INST_SYNC_ALWAYS 1
146 144
147 145 #ifdef __cplusplus
148 146 }
149 147 #endif
150 148
151 149 #endif /* _SYS_INSTANCE_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX