Print this page
8115 parallel zfs mount
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/kobj.h
+++ new/usr/src/uts/common/sys/kobj.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.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
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 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + *
25 + * Copyright 2017 RackTop Systems.
24 26 */
25 27
26 28 #ifndef _SYS_KOBJ_H
27 29 #define _SYS_KOBJ_H
28 30
29 -#pragma ident "%Z%%M% %I% %E% SMI"
30 -
31 31 #include <sys/modctl.h>
32 32 #include <sys/elf.h>
33 33 #include <sys/machelf.h>
34 34 #include <sys/vmem.h>
35 35 #include <sys/sdt.h>
36 36 #include <sys/bootstat.h>
37 37
38 38 #ifdef __cplusplus
39 39 extern "C" {
40 40 #endif
41 41
42 42 /*
43 43 * List of modules maintained by kobj.c
44 44 */
45 45 struct module_list {
46 46 struct module_list *next;
47 47 struct module *mp;
48 48 };
49 49
50 50 typedef unsigned short symid_t; /* symbol table index */
51 51 typedef unsigned char *reloc_dest_t;
52 52
53 53 typedef void module_mach;
54 54
55 55 struct module {
56 56 int total_allocated;
57 57
58 58 Ehdr hdr;
59 59 char *shdrs;
60 60 Shdr *symhdr, *strhdr;
61 61
62 62 char *depends_on;
63 63
64 64 size_t symsize;
65 65 char *symspace; /* symbols + strings + hashtbl, or NULL */
66 66 int flags;
67 67
68 68 size_t text_size;
69 69 size_t data_size;
70 70 char *text;
71 71 char *data;
72 72
73 73 unsigned int symtbl_section;
74 74 /* pointers into symspace, or NULL */
75 75 char *symtbl;
76 76 char *strings;
77 77
78 78 unsigned int hashsize;
79 79 symid_t *buckets;
80 80 symid_t *chains;
81 81
82 82 unsigned int nsyms;
83 83
84 84 unsigned int bss_align;
85 85 size_t bss_size;
86 86 uintptr_t bss;
87 87
88 88 char *filename;
89 89
90 90 struct module_list *head, *tail;
91 91 reloc_dest_t destination;
92 92 module_mach * machdata;
93 93 char *ctfdata;
94 94 size_t ctfsize;
95 95
96 96 char *fbt_tab;
97 97 size_t fbt_size;
98 98 size_t fbt_nentries;
99 99 caddr_t textwin;
100 100 caddr_t textwin_base;
101 101
102 102 sdt_probedesc_t *sdt_probes;
103 103 size_t sdt_nprobes;
104 104 char *sdt_tab;
105 105 size_t sdt_size;
106 106
107 107 char *sigdata;
108 108 size_t sigsize;
109 109 };
110 110
111 111 struct kobj_mem {
112 112 struct kobj_mem *km_next;
113 113 struct kobj_mem *km_prev;
114 114 uintptr_t km_addr;
115 115 size_t km_size;
116 116 uintptr_t km_alloc_addr;
117 117 size_t km_alloc_size;
118 118 };
119 119
120 120 struct _buf {
121 121 intptr_t _fd;
122 122 char *_ptr;
123 123 char *_base;
124 124 char *_name;
125 125 char *_dbuf;
126 126 int _size;
127 127 int _cnt;
128 128 int _off;
129 129 int _ln;
130 130 int _bsize;
131 131 int _iscmp;
132 132 int _dsize;
133 133 };
134 134
135 135
136 136 /*
137 137 * Statistical info.
138 138 */
139 139 typedef struct {
140 140 int nalloc;
141 141 int nfree;
142 142 int nalloc_calls;
143 143 int nfree_calls;
144 144 } kobj_stat_t;
145 145
146 146 #define kobj_filename(p) ((p)->_name)
147 147 #define kobj_linenum(p) ((p)->_ln)
148 148 #define kobj_newline(p) ((p)->_ln++)
149 149 #define kobj_getc(p) (--(p)->_cnt >= 0 ? ((int)*(p)->_ptr++):kobj_filbuf(p))
150 150 #define kobj_ungetc(p) (++(p)->_cnt > (p)->_size ? -1 : ((int)*(--(p)->_ptr)))
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
151 151 #define kobj_comphdr(p) ((struct comphdr *)(p)->_dbuf)
152 152
153 153 /* Offset into buffer */
154 154 #define B_OFFSET(file, off) (off % (file)->_bsize)
155 155
156 156 /* Start of page */
157 157 #define F_PAGE(file, off) (off - B_OFFSET(file, off))
158 158
159 159 #define F_BLKS(file, size) ((size / (file)->_bsize) * (file)->_bsize)
160 160
161 -#if defined(_KERNEL)
161 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
162 162
163 163 extern int kobj_load_module(struct modctl *, int);
164 164 extern void kobj_unload_module(struct modctl *);
165 165 extern uintptr_t kobj_lookup(struct module *, const char *);
166 166 extern Sym *kobj_lookup_all(struct module *, char *, int);
167 167 extern int kobj_addrcheck(void *, caddr_t);
168 168 extern int kobj_module_to_id(void *);
169 169 extern void kobj_getmodinfo(void *, struct modinfo *);
170 170 extern int kobj_get_needed(void *, short *, int);
171 171 extern uintptr_t kobj_getsymvalue(char *, int);
172 172 extern char *kobj_getsymname(uintptr_t, ulong_t *);
173 173 extern char *kobj_searchsym(struct module *, uintptr_t, ulong_t *);
174 174
175 175 extern int kobj_fstat(intptr_t, struct bootstat *);
176 176 extern intptr_t kobj_open(char *);
177 177 extern int kobj_path_exists(char *, int);
178 178 extern struct _buf *kobj_open_path(char *, int, int);
179 179 extern int kobj_read(intptr_t, char *, unsigned int, unsigned int);
180 180 extern void kobj_close(intptr_t);
181 181 extern void *kobj_alloc(size_t, int);
182 182 extern void *kobj_zalloc(size_t, int);
183 183 extern void kobj_free(void *, size_t);
184 184 extern struct _buf *kobj_open_file(char *);
185 185 extern void kobj_close_file(struct _buf *);
186 186 extern int kobj_read_file(struct _buf *, char *, unsigned, unsigned);
187 187 extern int kobj_get_filesize(struct _buf *, uint64_t *size);
188 188 extern uintptr_t kobj_getelfsym(char *, void *, int *);
189 189 extern void kobj_set_ctf(struct module *, caddr_t data, size_t size);
190 190
191 191 extern int kobj_filbuf(struct _buf *);
192 192 extern void kobj_sync(void);
193 193 #if defined(__i386) || defined(__sparc) || defined(__amd64)
194 194 extern void kobj_vmem_init(vmem_t **, vmem_t **);
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
195 195 #else
196 196 #error "ISA not supported"
197 197 #endif
198 198 extern caddr_t kobj_text_alloc(vmem_t *, size_t);
199 199 extern caddr_t kobj_texthole_alloc(caddr_t, size_t);
200 200 extern void kobj_texthole_free(caddr_t, size_t);
201 201 extern void kobj_stat_get(kobj_stat_t *);
202 202 extern void kobj_textwin_alloc(struct module *);
203 203 extern void kobj_textwin_free(struct module *);
204 204
205 -#endif /* defined(_KERNEL) */
205 +#endif /* defined(_KERNEL) || defined(_FAKE_KERNEL) */
206 206
207 207 #ifdef __cplusplus
208 208 }
209 209 #endif
210 210
211 211 #endif /* !_SYS_KOBJ_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX