]>
Commit | Line | Data |
---|---|---|
edf5051c FG |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Brian Behlendorf <behlendorf1@llnl.gov> | |
3 | Date: Wed, 7 Feb 2018 11:49:38 -0800 | |
4 | Subject: [PATCH] Fix cstyle warnings | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | This patch contains no functional changes. It is solely intended | |
10 | to resolve cstyle warnings in order to facilitate moving the spl | |
11 | source code in to the zfs repository. | |
12 | ||
13 | Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
14 | Closes #681 | |
15 | (cherry picked from commit 4852db99b4fb7ffe356e6fe9c024480e101dd69d) | |
16 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
17 | --- | |
18 | include/fs/fs_subr.h | 2 +- | |
19 | include/linux/math64_compat.h | 3 +- | |
20 | include/rpc/types.h | 2 +- | |
21 | include/rpc/xdr.h | 48 ++-- | |
22 | include/sharefs/share.h | 2 +- | |
23 | include/spl-ctl.h | 22 +- | |
24 | include/splat-ctl.h | 60 ++-- | |
25 | include/strings.h | 2 +- | |
26 | include/sys/acl.h | 138 +++++----- | |
27 | include/sys/acl_impl.h | 2 +- | |
28 | include/sys/atomic.h | 80 +++--- | |
29 | include/sys/attr.h | 2 +- | |
30 | include/sys/bitmap.h | 2 +- | |
31 | include/sys/bootconf.h | 2 +- | |
32 | include/sys/bootprops.h | 2 +- | |
33 | include/sys/buf.h | 2 +- | |
34 | include/sys/byteorder.h | 32 ++- | |
35 | include/sys/callb.h | 21 +- | |
36 | include/sys/callo.h | 10 +- | |
37 | include/sys/cmn_err.h | 14 +- | |
38 | include/sys/compress.h | 2 +- | |
39 | include/sys/conf.h | 2 +- | |
40 | include/sys/console.h | 10 +- | |
41 | include/sys/cpupart.h | 2 +- | |
42 | include/sys/cpuvar.h | 2 +- | |
43 | include/sys/crc32.h | 2 +- | |
44 | include/sys/cred.h | 4 +- | |
45 | include/sys/ctype.h | 2 +- | |
46 | include/sys/ddi.h | 2 +- | |
47 | include/sys/debug.h | 6 +- | |
48 | include/sys/dirent.h | 2 +- | |
49 | include/sys/disp.h | 2 +- | |
50 | include/sys/dkioc_free_util.h | 2 +- | |
51 | include/sys/dnlc.h | 2 +- | |
52 | include/sys/dumphdr.h | 2 +- | |
53 | include/sys/efi_partition.h | 2 +- | |
54 | include/sys/errno.h | 2 +- | |
55 | include/sys/fcntl.h | 4 +- | |
56 | include/sys/file.h | 2 +- | |
57 | include/sys/fs/swapnode.h | 2 +- | |
58 | include/sys/idmap.h | 4 +- | |
59 | include/sys/int_limits.h | 2 +- | |
60 | include/sys/int_types.h | 2 +- | |
61 | include/sys/inttypes.h | 2 +- | |
62 | include/sys/isa_defs.h | 64 ++--- | |
63 | include/sys/kidmap.h | 2 +- | |
64 | include/sys/kobj.h | 2 +- | |
65 | include/sys/kstat.h | 244 ++++++++-------- | |
66 | include/sys/list.h | 36 +-- | |
67 | include/sys/mkdev.h | 2 +- | |
68 | include/sys/mntent.h | 2 +- | |
69 | include/sys/modctl.h | 2 +- | |
70 | include/sys/mode.h | 8 +- | |
71 | include/sys/mount.h | 2 +- | |
72 | include/sys/mutex.h | 10 +- | |
73 | include/sys/note.h | 2 +- | |
74 | include/sys/open.h | 2 +- | |
75 | include/sys/param.h | 8 +- | |
76 | include/sys/pathname.h | 2 +- | |
77 | include/sys/policy.h | 20 +- | |
78 | include/sys/pool.h | 2 +- | |
79 | include/sys/priv_impl.h | 2 +- | |
80 | include/sys/proc.h | 2 +- | |
81 | include/sys/processor.h | 2 +- | |
82 | include/sys/pset.h | 14 +- | |
83 | include/sys/random.h | 4 +- | |
84 | include/sys/refstr.h | 2 +- | |
85 | include/sys/resource.h | 2 +- | |
86 | include/sys/rwlock.h | 34 +-- | |
87 | include/sys/sdt.h | 4 +- | |
88 | include/sys/sid.h | 12 +- | |
89 | include/sys/signal.h | 7 +- | |
90 | include/sys/stat.h | 2 +- | |
91 | include/sys/stropts.h | 2 +- | |
92 | include/sys/sunddi.h | 8 +- | |
93 | include/sys/sunldi.h | 4 +- | |
94 | include/sys/sysdc.h | 2 +- | |
95 | include/sys/sysmacros.h | 196 ++++++------- | |
96 | include/sys/systeminfo.h | 8 +- | |
97 | include/sys/systm.h | 2 +- | |
98 | include/sys/t_lock.h | 2 +- | |
99 | include/sys/taskq.h | 2 +- | |
100 | include/sys/thread.h | 36 +-- | |
101 | include/sys/timer.h | 37 ++- | |
102 | include/sys/tsd.h | 10 +- | |
103 | include/sys/types.h | 6 +- | |
104 | include/sys/u8_textprep.h | 2 +- | |
105 | include/sys/uio.h | 20 +- | |
106 | include/sys/unistd.h | 2 +- | |
107 | include/sys/user.h | 4 +- | |
108 | include/sys/va_list.h | 2 +- | |
109 | include/sys/varargs.h | 4 +- | |
110 | include/sys/vfs.h | 4 +- | |
111 | include/sys/vfs_opreg.h | 2 +- | |
112 | include/sys/vmsystm.h | 14 +- | |
113 | include/sys/vnode.h | 100 +++---- | |
114 | include/sys/zmod.h | 5 +- | |
115 | include/sys/zone.h | 2 +- | |
116 | include/unistd.h | 2 +- | |
117 | include/util/qsort.h | 4 +- | |
118 | include/util/sscanf.h | 2 +- | |
119 | include/vm/anon.h | 2 +- | |
120 | include/vm/pvn.h | 2 +- | |
121 | include/vm/seg_kmem.h | 2 +- | |
122 | module/spl/spl-atomic.c | 8 +- | |
123 | module/spl/spl-condvar.c | 8 +- | |
124 | module/spl/spl-cred.c | 38 ++- | |
125 | module/spl/spl-err.c | 5 +- | |
126 | module/spl/spl-generic.c | 84 +++--- | |
127 | module/spl/spl-kmem-cache.c | 22 +- | |
128 | module/spl/spl-kmem.c | 2 +- | |
129 | module/spl/spl-kobj.c | 12 +- | |
130 | module/spl/spl-kstat.c | 521 +++++++++++++++++------------------ | |
131 | module/spl/spl-mutex.c | 8 +- | |
132 | module/spl/spl-proc.c | 628 +++++++++++++++++++++--------------------- | |
133 | module/spl/spl-rwlock.c | 10 +- | |
134 | module/spl/spl-taskq.c | 22 +- | |
135 | module/spl/spl-thread.c | 29 +- | |
136 | module/spl/spl-vnode.c | 164 ++++++----- | |
137 | module/spl/spl-xdr.c | 157 ++++++----- | |
138 | module/spl/spl-zlib.c | 37 +-- | |
139 | 121 files changed, 1634 insertions(+), 1622 deletions(-) | |
140 | ||
141 | diff --git a/include/fs/fs_subr.h b/include/fs/fs_subr.h | |
142 | index 33ccc68..881a4cd 100644 | |
143 | --- a/include/fs/fs_subr.h | |
144 | +++ b/include/fs/fs_subr.h | |
145 | @@ -23,6 +23,6 @@ | |
146 | \*****************************************************************************/ | |
147 | ||
148 | #ifndef _SPL_FS_FS_SUBR_H | |
149 | -#define _SPL_FS_FS_SUBR_H | |
150 | +#define _SPL_FS_FS_SUBR_H | |
151 | ||
152 | #endif /* SPL_FS_FS_SUBR_H */ | |
153 | diff --git a/include/linux/math64_compat.h b/include/linux/math64_compat.h | |
154 | index 2c911a6..173b380 100644 | |
155 | --- a/include/linux/math64_compat.h | |
156 | +++ b/include/linux/math64_compat.h | |
157 | @@ -26,7 +26,8 @@ | |
158 | #define _SPL_MATH64_COMPAT_H | |
159 | ||
160 | #ifndef abs64 | |
161 | -#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; }) | |
162 | +/* CSTYLED */ | |
163 | +#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; }) | |
164 | #endif | |
165 | ||
166 | #endif /* _SPL_MATH64_COMPAT_H */ | |
167 | diff --git a/include/rpc/types.h b/include/rpc/types.h | |
168 | index b57b4bd..915ace5 100644 | |
169 | --- a/include/rpc/types.h | |
170 | +++ b/include/rpc/types.h | |
171 | @@ -23,7 +23,7 @@ | |
172 | \*****************************************************************************/ | |
173 | ||
174 | #ifndef _SPL_RPC_TYPES_H | |
175 | -#define _SPL_RPC_TYPES_H | |
176 | +#define _SPL_RPC_TYPES_H | |
177 | ||
178 | typedef int bool_t; | |
179 | ||
180 | diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h | |
181 | index d0f06b5..dc46f51 100644 | |
182 | --- a/include/rpc/xdr.h | |
183 | +++ b/include/rpc/xdr.h | |
184 | @@ -20,7 +20,7 @@ | |
185 | \*****************************************************************************/ | |
186 | ||
187 | #ifndef _SPL_RPC_XDR_H | |
188 | -#define _SPL_RPC_XDR_H | |
189 | +#define _SPL_RPC_XDR_H | |
190 | ||
191 | #include <sys/types.h> | |
192 | #include <rpc/types.h> | |
193 | @@ -36,11 +36,10 @@ enum xdr_op { | |
194 | struct xdr_ops; | |
195 | ||
196 | typedef struct { | |
197 | - struct xdr_ops *x_ops; /* Also used to let caller know if | |
198 | - xdrmem_create() succeeds (sigh..) */ | |
199 | - caddr_t x_addr; /* Current buffer addr */ | |
200 | - caddr_t x_addr_end; /* End of the buffer */ | |
201 | - enum xdr_op x_op; /* Stream direction */ | |
202 | + struct xdr_ops *x_ops; /* Let caller know xdrmem_create() succeeds */ | |
203 | + caddr_t x_addr; /* Current buffer addr */ | |
204 | + caddr_t x_addr_end; /* End of the buffer */ | |
205 | + enum xdr_op x_op; /* Stream direction */ | |
206 | } XDR; | |
207 | ||
208 | typedef bool_t (*xdrproc_t)(XDR *xdrs, void *ptr); | |
209 | @@ -56,13 +55,13 @@ struct xdr_ops { | |
210 | bool_t (*xdr_opaque)(XDR *, caddr_t, const uint_t); | |
211 | bool_t (*xdr_string)(XDR *, char **, const uint_t); | |
212 | bool_t (*xdr_array)(XDR *, caddr_t *, uint_t *, const uint_t, | |
213 | - const uint_t, const xdrproc_t); | |
214 | + const uint_t, const xdrproc_t); | |
215 | }; | |
216 | ||
217 | /* | |
218 | * XDR control operator. | |
219 | */ | |
220 | -#define XDR_GET_BYTES_AVAIL 1 | |
221 | +#define XDR_GET_BYTES_AVAIL 1 | |
222 | ||
223 | struct xdr_bytesrec { | |
224 | bool_t xc_is_last_record; | |
225 | @@ -74,11 +73,12 @@ struct xdr_bytesrec { | |
226 | */ | |
227 | void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, | |
228 | const enum xdr_op op); | |
229 | -#define xdr_destroy(xdrs) ((void) 0) /* Currently not needed. If needed later, | |
230 | - we'll add it to struct xdr_ops */ | |
231 | ||
232 | -#define xdr_control(xdrs, req, info) (xdrs)->x_ops->xdr_control((xdrs), \ | |
233 | - (req), (info)) | |
234 | +/* Currently not needed. If needed later, we'll add it to struct xdr_ops */ | |
235 | +#define xdr_destroy(xdrs) ((void) 0) | |
236 | + | |
237 | +#define xdr_control(xdrs, req, info) \ | |
238 | + (xdrs)->x_ops->xdr_control((xdrs), (req), (info)) | |
239 | ||
240 | /* | |
241 | * For precaution, the following are defined as static inlines instead of macros | |
242 | @@ -89,40 +89,40 @@ void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, | |
243 | */ | |
244 | static inline bool_t xdr_char(XDR *xdrs, char *cp) | |
245 | { | |
246 | - return xdrs->x_ops->xdr_char(xdrs, cp); | |
247 | + return (xdrs->x_ops->xdr_char(xdrs, cp)); | |
248 | } | |
249 | ||
250 | static inline bool_t xdr_u_short(XDR *xdrs, unsigned short *usp) | |
251 | { | |
252 | - return xdrs->x_ops->xdr_u_short(xdrs, usp); | |
253 | + return (xdrs->x_ops->xdr_u_short(xdrs, usp)); | |
254 | } | |
255 | ||
256 | static inline bool_t xdr_short(XDR *xdrs, short *sp) | |
257 | { | |
258 | - BUILD_BUG_ON(sizeof(short) != 2); | |
259 | - return xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp); | |
260 | + BUILD_BUG_ON(sizeof (short) != 2); | |
261 | + return (xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp)); | |
262 | } | |
263 | ||
264 | static inline bool_t xdr_u_int(XDR *xdrs, unsigned *up) | |
265 | { | |
266 | - return xdrs->x_ops->xdr_u_int(xdrs, up); | |
267 | + return (xdrs->x_ops->xdr_u_int(xdrs, up)); | |
268 | } | |
269 | ||
270 | static inline bool_t xdr_int(XDR *xdrs, int *ip) | |
271 | { | |
272 | - BUILD_BUG_ON(sizeof(int) != 4); | |
273 | - return xdrs->x_ops->xdr_u_int(xdrs, (unsigned *) ip); | |
274 | + BUILD_BUG_ON(sizeof (int) != 4); | |
275 | + return (xdrs->x_ops->xdr_u_int(xdrs, (unsigned *)ip)); | |
276 | } | |
277 | ||
278 | static inline bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp) | |
279 | { | |
280 | - return xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp); | |
281 | + return (xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp)); | |
282 | } | |
283 | ||
284 | static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp) | |
285 | { | |
286 | - BUILD_BUG_ON(sizeof(longlong_t) != 8); | |
287 | - return xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *) llp); | |
288 | + BUILD_BUG_ON(sizeof (longlong_t) != 8); | |
289 | + return (xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *)llp)); | |
290 | } | |
291 | ||
292 | /* | |
293 | @@ -130,7 +130,7 @@ static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp) | |
294 | */ | |
295 | static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
296 | { | |
297 | - return xdrs->x_ops->xdr_opaque(xdrs, cp, cnt); | |
298 | + return (xdrs->x_ops->xdr_opaque(xdrs, cp, cnt)); | |
299 | } | |
300 | ||
301 | /* | |
302 | @@ -139,7 +139,7 @@ static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
303 | */ | |
304 | static inline bool_t xdr_string(XDR *xdrs, char **sp, const uint_t maxsize) | |
305 | { | |
306 | - return xdrs->x_ops->xdr_string(xdrs, sp, maxsize); | |
307 | + return (xdrs->x_ops->xdr_string(xdrs, sp, maxsize)); | |
308 | } | |
309 | ||
310 | /* | |
311 | diff --git a/include/sharefs/share.h b/include/sharefs/share.h | |
312 | index fc248a2..13f0d9a 100644 | |
313 | --- a/include/sharefs/share.h | |
314 | +++ b/include/sharefs/share.h | |
315 | @@ -23,6 +23,6 @@ | |
316 | \*****************************************************************************/ | |
317 | ||
318 | #ifndef _SPL_SHARE_H | |
319 | -#define _SPL_SHARE_H | |
320 | +#define _SPL_SHARE_H | |
321 | ||
322 | #endif /* SPL_SHARE_H */ | |
323 | diff --git a/include/spl-ctl.h b/include/spl-ctl.h | |
324 | index bb24490..a31a0af 100644 | |
325 | --- a/include/spl-ctl.h | |
326 | +++ b/include/spl-ctl.h | |
327 | @@ -23,23 +23,23 @@ | |
328 | \*****************************************************************************/ | |
329 | ||
330 | #ifndef _DEBUG_CTL_H | |
331 | -#define _DEBUG_CTL_H | |
332 | +#define _DEBUG_CTL_H | |
333 | ||
334 | /* | |
335 | * Contains shared definitions which both the user space | |
336 | * and kernel space portions of splat must agree on. | |
337 | */ | |
338 | typedef struct spl_debug_header { | |
339 | - int ph_len; | |
340 | - int ph_flags; | |
341 | - int ph_subsys; | |
342 | - int ph_mask; | |
343 | - int ph_cpu_id; | |
344 | - int ph_sec; | |
345 | - long ph_usec; | |
346 | - int ph_stack; | |
347 | - int ph_pid; | |
348 | - int ph_line_num; | |
349 | + int ph_len; | |
350 | + int ph_flags; | |
351 | + int ph_subsys; | |
352 | + int ph_mask; | |
353 | + int ph_cpu_id; | |
354 | + int ph_sec; | |
355 | + long ph_usec; | |
356 | + int ph_stack; | |
357 | + int ph_pid; | |
358 | + int ph_line_num; | |
359 | } spl_debug_header_t; | |
360 | ||
361 | #endif /* _DEBUG_CTL_H */ | |
362 | diff --git a/include/splat-ctl.h b/include/splat-ctl.h | |
363 | index 15fd01b..d049551 100644 | |
364 | --- a/include/splat-ctl.h | |
365 | +++ b/include/splat-ctl.h | |
366 | @@ -23,7 +23,7 @@ | |
367 | \*****************************************************************************/ | |
368 | ||
369 | #ifndef _SPLAT_CTL_H | |
370 | -#define _SPLAT_CTL_H | |
371 | +#define _SPLAT_CTL_H | |
372 | ||
373 | #include <linux/types.h> | |
374 | ||
375 | @@ -32,11 +32,11 @@ | |
376 | * ensure 32-bit/64-bit interoperability over ioctl()'s only types with | |
377 | * fixed sizes can be used. | |
378 | */ | |
379 | -#define SPLAT_NAME "splatctl" | |
380 | -#define SPLAT_DEV "/dev/splatctl" | |
381 | +#define SPLAT_NAME "splatctl" | |
382 | +#define SPLAT_DEV "/dev/splatctl" | |
383 | ||
384 | -#define SPLAT_NAME_SIZE 20 | |
385 | -#define SPLAT_DESC_SIZE 60 | |
386 | +#define SPLAT_NAME_SIZE 20 | |
387 | +#define SPLAT_DESC_SIZE 60 | |
388 | ||
389 | typedef struct splat_user { | |
390 | char name[SPLAT_NAME_SIZE]; /* Short name */ | |
391 | @@ -72,38 +72,38 @@ typedef struct splat_cmd { | |
392 | } splat_cmd_t; | |
393 | ||
394 | /* Valid ioctls */ | |
395 | -#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t) | |
396 | -#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t) | |
397 | +#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t) | |
398 | +#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t) | |
399 | ||
400 | /* Valid configuration commands */ | |
401 | -#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ | |
402 | -#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ | |
403 | -#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */ | |
404 | -#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */ | |
405 | -#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */ | |
406 | -#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */ | |
407 | +#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ | |
408 | +#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ | |
409 | +#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */ | |
410 | +#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */ | |
411 | +#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */ | |
412 | +#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */ | |
413 | ||
414 | /* | |
415 | * Valid subsystem and test commands are defined in each subsystem as | |
416 | * SPLAT_SUBSYSTEM_*. We do need to be careful to avoid collisions, the | |
417 | * currently defined subsystems are as follows: | |
418 | */ | |
419 | -#define SPLAT_SUBSYSTEM_KMEM 0x0100 | |
420 | -#define SPLAT_SUBSYSTEM_TASKQ 0x0200 | |
421 | -#define SPLAT_SUBSYSTEM_KRNG 0x0300 | |
422 | -#define SPLAT_SUBSYSTEM_MUTEX 0x0400 | |
423 | -#define SPLAT_SUBSYSTEM_CONDVAR 0x0500 | |
424 | -#define SPLAT_SUBSYSTEM_THREAD 0x0600 | |
425 | -#define SPLAT_SUBSYSTEM_RWLOCK 0x0700 | |
426 | -#define SPLAT_SUBSYSTEM_TIME 0x0800 | |
427 | -#define SPLAT_SUBSYSTEM_VNODE 0x0900 | |
428 | -#define SPLAT_SUBSYSTEM_KOBJ 0x0a00 | |
429 | -#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00 | |
430 | -#define SPLAT_SUBSYSTEM_LIST 0x0c00 | |
431 | -#define SPLAT_SUBSYSTEM_GENERIC 0x0d00 | |
432 | -#define SPLAT_SUBSYSTEM_CRED 0x0e00 | |
433 | -#define SPLAT_SUBSYSTEM_ZLIB 0x0f00 | |
434 | -#define SPLAT_SUBSYSTEM_LINUX 0x1000 | |
435 | -#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00 | |
436 | +#define SPLAT_SUBSYSTEM_KMEM 0x0100 | |
437 | +#define SPLAT_SUBSYSTEM_TASKQ 0x0200 | |
438 | +#define SPLAT_SUBSYSTEM_KRNG 0x0300 | |
439 | +#define SPLAT_SUBSYSTEM_MUTEX 0x0400 | |
440 | +#define SPLAT_SUBSYSTEM_CONDVAR 0x0500 | |
441 | +#define SPLAT_SUBSYSTEM_THREAD 0x0600 | |
442 | +#define SPLAT_SUBSYSTEM_RWLOCK 0x0700 | |
443 | +#define SPLAT_SUBSYSTEM_TIME 0x0800 | |
444 | +#define SPLAT_SUBSYSTEM_VNODE 0x0900 | |
445 | +#define SPLAT_SUBSYSTEM_KOBJ 0x0a00 | |
446 | +#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00 | |
447 | +#define SPLAT_SUBSYSTEM_LIST 0x0c00 | |
448 | +#define SPLAT_SUBSYSTEM_GENERIC 0x0d00 | |
449 | +#define SPLAT_SUBSYSTEM_CRED 0x0e00 | |
450 | +#define SPLAT_SUBSYSTEM_ZLIB 0x0f00 | |
451 | +#define SPLAT_SUBSYSTEM_LINUX 0x1000 | |
452 | +#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00 | |
453 | ||
454 | #endif /* _SPLAT_CTL_H */ | |
455 | diff --git a/include/strings.h b/include/strings.h | |
456 | index dc0f314..d0cf1e0 100644 | |
457 | --- a/include/strings.h | |
458 | +++ b/include/strings.h | |
459 | @@ -23,6 +23,6 @@ | |
460 | \*****************************************************************************/ | |
461 | ||
462 | #ifndef _SPL_STRINGS_H | |
463 | -#define _SPL_STRINGS_H | |
464 | +#define _SPL_STRINGS_H | |
465 | ||
466 | #endif /* SPL_STRINGS_H */ | |
467 | diff --git a/include/sys/acl.h b/include/sys/acl.h | |
468 | index f4a3de5..34f4508 100644 | |
469 | --- a/include/sys/acl.h | |
470 | +++ b/include/sys/acl.h | |
471 | @@ -23,95 +23,97 @@ | |
472 | \*****************************************************************************/ | |
473 | ||
474 | #ifndef _SPL_ACL_H | |
475 | -#define _SPL_ACL_H | |
476 | +#define _SPL_ACL_H | |
477 | ||
478 | #include <sys/types.h> | |
479 | ||
480 | typedef struct ace { | |
481 | - uid_t a_who; | |
482 | - uint32_t a_access_mask; | |
483 | - uint16_t a_flags; | |
484 | - uint16_t a_type; | |
485 | + uid_t a_who; | |
486 | + uint32_t a_access_mask; | |
487 | + uint16_t a_flags; | |
488 | + uint16_t a_type; | |
489 | } ace_t; | |
490 | ||
491 | typedef struct ace_object { | |
492 | - uid_t a_who; /* uid or gid */ | |
493 | - uint32_t a_access_mask; /* read,write,... */ | |
494 | - uint16_t a_flags; /* see below */ | |
495 | - uint16_t a_type; /* allow or deny */ | |
496 | - uint8_t a_obj_type[16]; /* obj type */ | |
497 | - uint8_t a_inherit_obj_type[16]; /* inherit obj */ | |
498 | + uid_t a_who; /* uid or gid */ | |
499 | + uint32_t a_access_mask; /* read,write,... */ | |
500 | + uint16_t a_flags; /* see below */ | |
501 | + uint16_t a_type; /* allow or deny */ | |
502 | + uint8_t a_obj_type[16]; /* obj type */ | |
503 | + uint8_t a_inherit_obj_type[16]; /* inherit obj */ | |
504 | } ace_object_t; | |
505 | ||
506 | -#define MAX_ACL_ENTRIES 1024 | |
507 | +#define MAX_ACL_ENTRIES 1024 | |
508 | ||
509 | -#define ACE_READ_DATA 0x00000001 | |
510 | -#define ACE_LIST_DIRECTORY 0x00000001 | |
511 | -#define ACE_WRITE_DATA 0x00000002 | |
512 | -#define ACE_ADD_FILE 0x00000002 | |
513 | -#define ACE_APPEND_DATA 0x00000004 | |
514 | -#define ACE_ADD_SUBDIRECTORY 0x00000004 | |
515 | -#define ACE_READ_NAMED_ATTRS 0x00000008 | |
516 | -#define ACE_WRITE_NAMED_ATTRS 0x00000010 | |
517 | -#define ACE_EXECUTE 0x00000020 | |
518 | -#define ACE_DELETE_CHILD 0x00000040 | |
519 | -#define ACE_READ_ATTRIBUTES 0x00000080 | |
520 | -#define ACE_WRITE_ATTRIBUTES 0x00000100 | |
521 | -#define ACE_DELETE 0x00010000 | |
522 | -#define ACE_READ_ACL 0x00020000 | |
523 | -#define ACE_WRITE_ACL 0x00040000 | |
524 | -#define ACE_WRITE_OWNER 0x00080000 | |
525 | -#define ACE_SYNCHRONIZE 0x00100000 | |
526 | +#define ACE_READ_DATA 0x00000001 | |
527 | +#define ACE_LIST_DIRECTORY 0x00000001 | |
528 | +#define ACE_WRITE_DATA 0x00000002 | |
529 | +#define ACE_ADD_FILE 0x00000002 | |
530 | +#define ACE_APPEND_DATA 0x00000004 | |
531 | +#define ACE_ADD_SUBDIRECTORY 0x00000004 | |
532 | +#define ACE_READ_NAMED_ATTRS 0x00000008 | |
533 | +#define ACE_WRITE_NAMED_ATTRS 0x00000010 | |
534 | +#define ACE_EXECUTE 0x00000020 | |
535 | +#define ACE_DELETE_CHILD 0x00000040 | |
536 | +#define ACE_READ_ATTRIBUTES 0x00000080 | |
537 | +#define ACE_WRITE_ATTRIBUTES 0x00000100 | |
538 | +#define ACE_DELETE 0x00010000 | |
539 | +#define ACE_READ_ACL 0x00020000 | |
540 | +#define ACE_WRITE_ACL 0x00040000 | |
541 | +#define ACE_WRITE_OWNER 0x00080000 | |
542 | +#define ACE_SYNCHRONIZE 0x00100000 | |
543 | ||
544 | -#define ACE_FILE_INHERIT_ACE 0x0001 | |
545 | -#define ACE_DIRECTORY_INHERIT_ACE 0x0002 | |
546 | -#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 | |
547 | -#define ACE_INHERIT_ONLY_ACE 0x0008 | |
548 | -#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 | |
549 | -#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 | |
550 | -#define ACE_IDENTIFIER_GROUP 0x0040 | |
551 | -#define ACE_INHERITED_ACE 0x0080 | |
552 | -#define ACE_OWNER 0x1000 | |
553 | -#define ACE_GROUP 0x2000 | |
554 | -#define ACE_EVERYONE 0x4000 | |
555 | +#define ACE_FILE_INHERIT_ACE 0x0001 | |
556 | +#define ACE_DIRECTORY_INHERIT_ACE 0x0002 | |
557 | +#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 | |
558 | +#define ACE_INHERIT_ONLY_ACE 0x0008 | |
559 | +#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 | |
560 | +#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 | |
561 | +#define ACE_IDENTIFIER_GROUP 0x0040 | |
562 | +#define ACE_INHERITED_ACE 0x0080 | |
563 | +#define ACE_OWNER 0x1000 | |
564 | +#define ACE_GROUP 0x2000 | |
565 | +#define ACE_EVERYONE 0x4000 | |
566 | ||
567 | -#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 | |
568 | -#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 | |
569 | -#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 | |
570 | -#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 | |
571 | +#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 | |
572 | +#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 | |
573 | +#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 | |
574 | +#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 | |
575 | ||
576 | -#define ACL_AUTO_INHERIT 0x0001 | |
577 | -#define ACL_PROTECTED 0x0002 | |
578 | -#define ACL_DEFAULTED 0x0004 | |
579 | -#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) | |
580 | +#define ACL_AUTO_INHERIT 0x0001 | |
581 | +#define ACL_PROTECTED 0x0002 | |
582 | +#define ACL_DEFAULTED 0x0004 | |
583 | +#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) | |
584 | ||
585 | -#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 | |
586 | -#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 | |
587 | -#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 | |
588 | -#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 | |
589 | -#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 | |
590 | -#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 | |
591 | -#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A | |
592 | -#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B | |
593 | -#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C | |
594 | -#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D | |
595 | -#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E | |
596 | -#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F | |
597 | -#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 | |
598 | +#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 | |
599 | +#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 | |
600 | +#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 | |
601 | +#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 | |
602 | +#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 | |
603 | +#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 | |
604 | +#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A | |
605 | +#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B | |
606 | +#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C | |
607 | +#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D | |
608 | +#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E | |
609 | +#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F | |
610 | +#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 | |
611 | ||
612 | -#define ACE_ALL_TYPES 0x001F | |
613 | +#define ACE_ALL_TYPES 0x001F | |
614 | ||
615 | -#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) | |
616 | +#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) | |
617 | ||
618 | -#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ | |
619 | +/* BEGIN CSTYLED */ | |
620 | +#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ | |
621 | ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \ | |
622 | ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \ | |
623 | ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \ | |
624 | ACE_WRITE_OWNER|ACE_SYNCHRONIZE) | |
625 | +/* END CSTYLED */ | |
626 | ||
627 | -#define VSA_ACE 0x0010 | |
628 | -#define VSA_ACECNT 0x0020 | |
629 | -#define VSA_ACE_ALLTYPES 0x0040 | |
630 | -#define VSA_ACE_ACLFLAGS 0x0080 | |
631 | +#define VSA_ACE 0x0010 | |
632 | +#define VSA_ACECNT 0x0020 | |
633 | +#define VSA_ACE_ALLTYPES 0x0040 | |
634 | +#define VSA_ACE_ACLFLAGS 0x0080 | |
635 | ||
636 | #endif /* _SPL_ACL_H */ | |
637 | diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h | |
638 | index 67af713..c96cc52 100644 | |
639 | --- a/include/sys/acl_impl.h | |
640 | +++ b/include/sys/acl_impl.h | |
641 | @@ -23,6 +23,6 @@ | |
642 | \*****************************************************************************/ | |
643 | ||
644 | #ifndef _SPL_ACL_IMPL_H | |
645 | -#define _SPL_ACL_IMPL_H | |
646 | +#define _SPL_ACL_IMPL_H | |
647 | ||
648 | #endif /* _SPL_ACL_IMPL_H */ | |
649 | diff --git a/include/sys/atomic.h b/include/sys/atomic.h | |
650 | index 07b460e..1f730e2 100644 | |
651 | --- a/include/sys/atomic.h | |
652 | +++ b/include/sys/atomic.h | |
653 | @@ -23,7 +23,7 @@ | |
654 | \*****************************************************************************/ | |
655 | ||
656 | #ifndef _SPL_ATOMIC_H | |
657 | -#define _SPL_ATOMIC_H | |
658 | +#define _SPL_ATOMIC_H | |
659 | ||
660 | #include <linux/module.h> | |
661 | #include <linux/spinlock.h> | |
662 | @@ -91,7 +91,7 @@ atomic_inc_32_nv(volatile uint32_t *target) | |
663 | nv = ++(*target); | |
664 | spin_unlock(&atomic32_lock); | |
665 | ||
666 | - return nv; | |
667 | + return (nv); | |
668 | } | |
669 | ||
670 | static __inline__ uint32_t | |
671 | @@ -103,7 +103,7 @@ atomic_dec_32_nv(volatile uint32_t *target) | |
672 | nv = --(*target); | |
673 | spin_unlock(&atomic32_lock); | |
674 | ||
675 | - return nv; | |
676 | + return (nv); | |
677 | } | |
678 | ||
679 | static __inline__ uint32_t | |
680 | @@ -116,7 +116,7 @@ atomic_add_32_nv(volatile uint32_t *target, uint32_t delta) | |
681 | nv = *target; | |
682 | spin_unlock(&atomic32_lock); | |
683 | ||
684 | - return nv; | |
685 | + return (nv); | |
686 | } | |
687 | ||
688 | static __inline__ uint32_t | |
689 | @@ -129,12 +129,11 @@ atomic_sub_32_nv(volatile uint32_t *target, uint32_t delta) | |
690 | nv = *target; | |
691 | spin_unlock(&atomic32_lock); | |
692 | ||
693 | - return nv; | |
694 | + return (nv); | |
695 | } | |
696 | ||
697 | static __inline__ uint32_t | |
698 | -atomic_cas_32(volatile uint32_t *target, uint32_t cmp, | |
699 | - uint32_t newval) | |
700 | +atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) | |
701 | { | |
702 | uint32_t rc; | |
703 | ||
704 | @@ -145,7 +144,7 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp, | |
705 | ||
706 | spin_unlock(&atomic32_lock); | |
707 | ||
708 | - return rc; | |
709 | + return (rc); | |
710 | } | |
711 | ||
712 | static __inline__ uint32_t | |
713 | @@ -158,7 +157,7 @@ atomic_swap_32(volatile uint32_t *target, uint32_t newval) | |
714 | *target = newval; | |
715 | spin_unlock(&atomic32_lock); | |
716 | ||
717 | - return rc; | |
718 | + return (rc); | |
719 | } | |
720 | ||
721 | static __inline__ void | |
722 | @@ -202,7 +201,7 @@ atomic_inc_64_nv(volatile uint64_t *target) | |
723 | nv = ++(*target); | |
724 | spin_unlock(&atomic64_lock); | |
725 | ||
726 | - return nv; | |
727 | + return (nv); | |
728 | } | |
729 | ||
730 | static __inline__ uint64_t | |
731 | @@ -214,7 +213,7 @@ atomic_dec_64_nv(volatile uint64_t *target) | |
732 | nv = --(*target); | |
733 | spin_unlock(&atomic64_lock); | |
734 | ||
735 | - return nv; | |
736 | + return (nv); | |
737 | } | |
738 | ||
739 | static __inline__ uint64_t | |
740 | @@ -227,7 +226,7 @@ atomic_add_64_nv(volatile uint64_t *target, uint64_t delta) | |
741 | nv = *target; | |
742 | spin_unlock(&atomic64_lock); | |
743 | ||
744 | - return nv; | |
745 | + return (nv); | |
746 | } | |
747 | ||
748 | static __inline__ uint64_t | |
749 | @@ -240,12 +239,11 @@ atomic_sub_64_nv(volatile uint64_t *target, uint64_t delta) | |
750 | nv = *target; | |
751 | spin_unlock(&atomic64_lock); | |
752 | ||
753 | - return nv; | |
754 | + return (nv); | |
755 | } | |
756 | ||
757 | static __inline__ uint64_t | |
758 | -atomic_cas_64(volatile uint64_t *target, uint64_t cmp, | |
759 | - uint64_t newval) | |
760 | +atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) | |
761 | { | |
762 | uint64_t rc; | |
763 | ||
764 | @@ -255,7 +253,7 @@ atomic_cas_64(volatile uint64_t *target, uint64_t cmp, | |
765 | *target = newval; | |
766 | spin_unlock(&atomic64_lock); | |
767 | ||
768 | - return rc; | |
769 | + return (rc); | |
770 | } | |
771 | ||
772 | static __inline__ uint64_t | |
773 | @@ -268,31 +266,31 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval) | |
774 | *target = newval; | |
775 | spin_unlock(&atomic64_lock); | |
776 | ||
777 | - return rc; | |
778 | + return (rc); | |
779 | } | |
780 | ||
781 | #else /* ATOMIC_SPINLOCK */ | |
782 | ||
783 | -#define atomic_inc_32(v) atomic_inc((atomic_t *)(v)) | |
784 | -#define atomic_dec_32(v) atomic_dec((atomic_t *)(v)) | |
785 | -#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v)) | |
786 | -#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v)) | |
787 | -#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v)) | |
788 | -#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v)) | |
789 | -#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v)) | |
790 | -#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v)) | |
791 | -#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y) | |
792 | -#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x) | |
793 | -#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v)) | |
794 | -#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v)) | |
795 | -#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v)) | |
796 | -#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v)) | |
797 | -#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v)) | |
798 | -#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v)) | |
799 | -#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v)) | |
800 | -#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v)) | |
801 | -#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y) | |
802 | -#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x) | |
803 | +#define atomic_inc_32(v) atomic_inc((atomic_t *)(v)) | |
804 | +#define atomic_dec_32(v) atomic_dec((atomic_t *)(v)) | |
805 | +#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v)) | |
806 | +#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v)) | |
807 | +#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v)) | |
808 | +#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v)) | |
809 | +#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v)) | |
810 | +#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v)) | |
811 | +#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y) | |
812 | +#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x) | |
813 | +#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v)) | |
814 | +#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v)) | |
815 | +#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v)) | |
816 | +#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v)) | |
817 | +#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v)) | |
818 | +#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v)) | |
819 | +#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v)) | |
820 | +#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v)) | |
821 | +#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y) | |
822 | +#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x) | |
823 | ||
824 | #endif /* ATOMIC_SPINLOCK */ | |
825 | ||
826 | @@ -300,15 +298,15 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval) | |
827 | static __inline__ void * | |
828 | atomic_cas_ptr(volatile void *target, void *cmp, void *newval) | |
829 | { | |
830 | - return (void *)atomic_cas_64((volatile uint64_t *)target, | |
831 | - (uint64_t)cmp, (uint64_t)newval); | |
832 | + return ((void *)atomic_cas_64((volatile uint64_t *)target, | |
833 | + (uint64_t)cmp, (uint64_t)newval)); | |
834 | } | |
835 | #else /* _LP64 */ | |
836 | static __inline__ void * | |
837 | atomic_cas_ptr(volatile void *target, void *cmp, void *newval) | |
838 | { | |
839 | - return (void *)atomic_cas_32((volatile uint32_t *)target, | |
840 | - (uint32_t)cmp, (uint32_t)newval); | |
841 | + return ((void *)atomic_cas_32((volatile uint32_t *)target, | |
842 | + (uint32_t)cmp, (uint32_t)newval)); | |
843 | } | |
844 | #endif /* _LP64 */ | |
845 | ||
846 | diff --git a/include/sys/attr.h b/include/sys/attr.h | |
847 | index 5fb609c..48c5e26 100644 | |
848 | --- a/include/sys/attr.h | |
849 | +++ b/include/sys/attr.h | |
850 | @@ -23,6 +23,6 @@ | |
851 | \*****************************************************************************/ | |
852 | ||
853 | #ifndef _SPL_ATTR_H | |
854 | -#define _SPL_ATTR_H | |
855 | +#define _SPL_ATTR_H | |
856 | ||
857 | #endif /* SPL_ATTR_H */ | |
858 | diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h | |
859 | index e4acb0b..d940c14 100644 | |
860 | --- a/include/sys/bitmap.h | |
861 | +++ b/include/sys/bitmap.h | |
862 | @@ -23,6 +23,6 @@ | |
863 | \*****************************************************************************/ | |
864 | ||
865 | #ifndef _SPL_BITMAP_H | |
866 | -#define _SPL_BITMAP_H | |
867 | +#define _SPL_BITMAP_H | |
868 | ||
869 | #endif /* SPL_BITMAP_H */ | |
870 | diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h | |
871 | index 4e032ad..d83a478 100644 | |
872 | --- a/include/sys/bootconf.h | |
873 | +++ b/include/sys/bootconf.h | |
874 | @@ -23,6 +23,6 @@ | |
875 | \*****************************************************************************/ | |
876 | ||
877 | #ifndef _SPL_BOOTCONF_H | |
878 | -#define _SPL_BOOTCONF_H | |
879 | +#define _SPL_BOOTCONF_H | |
880 | ||
881 | #endif /* SPL_BOOTCONF_H */ | |
882 | diff --git a/include/sys/bootprops.h b/include/sys/bootprops.h | |
883 | index a562ec9..ac54bc2 100644 | |
884 | --- a/include/sys/bootprops.h | |
885 | +++ b/include/sys/bootprops.h | |
886 | @@ -23,6 +23,6 @@ | |
887 | \*****************************************************************************/ | |
888 | ||
889 | #ifndef _SPL_BOOTPROPS_H | |
890 | -#define _SPL_BOOTPROPS_H | |
891 | +#define _SPL_BOOTPROPS_H | |
892 | ||
893 | #endif /* SPL_BOOTPROPS_H */ | |
894 | diff --git a/include/sys/buf.h b/include/sys/buf.h | |
895 | index 8596c83..6879188 100644 | |
896 | --- a/include/sys/buf.h | |
897 | +++ b/include/sys/buf.h | |
898 | @@ -23,6 +23,6 @@ | |
899 | \*****************************************************************************/ | |
900 | ||
901 | #ifndef _SPL_BUF_H | |
902 | -#define _SPL_BUF_H | |
903 | +#define _SPL_BUF_H | |
904 | ||
905 | #endif /* SPL_BUF_H */ | |
906 | diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h | |
907 | index 184b52d..2034f22 100644 | |
908 | --- a/include/sys/byteorder.h | |
909 | +++ b/include/sys/byteorder.h | |
910 | @@ -23,45 +23,49 @@ | |
911 | \*****************************************************************************/ | |
912 | ||
913 | #ifndef _SPL_BYTEORDER_H | |
914 | -#define _SPL_BYTEORDER_H | |
915 | +#define _SPL_BYTEORDER_H | |
916 | ||
917 | #include <asm/byteorder.h> | |
918 | #include <sys/isa_defs.h> | |
919 | ||
920 | -#define LE_16(x) cpu_to_le16(x) | |
921 | -#define LE_32(x) cpu_to_le32(x) | |
922 | -#define LE_64(x) cpu_to_le64(x) | |
923 | -#define BE_16(x) cpu_to_be16(x) | |
924 | -#define BE_32(x) cpu_to_be32(x) | |
925 | -#define BE_64(x) cpu_to_be64(x) | |
926 | +#define LE_16(x) cpu_to_le16(x) | |
927 | +#define LE_32(x) cpu_to_le32(x) | |
928 | +#define LE_64(x) cpu_to_le64(x) | |
929 | +#define BE_16(x) cpu_to_be16(x) | |
930 | +#define BE_32(x) cpu_to_be32(x) | |
931 | +#define BE_64(x) cpu_to_be64(x) | |
932 | ||
933 | -#define BE_IN8(xa) \ | |
934 | +#define BE_IN8(xa) \ | |
935 | *((uint8_t *)(xa)) | |
936 | ||
937 | -#define BE_IN16(xa) \ | |
938 | +#define BE_IN16(xa) \ | |
939 | (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1)) | |
940 | ||
941 | -#define BE_IN32(xa) \ | |
942 | +#define BE_IN32(xa) \ | |
943 | (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2)) | |
944 | ||
945 | #ifdef _BIG_ENDIAN | |
946 | static __inline__ uint64_t | |
947 | -htonll(uint64_t n) { | |
948 | +htonll(uint64_t n) | |
949 | +{ | |
950 | return (n); | |
951 | } | |
952 | ||
953 | static __inline__ uint64_t | |
954 | -ntohll(uint64_t n) { | |
955 | +ntohll(uint64_t n) | |
956 | +{ | |
957 | return (n); | |
958 | } | |
959 | #else | |
960 | static __inline__ uint64_t | |
961 | -htonll(uint64_t n) { | |
962 | +htonll(uint64_t n) | |
963 | +{ | |
964 | return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); | |
965 | } | |
966 | ||
967 | static __inline__ uint64_t | |
968 | -ntohll(uint64_t n) { | |
969 | +ntohll(uint64_t n) | |
970 | +{ | |
971 | return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); | |
972 | } | |
973 | #endif | |
974 | diff --git a/include/sys/callb.h b/include/sys/callb.h | |
975 | index fbe4128..33e12b8 100644 | |
976 | --- a/include/sys/callb.h | |
977 | +++ b/include/sys/callb.h | |
978 | @@ -23,33 +23,32 @@ | |
979 | \*****************************************************************************/ | |
980 | ||
981 | #ifndef _SPL_CALLB_H | |
982 | -#define _SPL_CALLB_H | |
983 | +#define _SPL_CALLB_H | |
984 | ||
985 | #include <linux/module.h> | |
986 | #include <sys/mutex.h> | |
987 | ||
988 | -#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); | |
989 | +#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); | |
990 | ||
991 | typedef struct callb_cpr { | |
992 | - kmutex_t *cc_lockp; | |
993 | + kmutex_t *cc_lockp; | |
994 | } callb_cpr_t; | |
995 | ||
996 | -#define CALLB_CPR_INIT(cp, lockp, func, name) { \ | |
997 | - (cp)->cc_lockp = lockp; \ | |
998 | +#define CALLB_CPR_INIT(cp, lockp, func, name) { \ | |
999 | + (cp)->cc_lockp = lockp; \ | |
1000 | } | |
1001 | ||
1002 | -#define CALLB_CPR_SAFE_BEGIN(cp) { \ | |
1003 | +#define CALLB_CPR_SAFE_BEGIN(cp) { \ | |
1004 | CALLB_CPR_ASSERT(cp); \ | |
1005 | } | |
1006 | ||
1007 | -#define CALLB_CPR_SAFE_END(cp, lockp) { \ | |
1008 | +#define CALLB_CPR_SAFE_END(cp, lockp) { \ | |
1009 | CALLB_CPR_ASSERT(cp); \ | |
1010 | } | |
1011 | ||
1012 | -#define CALLB_CPR_EXIT(cp) { \ | |
1013 | - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ | |
1014 | - mutex_exit((cp)->cc_lockp); \ | |
1015 | +#define CALLB_CPR_EXIT(cp) { \ | |
1016 | + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ | |
1017 | + mutex_exit((cp)->cc_lockp); \ | |
1018 | } | |
1019 | ||
1020 | #endif /* _SPL_CALLB_H */ | |
1021 | - | |
1022 | diff --git a/include/sys/callo.h b/include/sys/callo.h | |
1023 | index 0d9fbcb..c7eea68 100644 | |
1024 | --- a/include/sys/callo.h | |
1025 | +++ b/include/sys/callo.h | |
1026 | @@ -22,7 +22,7 @@ | |
1027 | \*****************************************************************************/ | |
1028 | ||
1029 | #ifndef _SPL_CALLO_H | |
1030 | -#define _SPL_CALLO_H | |
1031 | +#define _SPL_CALLO_H | |
1032 | ||
1033 | /* | |
1034 | * Callout flags: | |
1035 | @@ -44,9 +44,9 @@ | |
1036 | * Legacy interfaces timeout() and realtime_timeout() pass this flag | |
1037 | * to timeout_generic() to indicate that a 32-bit ID should be allocated. | |
1038 | */ | |
1039 | -#define CALLOUT_FLAG_ROUNDUP 0x1 | |
1040 | -#define CALLOUT_FLAG_ABSOLUTE 0x2 | |
1041 | -#define CALLOUT_FLAG_HRESTIME 0x4 | |
1042 | -#define CALLOUT_FLAG_32BIT 0x8 | |
1043 | +#define CALLOUT_FLAG_ROUNDUP 0x1 | |
1044 | +#define CALLOUT_FLAG_ABSOLUTE 0x2 | |
1045 | +#define CALLOUT_FLAG_HRESTIME 0x4 | |
1046 | +#define CALLOUT_FLAG_32BIT 0x8 | |
1047 | ||
1048 | #endif /* _SPL_CALLB_H */ | |
1049 | diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h | |
1050 | index 1291510..f1c077e 100644 | |
1051 | --- a/include/sys/cmn_err.h | |
1052 | +++ b/include/sys/cmn_err.h | |
1053 | @@ -23,20 +23,20 @@ | |
1054 | \*****************************************************************************/ | |
1055 | ||
1056 | #ifndef _SPL_CMN_ERR_H | |
1057 | -#define _SPL_CMN_ERR_H | |
1058 | +#define _SPL_CMN_ERR_H | |
1059 | ||
1060 | #include <sys/varargs.h> | |
1061 | ||
1062 | -#define CE_CONT 0 /* continuation */ | |
1063 | -#define CE_NOTE 1 /* notice */ | |
1064 | -#define CE_WARN 2 /* warning */ | |
1065 | -#define CE_PANIC 3 /* panic */ | |
1066 | -#define CE_IGNORE 4 /* print nothing */ | |
1067 | +#define CE_CONT 0 /* continuation */ | |
1068 | +#define CE_NOTE 1 /* notice */ | |
1069 | +#define CE_WARN 2 /* warning */ | |
1070 | +#define CE_PANIC 3 /* panic */ | |
1071 | +#define CE_IGNORE 4 /* print nothing */ | |
1072 | ||
1073 | extern void cmn_err(int, const char *, ...); | |
1074 | extern void vcmn_err(int, const char *, __va_list); | |
1075 | extern void vpanic(const char *, __va_list); | |
1076 | ||
1077 | -#define fm_panic panic | |
1078 | +#define fm_panic panic | |
1079 | ||
1080 | #endif /* SPL_CMN_ERR_H */ | |
1081 | diff --git a/include/sys/compress.h b/include/sys/compress.h | |
1082 | index 55822f0..1a946ce 100644 | |
1083 | --- a/include/sys/compress.h | |
1084 | +++ b/include/sys/compress.h | |
1085 | @@ -23,6 +23,6 @@ | |
1086 | \*****************************************************************************/ | |
1087 | ||
1088 | #ifndef _SPL_COMPRESS_H | |
1089 | -#define _SPL_COMPRESS_H | |
1090 | +#define _SPL_COMPRESS_H | |
1091 | ||
1092 | #endif /* SPL_COMPRESS_H */ | |
1093 | diff --git a/include/sys/conf.h b/include/sys/conf.h | |
1094 | index eece0c7..e4c8f6c 100644 | |
1095 | --- a/include/sys/conf.h | |
1096 | +++ b/include/sys/conf.h | |
1097 | @@ -23,6 +23,6 @@ | |
1098 | \*****************************************************************************/ | |
1099 | ||
1100 | #ifndef _SPL_CONF_H | |
1101 | -#define _SPL_CONF_H | |
1102 | +#define _SPL_CONF_H | |
1103 | ||
1104 | #endif /* SPL_CONF_H */ | |
1105 | diff --git a/include/sys/console.h b/include/sys/console.h | |
1106 | index 76ef618..dfa38c9 100644 | |
1107 | --- a/include/sys/console.h | |
1108 | +++ b/include/sys/console.h | |
1109 | @@ -28,17 +28,17 @@ | |
1110 | void | |
1111 | console_vprintf(const char *fmt, va_list args) | |
1112 | { | |
1113 | - vprintk(fmt, args); | |
1114 | + vprintk(fmt, args); | |
1115 | } | |
1116 | ||
1117 | void | |
1118 | console_printf(const char *fmt, ...) | |
1119 | { | |
1120 | - va_list args; | |
1121 | + va_list args; | |
1122 | ||
1123 | - va_start(args, fmt); | |
1124 | - console_vprintf(fmt, args); | |
1125 | - va_end(args); | |
1126 | + va_start(args, fmt); | |
1127 | + console_vprintf(fmt, args); | |
1128 | + va_end(args); | |
1129 | } | |
1130 | ||
1131 | #endif /* _SPL_CONSOLE_H */ | |
1132 | diff --git a/include/sys/cpupart.h b/include/sys/cpupart.h | |
1133 | index fddeed6..eb819ff 100644 | |
1134 | --- a/include/sys/cpupart.h | |
1135 | +++ b/include/sys/cpupart.h | |
1136 | @@ -23,6 +23,6 @@ | |
1137 | \*****************************************************************************/ | |
1138 | ||
1139 | #ifndef _SPL_CPUPART_H | |
1140 | -#define _SPL_CPUPART_H | |
1141 | +#define _SPL_CPUPART_H | |
1142 | ||
1143 | #endif /* SPL_CPUPART_H */ | |
1144 | diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h | |
1145 | index 1284f94..6963067 100644 | |
1146 | --- a/include/sys/cpuvar.h | |
1147 | +++ b/include/sys/cpuvar.h | |
1148 | @@ -23,6 +23,6 @@ | |
1149 | \*****************************************************************************/ | |
1150 | ||
1151 | #ifndef _SPL_CPUVAR_H | |
1152 | -#define _SPL_CPUVAR_H | |
1153 | +#define _SPL_CPUVAR_H | |
1154 | ||
1155 | #endif /* SPL_CPUVAR_H */ | |
1156 | diff --git a/include/sys/crc32.h b/include/sys/crc32.h | |
1157 | index 1981f35..c14384a 100644 | |
1158 | --- a/include/sys/crc32.h | |
1159 | +++ b/include/sys/crc32.h | |
1160 | @@ -23,6 +23,6 @@ | |
1161 | \*****************************************************************************/ | |
1162 | ||
1163 | #ifndef _SPL_CRC32_H | |
1164 | -#define _SPL_CRC32_H | |
1165 | +#define _SPL_CRC32_H | |
1166 | ||
1167 | #endif /* SPL_CRC32_H */ | |
1168 | diff --git a/include/sys/cred.h b/include/sys/cred.h | |
1169 | index 2ad7115..3e96a07 100644 | |
1170 | --- a/include/sys/cred.h | |
1171 | +++ b/include/sys/cred.h | |
1172 | @@ -23,7 +23,7 @@ | |
1173 | \*****************************************************************************/ | |
1174 | ||
1175 | #ifndef _SPL_CRED_H | |
1176 | -#define _SPL_CRED_H | |
1177 | +#define _SPL_CRED_H | |
1178 | ||
1179 | #include <linux/module.h> | |
1180 | #include <sys/types.h> | |
1181 | @@ -68,7 +68,7 @@ extern gid_t crgetrgid(const cred_t *cr); | |
1182 | extern gid_t crgetsgid(const cred_t *cr); | |
1183 | extern gid_t crgetfsgid(const cred_t *cr); | |
1184 | extern int crgetngroups(const cred_t *cr); | |
1185 | -extern gid_t * crgetgroups(const cred_t *cr); | |
1186 | +extern gid_t *crgetgroups(const cred_t *cr); | |
1187 | extern int groupmember(gid_t gid, const cred_t *cr); | |
1188 | ||
1189 | #endif /* _SPL_CRED_H */ | |
1190 | diff --git a/include/sys/ctype.h b/include/sys/ctype.h | |
1191 | index 52037f9..86f29de 100644 | |
1192 | --- a/include/sys/ctype.h | |
1193 | +++ b/include/sys/ctype.h | |
1194 | @@ -23,7 +23,7 @@ | |
1195 | \*****************************************************************************/ | |
1196 | ||
1197 | #ifndef _SPL_CTYPE_H | |
1198 | -#define _SPL_CTYPE_H | |
1199 | +#define _SPL_CTYPE_H | |
1200 | ||
1201 | #include <linux/ctype.h> | |
1202 | ||
1203 | diff --git a/include/sys/ddi.h b/include/sys/ddi.h | |
1204 | index 2fa1388..b0af3cb 100644 | |
1205 | --- a/include/sys/ddi.h | |
1206 | +++ b/include/sys/ddi.h | |
1207 | @@ -23,6 +23,6 @@ | |
1208 | \*****************************************************************************/ | |
1209 | ||
1210 | #ifndef _SPL_DDI_H | |
1211 | -#define _SPL_DDI_H | |
1212 | +#define _SPL_DDI_H | |
1213 | ||
1214 | #endif /* SPL_DDI_H */ | |
1215 | diff --git a/include/sys/debug.h b/include/sys/debug.h | |
1216 | index 98ccbaf..6d683c2 100644 | |
1217 | --- a/include/sys/debug.h | |
1218 | +++ b/include/sys/debug.h | |
1219 | @@ -54,16 +54,17 @@ int spl_panic(const char *file, const char *func, int line, | |
1220 | const char *fmt, ...); | |
1221 | void spl_dumpstack(void); | |
1222 | ||
1223 | +/* BEGIN CSTYLED */ | |
1224 | #define PANIC(fmt, a...) \ | |
1225 | spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) | |
1226 | ||
1227 | #define VERIFY(cond) \ | |
1228 | - (void)(unlikely(!(cond)) && \ | |
1229 | + (void) (unlikely(!(cond)) && \ | |
1230 | spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
1231 | "%s", "VERIFY(" #cond ") failed\n")) | |
1232 | ||
1233 | #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ | |
1234 | - (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ | |
1235 | + (void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ | |
1236 | spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
1237 | "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ | |
1238 | "failed (" FMT " " #OP " " FMT ")\n", \ | |
1239 | @@ -120,6 +121,7 @@ void spl_dumpstack(void); | |
1240 | ((void)((!!(A) == !!(B)) || \ | |
1241 | spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
1242 | "(" #A ") is equivalent to (" #B ")"))) | |
1243 | +/* END CSTYLED */ | |
1244 | ||
1245 | #endif /* NDEBUG */ | |
1246 | ||
1247 | diff --git a/include/sys/dirent.h b/include/sys/dirent.h | |
1248 | index 68f75da..8a33588 100644 | |
1249 | --- a/include/sys/dirent.h | |
1250 | +++ b/include/sys/dirent.h | |
1251 | @@ -23,6 +23,6 @@ | |
1252 | \*****************************************************************************/ | |
1253 | ||
1254 | #ifndef _SPL_DIRENT_H | |
1255 | -#define _SPL_DIRENT_H | |
1256 | +#define _SPL_DIRENT_H | |
1257 | ||
1258 | #endif /* SPL_DIRENT_H */ | |
1259 | diff --git a/include/sys/disp.h b/include/sys/disp.h | |
1260 | index c3077a7..7f5ec85 100644 | |
1261 | --- a/include/sys/disp.h | |
1262 | +++ b/include/sys/disp.h | |
1263 | @@ -23,7 +23,7 @@ | |
1264 | \*****************************************************************************/ | |
1265 | ||
1266 | #ifndef _SPL_DISP_H | |
1267 | -#define _SPL_DISP_H | |
1268 | +#define _SPL_DISP_H | |
1269 | ||
1270 | #include <linux/preempt.h> | |
1271 | ||
1272 | diff --git a/include/sys/dkioc_free_util.h b/include/sys/dkioc_free_util.h | |
1273 | index bea5a5b..6b1b941 100644 | |
1274 | --- a/include/sys/dkioc_free_util.h | |
1275 | +++ b/include/sys/dkioc_free_util.h | |
1276 | @@ -52,7 +52,7 @@ static inline void dfl_free(dkioc_free_list_t *dfl) { | |
1277 | } | |
1278 | ||
1279 | static inline dkioc_free_list_t *dfl_alloc(uint64_t dfl_num_exts, int flags) { | |
1280 | - return vmem_zalloc(DFL_SZ(dfl_num_exts), flags); | |
1281 | + return (vmem_zalloc(DFL_SZ(dfl_num_exts), flags)); | |
1282 | } | |
1283 | ||
1284 | #endif /* _SPL_DKIOC_UTIL_H */ | |
1285 | diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h | |
1286 | index 99d16c8..2014af5 100644 | |
1287 | --- a/include/sys/dnlc.h | |
1288 | +++ b/include/sys/dnlc.h | |
1289 | @@ -23,6 +23,6 @@ | |
1290 | \*****************************************************************************/ | |
1291 | ||
1292 | #ifndef _SPL_DNLC_H | |
1293 | -#define _SPL_DNLC_H | |
1294 | +#define _SPL_DNLC_H | |
1295 | ||
1296 | #endif /* SPL_DNLC_H */ | |
1297 | diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h | |
1298 | index 1b45058..84c5b76 100644 | |
1299 | --- a/include/sys/dumphdr.h | |
1300 | +++ b/include/sys/dumphdr.h | |
1301 | @@ -23,6 +23,6 @@ | |
1302 | \*****************************************************************************/ | |
1303 | ||
1304 | #ifndef _SPL_DUMPHDR_H | |
1305 | -#define _SPL_DUMPHDR_H | |
1306 | +#define _SPL_DUMPHDR_H | |
1307 | ||
1308 | #endif /* SPL_DUMPHDR_H */ | |
1309 | diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h | |
1310 | index c392364..96739a1 100644 | |
1311 | --- a/include/sys/efi_partition.h | |
1312 | +++ b/include/sys/efi_partition.h | |
1313 | @@ -23,6 +23,6 @@ | |
1314 | \*****************************************************************************/ | |
1315 | ||
1316 | #ifndef _SPL_EFI_PARTITION_H | |
1317 | -#define _SPL_EFI_PARTITION_H | |
1318 | +#define _SPL_EFI_PARTITION_H | |
1319 | ||
1320 | #endif /* SPL_EFI_PARTITION_H */ | |
1321 | diff --git a/include/sys/errno.h b/include/sys/errno.h | |
1322 | index 64d8482..6b151bb 100644 | |
1323 | --- a/include/sys/errno.h | |
1324 | +++ b/include/sys/errno.h | |
1325 | @@ -23,6 +23,6 @@ | |
1326 | \*****************************************************************************/ | |
1327 | ||
1328 | #ifndef _SPL_ERRNO_H | |
1329 | -#define _SPL_ERRNO_H | |
1330 | +#define _SPL_ERRNO_H | |
1331 | ||
1332 | #endif /* SPL_ERRNO_H */ | |
1333 | diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h | |
1334 | index 88b7a69..d71c39b 100644 | |
1335 | --- a/include/sys/fcntl.h | |
1336 | +++ b/include/sys/fcntl.h | |
1337 | @@ -22,11 +22,11 @@ | |
1338 | \*****************************************************************************/ | |
1339 | ||
1340 | #ifndef _SPL_FCNTL_H | |
1341 | -#define _SPL_FCNTL_H | |
1342 | +#define _SPL_FCNTL_H | |
1343 | ||
1344 | #include <asm/fcntl.h> | |
1345 | ||
1346 | -#define F_FREESP 11 | |
1347 | +#define F_FREESP 11 | |
1348 | ||
1349 | #ifdef CONFIG_64BIT | |
1350 | typedef struct flock flock64_t; | |
1351 | diff --git a/include/sys/file.h b/include/sys/file.h | |
1352 | index 67b301c..20fa7dc 100644 | |
1353 | --- a/include/sys/file.h | |
1354 | +++ b/include/sys/file.h | |
1355 | @@ -23,7 +23,7 @@ | |
1356 | \*****************************************************************************/ | |
1357 | ||
1358 | #ifndef _SPL_FILE_H | |
1359 | -#define _SPL_FILE_H | |
1360 | +#define _SPL_FILE_H | |
1361 | ||
1362 | #define FIGNORECASE 0x00080000 | |
1363 | #define FKIOCTL 0x80000000 | |
1364 | diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h | |
1365 | index a5df129..b4745f4 100644 | |
1366 | --- a/include/sys/fs/swapnode.h | |
1367 | +++ b/include/sys/fs/swapnode.h | |
1368 | @@ -23,6 +23,6 @@ | |
1369 | \*****************************************************************************/ | |
1370 | ||
1371 | #ifndef _SPL_SWAPNODE_H | |
1372 | -#define _SPL_SWAPNODE_H | |
1373 | +#define _SPL_SWAPNODE_H | |
1374 | ||
1375 | #endif /* SPL_SWAPNODE_H */ | |
1376 | diff --git a/include/sys/idmap.h b/include/sys/idmap.h | |
1377 | index 3618c65..f524a02 100644 | |
1378 | --- a/include/sys/idmap.h | |
1379 | +++ b/include/sys/idmap.h | |
1380 | @@ -22,8 +22,8 @@ | |
1381 | \*****************************************************************************/ | |
1382 | ||
1383 | #ifndef _SPL_IDMAP_H | |
1384 | -#define _SPL_IDMAP_H | |
1385 | +#define _SPL_IDMAP_H | |
1386 | ||
1387 | -#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U | |
1388 | +#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U | |
1389 | ||
1390 | #endif /* SPL_IDMAP_H */ | |
1391 | diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h | |
1392 | index 64f0a11..689d9d7 100644 | |
1393 | --- a/include/sys/int_limits.h | |
1394 | +++ b/include/sys/int_limits.h | |
1395 | @@ -23,6 +23,6 @@ | |
1396 | \*****************************************************************************/ | |
1397 | ||
1398 | #ifndef _SPL_INT_LIMITS_H | |
1399 | -#define _SPL_INT_LIMITS_H | |
1400 | +#define _SPL_INT_LIMITS_H | |
1401 | ||
1402 | #endif /* SPL_INT_LIMITS_H */ | |
1403 | diff --git a/include/sys/int_types.h b/include/sys/int_types.h | |
1404 | index 582fded..fd4dafa 100644 | |
1405 | --- a/include/sys/int_types.h | |
1406 | +++ b/include/sys/int_types.h | |
1407 | @@ -23,7 +23,7 @@ | |
1408 | \*****************************************************************************/ | |
1409 | ||
1410 | #ifndef _SPL_INT_TYPES_H | |
1411 | -#define _SPL_INT_TYPES_H | |
1412 | +#define _SPL_INT_TYPES_H | |
1413 | ||
1414 | #include <sys/inttypes.h> | |
1415 | ||
1416 | diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h | |
1417 | index 82e555c..e63383e 100644 | |
1418 | --- a/include/sys/inttypes.h | |
1419 | +++ b/include/sys/inttypes.h | |
1420 | @@ -23,6 +23,6 @@ | |
1421 | \*****************************************************************************/ | |
1422 | ||
1423 | #ifndef _SPL_INTTYPES_H | |
1424 | -#define _SPL_INTTYPES_H | |
1425 | +#define _SPL_INTTYPES_H | |
1426 | ||
1427 | #endif /* SPL_INTTYPES_H */ | |
1428 | diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h | |
1429 | index 738795c..5559782 100644 | |
1430 | --- a/include/sys/isa_defs.h | |
1431 | +++ b/include/sys/isa_defs.h | |
1432 | @@ -29,59 +29,59 @@ | |
1433 | #if defined(__x86_64) || defined(__x86_64__) | |
1434 | ||
1435 | #if !defined(__x86_64) | |
1436 | -#define __x86_64 | |
1437 | +#define __x86_64 | |
1438 | #endif | |
1439 | ||
1440 | #if !defined(__amd64) | |
1441 | -#define __amd64 | |
1442 | +#define __amd64 | |
1443 | #endif | |
1444 | ||
1445 | #if !defined(__x86) | |
1446 | -#define __x86 | |
1447 | +#define __x86 | |
1448 | #endif | |
1449 | ||
1450 | #if !defined(_LP64) | |
1451 | -#define _LP64 | |
1452 | +#define _LP64 | |
1453 | #endif | |
1454 | ||
1455 | -#define _ALIGNMENT_REQUIRED 1 | |
1456 | +#define _ALIGNMENT_REQUIRED 1 | |
1457 | ||
1458 | ||
1459 | /* i386 arch specific defines */ | |
1460 | #elif defined(__i386) || defined(__i386__) | |
1461 | ||
1462 | #if !defined(__i386) | |
1463 | -#define __i386 | |
1464 | +#define __i386 | |
1465 | #endif | |
1466 | ||
1467 | #if !defined(__x86) | |
1468 | -#define __x86 | |
1469 | +#define __x86 | |
1470 | #endif | |
1471 | ||
1472 | #if !defined(_ILP32) | |
1473 | -#define _ILP32 | |
1474 | +#define _ILP32 | |
1475 | #endif | |
1476 | ||
1477 | -#define _ALIGNMENT_REQUIRED 0 | |
1478 | +#define _ALIGNMENT_REQUIRED 0 | |
1479 | ||
1480 | /* powerpc (ppc64) arch specific defines */ | |
1481 | #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) | |
1482 | ||
1483 | #if !defined(__powerpc) | |
1484 | -#define __powerpc | |
1485 | +#define __powerpc | |
1486 | #endif | |
1487 | ||
1488 | #if !defined(__powerpc__) | |
1489 | -#define __powerpc__ | |
1490 | +#define __powerpc__ | |
1491 | #endif | |
1492 | ||
1493 | #if defined(__powerpc64__) | |
1494 | #if !defined(_LP64) | |
1495 | -#define _LP64 | |
1496 | +#define _LP64 | |
1497 | #endif | |
1498 | #else | |
1499 | #if !defined(_ILP32) | |
1500 | -#define _ILP32 | |
1501 | +#define _ILP32 | |
1502 | #endif | |
1503 | #endif | |
1504 | ||
1505 | @@ -89,65 +89,65 @@ | |
1506 | * Illumos doesn't define _ALIGNMENT_REQUIRED for PPC, so default to 1 | |
1507 | * out of paranoia. | |
1508 | */ | |
1509 | -#define _ALIGNMENT_REQUIRED 1 | |
1510 | +#define _ALIGNMENT_REQUIRED 1 | |
1511 | ||
1512 | /* arm arch specific defines */ | |
1513 | #elif defined(__arm) || defined(__arm__) || defined(__aarch64__) | |
1514 | ||
1515 | #if !defined(__arm) | |
1516 | -#define __arm | |
1517 | +#define __arm | |
1518 | #endif | |
1519 | ||
1520 | #if !defined(__arm__) | |
1521 | -#define __arm__ | |
1522 | +#define __arm__ | |
1523 | #endif | |
1524 | ||
1525 | #if defined(__aarch64__) | |
1526 | #if !defined(_LP64) | |
1527 | -#define _LP64 | |
1528 | +#define _LP64 | |
1529 | #endif | |
1530 | #else | |
1531 | #if !defined(_ILP32) | |
1532 | -#define _ILP32 | |
1533 | +#define _ILP32 | |
1534 | #endif | |
1535 | #endif | |
1536 | ||
1537 | #if defined(__ARMEL__) || defined(__AARCH64EL__) | |
1538 | -#define _LITTLE_ENDIAN | |
1539 | +#define _LITTLE_ENDIAN | |
1540 | #else | |
1541 | -#define _BIG_ENDIAN | |
1542 | +#define _BIG_ENDIAN | |
1543 | #endif | |
1544 | ||
1545 | /* | |
1546 | * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1 | |
1547 | * out of paranoia. | |
1548 | */ | |
1549 | -#define _ALIGNMENT_REQUIRED 1 | |
1550 | +#define _ALIGNMENT_REQUIRED 1 | |
1551 | ||
1552 | /* sparc arch specific defines */ | |
1553 | #elif defined(__sparc) || defined(__sparc__) | |
1554 | ||
1555 | #if !defined(__sparc) | |
1556 | -#define __sparc | |
1557 | +#define __sparc | |
1558 | #endif | |
1559 | ||
1560 | #if !defined(__sparc__) | |
1561 | -#define __sparc__ | |
1562 | +#define __sparc__ | |
1563 | #endif | |
1564 | ||
1565 | #if defined(__arch64__) | |
1566 | #if !defined(_LP64) | |
1567 | -#define _LP64 | |
1568 | +#define _LP64 | |
1569 | #endif | |
1570 | #else | |
1571 | #if !defined(_ILP32) | |
1572 | -#define _ILP32 | |
1573 | +#define _ILP32 | |
1574 | #endif | |
1575 | #endif | |
1576 | ||
1577 | -#define _BIG_ENDIAN | |
1578 | -#define _SUNOS_VTOC_16 | |
1579 | -#define _ALIGNMENT_REQUIRED 1 | |
1580 | +#define _BIG_ENDIAN | |
1581 | +#define _SUNOS_VTOC_16 | |
1582 | +#define _ALIGNMENT_REQUIRED 1 | |
1583 | ||
1584 | /* s390 arch specific defines */ | |
1585 | #elif defined(__s390__) | |
1586 | @@ -167,7 +167,7 @@ | |
1587 | * Illumos doesn't define _ALIGNMENT_REQUIRED for s390, so default to 1 | |
1588 | * out of paranoia. | |
1589 | */ | |
1590 | -#define _ALIGNMENT_REQUIRED 1 | |
1591 | +#define _ALIGNMENT_REQUIRED 1 | |
1592 | ||
1593 | /* MIPS arch specific defines */ | |
1594 | #elif defined(__mips__) | |
1595 | @@ -190,7 +190,7 @@ | |
1596 | * Illumos doesn't define _ALIGNMENT_REQUIRED for MIPS, so default to 1 | |
1597 | * out of paranoia. | |
1598 | */ | |
1599 | -#define _ALIGNMENT_REQUIRED 1 | |
1600 | +#define _ALIGNMENT_REQUIRED 1 | |
1601 | ||
1602 | #else | |
1603 | /* | |
1604 | @@ -211,11 +211,11 @@ | |
1605 | #include <sys/byteorder.h> | |
1606 | ||
1607 | #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN) | |
1608 | -#define _LITTLE_ENDIAN __LITTLE_ENDIAN | |
1609 | +#define _LITTLE_ENDIAN __LITTLE_ENDIAN | |
1610 | #endif | |
1611 | ||
1612 | #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN) | |
1613 | -#define _BIG_ENDIAN __BIG_ENDIAN | |
1614 | +#define _BIG_ENDIAN __BIG_ENDIAN | |
1615 | #endif | |
1616 | ||
1617 | #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) | |
1618 | diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h | |
1619 | index 3d67b51..ce31d35 100644 | |
1620 | --- a/include/sys/kidmap.h | |
1621 | +++ b/include/sys/kidmap.h | |
1622 | @@ -23,7 +23,7 @@ | |
1623 | \*****************************************************************************/ | |
1624 | ||
1625 | #ifndef _SPL_KIDMAP_H | |
1626 | -#define _SPL_KIDMAP_H | |
1627 | +#define _SPL_KIDMAP_H | |
1628 | ||
1629 | #include <sys/idmap.h> | |
1630 | ||
1631 | diff --git a/include/sys/kobj.h b/include/sys/kobj.h | |
1632 | index 334449a..a688843 100644 | |
1633 | --- a/include/sys/kobj.h | |
1634 | +++ b/include/sys/kobj.h | |
1635 | @@ -23,7 +23,7 @@ | |
1636 | \*****************************************************************************/ | |
1637 | ||
1638 | #ifndef _SPL_KOBJ_H | |
1639 | -#define _SPL_KOBJ_H | |
1640 | +#define _SPL_KOBJ_H | |
1641 | ||
1642 | #include <sys/vnode.h> | |
1643 | ||
1644 | diff --git a/include/sys/kstat.h b/include/sys/kstat.h | |
1645 | index 7862ab0..2018019 100644 | |
1646 | --- a/include/sys/kstat.h | |
1647 | +++ b/include/sys/kstat.h | |
1648 | @@ -23,7 +23,7 @@ | |
1649 | \*****************************************************************************/ | |
1650 | ||
1651 | #ifndef _SPL_KSTAT_H | |
1652 | -#define _SPL_KSTAT_H | |
1653 | +#define _SPL_KSTAT_H | |
1654 | ||
1655 | #include <linux/module.h> | |
1656 | #include <linux/proc_compat.h> | |
1657 | @@ -32,63 +32,65 @@ | |
1658 | #include <sys/kmem.h> | |
1659 | #include <sys/mutex.h> | |
1660 | ||
1661 | -#define KSTAT_STRLEN 255 | |
1662 | -#define KSTAT_RAW_MAX (128*1024) | |
1663 | +#define KSTAT_STRLEN 255 | |
1664 | +#define KSTAT_RAW_MAX (128*1024) | |
1665 | ||
1666 | -/* For reference valid classes are: | |
1667 | +/* | |
1668 | + * For reference valid classes are: | |
1669 | * disk, tape, net, controller, vm, kvm, hat, streams, kstat, misc | |
1670 | */ | |
1671 | ||
1672 | -#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */ | |
1673 | -#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */ | |
1674 | -#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ | |
1675 | -#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ | |
1676 | -#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ | |
1677 | -#define KSTAT_NUM_TYPES 5 | |
1678 | - | |
1679 | -#define KSTAT_DATA_CHAR 0 | |
1680 | -#define KSTAT_DATA_INT32 1 | |
1681 | -#define KSTAT_DATA_UINT32 2 | |
1682 | -#define KSTAT_DATA_INT64 3 | |
1683 | -#define KSTAT_DATA_UINT64 4 | |
1684 | -#define KSTAT_DATA_LONG 5 | |
1685 | -#define KSTAT_DATA_ULONG 6 | |
1686 | -#define KSTAT_DATA_STRING 7 | |
1687 | -#define KSTAT_NUM_DATAS 8 | |
1688 | - | |
1689 | -#define KSTAT_INTR_HARD 0 | |
1690 | -#define KSTAT_INTR_SOFT 1 | |
1691 | -#define KSTAT_INTR_WATCHDOG 2 | |
1692 | -#define KSTAT_INTR_SPURIOUS 3 | |
1693 | -#define KSTAT_INTR_MULTSVC 4 | |
1694 | -#define KSTAT_NUM_INTRS 5 | |
1695 | - | |
1696 | -#define KSTAT_FLAG_VIRTUAL 0x01 | |
1697 | -#define KSTAT_FLAG_VAR_SIZE 0x02 | |
1698 | -#define KSTAT_FLAG_WRITABLE 0x04 | |
1699 | -#define KSTAT_FLAG_PERSISTENT 0x08 | |
1700 | -#define KSTAT_FLAG_DORMANT 0x10 | |
1701 | -#define KSTAT_FLAG_UNSUPPORTED (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \ | |
1702 | - KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT) | |
1703 | - | |
1704 | - | |
1705 | -#define KS_MAGIC 0x9d9d9d9d | |
1706 | +#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */ | |
1707 | +#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */ | |
1708 | +#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ | |
1709 | +#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ | |
1710 | +#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ | |
1711 | +#define KSTAT_NUM_TYPES 5 | |
1712 | + | |
1713 | +#define KSTAT_DATA_CHAR 0 | |
1714 | +#define KSTAT_DATA_INT32 1 | |
1715 | +#define KSTAT_DATA_UINT32 2 | |
1716 | +#define KSTAT_DATA_INT64 3 | |
1717 | +#define KSTAT_DATA_UINT64 4 | |
1718 | +#define KSTAT_DATA_LONG 5 | |
1719 | +#define KSTAT_DATA_ULONG 6 | |
1720 | +#define KSTAT_DATA_STRING 7 | |
1721 | +#define KSTAT_NUM_DATAS 8 | |
1722 | + | |
1723 | +#define KSTAT_INTR_HARD 0 | |
1724 | +#define KSTAT_INTR_SOFT 1 | |
1725 | +#define KSTAT_INTR_WATCHDOG 2 | |
1726 | +#define KSTAT_INTR_SPURIOUS 3 | |
1727 | +#define KSTAT_INTR_MULTSVC 4 | |
1728 | +#define KSTAT_NUM_INTRS 5 | |
1729 | + | |
1730 | +#define KSTAT_FLAG_VIRTUAL 0x01 | |
1731 | +#define KSTAT_FLAG_VAR_SIZE 0x02 | |
1732 | +#define KSTAT_FLAG_WRITABLE 0x04 | |
1733 | +#define KSTAT_FLAG_PERSISTENT 0x08 | |
1734 | +#define KSTAT_FLAG_DORMANT 0x10 | |
1735 | +#define KSTAT_FLAG_UNSUPPORTED \ | |
1736 | + (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \ | |
1737 | + KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT) | |
1738 | + | |
1739 | + | |
1740 | +#define KS_MAGIC 0x9d9d9d9d | |
1741 | ||
1742 | /* Dynamic updates */ | |
1743 | -#define KSTAT_READ 0 | |
1744 | -#define KSTAT_WRITE 1 | |
1745 | +#define KSTAT_READ 0 | |
1746 | +#define KSTAT_WRITE 1 | |
1747 | ||
1748 | struct kstat_s; | |
1749 | typedef struct kstat_s kstat_t; | |
1750 | ||
1751 | -typedef int kid_t; /* unique kstat id */ | |
1752 | -typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */ | |
1753 | +typedef int kid_t; /* unique kstat id */ | |
1754 | +typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */ | |
1755 | ||
1756 | typedef struct kstat_module { | |
1757 | - char ksm_name[KSTAT_STRLEN+1]; /* module name */ | |
1758 | - struct list_head ksm_module_list; /* module linkage */ | |
1759 | - struct list_head ksm_kstat_list; /* list of kstat entries */ | |
1760 | - struct proc_dir_entry *ksm_proc; /* proc entry */ | |
1761 | + char ksm_name[KSTAT_STRLEN+1]; /* module name */ | |
1762 | + struct list_head ksm_module_list; /* module linkage */ | |
1763 | + struct list_head ksm_kstat_list; /* list of kstat entries */ | |
1764 | + struct proc_dir_entry *ksm_proc; /* proc entry */ | |
1765 | } kstat_module_t; | |
1766 | ||
1767 | typedef struct kstat_raw_ops { | |
1768 | @@ -98,95 +100,96 @@ typedef struct kstat_raw_ops { | |
1769 | } kstat_raw_ops_t; | |
1770 | ||
1771 | struct kstat_s { | |
1772 | - int ks_magic; /* magic value */ | |
1773 | - kid_t ks_kid; /* unique kstat ID */ | |
1774 | - hrtime_t ks_crtime; /* creation time */ | |
1775 | - hrtime_t ks_snaptime; /* last access time */ | |
1776 | - char ks_module[KSTAT_STRLEN+1]; /* provider module name */ | |
1777 | - int ks_instance; /* provider module instance */ | |
1778 | - char ks_name[KSTAT_STRLEN+1]; /* kstat name */ | |
1779 | - char ks_class[KSTAT_STRLEN+1]; /* kstat class */ | |
1780 | - uchar_t ks_type; /* kstat data type */ | |
1781 | - uchar_t ks_flags; /* kstat flags */ | |
1782 | - void *ks_data; /* kstat type-specific data */ | |
1783 | - uint_t ks_ndata; /* # of type-specific data records */ | |
1784 | - size_t ks_data_size; /* size of kstat data section */ | |
1785 | - struct proc_dir_entry *ks_proc; /* proc linkage */ | |
1786 | - kstat_update_t *ks_update; /* dynamic updates */ | |
1787 | - void *ks_private; /* private data */ | |
1788 | - kmutex_t ks_private_lock; /* kstat private data lock */ | |
1789 | - kmutex_t *ks_lock; /* kstat data lock */ | |
1790 | - struct list_head ks_list; /* kstat linkage */ | |
1791 | - kstat_module_t *ks_owner; /* kstat module linkage */ | |
1792 | - kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */ | |
1793 | - char *ks_raw_buf; /* buf used for raw ops */ | |
1794 | - size_t ks_raw_bufsize; /* size of raw ops buffer */ | |
1795 | + int ks_magic; /* magic value */ | |
1796 | + kid_t ks_kid; /* unique kstat ID */ | |
1797 | + hrtime_t ks_crtime; /* creation time */ | |
1798 | + hrtime_t ks_snaptime; /* last access time */ | |
1799 | + char ks_module[KSTAT_STRLEN+1]; /* provider module name */ | |
1800 | + int ks_instance; /* provider module instance */ | |
1801 | + char ks_name[KSTAT_STRLEN+1]; /* kstat name */ | |
1802 | + char ks_class[KSTAT_STRLEN+1]; /* kstat class */ | |
1803 | + uchar_t ks_type; /* kstat data type */ | |
1804 | + uchar_t ks_flags; /* kstat flags */ | |
1805 | + void *ks_data; /* kstat type-specific data */ | |
1806 | + uint_t ks_ndata; /* # of data records */ | |
1807 | + size_t ks_data_size; /* size of kstat data section */ | |
1808 | + struct proc_dir_entry *ks_proc; /* proc linkage */ | |
1809 | + kstat_update_t *ks_update; /* dynamic updates */ | |
1810 | + void *ks_private; /* private data */ | |
1811 | + kmutex_t ks_private_lock; /* kstat private data lock */ | |
1812 | + kmutex_t *ks_lock; /* kstat data lock */ | |
1813 | + struct list_head ks_list; /* kstat linkage */ | |
1814 | + kstat_module_t *ks_owner; /* kstat module linkage */ | |
1815 | + kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */ | |
1816 | + char *ks_raw_buf; /* buf used for raw ops */ | |
1817 | + size_t ks_raw_bufsize; /* size of raw ops buffer */ | |
1818 | }; | |
1819 | ||
1820 | typedef struct kstat_named_s { | |
1821 | - char name[KSTAT_STRLEN]; /* name of counter */ | |
1822 | - uchar_t data_type; /* data type */ | |
1823 | - union { | |
1824 | - char c[16]; /* 128-bit int */ | |
1825 | - int32_t i32; /* 32-bit signed int */ | |
1826 | - uint32_t ui32; /* 32-bit unsigned int */ | |
1827 | - int64_t i64; /* 64-bit signed int */ | |
1828 | - uint64_t ui64; /* 64-bit unsigned int */ | |
1829 | - long l; /* native signed long */ | |
1830 | - ulong_t ul; /* native unsigned long */ | |
1831 | - struct { | |
1832 | - union { | |
1833 | - char *ptr; /* NULL-term string */ | |
1834 | - char __pad[8]; /* 64-bit padding */ | |
1835 | - } addr; | |
1836 | - uint32_t len; /* # bytes for strlen + '\0' */ | |
1837 | - } string; | |
1838 | - } value; | |
1839 | + char name[KSTAT_STRLEN]; /* name of counter */ | |
1840 | + uchar_t data_type; /* data type */ | |
1841 | + union { | |
1842 | + char c[16]; /* 128-bit int */ | |
1843 | + int32_t i32; /* 32-bit signed int */ | |
1844 | + uint32_t ui32; /* 32-bit unsigned int */ | |
1845 | + int64_t i64; /* 64-bit signed int */ | |
1846 | + uint64_t ui64; /* 64-bit unsigned int */ | |
1847 | + long l; /* native signed long */ | |
1848 | + ulong_t ul; /* native unsigned long */ | |
1849 | + struct { | |
1850 | + union { | |
1851 | + char *ptr; /* NULL-term string */ | |
1852 | + char __pad[8]; /* 64-bit padding */ | |
1853 | + } addr; | |
1854 | + uint32_t len; /* # bytes for strlen + '\0' */ | |
1855 | + } string; | |
1856 | + } value; | |
1857 | } kstat_named_t; | |
1858 | ||
1859 | -#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr) | |
1860 | -#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len) | |
1861 | +#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr) | |
1862 | +#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len) | |
1863 | ||
1864 | typedef struct kstat_intr { | |
1865 | - uint_t intrs[KSTAT_NUM_INTRS]; | |
1866 | + uint_t intrs[KSTAT_NUM_INTRS]; | |
1867 | } kstat_intr_t; | |
1868 | ||
1869 | typedef struct kstat_io { | |
1870 | - u_longlong_t nread; /* number of bytes read */ | |
1871 | - u_longlong_t nwritten; /* number of bytes written */ | |
1872 | - uint_t reads; /* number of read operations */ | |
1873 | - uint_t writes; /* number of write operations */ | |
1874 | - hrtime_t wtime; /* cumulative wait (pre-service) time */ | |
1875 | - hrtime_t wlentime; /* cumulative wait length*time product*/ | |
1876 | - hrtime_t wlastupdate; /* last time wait queue changed */ | |
1877 | - hrtime_t rtime; /* cumulative run (service) time */ | |
1878 | - hrtime_t rlentime; /* cumulative run length*time product */ | |
1879 | - hrtime_t rlastupdate; /* last time run queue changed */ | |
1880 | - uint_t wcnt; /* count of elements in wait state */ | |
1881 | - uint_t rcnt; /* count of elements in run state */ | |
1882 | + u_longlong_t nread; /* number of bytes read */ | |
1883 | + u_longlong_t nwritten; /* number of bytes written */ | |
1884 | + uint_t reads; /* number of read operations */ | |
1885 | + uint_t writes; /* number of write operations */ | |
1886 | + hrtime_t wtime; /* cumulative wait (pre-service) time */ | |
1887 | + hrtime_t wlentime; /* cumulative wait len*time product */ | |
1888 | + hrtime_t wlastupdate; /* last time wait queue changed */ | |
1889 | + hrtime_t rtime; /* cumulative run (service) time */ | |
1890 | + hrtime_t rlentime; /* cumulative run length*time product */ | |
1891 | + hrtime_t rlastupdate; /* last time run queue changed */ | |
1892 | + uint_t wcnt; /* count of elements in wait state */ | |
1893 | + uint_t rcnt; /* count of elements in run state */ | |
1894 | } kstat_io_t; | |
1895 | ||
1896 | typedef struct kstat_timer { | |
1897 | - char name[KSTAT_STRLEN+1]; /* event name */ | |
1898 | - u_longlong_t num_events; /* number of events */ | |
1899 | - hrtime_t elapsed_time; /* cumulative elapsed time */ | |
1900 | - hrtime_t min_time; /* shortest event duration */ | |
1901 | - hrtime_t max_time; /* longest event duration */ | |
1902 | - hrtime_t start_time; /* previous event start time */ | |
1903 | - hrtime_t stop_time; /* previous event stop time */ | |
1904 | + char name[KSTAT_STRLEN+1]; /* event name */ | |
1905 | + u_longlong_t num_events; /* number of events */ | |
1906 | + hrtime_t elapsed_time; /* cumulative elapsed time */ | |
1907 | + hrtime_t min_time; /* shortest event duration */ | |
1908 | + hrtime_t max_time; /* longest event duration */ | |
1909 | + hrtime_t start_time; /* previous event start time */ | |
1910 | + hrtime_t stop_time; /* previous event stop time */ | |
1911 | } kstat_timer_t; | |
1912 | ||
1913 | int spl_kstat_init(void); | |
1914 | void spl_kstat_fini(void); | |
1915 | ||
1916 | extern void __kstat_set_raw_ops(kstat_t *ksp, | |
1917 | - int (*headers)(char *buf, size_t size), | |
1918 | - int (*data)(char *buf, size_t size, void *data), | |
1919 | - void* (*addr)(kstat_t *ksp, loff_t index)); | |
1920 | + int (*headers)(char *buf, size_t size), | |
1921 | + int (*data)(char *buf, size_t size, void *data), | |
1922 | + void* (*addr)(kstat_t *ksp, loff_t index)); | |
1923 | + | |
1924 | extern kstat_t *__kstat_create(const char *ks_module, int ks_instance, | |
1925 | - const char *ks_name, const char *ks_class, | |
1926 | - uchar_t ks_type, uint_t ks_ndata, | |
1927 | - uchar_t ks_flags); | |
1928 | + const char *ks_name, const char *ks_class, uchar_t ks_type, | |
1929 | + uint_t ks_ndata, uchar_t ks_flags); | |
1930 | + | |
1931 | extern void __kstat_install(kstat_t *ksp); | |
1932 | extern void __kstat_delete(kstat_t *ksp); | |
1933 | extern void kstat_waitq_enter(kstat_io_t *); | |
1934 | @@ -194,9 +197,12 @@ extern void kstat_waitq_exit(kstat_io_t *); | |
1935 | extern void kstat_runq_enter(kstat_io_t *); | |
1936 | extern void kstat_runq_exit(kstat_io_t *); | |
1937 | ||
1938 | -#define kstat_set_raw_ops(k,h,d,a) __kstat_set_raw_ops(k,h,d,a) | |
1939 | -#define kstat_create(m,i,n,c,t,s,f) __kstat_create(m,i,n,c,t,s,f) | |
1940 | -#define kstat_install(k) __kstat_install(k) | |
1941 | -#define kstat_delete(k) __kstat_delete(k) | |
1942 | +#define kstat_set_raw_ops(k, h, d, a) \ | |
1943 | + __kstat_set_raw_ops(k, h, d, a) | |
1944 | +#define kstat_create(m, i, n, c, t, s, f) \ | |
1945 | + __kstat_create(m, i, n, c, t, s, f) | |
1946 | + | |
1947 | +#define kstat_install(k) __kstat_install(k) | |
1948 | +#define kstat_delete(k) __kstat_delete(k) | |
1949 | ||
1950 | #endif /* _SPL_KSTAT_H */ | |
1951 | diff --git a/include/sys/list.h b/include/sys/list.h | |
1952 | index 563784a..9aba3b4 100644 | |
1953 | --- a/include/sys/list.h | |
1954 | +++ b/include/sys/list.h | |
1955 | @@ -23,7 +23,7 @@ | |
1956 | \*****************************************************************************/ | |
1957 | ||
1958 | #ifndef _SPL_LIST_H | |
1959 | -#define _SPL_LIST_H | |
1960 | +#define _SPL_LIST_H | |
1961 | ||
1962 | #include <sys/types.h> | |
1963 | #include <linux/list.h> | |
1964 | @@ -53,13 +53,13 @@ typedef struct list { | |
1965 | list_node_t list_head; | |
1966 | } list_t; | |
1967 | ||
1968 | -#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) | |
1969 | -#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) | |
1970 | +#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) | |
1971 | +#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) | |
1972 | ||
1973 | static inline int | |
1974 | list_is_empty(list_t *list) | |
1975 | { | |
1976 | - return list_empty(&list->list_head); | |
1977 | + return (list_empty(&list->list_head)); | |
1978 | } | |
1979 | ||
1980 | static inline void | |
1981 | @@ -74,7 +74,7 @@ list_create(list_t *list, size_t size, size_t offset) | |
1982 | { | |
1983 | ASSERT(list); | |
1984 | ASSERT(size > 0); | |
1985 | - ASSERT(size >= offset + sizeof(list_node_t)); | |
1986 | + ASSERT(size >= offset + sizeof (list_node_t)); | |
1987 | ||
1988 | list->list_size = size; | |
1989 | list->list_offset = offset; | |
1990 | @@ -132,10 +132,10 @@ list_remove_head(list_t *list) | |
1991 | { | |
1992 | list_node_t *head = list->list_head.next; | |
1993 | if (head == &list->list_head) | |
1994 | - return NULL; | |
1995 | + return (NULL); | |
1996 | ||
1997 | list_del(head); | |
1998 | - return list_object(list, head); | |
1999 | + return (list_object(list, head)); | |
2000 | } | |
2001 | ||
2002 | static inline void * | |
2003 | @@ -143,28 +143,28 @@ list_remove_tail(list_t *list) | |
2004 | { | |
2005 | list_node_t *tail = list->list_head.prev; | |
2006 | if (tail == &list->list_head) | |
2007 | - return NULL; | |
2008 | + return (NULL); | |
2009 | ||
2010 | list_del(tail); | |
2011 | - return list_object(list, tail); | |
2012 | + return (list_object(list, tail)); | |
2013 | } | |
2014 | ||
2015 | static inline void * | |
2016 | list_head(list_t *list) | |
2017 | { | |
2018 | if (list_is_empty(list)) | |
2019 | - return NULL; | |
2020 | + return (NULL); | |
2021 | ||
2022 | - return list_object(list, list->list_head.next); | |
2023 | + return (list_object(list, list->list_head.next)); | |
2024 | } | |
2025 | ||
2026 | static inline void * | |
2027 | list_tail(list_t *list) | |
2028 | { | |
2029 | if (list_is_empty(list)) | |
2030 | - return NULL; | |
2031 | + return (NULL); | |
2032 | ||
2033 | - return list_object(list, list->list_head.prev); | |
2034 | + return (list_object(list, list->list_head.prev)); | |
2035 | } | |
2036 | ||
2037 | static inline void * | |
2038 | @@ -173,9 +173,9 @@ list_next(list_t *list, void *object) | |
2039 | list_node_t *node = list_d2l(list, object); | |
2040 | ||
2041 | if (node->next != &list->list_head) | |
2042 | - return list_object(list, node->next); | |
2043 | + return (list_object(list, node->next)); | |
2044 | ||
2045 | - return NULL; | |
2046 | + return (NULL); | |
2047 | } | |
2048 | ||
2049 | static inline void * | |
2050 | @@ -184,9 +184,9 @@ list_prev(list_t *list, void *object) | |
2051 | list_node_t *node = list_d2l(list, object); | |
2052 | ||
2053 | if (node->prev != &list->list_head) | |
2054 | - return list_object(list, node->prev); | |
2055 | + return (list_object(list, node->prev)); | |
2056 | ||
2057 | - return NULL; | |
2058 | + return (NULL); | |
2059 | } | |
2060 | ||
2061 | static inline int | |
2062 | @@ -201,7 +201,7 @@ spl_list_move_tail(list_t *dst, list_t *src) | |
2063 | list_splice_init(&src->list_head, dst->list_head.prev); | |
2064 | } | |
2065 | ||
2066 | -#define list_move_tail(dst, src) spl_list_move_tail(dst, src) | |
2067 | +#define list_move_tail(dst, src) spl_list_move_tail(dst, src) | |
2068 | ||
2069 | static inline void | |
2070 | list_link_replace(list_node_t *old_node, list_node_t *new_node) | |
2071 | diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h | |
2072 | index d765b73..8fbbc0c 100644 | |
2073 | --- a/include/sys/mkdev.h | |
2074 | +++ b/include/sys/mkdev.h | |
2075 | @@ -23,6 +23,6 @@ | |
2076 | \*****************************************************************************/ | |
2077 | ||
2078 | #ifndef _SPL_MKDEV_H | |
2079 | -#define _SPL_MKDEV_H | |
2080 | +#define _SPL_MKDEV_H | |
2081 | ||
2082 | #endif /* SPL_MKDEV_H */ | |
2083 | diff --git a/include/sys/mntent.h b/include/sys/mntent.h | |
2084 | index 66fae87..61ccac3 100644 | |
2085 | --- a/include/sys/mntent.h | |
2086 | +++ b/include/sys/mntent.h | |
2087 | @@ -23,6 +23,6 @@ | |
2088 | \*****************************************************************************/ | |
2089 | ||
2090 | #ifndef _SPL_MNTENT_H | |
2091 | -#define _SPL_MNTENT_H | |
2092 | +#define _SPL_MNTENT_H | |
2093 | ||
2094 | #endif /* SPL_MNTENT_H */ | |
2095 | diff --git a/include/sys/modctl.h b/include/sys/modctl.h | |
2096 | index 8d79e53..36dc9a6 100644 | |
2097 | --- a/include/sys/modctl.h | |
2098 | +++ b/include/sys/modctl.h | |
2099 | @@ -23,6 +23,6 @@ | |
2100 | \*****************************************************************************/ | |
2101 | ||
2102 | #ifndef _SPL_MODCTL_H | |
2103 | -#define _SPL_MODCTL_H | |
2104 | +#define _SPL_MODCTL_H | |
2105 | ||
2106 | #endif /* SPL_MODCTL_H */ | |
2107 | diff --git a/include/sys/mode.h b/include/sys/mode.h | |
2108 | index d09965e..1b43e65 100644 | |
2109 | --- a/include/sys/mode.h | |
2110 | +++ b/include/sys/mode.h | |
2111 | @@ -23,10 +23,10 @@ | |
2112 | \*****************************************************************************/ | |
2113 | ||
2114 | #ifndef _SPL_MODE_H | |
2115 | -#define _SPL_MODE_H | |
2116 | +#define _SPL_MODE_H | |
2117 | ||
2118 | -#define IFTOVT(mode) vn_mode_to_vtype(mode) | |
2119 | -#define VTTOIF(vtype) vn_vtype_to_mode(vtype) | |
2120 | -#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) | |
2121 | +#define IFTOVT(mode) vn_mode_to_vtype(mode) | |
2122 | +#define VTTOIF(vtype) vn_vtype_to_mode(vtype) | |
2123 | +#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) | |
2124 | ||
2125 | #endif /* SPL_MODE_H */ | |
2126 | diff --git a/include/sys/mount.h b/include/sys/mount.h | |
2127 | index ca1796d..3e3d8e5 100644 | |
2128 | --- a/include/sys/mount.h | |
2129 | +++ b/include/sys/mount.h | |
2130 | @@ -23,6 +23,6 @@ | |
2131 | \*****************************************************************************/ | |
2132 | ||
2133 | #ifndef _SPL_MOUNT_H | |
2134 | -#define _SPL_MOUNT_H | |
2135 | +#define _SPL_MOUNT_H | |
2136 | ||
2137 | #endif /* SPL_MOUNT_H */ | |
2138 | diff --git a/include/sys/mutex.h b/include/sys/mutex.h | |
2139 | index 8cbab7c..c7084b3 100644 | |
2140 | --- a/include/sys/mutex.h | |
2141 | +++ b/include/sys/mutex.h | |
2142 | @@ -84,13 +84,13 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ | |
2143 | lockdep_on(); \ | |
2144 | } | |
2145 | #else /* CONFIG_LOCKDEP */ | |
2146 | -#define spl_mutex_set_type(mp, type) | |
2147 | -#define spl_mutex_lockdep_off_maybe(mp) | |
2148 | -#define spl_mutex_lockdep_on_maybe(mp) | |
2149 | +#define spl_mutex_set_type(mp, type) | |
2150 | +#define spl_mutex_lockdep_off_maybe(mp) | |
2151 | +#define spl_mutex_lockdep_on_maybe(mp) | |
2152 | #endif /* CONFIG_LOCKDEP */ | |
2153 | ||
2154 | /* | |
2155 | - * The following functions must be a #define and not static inline. | |
2156 | + * The following functions must be a #define and not static inline. | |
2157 | * This ensures that the native linux mutex functions (lock/unlock) | |
2158 | * will be correctly located in the users code which is important | |
2159 | * for the built in kernel lock analysis tools | |
2160 | @@ -113,6 +113,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ | |
2161 | VERIFY3P(mutex_owner(mp), ==, NULL); \ | |
2162 | } | |
2163 | ||
2164 | +/* BEGIN CSTYLED */ | |
2165 | #define mutex_tryenter(mp) \ | |
2166 | ({ \ | |
2167 | int _rc_; \ | |
2168 | @@ -124,6 +125,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ | |
2169 | \ | |
2170 | _rc_; \ | |
2171 | }) | |
2172 | +/* END CSTYLED */ | |
2173 | ||
2174 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
2175 | #define mutex_enter_nested(mp, subclass) \ | |
2176 | diff --git a/include/sys/note.h b/include/sys/note.h | |
2177 | index 5117562..7480adf 100644 | |
2178 | --- a/include/sys/note.h | |
2179 | +++ b/include/sys/note.h | |
2180 | @@ -23,6 +23,6 @@ | |
2181 | \*****************************************************************************/ | |
2182 | ||
2183 | #ifndef _SPL_NOTE_H | |
2184 | -#define _SPL_NOTE_H | |
2185 | +#define _SPL_NOTE_H | |
2186 | ||
2187 | #endif /* SPL_NOTE_H */ | |
2188 | diff --git a/include/sys/open.h b/include/sys/open.h | |
2189 | index e3ebd8c..bf55ee7 100644 | |
2190 | --- a/include/sys/open.h | |
2191 | +++ b/include/sys/open.h | |
2192 | @@ -23,6 +23,6 @@ | |
2193 | \*****************************************************************************/ | |
2194 | ||
2195 | #ifndef _SPL_OPEN_H | |
2196 | -#define _SPL_OPEN_H | |
2197 | +#define _SPL_OPEN_H | |
2198 | ||
2199 | #endif /* SPL_OPEN_H */ | |
2200 | diff --git a/include/sys/param.h b/include/sys/param.h | |
2201 | index 665f641..274db42 100644 | |
2202 | --- a/include/sys/param.h | |
2203 | +++ b/include/sys/param.h | |
2204 | @@ -23,14 +23,14 @@ | |
2205 | \*****************************************************************************/ | |
2206 | ||
2207 | #ifndef _SPL_PARAM_H | |
2208 | -#define _SPL_PARAM_H | |
2209 | +#define _SPL_PARAM_H | |
2210 | ||
2211 | #include <asm/page.h> | |
2212 | ||
2213 | /* Pages to bytes and back */ | |
2214 | -#define ptob(pages) ((pages) << PAGE_SHIFT) | |
2215 | -#define btop(bytes) ((bytes) >> PAGE_SHIFT) | |
2216 | +#define ptob(pages) ((pages) << PAGE_SHIFT) | |
2217 | +#define btop(bytes) ((bytes) >> PAGE_SHIFT) | |
2218 | ||
2219 | -#define MAXUID UINT32_MAX | |
2220 | +#define MAXUID UINT32_MAX | |
2221 | ||
2222 | #endif /* SPL_PARAM_H */ | |
2223 | diff --git a/include/sys/pathname.h b/include/sys/pathname.h | |
2224 | index 71ea441..812114e 100644 | |
2225 | --- a/include/sys/pathname.h | |
2226 | +++ b/include/sys/pathname.h | |
2227 | @@ -23,7 +23,7 @@ | |
2228 | \*****************************************************************************/ | |
2229 | ||
2230 | #ifndef _SPL_PATHNAME_H | |
2231 | -#define _SPL_PATHNAME_H | |
2232 | +#define _SPL_PATHNAME_H | |
2233 | ||
2234 | typedef struct pathname { | |
2235 | char *pn_buf; /* underlying storage */ | |
2236 | diff --git a/include/sys/policy.h b/include/sys/policy.h | |
2237 | index 45e724b..2892ce1 100644 | |
2238 | --- a/include/sys/policy.h | |
2239 | +++ b/include/sys/policy.h | |
2240 | @@ -23,25 +23,25 @@ | |
2241 | \*****************************************************************************/ | |
2242 | ||
2243 | #ifndef _SPL_POLICY_H | |
2244 | -#define _SPL_POLICY_H | |
2245 | +#define _SPL_POLICY_H | |
2246 | ||
2247 | -#define secpolicy_fs_unmount(c,vfs) (0) | |
2248 | +#define secpolicy_fs_unmount(c, vfs) (0) | |
2249 | #define secpolicy_nfs(c) (0) | |
2250 | -#define secpolicy_sys_config(c,co) (0) | |
2251 | +#define secpolicy_sys_config(c, co) (0) | |
2252 | #define secpolicy_zfs(c) (0) | |
2253 | #define secpolicy_zinject(c) (0) | |
2254 | -#define secpolicy_vnode_setids_setgids(c,id) (0) | |
2255 | +#define secpolicy_vnode_setids_setgids(c, id) (0) | |
2256 | #define secpolicy_vnode_setid_retain(c, sr) (0) | |
2257 | #define secpolicy_setid_clear(v, c) (0) | |
2258 | -#define secpolicy_vnode_any_access(c,vp,o) (0) | |
2259 | -#define secpolicy_vnode_access2(c,cp,o,m1,m2) (0) | |
2260 | -#define secpolicy_vnode_chown(c,o) (0) | |
2261 | -#define secpolicy_vnode_setdac(c,o) (0) | |
2262 | +#define secpolicy_vnode_any_access(c, vp, o) (0) | |
2263 | +#define secpolicy_vnode_access2(c, cp, o, m1, m2) (0) | |
2264 | +#define secpolicy_vnode_chown(c, o) (0) | |
2265 | +#define secpolicy_vnode_setdac(c, o) (0) | |
2266 | #define secpolicy_vnode_remove(c) (0) | |
2267 | -#define secpolicy_vnode_setattr(c,v,a,o,f,func,n) (0) | |
2268 | +#define secpolicy_vnode_setattr(c, v, a, o, f, func, n) (0) | |
2269 | #define secpolicy_xvattr(x, o, c, t) (0) | |
2270 | #define secpolicy_vnode_stky_modify(c) (0) | |
2271 | -#define secpolicy_setid_setsticky_clear(v,a,o,c) (0) | |
2272 | +#define secpolicy_setid_setsticky_clear(v, a, o, c) (0) | |
2273 | #define secpolicy_basic_link(c) (0) | |
2274 | ||
2275 | #endif /* SPL_POLICY_H */ | |
2276 | diff --git a/include/sys/pool.h b/include/sys/pool.h | |
2277 | index bf6a0bb..410bb2f 100644 | |
2278 | --- a/include/sys/pool.h | |
2279 | +++ b/include/sys/pool.h | |
2280 | @@ -23,7 +23,7 @@ | |
2281 | \*****************************************************************************/ | |
2282 | ||
2283 | #ifndef _SPL_POOL_H | |
2284 | -#define _SPL_POOL_H | |
2285 | +#define _SPL_POOL_H | |
2286 | ||
2287 | #include <sys/pset.h> | |
2288 | ||
2289 | diff --git a/include/sys/priv_impl.h b/include/sys/priv_impl.h | |
2290 | index f1507a8..ef11a62 100644 | |
2291 | --- a/include/sys/priv_impl.h | |
2292 | +++ b/include/sys/priv_impl.h | |
2293 | @@ -23,6 +23,6 @@ | |
2294 | \*****************************************************************************/ | |
2295 | ||
2296 | #ifndef _SPL_PRIV_IMPL_H | |
2297 | -#define _SPL_PRIV_IMPL_H | |
2298 | +#define _SPL_PRIV_IMPL_H | |
2299 | ||
2300 | #endif /* _SPL_PRIV_IMPL_H */ | |
2301 | diff --git a/include/sys/proc.h b/include/sys/proc.h | |
2302 | index dbaf416..f926e1e 100644 | |
2303 | --- a/include/sys/proc.h | |
2304 | +++ b/include/sys/proc.h | |
2305 | @@ -23,6 +23,6 @@ | |
2306 | \*****************************************************************************/ | |
2307 | ||
2308 | #ifndef _SPL_PROC_H | |
2309 | -#define _SPL_PROC_H | |
2310 | +#define _SPL_PROC_H | |
2311 | ||
2312 | #endif /* SPL_PROC_H */ | |
2313 | diff --git a/include/sys/processor.h b/include/sys/processor.h | |
2314 | index 60b1a21..2e325c3 100644 | |
2315 | --- a/include/sys/processor.h | |
2316 | +++ b/include/sys/processor.h | |
2317 | @@ -25,7 +25,7 @@ | |
2318 | #ifndef _SPL_PROCESSOR_H | |
2319 | #define _SPL_PROCESSOR_H | |
2320 | ||
2321 | -#define getcpuid() smp_processor_id() | |
2322 | +#define getcpuid() smp_processor_id() | |
2323 | ||
2324 | typedef int processorid_t; | |
2325 | ||
2326 | diff --git a/include/sys/pset.h b/include/sys/pset.h | |
2327 | index 2723d31..d588600 100644 | |
2328 | --- a/include/sys/pset.h | |
2329 | +++ b/include/sys/pset.h | |
2330 | @@ -23,16 +23,16 @@ | |
2331 | \*****************************************************************************/ | |
2332 | ||
2333 | #ifndef _SPL_PSET_H | |
2334 | -#define _SPL_PSET_H | |
2335 | +#define _SPL_PSET_H | |
2336 | ||
2337 | typedef int psetid_t; | |
2338 | ||
2339 | /* special processor set id's */ | |
2340 | -#define PS_NONE -1 | |
2341 | -#define PS_QUERY -2 | |
2342 | -#define PS_MYID -3 | |
2343 | -#define PS_SOFT -4 | |
2344 | -#define PS_HARD -5 | |
2345 | -#define PS_QUERY_TYPE -6 | |
2346 | +#define PS_NONE -1 | |
2347 | +#define PS_QUERY -2 | |
2348 | +#define PS_MYID -3 | |
2349 | +#define PS_SOFT -4 | |
2350 | +#define PS_HARD -5 | |
2351 | +#define PS_QUERY_TYPE -6 | |
2352 | ||
2353 | #endif /* SPL_PSET_H */ | |
2354 | diff --git a/include/sys/random.h b/include/sys/random.h | |
2355 | index 64f70ee..1f05a58 100644 | |
2356 | --- a/include/sys/random.h | |
2357 | +++ b/include/sys/random.h | |
2358 | @@ -31,8 +31,8 @@ | |
2359 | static __inline__ int | |
2360 | random_get_bytes(uint8_t *ptr, size_t len) | |
2361 | { | |
2362 | - get_random_bytes((void *)ptr,(int)len); | |
2363 | - return 0; | |
2364 | + get_random_bytes((void *)ptr, (int)len); | |
2365 | + return (0); | |
2366 | } | |
2367 | ||
2368 | extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); | |
2369 | diff --git a/include/sys/refstr.h b/include/sys/refstr.h | |
2370 | index 49a3417..fec0ab2 100644 | |
2371 | --- a/include/sys/refstr.h | |
2372 | +++ b/include/sys/refstr.h | |
2373 | @@ -23,6 +23,6 @@ | |
2374 | \*****************************************************************************/ | |
2375 | ||
2376 | #ifndef _SPL_REFSTR_H | |
2377 | -#define _SPL_REFSTR_H | |
2378 | +#define _SPL_REFSTR_H | |
2379 | ||
2380 | #endif /* SPL_REFSTR_H */ | |
2381 | diff --git a/include/sys/resource.h b/include/sys/resource.h | |
2382 | index fe33655..0ff0a75 100644 | |
2383 | --- a/include/sys/resource.h | |
2384 | +++ b/include/sys/resource.h | |
2385 | @@ -23,7 +23,7 @@ | |
2386 | \*****************************************************************************/ | |
2387 | ||
2388 | #ifndef _SPL_RESOURCE_H | |
2389 | -#define _SPL_RESOURCE_H | |
2390 | +#define _SPL_RESOURCE_H | |
2391 | ||
2392 | #include <linux/resource.h> | |
2393 | ||
2394 | diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h | |
2395 | index ffb7b90..325dfc4 100644 | |
2396 | --- a/include/sys/rwlock.h | |
2397 | +++ b/include/sys/rwlock.h | |
2398 | @@ -23,7 +23,7 @@ | |
2399 | \*****************************************************************************/ | |
2400 | ||
2401 | #ifndef _SPL_RWLOCK_H | |
2402 | -#define _SPL_RWLOCK_H | |
2403 | +#define _SPL_RWLOCK_H | |
2404 | ||
2405 | #include <sys/types.h> | |
2406 | #include <linux/rwsem.h> | |
2407 | @@ -55,7 +55,7 @@ typedef struct { | |
2408 | #endif /* CONFIG_LOCKDEP */ | |
2409 | } krwlock_t; | |
2410 | ||
2411 | -#define SEM(rwp) (&(rwp)->rw_rwlock) | |
2412 | +#define SEM(rwp) (&(rwp)->rw_rwlock) | |
2413 | ||
2414 | static inline void | |
2415 | spl_rw_set_owner(krwlock_t *rwp) | |
2416 | @@ -81,9 +81,9 @@ static inline kthread_t * | |
2417 | rw_owner(krwlock_t *rwp) | |
2418 | { | |
2419 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | |
2420 | - return SEM(rwp)->owner; | |
2421 | + return (SEM(rwp)->owner); | |
2422 | #else | |
2423 | - return rwp->rw_owner; | |
2424 | + return (rwp->rw_owner); | |
2425 | #endif | |
2426 | } | |
2427 | ||
2428 | @@ -106,9 +106,9 @@ spl_rw_lockdep_on_maybe(krwlock_t *rwp) \ | |
2429 | lockdep_on(); \ | |
2430 | } | |
2431 | #else /* CONFIG_LOCKDEP */ | |
2432 | -#define spl_rw_set_type(rwp, type) | |
2433 | -#define spl_rw_lockdep_off_maybe(rwp) | |
2434 | -#define spl_rw_lockdep_on_maybe(rwp) | |
2435 | +#define spl_rw_set_type(rwp, type) | |
2436 | +#define spl_rw_lockdep_off_maybe(rwp) | |
2437 | +#define spl_rw_lockdep_on_maybe(rwp) | |
2438 | #endif /* CONFIG_LOCKDEP */ | |
2439 | ||
2440 | static inline int | |
2441 | @@ -131,16 +131,17 @@ RW_WRITE_HELD(krwlock_t *rwp) | |
2442 | static inline int | |
2443 | RW_LOCK_HELD(krwlock_t *rwp) | |
2444 | { | |
2445 | - return spl_rwsem_is_locked(SEM(rwp)); | |
2446 | + return (spl_rwsem_is_locked(SEM(rwp))); | |
2447 | } | |
2448 | ||
2449 | /* | |
2450 | - * The following functions must be a #define and not static inline. | |
2451 | + * The following functions must be a #define and not static inline. | |
2452 | * This ensures that the native linux semaphore functions (down/up) | |
2453 | * will be correctly located in the users code which is important | |
2454 | * for the built in kernel lock analysis tools | |
2455 | */ | |
2456 | -#define rw_init(rwp, name, type, arg) \ | |
2457 | +/* BEGIN CSTYLED */ | |
2458 | +#define rw_init(rwp, name, type, arg) \ | |
2459 | ({ \ | |
2460 | static struct lock_class_key __key; \ | |
2461 | ASSERT(type == RW_DEFAULT || type == RW_NOLOCKDEP); \ | |
2462 | @@ -150,12 +151,12 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2463 | spl_rw_set_type(rwp, type); \ | |
2464 | }) | |
2465 | ||
2466 | -#define rw_destroy(rwp) \ | |
2467 | +#define rw_destroy(rwp) \ | |
2468 | ({ \ | |
2469 | VERIFY(!RW_LOCK_HELD(rwp)); \ | |
2470 | }) | |
2471 | ||
2472 | -#define rw_tryenter(rwp, rw) \ | |
2473 | +#define rw_tryenter(rwp, rw) \ | |
2474 | ({ \ | |
2475 | int _rc_ = 0; \ | |
2476 | \ | |
2477 | @@ -175,7 +176,7 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2478 | _rc_; \ | |
2479 | }) | |
2480 | ||
2481 | -#define rw_enter(rwp, rw) \ | |
2482 | +#define rw_enter(rwp, rw) \ | |
2483 | ({ \ | |
2484 | spl_rw_lockdep_off_maybe(rwp); \ | |
2485 | switch (rw) { \ | |
2486 | @@ -192,7 +193,7 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2487 | spl_rw_lockdep_on_maybe(rwp); \ | |
2488 | }) | |
2489 | ||
2490 | -#define rw_exit(rwp) \ | |
2491 | +#define rw_exit(rwp) \ | |
2492 | ({ \ | |
2493 | spl_rw_lockdep_off_maybe(rwp); \ | |
2494 | if (RW_WRITE_HELD(rwp)) { \ | |
2495 | @@ -205,7 +206,7 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2496 | spl_rw_lockdep_on_maybe(rwp); \ | |
2497 | }) | |
2498 | ||
2499 | -#define rw_downgrade(rwp) \ | |
2500 | +#define rw_downgrade(rwp) \ | |
2501 | ({ \ | |
2502 | spl_rw_lockdep_off_maybe(rwp); \ | |
2503 | spl_rw_clear_owner(rwp); \ | |
2504 | @@ -213,7 +214,7 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2505 | spl_rw_lockdep_on_maybe(rwp); \ | |
2506 | }) | |
2507 | ||
2508 | -#define rw_tryupgrade(rwp) \ | |
2509 | +#define rw_tryupgrade(rwp) \ | |
2510 | ({ \ | |
2511 | int _rc_ = 0; \ | |
2512 | \ | |
2513 | @@ -227,6 +228,7 @@ RW_LOCK_HELD(krwlock_t *rwp) | |
2514 | } \ | |
2515 | _rc_; \ | |
2516 | }) | |
2517 | +/* END CSTYLED */ | |
2518 | ||
2519 | int spl_rw_init(void); | |
2520 | void spl_rw_fini(void); | |
2521 | diff --git a/include/sys/sdt.h b/include/sys/sdt.h | |
2522 | index 287bfaa..8178eb8 100644 | |
2523 | --- a/include/sys/sdt.h | |
2524 | +++ b/include/sys/sdt.h | |
2525 | @@ -23,8 +23,8 @@ | |
2526 | \*****************************************************************************/ | |
2527 | ||
2528 | #ifndef _SPL_SDT_H | |
2529 | -#define _SPL_SDT_H | |
2530 | +#define _SPL_SDT_H | |
2531 | ||
2532 | -#define SET_ERROR(x) (x) | |
2533 | +#define SET_ERROR(x) (x) | |
2534 | ||
2535 | #endif /* SPL_SDT_H */ | |
2536 | diff --git a/include/sys/sid.h b/include/sys/sid.h | |
2537 | index 8ee5d07..a54d78b 100644 | |
2538 | --- a/include/sys/sid.h | |
2539 | +++ b/include/sys/sid.h | |
2540 | @@ -23,7 +23,7 @@ | |
2541 | \*****************************************************************************/ | |
2542 | ||
2543 | #ifndef _SPL_SID_H | |
2544 | -#define _SPL_SID_H | |
2545 | +#define _SPL_SID_H | |
2546 | ||
2547 | typedef struct ksiddomain { | |
2548 | char *kd_name; | |
2549 | @@ -41,21 +41,21 @@ typedef int ksid_t; | |
2550 | static inline ksiddomain_t * | |
2551 | ksid_lookupdomain(const char *dom) | |
2552 | { | |
2553 | - ksiddomain_t *kd; | |
2554 | + ksiddomain_t *kd; | |
2555 | int len = strlen(dom); | |
2556 | ||
2557 | - kd = kmem_zalloc(sizeof(ksiddomain_t), KM_SLEEP); | |
2558 | - kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP); | |
2559 | + kd = kmem_zalloc(sizeof (ksiddomain_t), KM_SLEEP); | |
2560 | + kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP); | |
2561 | memcpy(kd->kd_name, dom, len); | |
2562 | ||
2563 | - return (kd); | |
2564 | + return (kd); | |
2565 | } | |
2566 | ||
2567 | static inline void | |
2568 | ksiddomain_rele(ksiddomain_t *ksid) | |
2569 | { | |
2570 | kmem_free(ksid->kd_name, strlen(ksid->kd_name) + 1); | |
2571 | - kmem_free(ksid, sizeof(ksiddomain_t)); | |
2572 | + kmem_free(ksid, sizeof (ksiddomain_t)); | |
2573 | } | |
2574 | ||
2575 | #endif /* _SPL_SID_H */ | |
2576 | diff --git a/include/sys/signal.h b/include/sys/signal.h | |
2577 | index 77cc2d3..849c6e9 100644 | |
2578 | --- a/include/sys/signal.h | |
2579 | +++ b/include/sys/signal.h | |
2580 | @@ -23,7 +23,7 @@ | |
2581 | \*****************************************************************************/ | |
2582 | ||
2583 | #ifndef _SPL_SIGNAL_H | |
2584 | -#define _SPL_SIGNAL_H | |
2585 | +#define _SPL_SIGNAL_H | |
2586 | ||
2587 | #include <linux/sched.h> | |
2588 | ||
2589 | @@ -34,7 +34,8 @@ | |
2590 | #define FORREAL 0 /* Usual side-effects */ | |
2591 | #define JUSTLOOKING 1 /* Don't stop the process */ | |
2592 | ||
2593 | -/* The "why" argument indicates the allowable side-effects of the call: | |
2594 | +/* | |
2595 | + * The "why" argument indicates the allowable side-effects of the call: | |
2596 | * | |
2597 | * FORREAL: Extract the next pending signal from p_sig into p_cursig; | |
2598 | * stop the process if a stop has been requested or if a traced signal | |
2599 | @@ -48,7 +49,7 @@ issig(int why) | |
2600 | { | |
2601 | ASSERT(why == FORREAL || why == JUSTLOOKING); | |
2602 | ||
2603 | - return signal_pending(current); | |
2604 | + return (signal_pending(current)); | |
2605 | } | |
2606 | ||
2607 | #endif /* SPL_SIGNAL_H */ | |
2608 | diff --git a/include/sys/stat.h b/include/sys/stat.h | |
2609 | index cde7556..c425b75 100644 | |
2610 | --- a/include/sys/stat.h | |
2611 | +++ b/include/sys/stat.h | |
2612 | @@ -23,7 +23,7 @@ | |
2613 | \*****************************************************************************/ | |
2614 | ||
2615 | #ifndef _SPL_STAT_H | |
2616 | -#define _SPL_STAT_H | |
2617 | +#define _SPL_STAT_H | |
2618 | ||
2619 | #include <linux/stat.h> | |
2620 | ||
2621 | diff --git a/include/sys/stropts.h b/include/sys/stropts.h | |
2622 | index 25c7ee1..c0c8566 100644 | |
2623 | --- a/include/sys/stropts.h | |
2624 | +++ b/include/sys/stropts.h | |
2625 | @@ -23,6 +23,6 @@ | |
2626 | \*****************************************************************************/ | |
2627 | ||
2628 | #ifndef _SPL_STROPTS_H | |
2629 | -#define _SPL_STROPTS_H | |
2630 | +#define _SPL_STROPTS_H | |
2631 | ||
2632 | #endif /* SPL_STROPTS_H */ | |
2633 | diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h | |
2634 | index c49b0c2..1f78094 100644 | |
2635 | --- a/include/sys/sunddi.h | |
2636 | +++ b/include/sys/sunddi.h | |
2637 | @@ -23,7 +23,7 @@ | |
2638 | \*****************************************************************************/ | |
2639 | ||
2640 | #ifndef _SPL_SUNDDI_H | |
2641 | -#define _SPL_SUNDDI_H | |
2642 | +#define _SPL_SUNDDI_H | |
2643 | ||
2644 | #include <sys/cred.h> | |
2645 | #include <sys/uio.h> | |
2646 | @@ -44,9 +44,9 @@ typedef int ddi_devid_t; | |
2647 | #define DDI_SUCCESS 0 | |
2648 | #define DDI_FAILURE -1 | |
2649 | ||
2650 | -#define ddi_prop_lookup_string(x1,x2,x3,x4,x5) (*x5 = NULL) | |
2651 | -#define ddi_prop_free(x) (void)0 | |
2652 | -#define ddi_root_node() (void)0 | |
2653 | +#define ddi_prop_lookup_string(x1, x2, x3, x4, x5) (*x5 = NULL) | |
2654 | +#define ddi_prop_free(x) (void)0 | |
2655 | +#define ddi_root_node() (void)0 | |
2656 | ||
2657 | extern int ddi_strtoul(const char *, char **, int, unsigned long *); | |
2658 | extern int ddi_strtol(const char *, char **, int, long *); | |
2659 | diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h | |
2660 | index ec84202..3f7f9b3 100644 | |
2661 | --- a/include/sys/sunldi.h | |
2662 | +++ b/include/sys/sunldi.h | |
2663 | @@ -23,7 +23,7 @@ | |
2664 | \*****************************************************************************/ | |
2665 | ||
2666 | #ifndef _SPL_SUNLDI_H | |
2667 | -#define _SPL_SUNLDI_H | |
2668 | +#define _SPL_SUNLDI_H | |
2669 | ||
2670 | #include <sys/types.h> | |
2671 | #include <linux/fs.h> | |
2672 | @@ -32,6 +32,6 @@ | |
2673 | #include <linux/bio.h> | |
2674 | #include <linux/blkdev.h> | |
2675 | ||
2676 | -#define SECTOR_SIZE 512 | |
2677 | +#define SECTOR_SIZE 512 | |
2678 | ||
2679 | #endif /* SPL_SUNLDI_H */ | |
2680 | diff --git a/include/sys/sysdc.h b/include/sys/sysdc.h | |
2681 | index 14ab48a..b6c0cf0 100644 | |
2682 | --- a/include/sys/sysdc.h | |
2683 | +++ b/include/sys/sysdc.h | |
2684 | @@ -23,6 +23,6 @@ | |
2685 | \*****************************************************************************/ | |
2686 | ||
2687 | #ifndef _SPL_SYSDC_H | |
2688 | -#define _SPL_SYSDC_H | |
2689 | +#define _SPL_SYSDC_H | |
2690 | ||
2691 | #endif /* SPL_SYSDC_H */ | |
2692 | diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h | |
2693 | index a4a9f3e..c5c691b 100644 | |
2694 | --- a/include/sys/sysmacros.h | |
2695 | +++ b/include/sys/sysmacros.h | |
2696 | @@ -23,7 +23,7 @@ | |
2697 | \*****************************************************************************/ | |
2698 | ||
2699 | #ifndef _SPL_SYSMACROS_H | |
2700 | -#define _SPL_SYSMACROS_H | |
2701 | +#define _SPL_SYSMACROS_H | |
2702 | ||
2703 | #include <linux/module.h> | |
2704 | #include <linux/sched.h> | |
2705 | @@ -39,120 +39,122 @@ | |
2706 | #endif | |
2707 | ||
2708 | #ifndef _KERNEL | |
2709 | -#define _KERNEL __KERNEL__ | |
2710 | +#define _KERNEL __KERNEL__ | |
2711 | #endif | |
2712 | ||
2713 | -#define FALSE 0 | |
2714 | -#define TRUE 1 | |
2715 | - | |
2716 | -#define INT8_MAX (127) | |
2717 | -#define INT8_MIN (-128) | |
2718 | -#define UINT8_MAX (255) | |
2719 | -#define UINT8_MIN (0) | |
2720 | - | |
2721 | -#define INT16_MAX (32767) | |
2722 | -#define INT16_MIN (-32768) | |
2723 | -#define UINT16_MAX (65535) | |
2724 | -#define UINT16_MIN (0) | |
2725 | - | |
2726 | -#define INT32_MAX INT_MAX | |
2727 | -#define INT32_MIN INT_MIN | |
2728 | -#define UINT32_MAX UINT_MAX | |
2729 | -#define UINT32_MIN UINT_MIN | |
2730 | - | |
2731 | -#define INT64_MAX LLONG_MAX | |
2732 | -#define INT64_MIN LLONG_MIN | |
2733 | -#define UINT64_MAX ULLONG_MAX | |
2734 | -#define UINT64_MIN ULLONG_MIN | |
2735 | - | |
2736 | -#define NBBY 8 | |
2737 | -#define ENOTSUP EOPNOTSUPP | |
2738 | - | |
2739 | -#define MAXMSGLEN 256 | |
2740 | -#define MAXNAMELEN 256 | |
2741 | -#define MAXPATHLEN PATH_MAX | |
2742 | -#define MAXOFFSET_T LLONG_MAX | |
2743 | -#define MAXBSIZE 8192 | |
2744 | -#define DEV_BSIZE 512 | |
2745 | -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
2746 | - | |
2747 | -#define proc_pageout NULL | |
2748 | -#define curproc current | |
2749 | -#define max_ncpus num_possible_cpus() | |
2750 | -#define boot_ncpus num_online_cpus() | |
2751 | -#define CPU_SEQID smp_processor_id() | |
2752 | -#define _NOTE(x) | |
2753 | -#define is_system_labeled() 0 | |
2754 | +#define FALSE 0 | |
2755 | +#define TRUE 1 | |
2756 | + | |
2757 | +#define INT8_MAX (127) | |
2758 | +#define INT8_MIN (-128) | |
2759 | +#define UINT8_MAX (255) | |
2760 | +#define UINT8_MIN (0) | |
2761 | + | |
2762 | +#define INT16_MAX (32767) | |
2763 | +#define INT16_MIN (-32768) | |
2764 | +#define UINT16_MAX (65535) | |
2765 | +#define UINT16_MIN (0) | |
2766 | + | |
2767 | +#define INT32_MAX INT_MAX | |
2768 | +#define INT32_MIN INT_MIN | |
2769 | +#define UINT32_MAX UINT_MAX | |
2770 | +#define UINT32_MIN UINT_MIN | |
2771 | + | |
2772 | +#define INT64_MAX LLONG_MAX | |
2773 | +#define INT64_MIN LLONG_MIN | |
2774 | +#define UINT64_MAX ULLONG_MAX | |
2775 | +#define UINT64_MIN ULLONG_MIN | |
2776 | + | |
2777 | +#define NBBY 8 | |
2778 | +#define ENOTSUP EOPNOTSUPP | |
2779 | + | |
2780 | +#define MAXMSGLEN 256 | |
2781 | +#define MAXNAMELEN 256 | |
2782 | +#define MAXPATHLEN PATH_MAX | |
2783 | +#define MAXOFFSET_T LLONG_MAX | |
2784 | +#define MAXBSIZE 8192 | |
2785 | +#define DEV_BSIZE 512 | |
2786 | +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ | |
2787 | + | |
2788 | +#define proc_pageout NULL | |
2789 | +#define curproc current | |
2790 | +#define max_ncpus num_possible_cpus() | |
2791 | +#define boot_ncpus num_online_cpus() | |
2792 | +#define CPU_SEQID smp_processor_id() | |
2793 | +#define _NOTE(x) | |
2794 | +#define is_system_labeled() 0 | |
2795 | ||
2796 | #ifndef RLIM64_INFINITY | |
2797 | -#define RLIM64_INFINITY (~0ULL) | |
2798 | +#define RLIM64_INFINITY (~0ULL) | |
2799 | #endif | |
2800 | ||
2801 | -/* 0..MAX_PRIO-1: Process priority | |
2802 | +/* | |
2803 | + * 0..MAX_PRIO-1: Process priority | |
2804 | * 0..MAX_RT_PRIO-1: RT priority tasks | |
2805 | * MAX_RT_PRIO..MAX_PRIO-1: SCHED_NORMAL tasks | |
2806 | * | |
2807 | * Treat shim tasks as SCHED_NORMAL tasks | |
2808 | */ | |
2809 | -#define minclsyspri (MAX_PRIO-1) | |
2810 | -#define maxclsyspri (MAX_RT_PRIO) | |
2811 | -#define defclsyspri (DEFAULT_PRIO) | |
2812 | +#define minclsyspri (MAX_PRIO-1) | |
2813 | +#define maxclsyspri (MAX_RT_PRIO) | |
2814 | +#define defclsyspri (DEFAULT_PRIO) | |
2815 | ||
2816 | #ifndef NICE_TO_PRIO | |
2817 | -#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | |
2818 | +#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | |
2819 | #endif | |
2820 | #ifndef PRIO_TO_NICE | |
2821 | -#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | |
2822 | +#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | |
2823 | #endif | |
2824 | ||
2825 | /* | |
2826 | * Missing macros | |
2827 | */ | |
2828 | #ifndef PAGESIZE | |
2829 | -#define PAGESIZE PAGE_SIZE | |
2830 | +#define PAGESIZE PAGE_SIZE | |
2831 | #endif | |
2832 | ||
2833 | #ifndef PAGESHIFT | |
2834 | -#define PAGESHIFT PAGE_SHIFT | |
2835 | +#define PAGESHIFT PAGE_SHIFT | |
2836 | #endif | |
2837 | ||
2838 | /* from Solaris sys/byteorder.h */ | |
2839 | -#define BSWAP_8(x) ((x) & 0xff) | |
2840 | -#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) | |
2841 | -#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) | |
2842 | -#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) | |
2843 | +#define BSWAP_8(x) ((x) & 0xff) | |
2844 | +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) | |
2845 | +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) | |
2846 | +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) | |
2847 | ||
2848 | -/* Map some simple functions. | |
2849 | +/* | |
2850 | + * Map some simple functions. | |
2851 | */ | |
2852 | -#define bzero(ptr,size) memset(ptr,0,size) | |
2853 | -#define bcopy(src,dest,size) memmove(dest,src,size) | |
2854 | -#define bcmp(src,dest,size) memcmp((src), (dest), (size_t)(size)) | |
2855 | +#define bzero(ptr, size) memset(ptr, 0, size) | |
2856 | +#define bcopy(src, dest, size) memmove(dest, src, size) | |
2857 | +#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size)) | |
2858 | ||
2859 | /* Dtrace probes do not exist in the linux kernel */ | |
2860 | #ifdef DTRACE_PROBE | |
2861 | #undef DTRACE_PROBE | |
2862 | #endif /* DTRACE_PROBE */ | |
2863 | -#define DTRACE_PROBE(a) ((void)0) | |
2864 | +#define DTRACE_PROBE(a) ((void)0) | |
2865 | ||
2866 | #ifdef DTRACE_PROBE1 | |
2867 | #undef DTRACE_PROBE1 | |
2868 | #endif /* DTRACE_PROBE1 */ | |
2869 | -#define DTRACE_PROBE1(a, b, c) ((void)0) | |
2870 | +#define DTRACE_PROBE1(a, b, c) ((void)0) | |
2871 | ||
2872 | #ifdef DTRACE_PROBE2 | |
2873 | #undef DTRACE_PROBE2 | |
2874 | #endif /* DTRACE_PROBE2 */ | |
2875 | -#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) | |
2876 | +#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) | |
2877 | ||
2878 | #ifdef DTRACE_PROBE3 | |
2879 | #undef DTRACE_PROBE3 | |
2880 | #endif /* DTRACE_PROBE3 */ | |
2881 | -#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) | |
2882 | +#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) | |
2883 | ||
2884 | #ifdef DTRACE_PROBE4 | |
2885 | #undef DTRACE_PROBE4 | |
2886 | #endif /* DTRACE_PROBE4 */ | |
2887 | -#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) | |
2888 | +#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) | |
2889 | ||
2890 | /* Missing globals */ | |
2891 | extern char spl_version[32]; | |
2892 | @@ -167,39 +169,39 @@ extern void spl_cleanup(void); | |
2893 | #define lowbit(x) __ffs(x) | |
2894 | ||
2895 | #define highbit64(x) fls64(x) | |
2896 | -#define makedevice(maj,min) makedev(maj,min) | |
2897 | +#define makedevice(maj, min) makedev(maj, min) | |
2898 | ||
2899 | /* common macros */ | |
2900 | #ifndef MIN | |
2901 | -#define MIN(a, b) ((a) < (b) ? (a) : (b)) | |
2902 | +#define MIN(a, b) ((a) < (b) ? (a) : (b)) | |
2903 | #endif | |
2904 | #ifndef MAX | |
2905 | -#define MAX(a, b) ((a) < (b) ? (b) : (a)) | |
2906 | +#define MAX(a, b) ((a) < (b) ? (b) : (a)) | |
2907 | #endif | |
2908 | #ifndef ABS | |
2909 | -#define ABS(a) ((a) < 0 ? -(a) : (a)) | |
2910 | +#define ABS(a) ((a) < 0 ? -(a) : (a)) | |
2911 | #endif | |
2912 | #ifndef DIV_ROUND_UP | |
2913 | -#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | |
2914 | +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) | |
2915 | #endif | |
2916 | #ifndef roundup | |
2917 | -#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | |
2918 | +#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | |
2919 | #endif | |
2920 | #ifndef howmany | |
2921 | -#define howmany(x, y) (((x) + ((y) - 1)) / (y)) | |
2922 | +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) | |
2923 | #endif | |
2924 | ||
2925 | /* | |
2926 | * Compatibility macros/typedefs needed for Solaris -> Linux port | |
2927 | */ | |
2928 | -#define P2ALIGN(x, align) ((x) & -(align)) | |
2929 | -#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) | |
2930 | -#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) | |
2931 | -#define P2PHASE(x, align) ((x) & ((align) - 1)) | |
2932 | -#define P2NPHASE(x, align) (-(x) & ((align) - 1)) | |
2933 | -#define ISP2(x) (((x) & ((x) - 1)) == 0) | |
2934 | -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1))==0) | |
2935 | -#define P2BOUNDARY(off, len, align) \ | |
2936 | +#define P2ALIGN(x, align) ((x) & -(align)) | |
2937 | +#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) | |
2938 | +#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) | |
2939 | +#define P2PHASE(x, align) ((x) & ((align) - 1)) | |
2940 | +#define P2NPHASE(x, align) (-(x) & ((align) - 1)) | |
2941 | +#define ISP2(x) (((x) & ((x) - 1)) == 0) | |
2942 | +#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) | |
2943 | +#define P2BOUNDARY(off, len, align) \ | |
2944 | (((off) ^ ((off) + (len) - 1)) > (align) - 1) | |
2945 | ||
2946 | /* | |
2947 | @@ -214,28 +216,28 @@ extern void spl_cleanup(void); | |
2948 | * or | |
2949 | * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t) | |
2950 | */ | |
2951 | -#define P2ALIGN_TYPED(x, align, type) \ | |
2952 | - ((type)(x) & -(type)(align)) | |
2953 | -#define P2PHASE_TYPED(x, align, type) \ | |
2954 | - ((type)(x) & ((type)(align) - 1)) | |
2955 | -#define P2NPHASE_TYPED(x, align, type) \ | |
2956 | - (-(type)(x) & ((type)(align) - 1)) | |
2957 | -#define P2ROUNDUP_TYPED(x, align, type) \ | |
2958 | - ((((type)(x) - 1) | ((type)(align) - 1)) + 1) | |
2959 | -#define P2END_TYPED(x, align, type) \ | |
2960 | - (-(~(type)(x) & -(type)(align))) | |
2961 | -#define P2PHASEUP_TYPED(x, align, phase, type) \ | |
2962 | - ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) | |
2963 | -#define P2CROSS_TYPED(x, y, align, type) \ | |
2964 | - (((type)(x) ^ (type)(y)) > (type)(align) - 1) | |
2965 | -#define P2SAMEHIGHBIT_TYPED(x, y, type) \ | |
2966 | - (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) | |
2967 | +#define P2ALIGN_TYPED(x, align, type) \ | |
2968 | + ((type)(x) & -(type)(align)) | |
2969 | +#define P2PHASE_TYPED(x, align, type) \ | |
2970 | + ((type)(x) & ((type)(align) - 1)) | |
2971 | +#define P2NPHASE_TYPED(x, align, type) \ | |
2972 | + (-(type)(x) & ((type)(align) - 1)) | |
2973 | +#define P2ROUNDUP_TYPED(x, align, type) \ | |
2974 | + ((((type)(x) - 1) | ((type)(align) - 1)) + 1) | |
2975 | +#define P2END_TYPED(x, align, type) \ | |
2976 | + (-(~(type)(x) & -(type)(align))) | |
2977 | +#define P2PHASEUP_TYPED(x, align, phase, type) \ | |
2978 | + ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) | |
2979 | +#define P2CROSS_TYPED(x, y, align, type) \ | |
2980 | + (((type)(x) ^ (type)(y)) > (type)(align) - 1) | |
2981 | +#define P2SAMEHIGHBIT_TYPED(x, y, type) \ | |
2982 | + (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) | |
2983 | ||
2984 | #if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) | |
2985 | ||
2986 | /* avoid any possibility of clashing with <stddef.h> version */ | |
2987 | ||
2988 | -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) | |
2989 | +#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) | |
2990 | #endif | |
2991 | ||
2992 | #endif /* _SPL_SYSMACROS_H */ | |
2993 | diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h | |
2994 | index 5c0cc46..e80b9d4 100644 | |
2995 | --- a/include/sys/systeminfo.h | |
2996 | +++ b/include/sys/systeminfo.h | |
2997 | @@ -23,14 +23,14 @@ | |
2998 | \*****************************************************************************/ | |
2999 | ||
3000 | #ifndef _SPL_SYSTEMINFO_H | |
3001 | -#define _SPL_SYSTEMINFO_H | |
3002 | +#define _SPL_SYSTEMINFO_H | |
3003 | ||
3004 | -#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ | |
3005 | +#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ | |
3006 | /* to hold a decimal or hex */ | |
3007 | /* hostid string */ | |
3008 | ||
3009 | /* Supplemental definitions for Linux. */ | |
3010 | -#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */ | |
3011 | -#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */ | |
3012 | +#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */ | |
3013 | +#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */ | |
3014 | ||
3015 | #endif /* SPL_SYSTEMINFO_H */ | |
3016 | diff --git a/include/sys/systm.h b/include/sys/systm.h | |
3017 | index 3336fb3..358cc6f 100644 | |
3018 | --- a/include/sys/systm.h | |
3019 | +++ b/include/sys/systm.h | |
3020 | @@ -23,7 +23,7 @@ | |
3021 | \*****************************************************************************/ | |
3022 | ||
3023 | #ifndef _SPL_SYSTM_H | |
3024 | -#define _SPL_SYSTM_H | |
3025 | +#define _SPL_SYSTM_H | |
3026 | ||
3027 | #include <sys/sunddi.h> | |
3028 | ||
3029 | diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h | |
3030 | index 6c159f9..6cb8513 100644 | |
3031 | --- a/include/sys/t_lock.h | |
3032 | +++ b/include/sys/t_lock.h | |
3033 | @@ -23,7 +23,7 @@ | |
3034 | \*****************************************************************************/ | |
3035 | ||
3036 | #ifndef _SPL_T_LOCK_H | |
3037 | -#define _SPL_T_LOCK_H | |
3038 | +#define _SPL_T_LOCK_H | |
3039 | ||
3040 | #include <sys/param.h> | |
3041 | #include <sys/mutex.h> | |
3042 | diff --git a/include/sys/taskq.h b/include/sys/taskq.h | |
3043 | index c5ccec7..4d90a35 100644 | |
3044 | --- a/include/sys/taskq.h | |
3045 | +++ b/include/sys/taskq.h | |
3046 | @@ -94,7 +94,7 @@ typedef struct taskq { | |
3047 | taskqid_t tq_lowest_id; /* lowest pend/work id */ | |
3048 | struct list_head tq_free_list; /* free taskq_ent_t's */ | |
3049 | struct list_head tq_pend_list; /* pending taskq_ent_t's */ | |
3050 | - struct list_head tq_prio_list; /* priority pending taskq_ent_t's */ | |
3051 | + struct list_head tq_prio_list; /* priority taskq_ent_t's */ | |
3052 | struct list_head tq_delay_list; /* delayed taskq_ent_t's */ | |
3053 | struct list_head tq_taskqs; /* all taskq_t's */ | |
3054 | spl_wait_queue_head_t tq_work_waitq; /* new work waitq */ | |
3055 | diff --git a/include/sys/thread.h b/include/sys/thread.h | |
3056 | index 433a076..5894db7 100644 | |
3057 | --- a/include/sys/thread.h | |
3058 | +++ b/include/sys/thread.h | |
3059 | @@ -23,7 +23,7 @@ | |
3060 | \*****************************************************************************/ | |
3061 | ||
3062 | #ifndef _SPL_THREAD_H | |
3063 | -#define _SPL_THREAD_H | |
3064 | +#define _SPL_THREAD_H | |
3065 | ||
3066 | #include <linux/module.h> | |
3067 | #include <linux/mm.h> | |
3068 | @@ -36,28 +36,30 @@ | |
3069 | /* | |
3070 | * Thread interfaces | |
3071 | */ | |
3072 | -#define TP_MAGIC 0x53535353 | |
3073 | +#define TP_MAGIC 0x53535353 | |
3074 | ||
3075 | -#define TS_SLEEP TASK_INTERRUPTIBLE | |
3076 | -#define TS_RUN TASK_RUNNING | |
3077 | -#define TS_ZOMB EXIT_ZOMBIE | |
3078 | -#define TS_STOPPED TASK_STOPPED | |
3079 | +#define TS_SLEEP TASK_INTERRUPTIBLE | |
3080 | +#define TS_RUN TASK_RUNNING | |
3081 | +#define TS_ZOMB EXIT_ZOMBIE | |
3082 | +#define TS_STOPPED TASK_STOPPED | |
3083 | ||
3084 | typedef void (*thread_func_t)(void *); | |
3085 | ||
3086 | -#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ | |
3087 | - __thread_create(stk, stksize, (thread_func_t)func, \ | |
3088 | - #func, arg, len, pp, state, pri) | |
3089 | -#define thread_exit() __thread_exit() | |
3090 | -#define thread_join(t) VERIFY(0) | |
3091 | -#define curthread current | |
3092 | -#define getcomm() current->comm | |
3093 | -#define getpid() current->pid | |
3094 | +/* BEGIN CSTYLED */ | |
3095 | +#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ | |
3096 | + __thread_create(stk, stksize, (thread_func_t)func, \ | |
3097 | + #func, arg, len, pp, state, pri) | |
3098 | +/* END CSTYLED */ | |
3099 | + | |
3100 | +#define thread_exit() __thread_exit() | |
3101 | +#define thread_join(t) VERIFY(0) | |
3102 | +#define curthread current | |
3103 | +#define getcomm() current->comm | |
3104 | +#define getpid() current->pid | |
3105 | ||
3106 | extern kthread_t *__thread_create(caddr_t stk, size_t stksize, | |
3107 | - thread_func_t func, const char *name, | |
3108 | - void *args, size_t len, proc_t *pp, | |
3109 | - int state, pri_t pri); | |
3110 | + thread_func_t func, const char *name, void *args, size_t len, proc_t *pp, | |
3111 | + int state, pri_t pri); | |
3112 | extern void __thread_exit(void); | |
3113 | extern struct task_struct *spl_kthread_create(int (*func)(void *), | |
3114 | void *data, const char namefmt[], ...); | |
3115 | diff --git a/include/sys/timer.h b/include/sys/timer.h | |
3116 | index 33d577e..0d1f362 100644 | |
3117 | --- a/include/sys/timer.h | |
3118 | +++ b/include/sys/timer.h | |
3119 | @@ -23,38 +23,37 @@ | |
3120 | \*****************************************************************************/ | |
3121 | ||
3122 | #ifndef _SPL_TIMER_H | |
3123 | -#define _SPL_TIMER_H | |
3124 | +#define _SPL_TIMER_H | |
3125 | ||
3126 | #include <linux/module.h> | |
3127 | #include <linux/sched.h> | |
3128 | #include <linux/timer.h> | |
3129 | ||
3130 | -#define lbolt ((clock_t)jiffies) | |
3131 | -#define lbolt64 ((int64_t)get_jiffies_64()) | |
3132 | +#define lbolt ((clock_t)jiffies) | |
3133 | +#define lbolt64 ((int64_t)get_jiffies_64()) | |
3134 | ||
3135 | -#define ddi_get_lbolt() ((clock_t)jiffies) | |
3136 | -#define ddi_get_lbolt64() ((int64_t)get_jiffies_64()) | |
3137 | +#define ddi_get_lbolt() ((clock_t)jiffies) | |
3138 | +#define ddi_get_lbolt64() ((int64_t)get_jiffies_64()) | |
3139 | ||
3140 | -#define ddi_time_before(a, b) (typecheck(clock_t, a) && \ | |
3141 | +#define ddi_time_before(a, b) (typecheck(clock_t, a) && \ | |
3142 | typecheck(clock_t, b) && \ | |
3143 | ((a) - (b) < 0)) | |
3144 | -#define ddi_time_after(a, b) ddi_time_before(b, a) | |
3145 | -#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b)) | |
3146 | -#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a) | |
3147 | +#define ddi_time_after(a, b) ddi_time_before(b, a) | |
3148 | +#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b)) | |
3149 | +#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a) | |
3150 | ||
3151 | -#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \ | |
3152 | +#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \ | |
3153 | typecheck(int64_t, b) && \ | |
3154 | ((a) - (b) < 0)) | |
3155 | -#define ddi_time_after64(a, b) ddi_time_before64(b, a) | |
3156 | -#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b)) | |
3157 | -#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a) | |
3158 | +#define ddi_time_after64(a, b) ddi_time_before64(b, a) | |
3159 | +#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b)) | |
3160 | +#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a) | |
3161 | ||
3162 | -#define delay(ticks) schedule_timeout_uninterruptible(ticks) | |
3163 | +#define delay(ticks) schedule_timeout_uninterruptible(ticks) | |
3164 | ||
3165 | -#define SEC_TO_TICK(sec) ((sec) * HZ) | |
3166 | -#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) | |
3167 | -#define USEC_TO_TICK(us) usecs_to_jiffies(us) | |
3168 | -#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) | |
3169 | +#define SEC_TO_TICK(sec) ((sec) * HZ) | |
3170 | +#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) | |
3171 | +#define USEC_TO_TICK(us) usecs_to_jiffies(us) | |
3172 | +#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) | |
3173 | ||
3174 | #endif /* _SPL_TIMER_H */ | |
3175 | - | |
3176 | diff --git a/include/sys/tsd.h b/include/sys/tsd.h | |
3177 | index 1894a82..48eaa80 100644 | |
3178 | --- a/include/sys/tsd.h | |
3179 | +++ b/include/sys/tsd.h | |
3180 | @@ -22,14 +22,14 @@ | |
3181 | \*****************************************************************************/ | |
3182 | ||
3183 | #ifndef _SPL_TSD_H | |
3184 | -#define _SPL_TSD_H | |
3185 | +#define _SPL_TSD_H | |
3186 | ||
3187 | #include <sys/types.h> | |
3188 | ||
3189 | -#define TSD_HASH_TABLE_BITS_DEFAULT 9 | |
3190 | -#define TSD_KEYS_MAX 32768 | |
3191 | -#define DTOR_PID (PID_MAX_LIMIT+1) | |
3192 | -#define PID_KEY (TSD_KEYS_MAX+1) | |
3193 | +#define TSD_HASH_TABLE_BITS_DEFAULT 9 | |
3194 | +#define TSD_KEYS_MAX 32768 | |
3195 | +#define DTOR_PID (PID_MAX_LIMIT+1) | |
3196 | +#define PID_KEY (TSD_KEYS_MAX+1) | |
3197 | ||
3198 | typedef void (*dtor_func_t)(void *); | |
3199 | ||
3200 | diff --git a/include/sys/types.h b/include/sys/types.h | |
3201 | index d718ca0..2fe63b7 100644 | |
3202 | --- a/include/sys/types.h | |
3203 | +++ b/include/sys/types.h | |
3204 | @@ -29,14 +29,14 @@ | |
3205 | #include <sys/sysmacros.h> | |
3206 | ||
3207 | #ifndef ULLONG_MAX | |
3208 | -#define ULLONG_MAX (~0ULL) | |
3209 | +#define ULLONG_MAX (~0ULL) | |
3210 | #endif | |
3211 | ||
3212 | #ifndef LLONG_MAX | |
3213 | -#define LLONG_MAX ((long long)(~0ULL>>1)) | |
3214 | +#define LLONG_MAX ((long long)(~0ULL>>1)) | |
3215 | #endif | |
3216 | ||
3217 | -typedef enum { B_FALSE=0, B_TRUE=1 } boolean_t; | |
3218 | +typedef enum { B_FALSE = 0, B_TRUE = 1 } boolean_t; | |
3219 | typedef unsigned long intptr_t; | |
3220 | typedef unsigned long ulong_t; | |
3221 | typedef unsigned int uint_t; | |
3222 | diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h | |
3223 | index 0a21c70..e10cb19 100644 | |
3224 | --- a/include/sys/u8_textprep.h | |
3225 | +++ b/include/sys/u8_textprep.h | |
3226 | @@ -23,6 +23,6 @@ | |
3227 | \*****************************************************************************/ | |
3228 | ||
3229 | #ifndef _SPL_U8_TEXTPREP_H | |
3230 | -#define _SPL_U8_TEXTPREP_H | |
3231 | +#define _SPL_U8_TEXTPREP_H | |
3232 | ||
3233 | #endif /* SPL_U8_TEXTPREP_H */ | |
3234 | diff --git a/include/sys/uio.h b/include/sys/uio.h | |
3235 | index 404c037..764beb9 100644 | |
3236 | --- a/include/sys/uio.h | |
3237 | +++ b/include/sys/uio.h | |
3238 | @@ -24,7 +24,7 @@ | |
3239 | \*****************************************************************************/ | |
3240 | ||
3241 | #ifndef _SPL_UIO_H | |
3242 | -#define _SPL_UIO_H | |
3243 | +#define _SPL_UIO_H | |
3244 | ||
3245 | #include <linux/uio.h> | |
3246 | #include <linux/blkdev.h> | |
3247 | @@ -34,15 +34,15 @@ | |
3248 | typedef struct iovec iovec_t; | |
3249 | ||
3250 | typedef enum uio_rw { | |
3251 | - UIO_READ = 0, | |
3252 | - UIO_WRITE = 1, | |
3253 | + UIO_READ = 0, | |
3254 | + UIO_WRITE = 1, | |
3255 | } uio_rw_t; | |
3256 | ||
3257 | typedef enum uio_seg { | |
3258 | - UIO_USERSPACE = 0, | |
3259 | - UIO_SYSSPACE = 1, | |
3260 | - UIO_USERISPACE= 2, | |
3261 | - UIO_BVEC = 3, | |
3262 | + UIO_USERSPACE = 0, | |
3263 | + UIO_SYSSPACE = 1, | |
3264 | + UIO_USERISPACE = 2, | |
3265 | + UIO_BVEC = 3, | |
3266 | } uio_seg_t; | |
3267 | ||
3268 | typedef struct uio { | |
3269 | @@ -71,7 +71,7 @@ typedef enum xuio_type { | |
3270 | } xuio_type_t; | |
3271 | ||
3272 | ||
3273 | -#define UIOA_IOV_MAX 16 | |
3274 | +#define UIOA_IOV_MAX 16 | |
3275 | ||
3276 | typedef struct uioa_page_s { | |
3277 | int uioa_pfncnt; | |
3278 | @@ -100,7 +100,7 @@ typedef struct xuio { | |
3279 | } xu_ext; | |
3280 | } xuio_t; | |
3281 | ||
3282 | -#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv | |
3283 | -#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw | |
3284 | +#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv | |
3285 | +#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw | |
3286 | ||
3287 | #endif /* SPL_UIO_H */ | |
3288 | diff --git a/include/sys/unistd.h b/include/sys/unistd.h | |
3289 | index e1d93c6..9391d1a 100644 | |
3290 | --- a/include/sys/unistd.h | |
3291 | +++ b/include/sys/unistd.h | |
3292 | @@ -23,6 +23,6 @@ | |
3293 | \*****************************************************************************/ | |
3294 | ||
3295 | #ifndef _SPL_UNISTD_H | |
3296 | -#define _SPL_UNISTD_H | |
3297 | +#define _SPL_UNISTD_H | |
3298 | ||
3299 | #endif /* SPL_UNISTD_H */ | |
3300 | diff --git a/include/sys/user.h b/include/sys/user.h | |
3301 | index 2b25dd3..3321407 100644 | |
3302 | --- a/include/sys/user.h | |
3303 | +++ b/include/sys/user.h | |
3304 | @@ -21,7 +21,7 @@ | |
3305 | \*****************************************************************************/ | |
3306 | ||
3307 | #ifndef _SPL_USER_H | |
3308 | -#define _SPL_USER_H | |
3309 | +#define _SPL_USER_H | |
3310 | ||
3311 | /* | |
3312 | * We have uf_info_t for areleasef(). We implement areleasef() using a global | |
3313 | @@ -37,6 +37,6 @@ | |
3314 | struct uf_info; | |
3315 | typedef struct uf_info uf_info_t; | |
3316 | ||
3317 | -#define P_FINFO(x) ((uf_info_t *)x) | |
3318 | +#define P_FINFO(x) ((uf_info_t *)x) | |
3319 | ||
3320 | #endif /* SPL_USER_H */ | |
3321 | diff --git a/include/sys/va_list.h b/include/sys/va_list.h | |
3322 | index 9fa173b..388b4c9 100644 | |
3323 | --- a/include/sys/va_list.h | |
3324 | +++ b/include/sys/va_list.h | |
3325 | @@ -23,6 +23,6 @@ | |
3326 | \*****************************************************************************/ | |
3327 | ||
3328 | #ifndef _SPL_VA_LIST_H | |
3329 | -#define _SPL_VA_LIST_H | |
3330 | +#define _SPL_VA_LIST_H | |
3331 | ||
3332 | #endif /* SPL_VA_LIST_H */ | |
3333 | diff --git a/include/sys/varargs.h b/include/sys/varargs.h | |
3334 | index bf360ff..82185bc 100644 | |
3335 | --- a/include/sys/varargs.h | |
3336 | +++ b/include/sys/varargs.h | |
3337 | @@ -23,8 +23,8 @@ | |
3338 | \*****************************************************************************/ | |
3339 | ||
3340 | #ifndef _SPL_VARARGS_H | |
3341 | -#define _SPL_VARARGS_H | |
3342 | +#define _SPL_VARARGS_H | |
3343 | ||
3344 | -#define __va_list va_list | |
3345 | +#define __va_list va_list | |
3346 | ||
3347 | #endif /* SPL_VARARGS_H */ | |
3348 | diff --git a/include/sys/vfs.h b/include/sys/vfs.h | |
3349 | index f01dc11..d6fc1c3 100644 | |
3350 | --- a/include/sys/vfs.h | |
3351 | +++ b/include/sys/vfs.h | |
3352 | @@ -23,7 +23,7 @@ | |
3353 | \*****************************************************************************/ | |
3354 | ||
3355 | #ifndef _SPL_ZFS_H | |
3356 | -#define _SPL_ZFS_H | |
3357 | +#define _SPL_ZFS_H | |
3358 | ||
3359 | #include <linux/mount.h> | |
3360 | #include <linux/fs.h> | |
3361 | @@ -40,7 +40,7 @@ typedef struct spl_fid { | |
3362 | long fid_pad; | |
3363 | struct { | |
3364 | ushort_t len; /* length of data in bytes */ | |
3365 | - char data[MAXFIDSZ];/* data (variable len) */ | |
3366 | + char data[MAXFIDSZ]; /* data (variable len) */ | |
3367 | } _fid; | |
3368 | } un; | |
3369 | } fid_t; | |
3370 | diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h | |
3371 | index d3540c5..5909504 100644 | |
3372 | --- a/include/sys/vfs_opreg.h | |
3373 | +++ b/include/sys/vfs_opreg.h | |
3374 | @@ -23,6 +23,6 @@ | |
3375 | \*****************************************************************************/ | |
3376 | ||
3377 | #ifndef _SPL_OPREG_H | |
3378 | -#define _SPL_OPREG_H | |
3379 | +#define _SPL_OPREG_H | |
3380 | ||
3381 | #endif /* SPL_OPREG_H */ | |
3382 | diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h | |
3383 | index 9d334fe..059512b 100644 | |
3384 | --- a/include/sys/vmsystm.h | |
3385 | +++ b/include/sys/vmsystm.h | |
3386 | @@ -23,7 +23,7 @@ | |
3387 | \*****************************************************************************/ | |
3388 | ||
3389 | #ifndef _SPL_VMSYSTM_H | |
3390 | -#define _SPL_VMSYSTM_H | |
3391 | +#define _SPL_VMSYSTM_H | |
3392 | ||
3393 | #include <linux/mmzone.h> | |
3394 | #include <linux/mm.h> | |
3395 | @@ -48,9 +48,9 @@ copyin(const void *from, void *to, size_t len) | |
3396 | { | |
3397 | /* On error copyin routine returns -1 */ | |
3398 | if (xcopyin(from, to, len)) | |
3399 | - return -1; | |
3400 | + return (-1); | |
3401 | ||
3402 | - return 0; | |
3403 | + return (0); | |
3404 | } | |
3405 | ||
3406 | static __inline__ int | |
3407 | @@ -58,9 +58,9 @@ copyout(const void *from, void *to, size_t len) | |
3408 | { | |
3409 | /* On error copyout routine returns -1 */ | |
3410 | if (xcopyout(from, to, len)) | |
3411 | - return -1; | |
3412 | + return (-1); | |
3413 | ||
3414 | - return 0; | |
3415 | + return (0); | |
3416 | } | |
3417 | ||
3418 | static __inline__ int | |
3419 | @@ -69,7 +69,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done) | |
3420 | size_t rc; | |
3421 | ||
3422 | if (len == 0) | |
3423 | - return -ENAMETOOLONG; | |
3424 | + return (-ENAMETOOLONG); | |
3425 | ||
3426 | /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */ | |
3427 | ||
3428 | @@ -78,7 +78,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done) | |
3429 | if (done != NULL) | |
3430 | *done = rc; | |
3431 | ||
3432 | - return 0; | |
3433 | + return (0); | |
3434 | } | |
3435 | ||
3436 | #endif /* SPL_VMSYSTM_H */ | |
3437 | diff --git a/include/sys/vnode.h b/include/sys/vnode.h | |
3438 | index ad7f8f4..0ed4794 100644 | |
3439 | --- a/include/sys/vnode.h | |
3440 | +++ b/include/sys/vnode.h | |
3441 | @@ -23,7 +23,7 @@ | |
3442 | \*****************************************************************************/ | |
3443 | ||
3444 | #ifndef _SPL_VNODE_H | |
3445 | -#define _SPL_VNODE_H | |
3446 | +#define _SPL_VNODE_H | |
3447 | ||
3448 | #include <linux/module.h> | |
3449 | #include <linux/syscalls.h> | |
3450 | @@ -49,25 +49,25 @@ | |
3451 | * was properly split in to O_SYNC and O_DSYNC respectively. | |
3452 | */ | |
3453 | #ifndef O_DSYNC | |
3454 | -#define O_DSYNC O_SYNC | |
3455 | +#define O_DSYNC O_SYNC | |
3456 | #endif | |
3457 | ||
3458 | -#define FREAD 1 | |
3459 | -#define FWRITE 2 | |
3460 | -#define FCREAT O_CREAT | |
3461 | -#define FTRUNC O_TRUNC | |
3462 | -#define FOFFMAX O_LARGEFILE | |
3463 | -#define FSYNC O_SYNC | |
3464 | -#define FDSYNC O_DSYNC | |
3465 | -#define FRSYNC O_SYNC | |
3466 | -#define FEXCL O_EXCL | |
3467 | -#define FDIRECT O_DIRECT | |
3468 | -#define FAPPEND O_APPEND | |
3469 | +#define FREAD 1 | |
3470 | +#define FWRITE 2 | |
3471 | +#define FCREAT O_CREAT | |
3472 | +#define FTRUNC O_TRUNC | |
3473 | +#define FOFFMAX O_LARGEFILE | |
3474 | +#define FSYNC O_SYNC | |
3475 | +#define FDSYNC O_DSYNC | |
3476 | +#define FRSYNC O_SYNC | |
3477 | +#define FEXCL O_EXCL | |
3478 | +#define FDIRECT O_DIRECT | |
3479 | +#define FAPPEND O_APPEND | |
3480 | ||
3481 | -#define FNODSYNC 0x10000 /* fsync pseudo flag */ | |
3482 | -#define FNOFOLLOW 0x20000 /* don't follow symlinks */ | |
3483 | +#define FNODSYNC 0x10000 /* fsync pseudo flag */ | |
3484 | +#define FNOFOLLOW 0x20000 /* don't follow symlinks */ | |
3485 | ||
3486 | -#define F_FREESP 11 /* Free file space */ | |
3487 | +#define F_FREESP 11 /* Free file space */ | |
3488 | ||
3489 | ||
3490 | /* | |
3491 | @@ -79,30 +79,30 @@ | |
3492 | #undef AT_UID | |
3493 | #undef AT_GID | |
3494 | ||
3495 | -#define AT_MODE ATTR_MODE | |
3496 | -#define AT_UID ATTR_UID | |
3497 | -#define AT_GID ATTR_GID | |
3498 | -#define AT_SIZE ATTR_SIZE | |
3499 | -#define AT_ATIME ATTR_ATIME | |
3500 | -#define AT_MTIME ATTR_MTIME | |
3501 | -#define AT_CTIME ATTR_CTIME | |
3502 | +#define AT_MODE ATTR_MODE | |
3503 | +#define AT_UID ATTR_UID | |
3504 | +#define AT_GID ATTR_GID | |
3505 | +#define AT_SIZE ATTR_SIZE | |
3506 | +#define AT_ATIME ATTR_ATIME | |
3507 | +#define AT_MTIME ATTR_MTIME | |
3508 | +#define AT_CTIME ATTR_CTIME | |
3509 | ||
3510 | -#define ATTR_XVATTR (1 << 31) | |
3511 | -#define AT_XVATTR ATTR_XVATTR | |
3512 | +#define ATTR_XVATTR (1 << 31) | |
3513 | +#define AT_XVATTR ATTR_XVATTR | |
3514 | ||
3515 | -#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \ | |
3516 | +#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \ | |
3517 | ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_FILE) | |
3518 | ||
3519 | -#define CRCREAT 0x01 | |
3520 | -#define RMFILE 0x02 | |
3521 | +#define CRCREAT 0x01 | |
3522 | +#define RMFILE 0x02 | |
3523 | ||
3524 | -#define B_INVAL 0x01 | |
3525 | -#define B_TRUNC 0x02 | |
3526 | +#define B_INVAL 0x01 | |
3527 | +#define B_TRUNC 0x02 | |
3528 | ||
3529 | -#define LOOKUP_DIR 0x01 | |
3530 | -#define LOOKUP_XATTR 0x02 | |
3531 | -#define CREATE_XATTR_DIR 0x04 | |
3532 | -#define ATTR_NOACLCHECK 0x20 | |
3533 | +#define LOOKUP_DIR 0x01 | |
3534 | +#define LOOKUP_XATTR 0x02 | |
3535 | +#define CREATE_XATTR_DIR 0x04 | |
3536 | +#define ATTR_NOACLCHECK 0x20 | |
3537 | ||
3538 | typedef enum vtype { | |
3539 | VNON = 0, | |
3540 | @@ -121,8 +121,8 @@ typedef enum vtype { | |
3541 | ||
3542 | typedef struct vattr { | |
3543 | enum vtype va_type; /* vnode type */ | |
3544 | - u_int va_mask; /* attribute bit-mask */ | |
3545 | - u_short va_mode; /* acc mode */ | |
3546 | + uint_t va_mask; /* attribute bit-mask */ | |
3547 | + ushort_t va_mode; /* acc mode */ | |
3548 | uid_t va_uid; /* owner uid */ | |
3549 | gid_t va_gid; /* owner gid */ | |
3550 | long va_fsid; /* fs id */ | |
3551 | @@ -168,12 +168,12 @@ void vn_free(vnode_t *vp); | |
3552 | extern vtype_t vn_mode_to_vtype(mode_t); | |
3553 | extern mode_t vn_vtype_to_mode(vtype_t); | |
3554 | extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode, | |
3555 | - vnode_t **vpp, int x1, void *x2); | |
3556 | + vnode_t **vpp, int x1, void *x2); | |
3557 | extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode, | |
3558 | - vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); | |
3559 | + vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); | |
3560 | extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, | |
3561 | - offset_t off, uio_seg_t seg, int x1, rlim64_t x2, | |
3562 | - void *x3, ssize_t *residp); | |
3563 | + offset_t off, uio_seg_t seg, int x1, rlim64_t x2, | |
3564 | + void *x3, ssize_t *residp); | |
3565 | extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4); | |
3566 | extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct); | |
3567 | ||
3568 | @@ -189,16 +189,16 @@ extern int vn_set_pwd(const char *filename); | |
3569 | int spl_vn_init(void); | |
3570 | void spl_vn_fini(void); | |
3571 | ||
3572 | -#define VOP_CLOSE vn_close | |
3573 | -#define VOP_SEEK vn_seek | |
3574 | -#define VOP_GETATTR vn_getattr | |
3575 | -#define VOP_FSYNC vn_fsync | |
3576 | -#define VOP_SPACE vn_space | |
3577 | -#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0) | |
3578 | -#define vn_is_readonly(vp) 0 | |
3579 | -#define getf vn_getf | |
3580 | -#define releasef vn_releasef | |
3581 | -#define areleasef vn_areleasef | |
3582 | +#define VOP_CLOSE vn_close | |
3583 | +#define VOP_SEEK vn_seek | |
3584 | +#define VOP_GETATTR vn_getattr | |
3585 | +#define VOP_FSYNC vn_fsync | |
3586 | +#define VOP_SPACE vn_space | |
3587 | +#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0) | |
3588 | +#define vn_is_readonly(vp) 0 | |
3589 | +#define getf vn_getf | |
3590 | +#define releasef vn_releasef | |
3591 | +#define areleasef vn_areleasef | |
3592 | ||
3593 | extern vnode_t *rootdir; | |
3594 | ||
3595 | diff --git a/include/sys/zmod.h b/include/sys/zmod.h | |
3596 | index 15b0bc8..c1d2524 100644 | |
3597 | --- a/include/sys/zmod.h | |
3598 | +++ b/include/sys/zmod.h | |
3599 | @@ -20,7 +20,8 @@ | |
3600 | * | |
3601 | * You should have received a copy of the GNU General Public License along | |
3602 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
3603 | - ***************************************************************************** | |
3604 | + * | |
3605 | + * | |
3606 | * z_compress_level/z_uncompress are nearly identical copies of the | |
3607 | * compress2/uncompress functions provided by the official zlib package | |
3608 | * available at http://zlib.net/. The only changes made we to slightly | |
3609 | @@ -53,7 +54,7 @@ | |
3610 | \*****************************************************************************/ | |
3611 | ||
3612 | #ifndef _SPL_ZMOD_H | |
3613 | -#define _SPL_ZMOD_H | |
3614 | +#define _SPL_ZMOD_H | |
3615 | ||
3616 | #include <sys/types.h> | |
3617 | #include <linux/zlib.h> | |
3618 | diff --git a/include/sys/zone.h b/include/sys/zone.h | |
3619 | index 5a3c086..47e83ba 100644 | |
3620 | --- a/include/sys/zone.h | |
3621 | +++ b/include/sys/zone.h | |
3622 | @@ -23,7 +23,7 @@ | |
3623 | \*****************************************************************************/ | |
3624 | ||
3625 | #ifndef _SPL_ZONE_H | |
3626 | -#define _SPL_ZONE_H | |
3627 | +#define _SPL_ZONE_H | |
3628 | ||
3629 | #include <sys/byteorder.h> | |
3630 | ||
3631 | diff --git a/include/unistd.h b/include/unistd.h | |
3632 | index e1d93c6..9391d1a 100644 | |
3633 | --- a/include/unistd.h | |
3634 | +++ b/include/unistd.h | |
3635 | @@ -23,6 +23,6 @@ | |
3636 | \*****************************************************************************/ | |
3637 | ||
3638 | #ifndef _SPL_UNISTD_H | |
3639 | -#define _SPL_UNISTD_H | |
3640 | +#define _SPL_UNISTD_H | |
3641 | ||
3642 | #endif /* SPL_UNISTD_H */ | |
3643 | diff --git a/include/util/qsort.h b/include/util/qsort.h | |
3644 | index e55c4f8..de0d350 100644 | |
3645 | --- a/include/util/qsort.h | |
3646 | +++ b/include/util/qsort.h | |
3647 | @@ -23,10 +23,10 @@ | |
3648 | \*****************************************************************************/ | |
3649 | ||
3650 | #ifndef _SPL_QSORT_H | |
3651 | -#define _SPL_QSORT_H | |
3652 | +#define _SPL_QSORT_H | |
3653 | ||
3654 | #include <linux/sort.h> | |
3655 | ||
3656 | -#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL) | |
3657 | +#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL) | |
3658 | ||
3659 | #endif /* SPL_QSORT_H */ | |
3660 | diff --git a/include/util/sscanf.h b/include/util/sscanf.h | |
3661 | index 23f0b5d..10e669d 100644 | |
3662 | --- a/include/util/sscanf.h | |
3663 | +++ b/include/util/sscanf.h | |
3664 | @@ -23,6 +23,6 @@ | |
3665 | \*****************************************************************************/ | |
3666 | ||
3667 | #ifndef _SPL_UTIL_SSCANF_H | |
3668 | -#define _SPL_UTIL_SSCANF_H | |
3669 | +#define _SPL_UTIL_SSCANF_H | |
3670 | ||
3671 | #endif /* SPL_UTIL_SSCAN_H */ | |
3672 | diff --git a/include/vm/anon.h b/include/vm/anon.h | |
3673 | index 9c9c239..049a326 100644 | |
3674 | --- a/include/vm/anon.h | |
3675 | +++ b/include/vm/anon.h | |
3676 | @@ -23,6 +23,6 @@ | |
3677 | \*****************************************************************************/ | |
3678 | ||
3679 | #ifndef _SPL_VM_ANON_H | |
3680 | -#define _SPL_VM_ANON_H | |
3681 | +#define _SPL_VM_ANON_H | |
3682 | ||
3683 | #endif /* SPL_VM_ANON_H */ | |
3684 | diff --git a/include/vm/pvn.h b/include/vm/pvn.h | |
3685 | index f3b3081..e56caf4 100644 | |
3686 | --- a/include/vm/pvn.h | |
3687 | +++ b/include/vm/pvn.h | |
3688 | @@ -23,6 +23,6 @@ | |
3689 | \*****************************************************************************/ | |
3690 | ||
3691 | #ifndef _SPL_VM_PVN_H | |
3692 | -#define _SPL_VM_PVN_H | |
3693 | +#define _SPL_VM_PVN_H | |
3694 | ||
3695 | #endif /* SPL_VM_PVN_H */ | |
3696 | diff --git a/include/vm/seg_kmem.h b/include/vm/seg_kmem.h | |
3697 | index 17df7b9..3ef2474 100644 | |
3698 | --- a/include/vm/seg_kmem.h | |
3699 | +++ b/include/vm/seg_kmem.h | |
3700 | @@ -23,7 +23,7 @@ | |
3701 | \*****************************************************************************/ | |
3702 | ||
3703 | #ifndef _SPL_SEG_KMEM_H | |
3704 | -#define _SPL_SEG_KMEM_H | |
3705 | +#define _SPL_SEG_KMEM_H | |
3706 | ||
3707 | #include <sys/vmsystm.h> | |
3708 | ||
3709 | diff --git a/module/spl/spl-atomic.c b/module/spl/spl-atomic.c | |
3710 | index c46252c..4e1e42c 100644 | |
3711 | --- a/module/spl/spl-atomic.c | |
3712 | +++ b/module/spl/spl-atomic.c | |
3713 | @@ -20,18 +20,12 @@ | |
3714 | * | |
3715 | * You should have received a copy of the GNU General Public License along | |
3716 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
3717 | - ***************************************************************************** | |
3718 | + * | |
3719 | * Solaris Porting Layer (SPL) Atomic Implementation. | |
3720 | \*****************************************************************************/ | |
3721 | ||
3722 | #include <sys/atomic.h> | |
3723 | ||
3724 | -#ifdef DEBUG_SUBSYSTEM | |
3725 | -#undef DEBUG_SUBSYSTEM | |
3726 | -#endif | |
3727 | - | |
3728 | -#define DEBUG_SUBSYSTEM S_ATOMIC | |
3729 | - | |
3730 | #ifdef ATOMIC_SPINLOCK | |
3731 | /* Global atomic lock declarations */ | |
3732 | DEFINE_SPINLOCK(atomic32_lock); | |
3733 | diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c | |
3734 | index 4778fb2..f0060bb 100644 | |
3735 | --- a/module/spl/spl-condvar.c | |
3736 | +++ b/module/spl/spl-condvar.c | |
3737 | @@ -335,8 +335,8 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, | |
3738 | * Compatibility wrapper for the cv_timedwait_hires() Illumos interface. | |
3739 | */ | |
3740 | static clock_t | |
3741 | -cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, | |
3742 | - int flag, int state) | |
3743 | +cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, | |
3744 | + hrtime_t res, int flag, int state) | |
3745 | { | |
3746 | if (res > 1) { | |
3747 | /* | |
3748 | @@ -363,8 +363,8 @@ cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, | |
3749 | EXPORT_SYMBOL(cv_timedwait_hires); | |
3750 | ||
3751 | clock_t | |
3752 | -cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, | |
3753 | - int flag) | |
3754 | +cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, | |
3755 | + hrtime_t res, int flag) | |
3756 | { | |
3757 | return (cv_timedwait_hires_common(cvp, mp, tim, res, flag, | |
3758 | TASK_INTERRUPTIBLE)); | |
3759 | diff --git a/module/spl/spl-cred.c b/module/spl/spl-cred.c | |
3760 | index 1d486c1..f7f7d87 100644 | |
3761 | --- a/module/spl/spl-cred.c | |
3762 | +++ b/module/spl/spl-cred.c | |
3763 | @@ -20,18 +20,12 @@ | |
3764 | * | |
3765 | * You should have received a copy of the GNU General Public License along | |
3766 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
3767 | - ***************************************************************************** | |
3768 | + * | |
3769 | * Solaris Porting Layer (SPL) Credential Implementation. | |
3770 | \*****************************************************************************/ | |
3771 | ||
3772 | #include <sys/cred.h> | |
3773 | ||
3774 | -#ifdef DEBUG_SUBSYSTEM | |
3775 | -#undef DEBUG_SUBSYSTEM | |
3776 | -#endif | |
3777 | - | |
3778 | -#define DEBUG_SUBSYSTEM S_CRED | |
3779 | - | |
3780 | static int | |
3781 | #ifdef HAVE_KUIDGID_T | |
3782 | cr_groups_search(const struct group_info *group_info, kgid_t grp) | |
3783 | @@ -43,7 +37,7 @@ cr_groups_search(const struct group_info *group_info, gid_t grp) | |
3784 | int cmp; | |
3785 | ||
3786 | if (!group_info) | |
3787 | - return 0; | |
3788 | + return (0); | |
3789 | ||
3790 | left = 0; | |
3791 | right = group_info->ngroups; | |
3792 | @@ -57,16 +51,16 @@ cr_groups_search(const struct group_info *group_info, gid_t grp) | |
3793 | else if (cmp < 0) | |
3794 | right = mid; | |
3795 | else | |
3796 | - return 1; | |
3797 | + return (1); | |
3798 | } | |
3799 | - return 0; | |
3800 | + return (0); | |
3801 | } | |
3802 | ||
3803 | /* Hold a reference on the credential */ | |
3804 | void | |
3805 | crhold(cred_t *cr) | |
3806 | { | |
3807 | - (void)get_cred((const cred_t *)cr); | |
3808 | + (void) get_cred((const cred_t *)cr); | |
3809 | } | |
3810 | ||
3811 | /* Free a reference on the credential */ | |
3812 | @@ -96,7 +90,7 @@ crgetngroups(const cred_t *cr) | |
3813 | rc = NGROUPS_PER_BLOCK; | |
3814 | } | |
3815 | #endif | |
3816 | - return rc; | |
3817 | + return (rc); | |
3818 | } | |
3819 | ||
3820 | /* | |
3821 | @@ -119,7 +113,7 @@ crgetgroups(const cred_t *cr) | |
3822 | if (gi->nblocks > 0) | |
3823 | gids = KGIDP_TO_SGIDP(gi->blocks[0]); | |
3824 | #endif | |
3825 | - return gids; | |
3826 | + return (gids); | |
3827 | } | |
3828 | ||
3829 | /* Check if the passed gid is available in supplied credential. */ | |
3830 | @@ -132,63 +126,63 @@ groupmember(gid_t gid, const cred_t *cr) | |
3831 | gi = cr->group_info; | |
3832 | rc = cr_groups_search(gi, SGID_TO_KGID(gid)); | |
3833 | ||
3834 | - return rc; | |
3835 | + return (rc); | |
3836 | } | |
3837 | ||
3838 | /* Return the effective user id */ | |
3839 | uid_t | |
3840 | crgetuid(const cred_t *cr) | |
3841 | { | |
3842 | - return KUID_TO_SUID(cr->euid); | |
3843 | + return (KUID_TO_SUID(cr->euid)); | |
3844 | } | |
3845 | ||
3846 | /* Return the real user id */ | |
3847 | uid_t | |
3848 | crgetruid(const cred_t *cr) | |
3849 | { | |
3850 | - return KUID_TO_SUID(cr->uid); | |
3851 | + return (KUID_TO_SUID(cr->uid)); | |
3852 | } | |
3853 | ||
3854 | /* Return the saved user id */ | |
3855 | uid_t | |
3856 | crgetsuid(const cred_t *cr) | |
3857 | { | |
3858 | - return KUID_TO_SUID(cr->suid); | |
3859 | + return (KUID_TO_SUID(cr->suid)); | |
3860 | } | |
3861 | ||
3862 | /* Return the filesystem user id */ | |
3863 | uid_t | |
3864 | crgetfsuid(const cred_t *cr) | |
3865 | { | |
3866 | - return KUID_TO_SUID(cr->fsuid); | |
3867 | + return (KUID_TO_SUID(cr->fsuid)); | |
3868 | } | |
3869 | ||
3870 | /* Return the effective group id */ | |
3871 | gid_t | |
3872 | crgetgid(const cred_t *cr) | |
3873 | { | |
3874 | - return KGID_TO_SGID(cr->egid); | |
3875 | + return (KGID_TO_SGID(cr->egid)); | |
3876 | } | |
3877 | ||
3878 | /* Return the real group id */ | |
3879 | gid_t | |
3880 | crgetrgid(const cred_t *cr) | |
3881 | { | |
3882 | - return KGID_TO_SGID(cr->gid); | |
3883 | + return (KGID_TO_SGID(cr->gid)); | |
3884 | } | |
3885 | ||
3886 | /* Return the saved group id */ | |
3887 | gid_t | |
3888 | crgetsgid(const cred_t *cr) | |
3889 | { | |
3890 | - return KGID_TO_SGID(cr->sgid); | |
3891 | + return (KGID_TO_SGID(cr->sgid)); | |
3892 | } | |
3893 | ||
3894 | /* Return the filesystem group id */ | |
3895 | gid_t | |
3896 | crgetfsgid(const cred_t *cr) | |
3897 | { | |
3898 | - return KGID_TO_SGID(cr->fsgid); | |
3899 | + return (KGID_TO_SGID(cr->fsgid)); | |
3900 | } | |
3901 | ||
3902 | EXPORT_SYMBOL(crhold); | |
3903 | diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c | |
3904 | index 2f66b6e..e089de2 100644 | |
3905 | --- a/module/spl/spl-err.c | |
3906 | +++ b/module/spl/spl-err.c | |
3907 | @@ -20,7 +20,7 @@ | |
3908 | * | |
3909 | * You should have received a copy of the GNU General Public License along | |
3910 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
3911 | - ***************************************************************************** | |
3912 | + * | |
3913 | * Solaris Porting Layer (SPL) Error Implementation. | |
3914 | \*****************************************************************************/ | |
3915 | ||
3916 | @@ -36,8 +36,7 @@ | |
3917 | */ | |
3918 | unsigned int spl_panic_halt; | |
3919 | module_param(spl_panic_halt, uint, 0644); | |
3920 | -MODULE_PARM_DESC(spl_panic_halt, | |
3921 | - "Cause kernel panic on assertion failures"); | |
3922 | +MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures"); | |
3923 | ||
3924 | /* | |
3925 | * Limit the number of stack traces dumped to not more than 5 every | |
3926 | diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c | |
3927 | index f6782da..80fc54c 100644 | |
3928 | --- a/module/spl/spl-generic.c | |
3929 | +++ b/module/spl/spl-generic.c | |
3930 | @@ -20,7 +20,7 @@ | |
3931 | * | |
3932 | * You should have received a copy of the GNU General Public License along | |
3933 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
3934 | - ***************************************************************************** | |
3935 | + * | |
3936 | * Solaris Porting Layer (SPL) Generic Implementation. | |
3937 | \*****************************************************************************/ | |
3938 | ||
3939 | @@ -109,13 +109,14 @@ spl_rand_next(uint64_t *s) { | |
3940 | ||
3941 | static inline void | |
3942 | spl_rand_jump(uint64_t *s) { | |
3943 | - static const uint64_t JUMP[] = { 0x8a5cd789635d2dff, 0x121fd2155c472f96 }; | |
3944 | + static const uint64_t JUMP[] = | |
3945 | + { 0x8a5cd789635d2dff, 0x121fd2155c472f96 }; | |
3946 | ||
3947 | uint64_t s0 = 0; | |
3948 | uint64_t s1 = 0; | |
3949 | int i, b; | |
3950 | - for(i = 0; i < sizeof JUMP / sizeof *JUMP; i++) | |
3951 | - for(b = 0; b < 64; b++) { | |
3952 | + for (i = 0; i < sizeof (JUMP) / sizeof (*JUMP); i++) | |
3953 | + for (b = 0; b < 64; b++) { | |
3954 | if (JUMP[i] & 1ULL << b) { | |
3955 | s0 ^= s[0]; | |
3956 | s1 ^= s[1]; | |
3957 | @@ -187,16 +188,16 @@ nlz64(uint64_t x) { | |
3958 | register int n = 0; | |
3959 | ||
3960 | if (x == 0) | |
3961 | - return 64; | |
3962 | + return (64); | |
3963 | ||
3964 | - if (x <= 0x00000000FFFFFFFFULL) {n = n + 32; x = x << 32;} | |
3965 | - if (x <= 0x0000FFFFFFFFFFFFULL) {n = n + 16; x = x << 16;} | |
3966 | - if (x <= 0x00FFFFFFFFFFFFFFULL) {n = n + 8; x = x << 8;} | |
3967 | - if (x <= 0x0FFFFFFFFFFFFFFFULL) {n = n + 4; x = x << 4;} | |
3968 | - if (x <= 0x3FFFFFFFFFFFFFFFULL) {n = n + 2; x = x << 2;} | |
3969 | - if (x <= 0x7FFFFFFFFFFFFFFFULL) {n = n + 1;} | |
3970 | + if (x <= 0x00000000FFFFFFFFULL) { n = n + 32; x = x << 32; } | |
3971 | + if (x <= 0x0000FFFFFFFFFFFFULL) { n = n + 16; x = x << 16; } | |
3972 | + if (x <= 0x00FFFFFFFFFFFFFFULL) { n = n + 8; x = x << 8; } | |
3973 | + if (x <= 0x0FFFFFFFFFFFFFFFULL) { n = n + 4; x = x << 4; } | |
3974 | + if (x <= 0x3FFFFFFFFFFFFFFFULL) { n = n + 2; x = x << 2; } | |
3975 | + if (x <= 0x7FFFFFFFFFFFFFFFULL) { n = n + 1; } | |
3976 | ||
3977 | - return n; | |
3978 | + return (n); | |
3979 | } | |
3980 | ||
3981 | /* | |
3982 | @@ -207,7 +208,7 @@ static inline uint64_t | |
3983 | __div_u64(uint64_t u, uint32_t v) | |
3984 | { | |
3985 | (void) do_div(u, v); | |
3986 | - return u; | |
3987 | + return (u); | |
3988 | } | |
3989 | ||
3990 | /* | |
3991 | @@ -227,7 +228,7 @@ __udivdi3(uint64_t u, uint64_t v) | |
3992 | ||
3993 | if (v >> 32 == 0) { // If v < 2**32: | |
3994 | if (u >> 32 < v) { // If u/v cannot overflow, | |
3995 | - return __div_u64(u, v); // just do one division. | |
3996 | + return (__div_u64(u, v)); // just do one division. | |
3997 | } else { // If u/v would overflow: | |
3998 | u1 = u >> 32; // Break u into two halves. | |
3999 | u0 = u & 0xFFFFFFFF; | |
4000 | @@ -235,7 +236,7 @@ __udivdi3(uint64_t u, uint64_t v) | |
4001 | k = u1 - q1 * v; // First remainder, < v. | |
4002 | u0 += (k << 32); | |
4003 | q0 = __div_u64(u0, v); // Seconds quotient digit. | |
4004 | - return (q1 << 32) + q0; | |
4005 | + return ((q1 << 32) + q0); | |
4006 | } | |
4007 | } else { // If v >= 2**32: | |
4008 | n = nlz64(v); // 0 <= n <= 31. | |
4009 | @@ -249,7 +250,7 @@ __udivdi3(uint64_t u, uint64_t v) | |
4010 | if ((u - q0 * v) >= v) | |
4011 | q0 = q0 + 1; // Now q0 is correct. | |
4012 | ||
4013 | - return q0; | |
4014 | + return (q0); | |
4015 | } | |
4016 | } | |
4017 | EXPORT_SYMBOL(__udivdi3); | |
4018 | @@ -263,7 +264,7 @@ __divdi3(int64_t u, int64_t v) | |
4019 | int64_t q, t; | |
4020 | q = __udivdi3(abs64(u), abs64(v)); | |
4021 | t = (u ^ v) >> 63; // If u, v have different | |
4022 | - return (q ^ t) - t; // signs, negate q. | |
4023 | + return ((q ^ t) - t); // signs, negate q. | |
4024 | } | |
4025 | EXPORT_SYMBOL(__divdi3); | |
4026 | ||
4027 | @@ -344,9 +345,11 @@ __aeabi_uldivmod(uint64_t u, uint64_t v) | |
4028 | register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF); | |
4029 | register uint32_t r3 asm("r3") = (mod >> 32); | |
4030 | ||
4031 | + /* BEGIN CSTYLED */ | |
4032 | asm volatile("" | |
4033 | : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */ | |
4034 | : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */ | |
4035 | + /* END CSTYLED */ | |
4036 | ||
4037 | return; /* r0; */ | |
4038 | } | |
4039 | @@ -367,9 +370,11 @@ __aeabi_ldivmod(int64_t u, int64_t v) | |
4040 | register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF); | |
4041 | register uint32_t r3 asm("r3") = (mod >> 32); | |
4042 | ||
4043 | + /* BEGIN CSTYLED */ | |
4044 | asm volatile("" | |
4045 | : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */ | |
4046 | : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */ | |
4047 | + /* END CSTYLED */ | |
4048 | ||
4049 | return; /* r0; */ | |
4050 | } | |
4051 | @@ -378,7 +383,8 @@ EXPORT_SYMBOL(__aeabi_ldivmod); | |
4052 | #endif /* __arm || __arm__ */ | |
4053 | #endif /* BITS_PER_LONG */ | |
4054 | ||
4055 | -/* NOTE: The strtoxx behavior is solely based on my reading of the Solaris | |
4056 | +/* | |
4057 | + * NOTE: The strtoxx behavior is solely based on my reading of the Solaris | |
4058 | * ddi_strtol(9F) man page. I have not verified the behavior of these | |
4059 | * functions against their Solaris counterparts. It is possible that I | |
4060 | * may have misinterpreted the man page or the man page is incorrect. | |
4061 | @@ -388,28 +394,28 @@ int ddi_strtol(const char *, char **, int, long *); | |
4062 | int ddi_strtoull(const char *, char **, int, unsigned long long *); | |
4063 | int ddi_strtoll(const char *, char **, int, long long *); | |
4064 | ||
4065 | -#define define_ddi_strtoux(type, valtype) \ | |
4066 | +#define define_ddi_strtoux(type, valtype) \ | |
4067 | int ddi_strtou##type(const char *str, char **endptr, \ | |
4068 | - int base, valtype *result) \ | |
4069 | + int base, valtype *result) \ | |
4070 | { \ | |
4071 | valtype last_value, value = 0; \ | |
4072 | char *ptr = (char *)str; \ | |
4073 | int flag = 1, digit; \ | |
4074 | \ | |
4075 | if (strlen(ptr) == 0) \ | |
4076 | - return EINVAL; \ | |
4077 | + return (EINVAL); \ | |
4078 | \ | |
4079 | /* Auto-detect base based on prefix */ \ | |
4080 | if (!base) { \ | |
4081 | if (str[0] == '0') { \ | |
4082 | - if (tolower(str[1])=='x' && isxdigit(str[2])) { \ | |
4083 | + if (tolower(str[1]) == 'x' && isxdigit(str[2])) { \ | |
4084 | base = 16; /* hex */ \ | |
4085 | ptr += 2; \ | |
4086 | } else if (str[1] >= '0' && str[1] < 8) { \ | |
4087 | base = 8; /* octal */ \ | |
4088 | ptr += 1; \ | |
4089 | } else { \ | |
4090 | - return EINVAL; \ | |
4091 | + return (EINVAL); \ | |
4092 | } \ | |
4093 | } else { \ | |
4094 | base = 10; /* decimal */ \ | |
4095 | @@ -430,7 +436,7 @@ int ddi_strtou##type(const char *str, char **endptr, \ | |
4096 | last_value = value; \ | |
4097 | value = value * base + digit; \ | |
4098 | if (last_value > value) /* Overflow */ \ | |
4099 | - return ERANGE; \ | |
4100 | + return (ERANGE); \ | |
4101 | \ | |
4102 | flag = 1; \ | |
4103 | ptr++; \ | |
4104 | @@ -442,12 +448,12 @@ int ddi_strtou##type(const char *str, char **endptr, \ | |
4105 | if (endptr) \ | |
4106 | *endptr = (char *)(flag ? ptr : str); \ | |
4107 | \ | |
4108 | - return 0; \ | |
4109 | + return (0); \ | |
4110 | } \ | |
4111 | ||
4112 | -#define define_ddi_strtox(type, valtype) \ | |
4113 | +#define define_ddi_strtox(type, valtype) \ | |
4114 | int ddi_strto##type(const char *str, char **endptr, \ | |
4115 | - int base, valtype *result) \ | |
4116 | + int base, valtype *result) \ | |
4117 | { \ | |
4118 | int rc; \ | |
4119 | \ | |
4120 | @@ -463,7 +469,7 @@ int ddi_strto##type(const char *str, char **endptr, \ | |
4121 | rc = ddi_strtou##type(str, endptr, base, result); \ | |
4122 | } \ | |
4123 | \ | |
4124 | - return rc; \ | |
4125 | + return (rc); \ | |
4126 | } | |
4127 | ||
4128 | define_ddi_strtoux(l, unsigned long) | |
4129 | @@ -482,10 +488,10 @@ ddi_copyin(const void *from, void *to, size_t len, int flags) | |
4130 | /* Fake ioctl() issued by kernel, 'from' is a kernel address */ | |
4131 | if (flags & FKIOCTL) { | |
4132 | memcpy(to, from, len); | |
4133 | - return 0; | |
4134 | + return (0); | |
4135 | } | |
4136 | ||
4137 | - return copyin(from, to, len); | |
4138 | + return (copyin(from, to, len)); | |
4139 | } | |
4140 | EXPORT_SYMBOL(ddi_copyin); | |
4141 | ||
4142 | @@ -495,10 +501,10 @@ ddi_copyout(const void *from, void *to, size_t len, int flags) | |
4143 | /* Fake ioctl() issued by kernel, 'from' is a kernel address */ | |
4144 | if (flags & FKIOCTL) { | |
4145 | memcpy(to, from, len); | |
4146 | - return 0; | |
4147 | + return (0); | |
4148 | } | |
4149 | ||
4150 | - return copyout(from, to, len); | |
4151 | + return (copyout(from, to, len)); | |
4152 | } | |
4153 | EXPORT_SYMBOL(ddi_copyout); | |
4154 | ||
4155 | @@ -559,7 +565,7 @@ hostid_read(uint32_t *hostid) | |
4156 | return (error); | |
4157 | } | |
4158 | ||
4159 | - if (size < sizeof(HW_HOSTID_MASK)) { | |
4160 | + if (size < sizeof (HW_HOSTID_MASK)) { | |
4161 | kobj_close_file(file); | |
4162 | return (EINVAL); | |
4163 | } | |
4164 | @@ -568,7 +574,7 @@ hostid_read(uint32_t *hostid) | |
4165 | * Read directly into the variable like eglibc does. | |
4166 | * Short reads are okay; native behavior is preserved. | |
4167 | */ | |
4168 | - error = kobj_read_file(file, (char *)&value, sizeof(value), 0); | |
4169 | + error = kobj_read_file(file, (char *)&value, sizeof (value), 0); | |
4170 | if (error < 0) { | |
4171 | kobj_close_file(file); | |
4172 | return (EIO); | |
4173 | @@ -578,7 +584,7 @@ hostid_read(uint32_t *hostid) | |
4174 | *hostid = (value & HW_HOSTID_MASK); | |
4175 | kobj_close_file(file); | |
4176 | ||
4177 | - return 0; | |
4178 | + return (0); | |
4179 | } | |
4180 | ||
4181 | /* | |
4182 | @@ -704,7 +710,7 @@ spl_init(void) | |
4183 | goto out10; | |
4184 | ||
4185 | printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, | |
4186 | - SPL_META_RELEASE, SPL_DEBUG_STR); | |
4187 | + SPL_META_RELEASE, SPL_DEBUG_STR); | |
4188 | return (rc); | |
4189 | ||
4190 | out10: | |
4191 | @@ -727,8 +733,8 @@ out2: | |
4192 | spl_kvmem_fini(); | |
4193 | out1: | |
4194 | printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer " | |
4195 | - "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, | |
4196 | - SPL_DEBUG_STR, rc); | |
4197 | + "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, | |
4198 | + SPL_DEBUG_STR, rc); | |
4199 | ||
4200 | return (rc); | |
4201 | } | |
4202 | @@ -737,7 +743,7 @@ static void __exit | |
4203 | spl_fini(void) | |
4204 | { | |
4205 | printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n", | |
4206 | - SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); | |
4207 | + SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); | |
4208 | spl_zlib_fini(); | |
4209 | spl_kstat_fini(); | |
4210 | spl_proc_fini(); | |
4211 | diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c | |
4212 | index 3668669..e4bcdd8 100644 | |
4213 | --- a/module/spl/spl-kmem-cache.c | |
4214 | +++ b/module/spl/spl-kmem-cache.c | |
4215 | @@ -134,8 +134,8 @@ MODULE_PARM_DESC(spl_kmem_cache_slab_limit, | |
4216 | * have been deemed costly by the kernel. | |
4217 | */ | |
4218 | unsigned int spl_kmem_cache_kmem_limit = | |
4219 | - ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) / | |
4220 | - SPL_KMEM_CACHE_OBJ_PER_SLAB; | |
4221 | + ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) / | |
4222 | + SPL_KMEM_CACHE_OBJ_PER_SLAB; | |
4223 | module_param(spl_kmem_cache_kmem_limit, uint, 0644); | |
4224 | MODULE_PARM_DESC(spl_kmem_cache_kmem_limit, | |
4225 | "Objects less than N bytes use the kmalloc"); | |
4226 | @@ -1000,15 +1000,15 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, | |
4227 | #endif | |
4228 | ||
4229 | #if defined(HAVE_KMEM_CACHE_CREATE_USERCOPY) | |
4230 | - /* | |
4231 | - * Newer grsec patchset uses kmem_cache_create_usercopy() | |
4232 | - * instead of SLAB_USERCOPY flag | |
4233 | - */ | |
4234 | - skc->skc_linux_cache = kmem_cache_create_usercopy( | |
4235 | - skc->skc_name, size, align, slabflags, 0, size, NULL); | |
4236 | + /* | |
4237 | + * Newer grsec patchset uses kmem_cache_create_usercopy() | |
4238 | + * instead of SLAB_USERCOPY flag | |
4239 | + */ | |
4240 | + skc->skc_linux_cache = kmem_cache_create_usercopy( | |
4241 | + skc->skc_name, size, align, slabflags, 0, size, NULL); | |
4242 | #else | |
4243 | - skc->skc_linux_cache = kmem_cache_create( | |
4244 | - skc->skc_name, size, align, slabflags, NULL); | |
4245 | + skc->skc_linux_cache = kmem_cache_create( | |
4246 | + skc->skc_name, size, align, slabflags, NULL); | |
4247 | #endif | |
4248 | if (skc->skc_linux_cache == NULL) { | |
4249 | rc = ENOMEM; | |
4250 | @@ -1186,7 +1186,7 @@ spl_cache_grow_work(void *data) | |
4251 | spl_kmem_alloc_t *ska = (spl_kmem_alloc_t *)data; | |
4252 | spl_kmem_cache_t *skc = ska->ska_cache; | |
4253 | ||
4254 | - (void)__spl_cache_grow(skc, ska->ska_flags); | |
4255 | + (void) __spl_cache_grow(skc, ska->ska_flags); | |
4256 | ||
4257 | atomic_dec(&skc->skc_ref); | |
4258 | smp_mb__before_atomic(); | |
4259 | diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c | |
4260 | index 41bec75..bf9c6b1 100755 | |
4261 | --- a/module/spl/spl-kmem.c | |
4262 | +++ b/module/spl/spl-kmem.c | |
4263 | @@ -383,7 +383,7 @@ spl_kmem_free_track(const void *ptr, size_t size) | |
4264 | { | |
4265 | kmem_debug_t *dptr; | |
4266 | ||
4267 | - /* Ignore NULL pointer since we haven't tracked it at all*/ | |
4268 | + /* Ignore NULL pointer since we haven't tracked it at all */ | |
4269 | if (ptr == NULL) | |
4270 | return; | |
4271 | ||
4272 | diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c | |
4273 | index b79fcb8..500f246 100644 | |
4274 | --- a/module/spl/spl-kobj.c | |
4275 | +++ b/module/spl/spl-kobj.c | |
4276 | @@ -20,7 +20,7 @@ | |
4277 | * | |
4278 | * You should have received a copy of the GNU General Public License along | |
4279 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
4280 | - ***************************************************************************** | |
4281 | + * | |
4282 | * Solaris Porting Layer (SPL) Kobj Implementation. | |
4283 | \*****************************************************************************/ | |
4284 | ||
4285 | @@ -33,7 +33,7 @@ kobj_open_file(const char *name) | |
4286 | vnode_t *vp; | |
4287 | int rc; | |
4288 | ||
4289 | - file = kmalloc(sizeof(_buf_t), kmem_flags_convert(KM_SLEEP)); | |
4290 | + file = kmalloc(sizeof (_buf_t), kmem_flags_convert(KM_SLEEP)); | |
4291 | if (file == NULL) | |
4292 | return ((_buf_t *)-1UL); | |
4293 | ||
4294 | @@ -52,7 +52,7 @@ void | |
4295 | kobj_close_file(struct _buf *file) | |
4296 | { | |
4297 | VOP_CLOSE(file->vp, 0, 0, 0, 0, 0); | |
4298 | - kfree(file); | |
4299 | + kfree(file); | |
4300 | } /* kobj_close_file() */ | |
4301 | EXPORT_SYMBOL(kobj_close_file); | |
4302 | ||
4303 | @@ -72,15 +72,15 @@ EXPORT_SYMBOL(kobj_read_file); | |
4304 | int | |
4305 | kobj_get_filesize(struct _buf *file, uint64_t *size) | |
4306 | { | |
4307 | - vattr_t vap; | |
4308 | + vattr_t vap; | |
4309 | int rc; | |
4310 | ||
4311 | rc = VOP_GETATTR(file->vp, &vap, 0, 0, NULL); | |
4312 | if (rc) | |
4313 | return (rc); | |
4314 | ||
4315 | - *size = vap.va_size; | |
4316 | + *size = vap.va_size; | |
4317 | ||
4318 | - return (rc); | |
4319 | + return (rc); | |
4320 | } /* kobj_get_filesize() */ | |
4321 | EXPORT_SYMBOL(kobj_get_filesize); | |
4322 | diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c | |
4323 | index ed52653..d2baa49 100644 | |
4324 | --- a/module/spl/spl-kstat.c | |
4325 | +++ b/module/spl/spl-kstat.c | |
4326 | @@ -20,7 +20,7 @@ | |
4327 | * | |
4328 | * You should have received a copy of the GNU General Public License along | |
4329 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
4330 | - ***************************************************************************** | |
4331 | + * | |
4332 | * Solaris Porting Layer (SPL) Kstat Implementation. | |
4333 | \*****************************************************************************/ | |
4334 | ||
4335 | @@ -30,7 +30,7 @@ | |
4336 | #include <sys/cmn_err.h> | |
4337 | ||
4338 | #ifndef HAVE_PDE_DATA | |
4339 | -#define PDE_DATA(x) (PDE(x)->data) | |
4340 | +#define PDE_DATA(x) (PDE(x)->data) | |
4341 | #endif | |
4342 | ||
4343 | static kmutex_t kstat_module_lock; | |
4344 | @@ -41,13 +41,13 @@ static int | |
4345 | kstat_resize_raw(kstat_t *ksp) | |
4346 | { | |
4347 | if (ksp->ks_raw_bufsize == KSTAT_RAW_MAX) | |
4348 | - return ENOMEM; | |
4349 | + return (ENOMEM); | |
4350 | ||
4351 | vmem_free(ksp->ks_raw_buf, ksp->ks_raw_bufsize); | |
4352 | ksp->ks_raw_bufsize = MIN(ksp->ks_raw_bufsize * 2, KSTAT_RAW_MAX); | |
4353 | ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); | |
4354 | ||
4355 | - return 0; | |
4356 | + return (0); | |
4357 | } | |
4358 | ||
4359 | void | |
4360 | @@ -119,210 +119,212 @@ EXPORT_SYMBOL(kstat_runq_exit); | |
4361 | static int | |
4362 | kstat_seq_show_headers(struct seq_file *f) | |
4363 | { | |
4364 | - kstat_t *ksp = (kstat_t *)f->private; | |
4365 | + kstat_t *ksp = (kstat_t *)f->private; | |
4366 | int rc = 0; | |
4367 | ||
4368 | - ASSERT(ksp->ks_magic == KS_MAGIC); | |
4369 | + ASSERT(ksp->ks_magic == KS_MAGIC); | |
4370 | ||
4371 | - seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n", | |
4372 | - ksp->ks_kid, ksp->ks_type, ksp->ks_flags, | |
4373 | - ksp->ks_ndata, (int)ksp->ks_data_size, | |
4374 | - ksp->ks_crtime, ksp->ks_snaptime); | |
4375 | + seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n", | |
4376 | + ksp->ks_kid, ksp->ks_type, ksp->ks_flags, | |
4377 | + ksp->ks_ndata, (int)ksp->ks_data_size, | |
4378 | + ksp->ks_crtime, ksp->ks_snaptime); | |
4379 | ||
4380 | switch (ksp->ks_type) { | |
4381 | - case KSTAT_TYPE_RAW: | |
4382 | + case KSTAT_TYPE_RAW: | |
4383 | restart: | |
4384 | - if (ksp->ks_raw_ops.headers) { | |
4385 | - rc = ksp->ks_raw_ops.headers( | |
4386 | - ksp->ks_raw_buf, ksp->ks_raw_bufsize); | |
4387 | + if (ksp->ks_raw_ops.headers) { | |
4388 | + rc = ksp->ks_raw_ops.headers( | |
4389 | + ksp->ks_raw_buf, ksp->ks_raw_bufsize); | |
4390 | if (rc == ENOMEM && !kstat_resize_raw(ksp)) | |
4391 | goto restart; | |
4392 | if (!rc) | |
4393 | - seq_puts(f, ksp->ks_raw_buf); | |
4394 | - } else { | |
4395 | - seq_printf(f, "raw data\n"); | |
4396 | - } | |
4397 | - break; | |
4398 | - case KSTAT_TYPE_NAMED: | |
4399 | - seq_printf(f, "%-31s %-4s %s\n", | |
4400 | - "name", "type", "data"); | |
4401 | - break; | |
4402 | - case KSTAT_TYPE_INTR: | |
4403 | - seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n", | |
4404 | - "hard", "soft", "watchdog", | |
4405 | - "spurious", "multsvc"); | |
4406 | - break; | |
4407 | - case KSTAT_TYPE_IO: | |
4408 | - seq_printf(f, | |
4409 | - "%-8s %-8s %-8s %-8s %-8s %-8s " | |
4410 | - "%-8s %-8s %-8s %-8s %-8s %-8s\n", | |
4411 | - "nread", "nwritten", "reads", "writes", | |
4412 | - "wtime", "wlentime", "wupdate", | |
4413 | - "rtime", "rlentime", "rupdate", | |
4414 | - "wcnt", "rcnt"); | |
4415 | - break; | |
4416 | - case KSTAT_TYPE_TIMER: | |
4417 | - seq_printf(f, | |
4418 | - "%-31s %-8s " | |
4419 | - "%-8s %-8s %-8s %-8s %-8s\n", | |
4420 | - "name", "events", "elapsed", | |
4421 | - "min", "max", "start", "stop"); | |
4422 | - break; | |
4423 | - default: | |
4424 | - PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4425 | - } | |
4426 | - | |
4427 | - return -rc; | |
4428 | + seq_puts(f, ksp->ks_raw_buf); | |
4429 | + } else { | |
4430 | + seq_printf(f, "raw data\n"); | |
4431 | + } | |
4432 | + break; | |
4433 | + case KSTAT_TYPE_NAMED: | |
4434 | + seq_printf(f, "%-31s %-4s %s\n", | |
4435 | + "name", "type", "data"); | |
4436 | + break; | |
4437 | + case KSTAT_TYPE_INTR: | |
4438 | + seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n", | |
4439 | + "hard", "soft", "watchdog", | |
4440 | + "spurious", "multsvc"); | |
4441 | + break; | |
4442 | + case KSTAT_TYPE_IO: | |
4443 | + seq_printf(f, | |
4444 | + "%-8s %-8s %-8s %-8s %-8s %-8s " | |
4445 | + "%-8s %-8s %-8s %-8s %-8s %-8s\n", | |
4446 | + "nread", "nwritten", "reads", "writes", | |
4447 | + "wtime", "wlentime", "wupdate", | |
4448 | + "rtime", "rlentime", "rupdate", | |
4449 | + "wcnt", "rcnt"); | |
4450 | + break; | |
4451 | + case KSTAT_TYPE_TIMER: | |
4452 | + seq_printf(f, | |
4453 | + "%-31s %-8s " | |
4454 | + "%-8s %-8s %-8s %-8s %-8s\n", | |
4455 | + "name", "events", "elapsed", | |
4456 | + "min", "max", "start", "stop"); | |
4457 | + break; | |
4458 | + default: | |
4459 | + PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4460 | + } | |
4461 | + | |
4462 | + return (-rc); | |
4463 | } | |
4464 | ||
4465 | static int | |
4466 | kstat_seq_show_raw(struct seq_file *f, unsigned char *p, int l) | |
4467 | { | |
4468 | - int i, j; | |
4469 | + int i, j; | |
4470 | ||
4471 | - for (i = 0; ; i++) { | |
4472 | - seq_printf(f, "%03x:", i); | |
4473 | + for (i = 0; ; i++) { | |
4474 | + seq_printf(f, "%03x:", i); | |
4475 | ||
4476 | - for (j = 0; j < 16; j++) { | |
4477 | - if (i * 16 + j >= l) { | |
4478 | - seq_printf(f, "\n"); | |
4479 | - goto out; | |
4480 | - } | |
4481 | + for (j = 0; j < 16; j++) { | |
4482 | + if (i * 16 + j >= l) { | |
4483 | + seq_printf(f, "\n"); | |
4484 | + goto out; | |
4485 | + } | |
4486 | ||
4487 | - seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]); | |
4488 | - } | |
4489 | - seq_printf(f, "\n"); | |
4490 | - } | |
4491 | + seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]); | |
4492 | + } | |
4493 | + seq_printf(f, "\n"); | |
4494 | + } | |
4495 | out: | |
4496 | - return 0; | |
4497 | + return (0); | |
4498 | } | |
4499 | ||
4500 | static int | |
4501 | kstat_seq_show_named(struct seq_file *f, kstat_named_t *knp) | |
4502 | { | |
4503 | - seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type); | |
4504 | - | |
4505 | - switch (knp->data_type) { | |
4506 | - case KSTAT_DATA_CHAR: | |
4507 | - knp->value.c[15] = '\0'; /* NULL terminate */ | |
4508 | - seq_printf(f, "%-16s", knp->value.c); | |
4509 | - break; | |
4510 | - /* XXX - We need to be more careful able what tokens are | |
4511 | - * used for each arch, for now this is correct for x86_64. | |
4512 | - */ | |
4513 | - case KSTAT_DATA_INT32: | |
4514 | - seq_printf(f, "%d", knp->value.i32); | |
4515 | - break; | |
4516 | - case KSTAT_DATA_UINT32: | |
4517 | - seq_printf(f, "%u", knp->value.ui32); | |
4518 | - break; | |
4519 | - case KSTAT_DATA_INT64: | |
4520 | - seq_printf(f, "%lld", (signed long long)knp->value.i64); | |
4521 | - break; | |
4522 | - case KSTAT_DATA_UINT64: | |
4523 | - seq_printf(f, "%llu", (unsigned long long)knp->value.ui64); | |
4524 | - break; | |
4525 | - case KSTAT_DATA_LONG: | |
4526 | - seq_printf(f, "%ld", knp->value.l); | |
4527 | - break; | |
4528 | - case KSTAT_DATA_ULONG: | |
4529 | - seq_printf(f, "%lu", knp->value.ul); | |
4530 | - break; | |
4531 | - case KSTAT_DATA_STRING: | |
4532 | - KSTAT_NAMED_STR_PTR(knp) | |
4533 | - [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0'; | |
4534 | - seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp)); | |
4535 | - break; | |
4536 | - default: | |
4537 | - PANIC("Undefined kstat data type %d\n", knp->data_type); | |
4538 | - } | |
4539 | - | |
4540 | - seq_printf(f, "\n"); | |
4541 | - | |
4542 | - return 0; | |
4543 | + seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type); | |
4544 | + | |
4545 | + switch (knp->data_type) { | |
4546 | + case KSTAT_DATA_CHAR: | |
4547 | + knp->value.c[15] = '\0'; /* NULL terminate */ | |
4548 | + seq_printf(f, "%-16s", knp->value.c); | |
4549 | + break; | |
4550 | + /* | |
4551 | + * NOTE - We need to be more careful able what tokens are | |
4552 | + * used for each arch, for now this is correct for x86_64. | |
4553 | + */ | |
4554 | + case KSTAT_DATA_INT32: | |
4555 | + seq_printf(f, "%d", knp->value.i32); | |
4556 | + break; | |
4557 | + case KSTAT_DATA_UINT32: | |
4558 | + seq_printf(f, "%u", knp->value.ui32); | |
4559 | + break; | |
4560 | + case KSTAT_DATA_INT64: | |
4561 | + seq_printf(f, "%lld", (signed long long)knp->value.i64); | |
4562 | + break; | |
4563 | + case KSTAT_DATA_UINT64: | |
4564 | + seq_printf(f, "%llu", | |
4565 | + (unsigned long long)knp->value.ui64); | |
4566 | + break; | |
4567 | + case KSTAT_DATA_LONG: | |
4568 | + seq_printf(f, "%ld", knp->value.l); | |
4569 | + break; | |
4570 | + case KSTAT_DATA_ULONG: | |
4571 | + seq_printf(f, "%lu", knp->value.ul); | |
4572 | + break; | |
4573 | + case KSTAT_DATA_STRING: | |
4574 | + KSTAT_NAMED_STR_PTR(knp) | |
4575 | + [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0'; | |
4576 | + seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp)); | |
4577 | + break; | |
4578 | + default: | |
4579 | + PANIC("Undefined kstat data type %d\n", knp->data_type); | |
4580 | + } | |
4581 | + | |
4582 | + seq_printf(f, "\n"); | |
4583 | + | |
4584 | + return (0); | |
4585 | } | |
4586 | ||
4587 | static int | |
4588 | kstat_seq_show_intr(struct seq_file *f, kstat_intr_t *kip) | |
4589 | { | |
4590 | - seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n", | |
4591 | - kip->intrs[KSTAT_INTR_HARD], | |
4592 | - kip->intrs[KSTAT_INTR_SOFT], | |
4593 | - kip->intrs[KSTAT_INTR_WATCHDOG], | |
4594 | - kip->intrs[KSTAT_INTR_SPURIOUS], | |
4595 | - kip->intrs[KSTAT_INTR_MULTSVC]); | |
4596 | - | |
4597 | - return 0; | |
4598 | + seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n", | |
4599 | + kip->intrs[KSTAT_INTR_HARD], | |
4600 | + kip->intrs[KSTAT_INTR_SOFT], | |
4601 | + kip->intrs[KSTAT_INTR_WATCHDOG], | |
4602 | + kip->intrs[KSTAT_INTR_SPURIOUS], | |
4603 | + kip->intrs[KSTAT_INTR_MULTSVC]); | |
4604 | + | |
4605 | + return (0); | |
4606 | } | |
4607 | ||
4608 | static int | |
4609 | kstat_seq_show_io(struct seq_file *f, kstat_io_t *kip) | |
4610 | { | |
4611 | - seq_printf(f, | |
4612 | - "%-8llu %-8llu %-8u %-8u %-8lld %-8lld " | |
4613 | - "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n", | |
4614 | - kip->nread, kip->nwritten, | |
4615 | - kip->reads, kip->writes, | |
4616 | - kip->wtime, kip->wlentime, kip->wlastupdate, | |
4617 | - kip->rtime, kip->rlentime, kip->rlastupdate, | |
4618 | - kip->wcnt, kip->rcnt); | |
4619 | - | |
4620 | - return 0; | |
4621 | + seq_printf(f, | |
4622 | + "%-8llu %-8llu %-8u %-8u %-8lld %-8lld " | |
4623 | + "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n", | |
4624 | + kip->nread, kip->nwritten, | |
4625 | + kip->reads, kip->writes, | |
4626 | + kip->wtime, kip->wlentime, kip->wlastupdate, | |
4627 | + kip->rtime, kip->rlentime, kip->rlastupdate, | |
4628 | + kip->wcnt, kip->rcnt); | |
4629 | + | |
4630 | + return (0); | |
4631 | } | |
4632 | ||
4633 | static int | |
4634 | kstat_seq_show_timer(struct seq_file *f, kstat_timer_t *ktp) | |
4635 | { | |
4636 | - seq_printf(f, | |
4637 | - "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n", | |
4638 | - ktp->name, ktp->num_events, ktp->elapsed_time, | |
4639 | - ktp->min_time, ktp->max_time, | |
4640 | - ktp->start_time, ktp->stop_time); | |
4641 | + seq_printf(f, | |
4642 | + "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n", | |
4643 | + ktp->name, ktp->num_events, ktp->elapsed_time, | |
4644 | + ktp->min_time, ktp->max_time, | |
4645 | + ktp->start_time, ktp->stop_time); | |
4646 | ||
4647 | - return 0; | |
4648 | + return (0); | |
4649 | } | |
4650 | ||
4651 | static int | |
4652 | kstat_seq_show(struct seq_file *f, void *p) | |
4653 | { | |
4654 | - kstat_t *ksp = (kstat_t *)f->private; | |
4655 | - int rc = 0; | |
4656 | + kstat_t *ksp = (kstat_t *)f->private; | |
4657 | + int rc = 0; | |
4658 | ||
4659 | - ASSERT(ksp->ks_magic == KS_MAGIC); | |
4660 | + ASSERT(ksp->ks_magic == KS_MAGIC); | |
4661 | ||
4662 | switch (ksp->ks_type) { | |
4663 | - case KSTAT_TYPE_RAW: | |
4664 | + case KSTAT_TYPE_RAW: | |
4665 | restart: | |
4666 | - if (ksp->ks_raw_ops.data) { | |
4667 | - rc = ksp->ks_raw_ops.data( | |
4668 | + if (ksp->ks_raw_ops.data) { | |
4669 | + rc = ksp->ks_raw_ops.data( | |
4670 | ksp->ks_raw_buf, ksp->ks_raw_bufsize, p); | |
4671 | if (rc == ENOMEM && !kstat_resize_raw(ksp)) | |
4672 | goto restart; | |
4673 | if (!rc) | |
4674 | - seq_puts(f, ksp->ks_raw_buf); | |
4675 | - } else { | |
4676 | - ASSERT(ksp->ks_ndata == 1); | |
4677 | - rc = kstat_seq_show_raw(f, ksp->ks_data, | |
4678 | - ksp->ks_data_size); | |
4679 | - } | |
4680 | - break; | |
4681 | - case KSTAT_TYPE_NAMED: | |
4682 | - rc = kstat_seq_show_named(f, (kstat_named_t *)p); | |
4683 | - break; | |
4684 | - case KSTAT_TYPE_INTR: | |
4685 | - rc = kstat_seq_show_intr(f, (kstat_intr_t *)p); | |
4686 | - break; | |
4687 | - case KSTAT_TYPE_IO: | |
4688 | - rc = kstat_seq_show_io(f, (kstat_io_t *)p); | |
4689 | - break; | |
4690 | - case KSTAT_TYPE_TIMER: | |
4691 | - rc = kstat_seq_show_timer(f, (kstat_timer_t *)p); | |
4692 | - break; | |
4693 | - default: | |
4694 | - PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4695 | - } | |
4696 | - | |
4697 | - return -rc; | |
4698 | + seq_puts(f, ksp->ks_raw_buf); | |
4699 | + } else { | |
4700 | + ASSERT(ksp->ks_ndata == 1); | |
4701 | + rc = kstat_seq_show_raw(f, ksp->ks_data, | |
4702 | + ksp->ks_data_size); | |
4703 | + } | |
4704 | + break; | |
4705 | + case KSTAT_TYPE_NAMED: | |
4706 | + rc = kstat_seq_show_named(f, (kstat_named_t *)p); | |
4707 | + break; | |
4708 | + case KSTAT_TYPE_INTR: | |
4709 | + rc = kstat_seq_show_intr(f, (kstat_intr_t *)p); | |
4710 | + break; | |
4711 | + case KSTAT_TYPE_IO: | |
4712 | + rc = kstat_seq_show_io(f, (kstat_io_t *)p); | |
4713 | + break; | |
4714 | + case KSTAT_TYPE_TIMER: | |
4715 | + rc = kstat_seq_show_timer(f, (kstat_timer_t *)p); | |
4716 | + break; | |
4717 | + default: | |
4718 | + PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4719 | + } | |
4720 | + | |
4721 | + return (-rc); | |
4722 | } | |
4723 | ||
4724 | int | |
4725 | @@ -333,79 +335,79 @@ kstat_default_update(kstat_t *ksp, int rw) | |
4726 | if (rw == KSTAT_WRITE) | |
4727 | return (EACCES); | |
4728 | ||
4729 | - return 0; | |
4730 | + return (0); | |
4731 | } | |
4732 | ||
4733 | static void * | |
4734 | kstat_seq_data_addr(kstat_t *ksp, loff_t n) | |
4735 | { | |
4736 | - void *rc = NULL; | |
4737 | + void *rc = NULL; | |
4738 | ||
4739 | switch (ksp->ks_type) { | |
4740 | - case KSTAT_TYPE_RAW: | |
4741 | - if (ksp->ks_raw_ops.addr) | |
4742 | - rc = ksp->ks_raw_ops.addr(ksp, n); | |
4743 | - else | |
4744 | - rc = ksp->ks_data; | |
4745 | - break; | |
4746 | - case KSTAT_TYPE_NAMED: | |
4747 | - rc = ksp->ks_data + n * sizeof(kstat_named_t); | |
4748 | - break; | |
4749 | - case KSTAT_TYPE_INTR: | |
4750 | - rc = ksp->ks_data + n * sizeof(kstat_intr_t); | |
4751 | - break; | |
4752 | - case KSTAT_TYPE_IO: | |
4753 | - rc = ksp->ks_data + n * sizeof(kstat_io_t); | |
4754 | - break; | |
4755 | - case KSTAT_TYPE_TIMER: | |
4756 | - rc = ksp->ks_data + n * sizeof(kstat_timer_t); | |
4757 | - break; | |
4758 | - default: | |
4759 | - PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4760 | - } | |
4761 | - | |
4762 | - return (rc); | |
4763 | + case KSTAT_TYPE_RAW: | |
4764 | + if (ksp->ks_raw_ops.addr) | |
4765 | + rc = ksp->ks_raw_ops.addr(ksp, n); | |
4766 | + else | |
4767 | + rc = ksp->ks_data; | |
4768 | + break; | |
4769 | + case KSTAT_TYPE_NAMED: | |
4770 | + rc = ksp->ks_data + n * sizeof (kstat_named_t); | |
4771 | + break; | |
4772 | + case KSTAT_TYPE_INTR: | |
4773 | + rc = ksp->ks_data + n * sizeof (kstat_intr_t); | |
4774 | + break; | |
4775 | + case KSTAT_TYPE_IO: | |
4776 | + rc = ksp->ks_data + n * sizeof (kstat_io_t); | |
4777 | + break; | |
4778 | + case KSTAT_TYPE_TIMER: | |
4779 | + rc = ksp->ks_data + n * sizeof (kstat_timer_t); | |
4780 | + break; | |
4781 | + default: | |
4782 | + PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4783 | + } | |
4784 | + | |
4785 | + return (rc); | |
4786 | } | |
4787 | ||
4788 | static void * | |
4789 | kstat_seq_start(struct seq_file *f, loff_t *pos) | |
4790 | { | |
4791 | - loff_t n = *pos; | |
4792 | - kstat_t *ksp = (kstat_t *)f->private; | |
4793 | - ASSERT(ksp->ks_magic == KS_MAGIC); | |
4794 | + loff_t n = *pos; | |
4795 | + kstat_t *ksp = (kstat_t *)f->private; | |
4796 | + ASSERT(ksp->ks_magic == KS_MAGIC); | |
4797 | ||
4798 | mutex_enter(ksp->ks_lock); | |
4799 | ||
4800 | - if (ksp->ks_type == KSTAT_TYPE_RAW) { | |
4801 | - ksp->ks_raw_bufsize = PAGE_SIZE; | |
4802 | - ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); | |
4803 | - } | |
4804 | + if (ksp->ks_type == KSTAT_TYPE_RAW) { | |
4805 | + ksp->ks_raw_bufsize = PAGE_SIZE; | |
4806 | + ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); | |
4807 | + } | |
4808 | ||
4809 | - /* Dynamically update kstat, on error existing kstats are used */ | |
4810 | - (void) ksp->ks_update(ksp, KSTAT_READ); | |
4811 | + /* Dynamically update kstat, on error existing kstats are used */ | |
4812 | + (void) ksp->ks_update(ksp, KSTAT_READ); | |
4813 | ||
4814 | ksp->ks_snaptime = gethrtime(); | |
4815 | ||
4816 | - if (!n && kstat_seq_show_headers(f)) | |
4817 | + if (!n && kstat_seq_show_headers(f)) | |
4818 | return (NULL); | |
4819 | ||
4820 | - if (n >= ksp->ks_ndata) | |
4821 | - return (NULL); | |
4822 | + if (n >= ksp->ks_ndata) | |
4823 | + return (NULL); | |
4824 | ||
4825 | - return (kstat_seq_data_addr(ksp, n)); | |
4826 | + return (kstat_seq_data_addr(ksp, n)); | |
4827 | } | |
4828 | ||
4829 | static void * | |
4830 | kstat_seq_next(struct seq_file *f, void *p, loff_t *pos) | |
4831 | { | |
4832 | - kstat_t *ksp = (kstat_t *)f->private; | |
4833 | - ASSERT(ksp->ks_magic == KS_MAGIC); | |
4834 | + kstat_t *ksp = (kstat_t *)f->private; | |
4835 | + ASSERT(ksp->ks_magic == KS_MAGIC); | |
4836 | ||
4837 | - ++*pos; | |
4838 | - if (*pos >= ksp->ks_ndata) | |
4839 | - return (NULL); | |
4840 | + ++*pos; | |
4841 | + if (*pos >= ksp->ks_ndata) | |
4842 | + return (NULL); | |
4843 | ||
4844 | - return (kstat_seq_data_addr(ksp, *pos)); | |
4845 | + return (kstat_seq_data_addr(ksp, *pos)); | |
4846 | } | |
4847 | ||
4848 | static void | |
4849 | @@ -421,10 +423,10 @@ kstat_seq_stop(struct seq_file *f, void *v) | |
4850 | } | |
4851 | ||
4852 | static struct seq_operations kstat_seq_ops = { | |
4853 | - .show = kstat_seq_show, | |
4854 | - .start = kstat_seq_start, | |
4855 | - .next = kstat_seq_next, | |
4856 | - .stop = kstat_seq_stop, | |
4857 | + .show = kstat_seq_show, | |
4858 | + .start = kstat_seq_start, | |
4859 | + .next = kstat_seq_next, | |
4860 | + .stop = kstat_seq_stop, | |
4861 | }; | |
4862 | ||
4863 | static kstat_module_t * | |
4864 | @@ -465,28 +467,28 @@ kstat_delete_module(kstat_module_t *module) | |
4865 | ASSERT(list_empty(&module->ksm_kstat_list)); | |
4866 | remove_proc_entry(module->ksm_name, proc_spl_kstat); | |
4867 | list_del(&module->ksm_module_list); | |
4868 | - kmem_free(module, sizeof(kstat_module_t)); | |
4869 | + kmem_free(module, sizeof (kstat_module_t)); | |
4870 | } | |
4871 | ||
4872 | static int | |
4873 | proc_kstat_open(struct inode *inode, struct file *filp) | |
4874 | { | |
4875 | - struct seq_file *f; | |
4876 | - int rc; | |
4877 | + struct seq_file *f; | |
4878 | + int rc; | |
4879 | ||
4880 | - rc = seq_open(filp, &kstat_seq_ops); | |
4881 | - if (rc) | |
4882 | - return rc; | |
4883 | + rc = seq_open(filp, &kstat_seq_ops); | |
4884 | + if (rc) | |
4885 | + return (rc); | |
4886 | ||
4887 | - f = filp->private_data; | |
4888 | - f->private = PDE_DATA(inode); | |
4889 | + f = filp->private_data; | |
4890 | + f->private = PDE_DATA(inode); | |
4891 | ||
4892 | - return rc; | |
4893 | + return (rc); | |
4894 | } | |
4895 | ||
4896 | static ssize_t | |
4897 | -proc_kstat_write(struct file *filp, const char __user *buf, | |
4898 | - size_t len, loff_t *ppos) | |
4899 | +proc_kstat_write(struct file *filp, const char __user *buf, size_t len, | |
4900 | + loff_t *ppos) | |
4901 | { | |
4902 | struct seq_file *f = filp->private_data; | |
4903 | kstat_t *ksp = f->private; | |
4904 | @@ -527,8 +529,8 @@ EXPORT_SYMBOL(__kstat_set_raw_ops); | |
4905 | ||
4906 | kstat_t * | |
4907 | __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, | |
4908 | - const char *ks_class, uchar_t ks_type, uint_t ks_ndata, | |
4909 | - uchar_t ks_flags) | |
4910 | + const char *ks_class, uchar_t ks_type, uint_t ks_ndata, | |
4911 | + uchar_t ks_flags) | |
4912 | { | |
4913 | kstat_t *ksp; | |
4914 | ||
4915 | @@ -538,24 +540,24 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, | |
4916 | ASSERT(!(ks_flags & KSTAT_FLAG_UNSUPPORTED)); | |
4917 | ||
4918 | if ((ks_type == KSTAT_TYPE_INTR) || (ks_type == KSTAT_TYPE_IO)) | |
4919 | - ASSERT(ks_ndata == 1); | |
4920 | + ASSERT(ks_ndata == 1); | |
4921 | ||
4922 | - ksp = kmem_zalloc(sizeof(*ksp), KM_SLEEP); | |
4923 | + ksp = kmem_zalloc(sizeof (*ksp), KM_SLEEP); | |
4924 | if (ksp == NULL) | |
4925 | - return ksp; | |
4926 | + return (ksp); | |
4927 | ||
4928 | mutex_enter(&kstat_module_lock); | |
4929 | ksp->ks_kid = kstat_id; | |
4930 | - kstat_id++; | |
4931 | + kstat_id++; | |
4932 | mutex_exit(&kstat_module_lock); | |
4933 | ||
4934 | - ksp->ks_magic = KS_MAGIC; | |
4935 | + ksp->ks_magic = KS_MAGIC; | |
4936 | mutex_init(&ksp->ks_private_lock, NULL, MUTEX_DEFAULT, NULL); | |
4937 | ksp->ks_lock = &ksp->ks_private_lock; | |
4938 | INIT_LIST_HEAD(&ksp->ks_list); | |
4939 | ||
4940 | ksp->ks_crtime = gethrtime(); | |
4941 | - ksp->ks_snaptime = ksp->ks_crtime; | |
4942 | + ksp->ks_snaptime = ksp->ks_crtime; | |
4943 | strncpy(ksp->ks_module, ks_module, KSTAT_STRLEN); | |
4944 | ksp->ks_instance = ks_instance; | |
4945 | strncpy(ksp->ks_name, ks_name, KSTAT_STRLEN); | |
4946 | @@ -571,41 +573,41 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, | |
4947 | ksp->ks_raw_bufsize = 0; | |
4948 | ||
4949 | switch (ksp->ks_type) { | |
4950 | - case KSTAT_TYPE_RAW: | |
4951 | - ksp->ks_ndata = 1; | |
4952 | - ksp->ks_data_size = ks_ndata; | |
4953 | - break; | |
4954 | - case KSTAT_TYPE_NAMED: | |
4955 | - ksp->ks_ndata = ks_ndata; | |
4956 | - ksp->ks_data_size = ks_ndata * sizeof(kstat_named_t); | |
4957 | - break; | |
4958 | - case KSTAT_TYPE_INTR: | |
4959 | - ksp->ks_ndata = ks_ndata; | |
4960 | - ksp->ks_data_size = ks_ndata * sizeof(kstat_intr_t); | |
4961 | - break; | |
4962 | - case KSTAT_TYPE_IO: | |
4963 | - ksp->ks_ndata = ks_ndata; | |
4964 | - ksp->ks_data_size = ks_ndata * sizeof(kstat_io_t); | |
4965 | - break; | |
4966 | - case KSTAT_TYPE_TIMER: | |
4967 | - ksp->ks_ndata = ks_ndata; | |
4968 | - ksp->ks_data_size = ks_ndata * sizeof(kstat_timer_t); | |
4969 | - break; | |
4970 | - default: | |
4971 | - PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4972 | - } | |
4973 | + case KSTAT_TYPE_RAW: | |
4974 | + ksp->ks_ndata = 1; | |
4975 | + ksp->ks_data_size = ks_ndata; | |
4976 | + break; | |
4977 | + case KSTAT_TYPE_NAMED: | |
4978 | + ksp->ks_ndata = ks_ndata; | |
4979 | + ksp->ks_data_size = ks_ndata * sizeof (kstat_named_t); | |
4980 | + break; | |
4981 | + case KSTAT_TYPE_INTR: | |
4982 | + ksp->ks_ndata = ks_ndata; | |
4983 | + ksp->ks_data_size = ks_ndata * sizeof (kstat_intr_t); | |
4984 | + break; | |
4985 | + case KSTAT_TYPE_IO: | |
4986 | + ksp->ks_ndata = ks_ndata; | |
4987 | + ksp->ks_data_size = ks_ndata * sizeof (kstat_io_t); | |
4988 | + break; | |
4989 | + case KSTAT_TYPE_TIMER: | |
4990 | + ksp->ks_ndata = ks_ndata; | |
4991 | + ksp->ks_data_size = ks_ndata * sizeof (kstat_timer_t); | |
4992 | + break; | |
4993 | + default: | |
4994 | + PANIC("Undefined kstat type %d\n", ksp->ks_type); | |
4995 | + } | |
4996 | ||
4997 | if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) { | |
4998 | - ksp->ks_data = NULL; | |
4999 | - } else { | |
5000 | - ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP); | |
5001 | - if (ksp->ks_data == NULL) { | |
5002 | - kmem_free(ksp, sizeof(*ksp)); | |
5003 | - ksp = NULL; | |
5004 | - } | |
5005 | - } | |
5006 | - | |
5007 | - return ksp; | |
5008 | + ksp->ks_data = NULL; | |
5009 | + } else { | |
5010 | + ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP); | |
5011 | + if (ksp->ks_data == NULL) { | |
5012 | + kmem_free(ksp, sizeof (*ksp)); | |
5013 | + ksp = NULL; | |
5014 | + } | |
5015 | + } | |
5016 | + | |
5017 | + return (ksp); | |
5018 | } | |
5019 | EXPORT_SYMBOL(__kstat_create); | |
5020 | ||
5021 | @@ -706,9 +708,7 @@ __kstat_delete(kstat_t *ksp) | |
5022 | ||
5023 | ksp->ks_lock = NULL; | |
5024 | mutex_destroy(&ksp->ks_private_lock); | |
5025 | - kmem_free(ksp, sizeof(*ksp)); | |
5026 | - | |
5027 | - return; | |
5028 | + kmem_free(ksp, sizeof (*ksp)); | |
5029 | } | |
5030 | EXPORT_SYMBOL(__kstat_delete); | |
5031 | ||
5032 | @@ -717,7 +717,7 @@ spl_kstat_init(void) | |
5033 | { | |
5034 | mutex_init(&kstat_module_lock, NULL, MUTEX_DEFAULT, NULL); | |
5035 | INIT_LIST_HEAD(&kstat_module_list); | |
5036 | - kstat_id = 0; | |
5037 | + kstat_id = 0; | |
5038 | return (0); | |
5039 | } | |
5040 | ||
5041 | @@ -727,4 +727,3 @@ spl_kstat_fini(void) | |
5042 | ASSERT(list_empty(&kstat_module_list)); | |
5043 | mutex_destroy(&kstat_module_lock); | |
5044 | } | |
5045 | - | |
5046 | diff --git a/module/spl/spl-mutex.c b/module/spl/spl-mutex.c | |
5047 | index a29d488..dfb26bf 100644 | |
5048 | --- a/module/spl/spl-mutex.c | |
5049 | +++ b/module/spl/spl-mutex.c | |
5050 | @@ -20,17 +20,11 @@ | |
5051 | * | |
5052 | * You should have received a copy of the GNU General Public License along | |
5053 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
5054 | - ***************************************************************************** | |
5055 | + * | |
5056 | * Solaris Porting Layer (SPL) Mutex Implementation. | |
5057 | \*****************************************************************************/ | |
5058 | ||
5059 | #include <sys/mutex.h> | |
5060 | ||
5061 | -#ifdef DEBUG_SUBSYSTEM | |
5062 | -#undef DEBUG_SUBSYSTEM | |
5063 | -#endif | |
5064 | - | |
5065 | -#define DEBUG_SUBSYSTEM S_MUTEX | |
5066 | - | |
5067 | int spl_mutex_init(void) { return 0; } | |
5068 | void spl_mutex_fini(void) { } | |
5069 | diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c | |
5070 | index 05c1a5d..60d6bbb 100644 | |
5071 | --- a/module/spl/spl-proc.c | |
5072 | +++ b/module/spl/spl-proc.c | |
5073 | @@ -20,7 +20,7 @@ | |
5074 | * | |
5075 | * You should have received a copy of the GNU General Public License along | |
5076 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
5077 | - ***************************************************************************** | |
5078 | + * | |
5079 | * Solaris Porting Layer (SPL) Proc Implementation. | |
5080 | \*****************************************************************************/ | |
5081 | ||
5082 | @@ -37,7 +37,7 @@ | |
5083 | #include <linux/uaccess.h> | |
5084 | #include <linux/version.h> | |
5085 | ||
5086 | -#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
5087 | +#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | |
5088 | typedef struct ctl_table __no_const spl_ctl_table; | |
5089 | #else | |
5090 | typedef struct ctl_table spl_ctl_table; | |
5091 | @@ -55,56 +55,57 @@ static struct proc_dir_entry *proc_spl_taskq = NULL; | |
5092 | struct proc_dir_entry *proc_spl_kstat = NULL; | |
5093 | ||
5094 | static int | |
5095 | -proc_copyin_string(char *kbuffer, int kbuffer_size, | |
5096 | - const char *ubuffer, int ubuffer_size) | |
5097 | +proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer, | |
5098 | + int ubuffer_size) | |
5099 | { | |
5100 | - int size; | |
5101 | + int size; | |
5102 | ||
5103 | - if (ubuffer_size > kbuffer_size) | |
5104 | - return -EOVERFLOW; | |
5105 | + if (ubuffer_size > kbuffer_size) | |
5106 | + return (-EOVERFLOW); | |
5107 | ||
5108 | - if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size)) | |
5109 | - return -EFAULT; | |
5110 | + if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size)) | |
5111 | + return (-EFAULT); | |
5112 | ||
5113 | - /* strip trailing whitespace */ | |
5114 | - size = strnlen(kbuffer, ubuffer_size); | |
5115 | - while (size-- >= 0) | |
5116 | - if (!isspace(kbuffer[size])) | |
5117 | - break; | |
5118 | + /* strip trailing whitespace */ | |
5119 | + size = strnlen(kbuffer, ubuffer_size); | |
5120 | + while (size-- >= 0) | |
5121 | + if (!isspace(kbuffer[size])) | |
5122 | + break; | |
5123 | ||
5124 | - /* empty string */ | |
5125 | - if (size < 0) | |
5126 | - return -EINVAL; | |
5127 | + /* empty string */ | |
5128 | + if (size < 0) | |
5129 | + return (-EINVAL); | |
5130 | ||
5131 | - /* no space to terminate */ | |
5132 | - if (size == kbuffer_size) | |
5133 | - return -EOVERFLOW; | |
5134 | + /* no space to terminate */ | |
5135 | + if (size == kbuffer_size) | |
5136 | + return (-EOVERFLOW); | |
5137 | ||
5138 | - kbuffer[size + 1] = 0; | |
5139 | - return 0; | |
5140 | + kbuffer[size + 1] = 0; | |
5141 | + return (0); | |
5142 | } | |
5143 | ||
5144 | static int | |
5145 | proc_copyout_string(char *ubuffer, int ubuffer_size, | |
5146 | - const char *kbuffer, char *append) | |
5147 | + const char *kbuffer, char *append) | |
5148 | { | |
5149 | - /* NB if 'append' != NULL, it's a single character to append to the | |
5150 | - * copied out string - usually "\n", for /proc entries and | |
5151 | - * (i.e. a terminating zero byte) for sysctl entries | |
5152 | - */ | |
5153 | - int size = MIN(strlen(kbuffer), ubuffer_size); | |
5154 | + /* | |
5155 | + * NB if 'append' != NULL, it's a single character to append to the | |
5156 | + * copied out string - usually "\n", for /proc entries and | |
5157 | + * (i.e. a terminating zero byte) for sysctl entries | |
5158 | + */ | |
5159 | + int size = MIN(strlen(kbuffer), ubuffer_size); | |
5160 | ||
5161 | - if (copy_to_user(ubuffer, kbuffer, size)) | |
5162 | - return -EFAULT; | |
5163 | + if (copy_to_user(ubuffer, kbuffer, size)) | |
5164 | + return (-EFAULT); | |
5165 | ||
5166 | - if (append != NULL && size < ubuffer_size) { | |
5167 | - if (copy_to_user(ubuffer + size, append, 1)) | |
5168 | - return -EFAULT; | |
5169 | + if (append != NULL && size < ubuffer_size) { | |
5170 | + if (copy_to_user(ubuffer + size, append, 1)) | |
5171 | + return (-EFAULT); | |
5172 | ||
5173 | - size++; | |
5174 | - } | |
5175 | + size++; | |
5176 | + } | |
5177 | ||
5178 | - return size; | |
5179 | + return (size); | |
5180 | } | |
5181 | ||
5182 | #ifdef DEBUG_KMEM | |
5183 | @@ -112,27 +113,27 @@ static int | |
5184 | proc_domemused(struct ctl_table *table, int write, | |
5185 | void __user *buffer, size_t *lenp, loff_t *ppos) | |
5186 | { | |
5187 | - int rc = 0; | |
5188 | - unsigned long min = 0, max = ~0, val; | |
5189 | - spl_ctl_table dummy = *table; | |
5190 | - | |
5191 | - dummy.data = &val; | |
5192 | - dummy.proc_handler = &proc_dointvec; | |
5193 | - dummy.extra1 = &min; | |
5194 | - dummy.extra2 = &max; | |
5195 | - | |
5196 | - if (write) { | |
5197 | - *ppos += *lenp; | |
5198 | - } else { | |
5199 | -# ifdef HAVE_ATOMIC64_T | |
5200 | - val = atomic64_read((atomic64_t *)table->data); | |
5201 | -# else | |
5202 | - val = atomic_read((atomic_t *)table->data); | |
5203 | -# endif /* HAVE_ATOMIC64_T */ | |
5204 | - rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); | |
5205 | - } | |
5206 | - | |
5207 | - return (rc); | |
5208 | + int rc = 0; | |
5209 | + unsigned long min = 0, max = ~0, val; | |
5210 | + spl_ctl_table dummy = *table; | |
5211 | + | |
5212 | + dummy.data = &val; | |
5213 | + dummy.proc_handler = &proc_dointvec; | |
5214 | + dummy.extra1 = &min; | |
5215 | + dummy.extra2 = &max; | |
5216 | + | |
5217 | + if (write) { | |
5218 | + *ppos += *lenp; | |
5219 | + } else { | |
5220 | +#ifdef HAVE_ATOMIC64_T | |
5221 | + val = atomic64_read((atomic64_t *)table->data); | |
5222 | +#else | |
5223 | + val = atomic_read((atomic_t *)table->data); | |
5224 | +#endif /* HAVE_ATOMIC64_T */ | |
5225 | + rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); | |
5226 | + } | |
5227 | + | |
5228 | + return (rc); | |
5229 | } | |
5230 | #endif /* DEBUG_KMEM */ | |
5231 | ||
5232 | @@ -140,23 +141,23 @@ static int | |
5233 | proc_doslab(struct ctl_table *table, int write, | |
5234 | void __user *buffer, size_t *lenp, loff_t *ppos) | |
5235 | { | |
5236 | - int rc = 0; | |
5237 | - unsigned long min = 0, max = ~0, val = 0, mask; | |
5238 | - spl_ctl_table dummy = *table; | |
5239 | - spl_kmem_cache_t *skc; | |
5240 | + int rc = 0; | |
5241 | + unsigned long min = 0, max = ~0, val = 0, mask; | |
5242 | + spl_ctl_table dummy = *table; | |
5243 | + spl_kmem_cache_t *skc; | |
5244 | ||
5245 | - dummy.data = &val; | |
5246 | - dummy.proc_handler = &proc_dointvec; | |
5247 | - dummy.extra1 = &min; | |
5248 | - dummy.extra2 = &max; | |
5249 | + dummy.data = &val; | |
5250 | + dummy.proc_handler = &proc_dointvec; | |
5251 | + dummy.extra1 = &min; | |
5252 | + dummy.extra2 = &max; | |
5253 | ||
5254 | - if (write) { | |
5255 | - *ppos += *lenp; | |
5256 | - } else { | |
5257 | - down_read(&spl_kmem_cache_sem); | |
5258 | - mask = (unsigned long)table->data; | |
5259 | + if (write) { | |
5260 | + *ppos += *lenp; | |
5261 | + } else { | |
5262 | + down_read(&spl_kmem_cache_sem); | |
5263 | + mask = (unsigned long)table->data; | |
5264 | ||
5265 | - list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) { | |
5266 | + list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) { | |
5267 | ||
5268 | /* Only use slabs of the correct kmem/vmem type */ | |
5269 | if (!(skc->skc_flags & mask)) | |
5270 | @@ -165,58 +166,61 @@ proc_doslab(struct ctl_table *table, int write, | |
5271 | /* Sum the specified field for selected slabs */ | |
5272 | switch (mask & (KMC_TOTAL | KMC_ALLOC | KMC_MAX)) { | |
5273 | case KMC_TOTAL: | |
5274 | - val += skc->skc_slab_size * skc->skc_slab_total; | |
5275 | + val += skc->skc_slab_size * skc->skc_slab_total; | |
5276 | break; | |
5277 | case KMC_ALLOC: | |
5278 | - val += skc->skc_obj_size * skc->skc_obj_alloc; | |
5279 | + val += skc->skc_obj_size * skc->skc_obj_alloc; | |
5280 | break; | |
5281 | case KMC_MAX: | |
5282 | - val += skc->skc_obj_size * skc->skc_obj_max; | |
5283 | + val += skc->skc_obj_size * skc->skc_obj_max; | |
5284 | break; | |
5285 | } | |
5286 | - } | |
5287 | + } | |
5288 | ||
5289 | - up_read(&spl_kmem_cache_sem); | |
5290 | - rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); | |
5291 | - } | |
5292 | + up_read(&spl_kmem_cache_sem); | |
5293 | + rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); | |
5294 | + } | |
5295 | ||
5296 | - return (rc); | |
5297 | + return (rc); | |
5298 | } | |
5299 | ||
5300 | static int | |
5301 | proc_dohostid(struct ctl_table *table, int write, | |
5302 | void __user *buffer, size_t *lenp, loff_t *ppos) | |
5303 | { | |
5304 | - int len, rc = 0; | |
5305 | - char *end, str[32]; | |
5306 | - | |
5307 | - if (write) { | |
5308 | - /* We can't use proc_doulongvec_minmax() in the write | |
5309 | - * case here because hostid while a hex value has no | |
5310 | - * leading 0x which confuses the helper function. */ | |
5311 | - rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); | |
5312 | - if (rc < 0) | |
5313 | - return (rc); | |
5314 | - | |
5315 | - spl_hostid = simple_strtoul(str, &end, 16); | |
5316 | - if (str == end) | |
5317 | - return (-EINVAL); | |
5318 | - | |
5319 | - } else { | |
5320 | - len = snprintf(str, sizeof(str), "%lx", | |
5321 | + int len, rc = 0; | |
5322 | + char *end, str[32]; | |
5323 | + | |
5324 | + if (write) { | |
5325 | + /* | |
5326 | + * We can't use proc_doulongvec_minmax() in the write | |
5327 | + * case here because hostid while a hex value has no | |
5328 | + * leading 0x which confuses the helper function. | |
5329 | + */ | |
5330 | + rc = proc_copyin_string(str, sizeof (str), buffer, *lenp); | |
5331 | + if (rc < 0) | |
5332 | + return (rc); | |
5333 | + | |
5334 | + spl_hostid = simple_strtoul(str, &end, 16); | |
5335 | + if (str == end) | |
5336 | + return (-EINVAL); | |
5337 | + | |
5338 | + } else { | |
5339 | + len = snprintf(str, sizeof (str), "%lx", | |
5340 | (unsigned long) zone_get_hostid(NULL)); | |
5341 | - if (*ppos >= len) | |
5342 | - rc = 0; | |
5343 | - else | |
5344 | - rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n"); | |
5345 | - | |
5346 | - if (rc >= 0) { | |
5347 | - *lenp = rc; | |
5348 | - *ppos += rc; | |
5349 | - } | |
5350 | - } | |
5351 | - | |
5352 | - return (rc); | |
5353 | + if (*ppos >= len) | |
5354 | + rc = 0; | |
5355 | + else | |
5356 | + rc = proc_copyout_string(buffer, | |
5357 | + *lenp, str + *ppos, "\n"); | |
5358 | + | |
5359 | + if (rc >= 0) { | |
5360 | + *lenp = rc; | |
5361 | + *ppos += rc; | |
5362 | + } | |
5363 | + } | |
5364 | + | |
5365 | + return (rc); | |
5366 | } | |
5367 | ||
5368 | static void | |
5369 | @@ -229,11 +233,11 @@ taskq_seq_show_headers(struct seq_file *f) | |
5370 | ||
5371 | /* indices into the lheads array below */ | |
5372 | #define LHEAD_PEND 0 | |
5373 | -#define LHEAD_PRIO 1 | |
5374 | -#define LHEAD_DELAY 2 | |
5375 | -#define LHEAD_WAIT 3 | |
5376 | -#define LHEAD_ACTIVE 4 | |
5377 | -#define LHEAD_SIZE 5 | |
5378 | +#define LHEAD_PRIO 1 | |
5379 | +#define LHEAD_DELAY 2 | |
5380 | +#define LHEAD_WAIT 3 | |
5381 | +#define LHEAD_ACTIVE 4 | |
5382 | +#define LHEAD_SIZE 5 | |
5383 | ||
5384 | static unsigned int spl_max_show_tasks = 512; | |
5385 | module_param(spl_max_show_tasks, uint, 0644); | |
5386 | @@ -287,7 +291,7 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag) | |
5387 | spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags); | |
5388 | ||
5389 | /* show the base taskq contents */ | |
5390 | - snprintf(name, sizeof(name), "%s/%d", tq->tq_name, tq->tq_instance); | |
5391 | + snprintf(name, sizeof (name), "%s/%d", tq->tq_name, tq->tq_instance); | |
5392 | seq_printf(f, "%-25s ", name); | |
5393 | seq_printf(f, "%5d %5d %5d %5d %5d %5d %12d %5d %10x\n", | |
5394 | tq->tq_nactive, tq->tq_nthreads, tq->tq_nspawn, | |
5395 | @@ -299,7 +303,8 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag) | |
5396 | j = 0; | |
5397 | list_for_each_entry(tqt, &tq->tq_active_list, tqt_active_list) { | |
5398 | if (j == 0) | |
5399 | - seq_printf(f, "\t%s:", list_names[LHEAD_ACTIVE]); | |
5400 | + seq_printf(f, "\t%s:", | |
5401 | + list_names[LHEAD_ACTIVE]); | |
5402 | else if (j == 2) { | |
5403 | seq_printf(f, "\n\t "); | |
5404 | j = 0; | |
5405 | @@ -403,32 +408,32 @@ taskq_seq_next(struct seq_file *f, void *p, loff_t *pos) | |
5406 | ||
5407 | ++*pos; | |
5408 | return ((tq->tq_taskqs.next == &tq_list) ? | |
5409 | - NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs)); | |
5410 | + NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs)); | |
5411 | } | |
5412 | ||
5413 | static void | |
5414 | slab_seq_show_headers(struct seq_file *f) | |
5415 | { | |
5416 | - seq_printf(f, | |
5417 | - "--------------------- cache ----------" | |
5418 | - "--------------------------------------------- " | |
5419 | - "----- slab ------ " | |
5420 | - "---- object ----- " | |
5421 | - "--- emergency ---\n"); | |
5422 | - seq_printf(f, | |
5423 | - "name " | |
5424 | - " flags size alloc slabsize objsize " | |
5425 | - "total alloc max " | |
5426 | - "total alloc max " | |
5427 | - "dlock alloc max\n"); | |
5428 | + seq_printf(f, | |
5429 | + "--------------------- cache ----------" | |
5430 | + "--------------------------------------------- " | |
5431 | + "----- slab ------ " | |
5432 | + "---- object ----- " | |
5433 | + "--- emergency ---\n"); | |
5434 | + seq_printf(f, | |
5435 | + "name " | |
5436 | + " flags size alloc slabsize objsize " | |
5437 | + "total alloc max " | |
5438 | + "total alloc max " | |
5439 | + "dlock alloc max\n"); | |
5440 | } | |
5441 | ||
5442 | static int | |
5443 | slab_seq_show(struct seq_file *f, void *p) | |
5444 | { | |
5445 | - spl_kmem_cache_t *skc = p; | |
5446 | + spl_kmem_cache_t *skc = p; | |
5447 | ||
5448 | - ASSERT(skc->skc_magic == SKC_MAGIC); | |
5449 | + ASSERT(skc->skc_magic == SKC_MAGIC); | |
5450 | ||
5451 | /* | |
5452 | * Backed by Linux slab see /proc/slabinfo. | |
5453 | @@ -436,48 +441,48 @@ slab_seq_show(struct seq_file *f, void *p) | |
5454 | if (skc->skc_flags & KMC_SLAB) | |
5455 | return (0); | |
5456 | ||
5457 | - spin_lock(&skc->skc_lock); | |
5458 | - seq_printf(f, "%-36s ", skc->skc_name); | |
5459 | - seq_printf(f, "0x%05lx %9lu %9lu %8u %8u " | |
5460 | - "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", | |
5461 | - (long unsigned)skc->skc_flags, | |
5462 | - (long unsigned)(skc->skc_slab_size * skc->skc_slab_total), | |
5463 | - (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc), | |
5464 | - (unsigned)skc->skc_slab_size, | |
5465 | - (unsigned)skc->skc_obj_size, | |
5466 | - (long unsigned)skc->skc_slab_total, | |
5467 | - (long unsigned)skc->skc_slab_alloc, | |
5468 | - (long unsigned)skc->skc_slab_max, | |
5469 | - (long unsigned)skc->skc_obj_total, | |
5470 | - (long unsigned)skc->skc_obj_alloc, | |
5471 | - (long unsigned)skc->skc_obj_max, | |
5472 | - (long unsigned)skc->skc_obj_deadlock, | |
5473 | - (long unsigned)skc->skc_obj_emergency, | |
5474 | - (long unsigned)skc->skc_obj_emergency_max); | |
5475 | - | |
5476 | - spin_unlock(&skc->skc_lock); | |
5477 | - | |
5478 | - return 0; | |
5479 | + spin_lock(&skc->skc_lock); | |
5480 | + seq_printf(f, "%-36s ", skc->skc_name); | |
5481 | + seq_printf(f, "0x%05lx %9lu %9lu %8u %8u " | |
5482 | + "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", | |
5483 | + (long unsigned)skc->skc_flags, | |
5484 | + (long unsigned)(skc->skc_slab_size * skc->skc_slab_total), | |
5485 | + (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc), | |
5486 | + (unsigned)skc->skc_slab_size, | |
5487 | + (unsigned)skc->skc_obj_size, | |
5488 | + (long unsigned)skc->skc_slab_total, | |
5489 | + (long unsigned)skc->skc_slab_alloc, | |
5490 | + (long unsigned)skc->skc_slab_max, | |
5491 | + (long unsigned)skc->skc_obj_total, | |
5492 | + (long unsigned)skc->skc_obj_alloc, | |
5493 | + (long unsigned)skc->skc_obj_max, | |
5494 | + (long unsigned)skc->skc_obj_deadlock, | |
5495 | + (long unsigned)skc->skc_obj_emergency, | |
5496 | + (long unsigned)skc->skc_obj_emergency_max); | |
5497 | + | |
5498 | + spin_unlock(&skc->skc_lock); | |
5499 | + | |
5500 | + return (0); | |
5501 | } | |
5502 | ||
5503 | static void * | |
5504 | slab_seq_start(struct seq_file *f, loff_t *pos) | |
5505 | { | |
5506 | - struct list_head *p; | |
5507 | - loff_t n = *pos; | |
5508 | + struct list_head *p; | |
5509 | + loff_t n = *pos; | |
5510 | ||
5511 | down_read(&spl_kmem_cache_sem); | |
5512 | - if (!n) | |
5513 | - slab_seq_show_headers(f); | |
5514 | + if (!n) | |
5515 | + slab_seq_show_headers(f); | |
5516 | ||
5517 | - p = spl_kmem_cache_list.next; | |
5518 | - while (n--) { | |
5519 | - p = p->next; | |
5520 | - if (p == &spl_kmem_cache_list) | |
5521 | - return (NULL); | |
5522 | - } | |
5523 | + p = spl_kmem_cache_list.next; | |
5524 | + while (n--) { | |
5525 | + p = p->next; | |
5526 | + if (p == &spl_kmem_cache_list) | |
5527 | + return (NULL); | |
5528 | + } | |
5529 | ||
5530 | - return (list_entry(p, spl_kmem_cache_t, skc_list)); | |
5531 | + return (list_entry(p, spl_kmem_cache_t, skc_list)); | |
5532 | } | |
5533 | ||
5534 | static void * | |
5535 | @@ -485,9 +490,9 @@ slab_seq_next(struct seq_file *f, void *p, loff_t *pos) | |
5536 | { | |
5537 | spl_kmem_cache_t *skc = p; | |
5538 | ||
5539 | - ++*pos; | |
5540 | - return ((skc->skc_list.next == &spl_kmem_cache_list) ? | |
5541 | - NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list)); | |
5542 | + ++*pos; | |
5543 | + return ((skc->skc_list.next == &spl_kmem_cache_list) ? | |
5544 | + NULL : list_entry(skc->skc_list.next, spl_kmem_cache_t, skc_list)); | |
5545 | } | |
5546 | ||
5547 | static void | |
5548 | @@ -497,23 +502,23 @@ slab_seq_stop(struct seq_file *f, void *v) | |
5549 | } | |
5550 | ||
5551 | static struct seq_operations slab_seq_ops = { | |
5552 | - .show = slab_seq_show, | |
5553 | - .start = slab_seq_start, | |
5554 | - .next = slab_seq_next, | |
5555 | - .stop = slab_seq_stop, | |
5556 | + .show = slab_seq_show, | |
5557 | + .start = slab_seq_start, | |
5558 | + .next = slab_seq_next, | |
5559 | + .stop = slab_seq_stop, | |
5560 | }; | |
5561 | ||
5562 | static int | |
5563 | proc_slab_open(struct inode *inode, struct file *filp) | |
5564 | { | |
5565 | - return seq_open(filp, &slab_seq_ops); | |
5566 | + return (seq_open(filp, &slab_seq_ops)); | |
5567 | } | |
5568 | ||
5569 | static struct file_operations proc_slab_operations = { | |
5570 | - .open = proc_slab_open, | |
5571 | - .read = seq_read, | |
5572 | - .llseek = seq_lseek, | |
5573 | - .release = seq_release, | |
5574 | + .open = proc_slab_open, | |
5575 | + .read = seq_read, | |
5576 | + .llseek = seq_lseek, | |
5577 | + .release = seq_release, | |
5578 | }; | |
5579 | ||
5580 | static void | |
5581 | @@ -523,122 +528,122 @@ taskq_seq_stop(struct seq_file *f, void *v) | |
5582 | } | |
5583 | ||
5584 | static struct seq_operations taskq_all_seq_ops = { | |
5585 | - .show = taskq_all_seq_show, | |
5586 | - .start = taskq_seq_start, | |
5587 | - .next = taskq_seq_next, | |
5588 | - .stop = taskq_seq_stop, | |
5589 | + .show = taskq_all_seq_show, | |
5590 | + .start = taskq_seq_start, | |
5591 | + .next = taskq_seq_next, | |
5592 | + .stop = taskq_seq_stop, | |
5593 | }; | |
5594 | ||
5595 | static struct seq_operations taskq_seq_ops = { | |
5596 | - .show = taskq_seq_show, | |
5597 | - .start = taskq_seq_start, | |
5598 | - .next = taskq_seq_next, | |
5599 | - .stop = taskq_seq_stop, | |
5600 | + .show = taskq_seq_show, | |
5601 | + .start = taskq_seq_start, | |
5602 | + .next = taskq_seq_next, | |
5603 | + .stop = taskq_seq_stop, | |
5604 | }; | |
5605 | ||
5606 | static int | |
5607 | proc_taskq_all_open(struct inode *inode, struct file *filp) | |
5608 | { | |
5609 | - return seq_open(filp, &taskq_all_seq_ops); | |
5610 | + return (seq_open(filp, &taskq_all_seq_ops)); | |
5611 | } | |
5612 | ||
5613 | static int | |
5614 | proc_taskq_open(struct inode *inode, struct file *filp) | |
5615 | { | |
5616 | - return seq_open(filp, &taskq_seq_ops); | |
5617 | + return (seq_open(filp, &taskq_seq_ops)); | |
5618 | } | |
5619 | ||
5620 | static struct file_operations proc_taskq_all_operations = { | |
5621 | - .open = proc_taskq_all_open, | |
5622 | - .read = seq_read, | |
5623 | - .llseek = seq_lseek, | |
5624 | - .release = seq_release, | |
5625 | + .open = proc_taskq_all_open, | |
5626 | + .read = seq_read, | |
5627 | + .llseek = seq_lseek, | |
5628 | + .release = seq_release, | |
5629 | }; | |
5630 | ||
5631 | static struct file_operations proc_taskq_operations = { | |
5632 | - .open = proc_taskq_open, | |
5633 | - .read = seq_read, | |
5634 | - .llseek = seq_lseek, | |
5635 | - .release = seq_release, | |
5636 | + .open = proc_taskq_open, | |
5637 | + .read = seq_read, | |
5638 | + .llseek = seq_lseek, | |
5639 | + .release = seq_release, | |
5640 | }; | |
5641 | ||
5642 | static struct ctl_table spl_kmem_table[] = { | |
5643 | #ifdef DEBUG_KMEM | |
5644 | - { | |
5645 | - .procname = "kmem_used", | |
5646 | - .data = &kmem_alloc_used, | |
5647 | -# ifdef HAVE_ATOMIC64_T | |
5648 | - .maxlen = sizeof(atomic64_t), | |
5649 | -# else | |
5650 | - .maxlen = sizeof(atomic_t), | |
5651 | -# endif /* HAVE_ATOMIC64_T */ | |
5652 | - .mode = 0444, | |
5653 | - .proc_handler = &proc_domemused, | |
5654 | - }, | |
5655 | - { | |
5656 | - .procname = "kmem_max", | |
5657 | - .data = &kmem_alloc_max, | |
5658 | - .maxlen = sizeof(unsigned long), | |
5659 | - .extra1 = &table_min, | |
5660 | - .extra2 = &table_max, | |
5661 | - .mode = 0444, | |
5662 | - .proc_handler = &proc_doulongvec_minmax, | |
5663 | - }, | |
5664 | + { | |
5665 | + .procname = "kmem_used", | |
5666 | + .data = &kmem_alloc_used, | |
5667 | +#ifdef HAVE_ATOMIC64_T | |
5668 | + .maxlen = sizeof (atomic64_t), | |
5669 | +#else | |
5670 | + .maxlen = sizeof (atomic_t), | |
5671 | +#endif /* HAVE_ATOMIC64_T */ | |
5672 | + .mode = 0444, | |
5673 | + .proc_handler = &proc_domemused, | |
5674 | + }, | |
5675 | + { | |
5676 | + .procname = "kmem_max", | |
5677 | + .data = &kmem_alloc_max, | |
5678 | + .maxlen = sizeof (unsigned long), | |
5679 | + .extra1 = &table_min, | |
5680 | + .extra2 = &table_max, | |
5681 | + .mode = 0444, | |
5682 | + .proc_handler = &proc_doulongvec_minmax, | |
5683 | + }, | |
5684 | #endif /* DEBUG_KMEM */ | |
5685 | - { | |
5686 | - .procname = "slab_kmem_total", | |
5687 | - .data = (void *)(KMC_KMEM | KMC_TOTAL), | |
5688 | - .maxlen = sizeof(unsigned long), | |
5689 | - .extra1 = &table_min, | |
5690 | - .extra2 = &table_max, | |
5691 | - .mode = 0444, | |
5692 | - .proc_handler = &proc_doslab, | |
5693 | - }, | |
5694 | - { | |
5695 | - .procname = "slab_kmem_alloc", | |
5696 | - .data = (void *)(KMC_KMEM | KMC_ALLOC), | |
5697 | - .maxlen = sizeof(unsigned long), | |
5698 | - .extra1 = &table_min, | |
5699 | - .extra2 = &table_max, | |
5700 | - .mode = 0444, | |
5701 | - .proc_handler = &proc_doslab, | |
5702 | - }, | |
5703 | - { | |
5704 | - .procname = "slab_kmem_max", | |
5705 | - .data = (void *)(KMC_KMEM | KMC_MAX), | |
5706 | - .maxlen = sizeof(unsigned long), | |
5707 | - .extra1 = &table_min, | |
5708 | - .extra2 = &table_max, | |
5709 | - .mode = 0444, | |
5710 | - .proc_handler = &proc_doslab, | |
5711 | - }, | |
5712 | - { | |
5713 | - .procname = "slab_vmem_total", | |
5714 | - .data = (void *)(KMC_VMEM | KMC_TOTAL), | |
5715 | - .maxlen = sizeof(unsigned long), | |
5716 | - .extra1 = &table_min, | |
5717 | - .extra2 = &table_max, | |
5718 | - .mode = 0444, | |
5719 | - .proc_handler = &proc_doslab, | |
5720 | - }, | |
5721 | - { | |
5722 | - .procname = "slab_vmem_alloc", | |
5723 | - .data = (void *)(KMC_VMEM | KMC_ALLOC), | |
5724 | - .maxlen = sizeof(unsigned long), | |
5725 | - .extra1 = &table_min, | |
5726 | - .extra2 = &table_max, | |
5727 | - .mode = 0444, | |
5728 | - .proc_handler = &proc_doslab, | |
5729 | - }, | |
5730 | - { | |
5731 | - .procname = "slab_vmem_max", | |
5732 | - .data = (void *)(KMC_VMEM | KMC_MAX), | |
5733 | - .maxlen = sizeof(unsigned long), | |
5734 | - .extra1 = &table_min, | |
5735 | - .extra2 = &table_max, | |
5736 | - .mode = 0444, | |
5737 | - .proc_handler = &proc_doslab, | |
5738 | - }, | |
5739 | + { | |
5740 | + .procname = "slab_kmem_total", | |
5741 | + .data = (void *)(KMC_KMEM | KMC_TOTAL), | |
5742 | + .maxlen = sizeof (unsigned long), | |
5743 | + .extra1 = &table_min, | |
5744 | + .extra2 = &table_max, | |
5745 | + .mode = 0444, | |
5746 | + .proc_handler = &proc_doslab, | |
5747 | + }, | |
5748 | + { | |
5749 | + .procname = "slab_kmem_alloc", | |
5750 | + .data = (void *)(KMC_KMEM | KMC_ALLOC), | |
5751 | + .maxlen = sizeof (unsigned long), | |
5752 | + .extra1 = &table_min, | |
5753 | + .extra2 = &table_max, | |
5754 | + .mode = 0444, | |
5755 | + .proc_handler = &proc_doslab, | |
5756 | + }, | |
5757 | + { | |
5758 | + .procname = "slab_kmem_max", | |
5759 | + .data = (void *)(KMC_KMEM | KMC_MAX), | |
5760 | + .maxlen = sizeof (unsigned long), | |
5761 | + .extra1 = &table_min, | |
5762 | + .extra2 = &table_max, | |
5763 | + .mode = 0444, | |
5764 | + .proc_handler = &proc_doslab, | |
5765 | + }, | |
5766 | + { | |
5767 | + .procname = "slab_vmem_total", | |
5768 | + .data = (void *)(KMC_VMEM | KMC_TOTAL), | |
5769 | + .maxlen = sizeof (unsigned long), | |
5770 | + .extra1 = &table_min, | |
5771 | + .extra2 = &table_max, | |
5772 | + .mode = 0444, | |
5773 | + .proc_handler = &proc_doslab, | |
5774 | + }, | |
5775 | + { | |
5776 | + .procname = "slab_vmem_alloc", | |
5777 | + .data = (void *)(KMC_VMEM | KMC_ALLOC), | |
5778 | + .maxlen = sizeof (unsigned long), | |
5779 | + .extra1 = &table_min, | |
5780 | + .extra2 = &table_max, | |
5781 | + .mode = 0444, | |
5782 | + .proc_handler = &proc_doslab, | |
5783 | + }, | |
5784 | + { | |
5785 | + .procname = "slab_vmem_max", | |
5786 | + .data = (void *)(KMC_VMEM | KMC_MAX), | |
5787 | + .maxlen = sizeof (unsigned long), | |
5788 | + .extra1 = &table_min, | |
5789 | + .extra2 = &table_max, | |
5790 | + .mode = 0444, | |
5791 | + .proc_handler = &proc_doslab, | |
5792 | + }, | |
5793 | {}, | |
5794 | }; | |
5795 | ||
5796 | @@ -647,43 +652,44 @@ static struct ctl_table spl_kstat_table[] = { | |
5797 | }; | |
5798 | ||
5799 | static struct ctl_table spl_table[] = { | |
5800 | - /* NB No .strategy entries have been provided since | |
5801 | - * sysctl(8) prefers to go via /proc for portability. | |
5802 | - */ | |
5803 | - { | |
5804 | - .procname = "version", | |
5805 | - .data = spl_version, | |
5806 | - .maxlen = sizeof(spl_version), | |
5807 | - .mode = 0444, | |
5808 | - .proc_handler = &proc_dostring, | |
5809 | - }, | |
5810 | - { | |
5811 | - .procname = "hostid", | |
5812 | - .data = &spl_hostid, | |
5813 | - .maxlen = sizeof(unsigned long), | |
5814 | - .mode = 0644, | |
5815 | - .proc_handler = &proc_dohostid, | |
5816 | - }, | |
5817 | + /* | |
5818 | + * NB No .strategy entries have been provided since | |
5819 | + * sysctl(8) prefers to go via /proc for portability. | |
5820 | + */ | |
5821 | + { | |
5822 | + .procname = "version", | |
5823 | + .data = spl_version, | |
5824 | + .maxlen = sizeof (spl_version), | |
5825 | + .mode = 0444, | |
5826 | + .proc_handler = &proc_dostring, | |
5827 | + }, | |
5828 | + { | |
5829 | + .procname = "hostid", | |
5830 | + .data = &spl_hostid, | |
5831 | + .maxlen = sizeof (unsigned long), | |
5832 | + .mode = 0644, | |
5833 | + .proc_handler = &proc_dohostid, | |
5834 | + }, | |
5835 | { | |
5836 | - .procname = "kmem", | |
5837 | - .mode = 0555, | |
5838 | - .child = spl_kmem_table, | |
5839 | + .procname = "kmem", | |
5840 | + .mode = 0555, | |
5841 | + .child = spl_kmem_table, | |
5842 | }, | |
5843 | { | |
5844 | - .procname = "kstat", | |
5845 | - .mode = 0555, | |
5846 | - .child = spl_kstat_table, | |
5847 | + .procname = "kstat", | |
5848 | + .mode = 0555, | |
5849 | + .child = spl_kstat_table, | |
5850 | }, | |
5851 | - {}, | |
5852 | + {}, | |
5853 | }; | |
5854 | ||
5855 | static struct ctl_table spl_dir[] = { | |
5856 | - { | |
5857 | - .procname = "spl", | |
5858 | - .mode = 0555, | |
5859 | - .child = spl_table, | |
5860 | - }, | |
5861 | - {} | |
5862 | + { | |
5863 | + .procname = "spl", | |
5864 | + .mode = 0555, | |
5865 | + .child = spl_table, | |
5866 | + }, | |
5867 | + {} | |
5868 | }; | |
5869 | ||
5870 | static struct ctl_table spl_root[] = { | |
5871 | @@ -703,7 +709,7 @@ spl_proc_init(void) | |
5872 | { | |
5873 | int rc = 0; | |
5874 | ||
5875 | - spl_header = register_sysctl_table(spl_root); | |
5876 | + spl_header = register_sysctl_table(spl_root); | |
5877 | if (spl_header == NULL) | |
5878 | return (-EUNATCH); | |
5879 | ||
5880 | @@ -727,48 +733,48 @@ spl_proc_init(void) | |
5881 | goto out; | |
5882 | } | |
5883 | ||
5884 | - proc_spl_kmem = proc_mkdir("kmem", proc_spl); | |
5885 | - if (proc_spl_kmem == NULL) { | |
5886 | - rc = -EUNATCH; | |
5887 | + proc_spl_kmem = proc_mkdir("kmem", proc_spl); | |
5888 | + if (proc_spl_kmem == NULL) { | |
5889 | + rc = -EUNATCH; | |
5890 | goto out; | |
5891 | } | |
5892 | ||
5893 | proc_spl_kmem_slab = proc_create_data("slab", 0444, | |
5894 | proc_spl_kmem, &proc_slab_operations, NULL); | |
5895 | - if (proc_spl_kmem_slab == NULL) { | |
5896 | + if (proc_spl_kmem_slab == NULL) { | |
5897 | rc = -EUNATCH; | |
5898 | goto out; | |
5899 | } | |
5900 | ||
5901 | - proc_spl_kstat = proc_mkdir("kstat", proc_spl); | |
5902 | - if (proc_spl_kstat == NULL) { | |
5903 | - rc = -EUNATCH; | |
5904 | + proc_spl_kstat = proc_mkdir("kstat", proc_spl); | |
5905 | + if (proc_spl_kstat == NULL) { | |
5906 | + rc = -EUNATCH; | |
5907 | goto out; | |
5908 | } | |
5909 | out: | |
5910 | if (rc) { | |
5911 | remove_proc_entry("kstat", proc_spl); | |
5912 | - remove_proc_entry("slab", proc_spl_kmem); | |
5913 | + remove_proc_entry("slab", proc_spl_kmem); | |
5914 | remove_proc_entry("kmem", proc_spl); | |
5915 | remove_proc_entry("taskq-all", proc_spl); | |
5916 | remove_proc_entry("taskq", proc_spl); | |
5917 | remove_proc_entry("spl", NULL); | |
5918 | - unregister_sysctl_table(spl_header); | |
5919 | + unregister_sysctl_table(spl_header); | |
5920 | } | |
5921 | ||
5922 | - return (rc); | |
5923 | + return (rc); | |
5924 | } | |
5925 | ||
5926 | void | |
5927 | spl_proc_fini(void) | |
5928 | { | |
5929 | remove_proc_entry("kstat", proc_spl); | |
5930 | - remove_proc_entry("slab", proc_spl_kmem); | |
5931 | + remove_proc_entry("slab", proc_spl_kmem); | |
5932 | remove_proc_entry("kmem", proc_spl); | |
5933 | remove_proc_entry("taskq-all", proc_spl); | |
5934 | remove_proc_entry("taskq", proc_spl); | |
5935 | remove_proc_entry("spl", NULL); | |
5936 | ||
5937 | - ASSERT(spl_header != NULL); | |
5938 | - unregister_sysctl_table(spl_header); | |
5939 | + ASSERT(spl_header != NULL); | |
5940 | + unregister_sysctl_table(spl_header); | |
5941 | } | |
5942 | diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c | |
5943 | index d99ef4f..bf7ee2f 100644 | |
5944 | --- a/module/spl/spl-rwlock.c | |
5945 | +++ b/module/spl/spl-rwlock.c | |
5946 | @@ -20,18 +20,12 @@ | |
5947 | * | |
5948 | * You should have received a copy of the GNU General Public License along | |
5949 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
5950 | - ***************************************************************************** | |
5951 | + * | |
5952 | * Solaris Porting Layer (SPL) Reader/Writer Lock Implementation. | |
5953 | \*****************************************************************************/ | |
5954 | ||
5955 | #include <sys/rwlock.h> | |
5956 | ||
5957 | -#ifdef DEBUG_SUBSYSTEM | |
5958 | -#undef DEBUG_SUBSYSTEM | |
5959 | -#endif | |
5960 | - | |
5961 | -#define DEBUG_SUBSYSTEM S_RWLOCK | |
5962 | - | |
5963 | #if defined(CONFIG_PREEMPT_RT_FULL) | |
5964 | ||
5965 | #include <linux/rtmutex.h> | |
5966 | @@ -94,7 +88,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem) | |
5967 | static int | |
5968 | __rwsem_tryupgrade(struct rw_semaphore *rwsem) | |
5969 | { | |
5970 | - typeof (rwsem->count) val; | |
5971 | + typeof(rwsem->count) val; | |
5972 | val = cmpxchg(&rwsem->count, SPL_RWSEM_SINGLE_READER_VALUE, | |
5973 | SPL_RWSEM_SINGLE_WRITER_VALUE); | |
5974 | return (val == SPL_RWSEM_SINGLE_READER_VALUE); | |
5975 | diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c | |
5976 | index ae26bdb..2919a94 100644 | |
5977 | --- a/module/spl/spl-taskq.c | |
5978 | +++ b/module/spl/spl-taskq.c | |
5979 | @@ -87,7 +87,7 @@ taskq_find_by_name(const char *name) | |
5980 | list_for_each_prev(tql, &tq_list) { | |
5981 | tq = list_entry(tql, taskq_t, tq_taskqs); | |
5982 | if (strcmp(name, tq->tq_name) == 0) | |
5983 | - return tq->tq_instance; | |
5984 | + return (tq->tq_instance); | |
5985 | } | |
5986 | return (-1); | |
5987 | } | |
5988 | @@ -573,7 +573,8 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) | |
5989 | ASSERT(tq->tq_nactive <= tq->tq_nthreads); | |
5990 | if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { | |
5991 | /* Dynamic taskq may be able to spawn another thread */ | |
5992 | - if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) | |
5993 | + if (!(tq->tq_flags & TASKQ_DYNAMIC) || | |
5994 | + taskq_thread_spawn(tq) == 0) | |
5995 | goto out; | |
5996 | } | |
5997 | ||
5998 | @@ -686,7 +687,8 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, | |
5999 | ||
6000 | if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { | |
6001 | /* Dynamic taskq may be able to spawn another thread */ | |
6002 | - if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) | |
6003 | + if (!(tq->tq_flags & TASKQ_DYNAMIC) || | |
6004 | + taskq_thread_spawn(tq) == 0) | |
6005 | goto out2; | |
6006 | flags |= TQ_FRONT; | |
6007 | } | |
6008 | @@ -786,7 +788,8 @@ taskq_thread_spawn_task(void *arg) | |
6009 | ||
6010 | if (taskq_thread_create(tq) == NULL) { | |
6011 | /* restore spawning count if failed */ | |
6012 | - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); | |
6013 | + spin_lock_irqsave_nested(&tq->tq_lock, flags, | |
6014 | + tq->tq_lock_class); | |
6015 | tq->tq_nspawn--; | |
6016 | spin_unlock_irqrestore(&tq->tq_lock, flags); | |
6017 | } | |
6018 | @@ -1146,7 +1149,8 @@ taskq_destroy(taskq_t *tq) | |
6019 | while (tq->tq_nspawn) { | |
6020 | spin_unlock_irqrestore(&tq->tq_lock, flags); | |
6021 | schedule_timeout_interruptible(1); | |
6022 | - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); | |
6023 | + spin_lock_irqsave_nested(&tq->tq_lock, flags, | |
6024 | + tq->tq_lock_class); | |
6025 | } | |
6026 | ||
6027 | /* | |
6028 | @@ -1239,16 +1243,16 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp) | |
6029 | ||
6030 | #ifdef module_param_cb | |
6031 | static const struct kernel_param_ops param_ops_taskq_kick = { | |
6032 | - .set = param_set_taskq_kick, | |
6033 | - .get = param_get_uint, | |
6034 | + .set = param_set_taskq_kick, | |
6035 | + .get = param_get_uint, | |
6036 | }; | |
6037 | module_param_cb(spl_taskq_kick, ¶m_ops_taskq_kick, &spl_taskq_kick, 0644); | |
6038 | #else | |
6039 | module_param_call(spl_taskq_kick, param_set_taskq_kick, param_get_uint, | |
6040 | - &spl_taskq_kick, 0644); | |
6041 | + &spl_taskq_kick, 0644); | |
6042 | #endif | |
6043 | MODULE_PARM_DESC(spl_taskq_kick, | |
6044 | - "Write nonzero to kick stuck taskqs to spawn more threads"); | |
6045 | + "Write nonzero to kick stuck taskqs to spawn more threads"); | |
6046 | ||
6047 | int | |
6048 | spl_taskq_init(void) | |
6049 | diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c | |
6050 | index b0f4d57..357d0ca 100644 | |
6051 | --- a/module/spl/spl-thread.c | |
6052 | +++ b/module/spl/spl-thread.c | |
6053 | @@ -20,7 +20,7 @@ | |
6054 | * | |
6055 | * You should have received a copy of the GNU General Public License along | |
6056 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
6057 | - ***************************************************************************** | |
6058 | + * | |
6059 | * Solaris Porting Layer (SPL) Thread Implementation. | |
6060 | \*****************************************************************************/ | |
6061 | ||
6062 | @@ -33,8 +33,8 @@ | |
6063 | */ | |
6064 | typedef struct thread_priv_s { | |
6065 | unsigned long tp_magic; /* Magic */ | |
6066 | - int tp_name_size; /* Name size */ | |
6067 | - char *tp_name; /* Name (without _thread suffix) */ | |
6068 | + int tp_name_size; /* Name size */ | |
6069 | + char *tp_name; /* Name (without _thread suffix) */ | |
6070 | void (*tp_func)(void *); /* Registered function */ | |
6071 | void *tp_args; /* Args to be passed to function */ | |
6072 | size_t tp_len; /* Len to be passed to function */ | |
6073 | @@ -55,12 +55,12 @@ thread_generic_wrapper(void *arg) | |
6074 | set_current_state(tp->tp_state); | |
6075 | set_user_nice((kthread_t *)current, PRIO_TO_NICE(tp->tp_pri)); | |
6076 | kmem_free(tp->tp_name, tp->tp_name_size); | |
6077 | - kmem_free(tp, sizeof(thread_priv_t)); | |
6078 | + kmem_free(tp, sizeof (thread_priv_t)); | |
6079 | ||
6080 | if (func) | |
6081 | func(args); | |
6082 | ||
6083 | - return 0; | |
6084 | + return (0); | |
6085 | } | |
6086 | ||
6087 | void | |
6088 | @@ -72,9 +72,11 @@ __thread_exit(void) | |
6089 | } | |
6090 | EXPORT_SYMBOL(__thread_exit); | |
6091 | ||
6092 | -/* thread_create() may block forever if it cannot create a thread or | |
6093 | +/* | |
6094 | + * thread_create() may block forever if it cannot create a thread or | |
6095 | * allocate memory. This is preferable to returning a NULL which Solaris | |
6096 | - * style callers likely never check for... since it can't fail. */ | |
6097 | + * style callers likely never check for... since it can't fail. | |
6098 | + */ | |
6099 | kthread_t * | |
6100 | __thread_create(caddr_t stk, size_t stksize, thread_func_t func, | |
6101 | const char *name, void *args, size_t len, proc_t *pp, | |
6102 | @@ -88,7 +90,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, | |
6103 | /* Variable stack size unsupported */ | |
6104 | ASSERT(stk == NULL); | |
6105 | ||
6106 | - tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE); | |
6107 | + tp = kmem_alloc(sizeof (thread_priv_t), KM_PUSHPAGE); | |
6108 | if (tp == NULL) | |
6109 | return (NULL); | |
6110 | ||
6111 | @@ -96,14 +98,15 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, | |
6112 | tp->tp_name_size = strlen(name) + 1; | |
6113 | ||
6114 | tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE); | |
6115 | - if (tp->tp_name == NULL) { | |
6116 | - kmem_free(tp, sizeof(thread_priv_t)); | |
6117 | + if (tp->tp_name == NULL) { | |
6118 | + kmem_free(tp, sizeof (thread_priv_t)); | |
6119 | return (NULL); | |
6120 | } | |
6121 | ||
6122 | strncpy(tp->tp_name, name, tp->tp_name_size); | |
6123 | ||
6124 | - /* Strip trailing "_thread" from passed name which will be the func | |
6125 | + /* | |
6126 | + * Strip trailing "_thread" from passed name which will be the func | |
6127 | * name since the exposed API has no parameter for passing a name. | |
6128 | */ | |
6129 | p = strstr(tp->tp_name, "_thread"); | |
6130 | @@ -117,7 +120,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, | |
6131 | tp->tp_pri = pri; | |
6132 | ||
6133 | tsk = spl_kthread_create(thread_generic_wrapper, (void *)tp, | |
6134 | - "%s", tp->tp_name); | |
6135 | + "%s", tp->tp_name); | |
6136 | if (IS_ERR(tsk)) | |
6137 | return (NULL); | |
6138 | ||
6139 | @@ -139,7 +142,7 @@ spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...) | |
6140 | char name[TASK_COMM_LEN]; | |
6141 | ||
6142 | va_start(args, namefmt); | |
6143 | - vsnprintf(name, sizeof(name), namefmt, args); | |
6144 | + vsnprintf(name, sizeof (name), namefmt, args); | |
6145 | va_end(args); | |
6146 | do { | |
6147 | tsk = kthread_create(func, data, "%s", name); | |
6148 | diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c | |
6149 | index a804e10..75d8936 100644 | |
6150 | --- a/module/spl/spl-vnode.c | |
6151 | +++ b/module/spl/spl-vnode.c | |
6152 | @@ -20,7 +20,7 @@ | |
6153 | * | |
6154 | * You should have received a copy of the GNU General Public License along | |
6155 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
6156 | - ***************************************************************************** | |
6157 | + * | |
6158 | * Solaris Porting Layer (SPL) Vnode Implementation. | |
6159 | \*****************************************************************************/ | |
6160 | ||
6161 | @@ -43,27 +43,27 @@ vtype_t | |
6162 | vn_mode_to_vtype(mode_t mode) | |
6163 | { | |
6164 | if (S_ISREG(mode)) | |
6165 | - return VREG; | |
6166 | + return (VREG); | |
6167 | ||
6168 | if (S_ISDIR(mode)) | |
6169 | - return VDIR; | |
6170 | + return (VDIR); | |
6171 | ||
6172 | if (S_ISCHR(mode)) | |
6173 | - return VCHR; | |
6174 | + return (VCHR); | |
6175 | ||
6176 | if (S_ISBLK(mode)) | |
6177 | - return VBLK; | |
6178 | + return (VBLK); | |
6179 | ||
6180 | if (S_ISFIFO(mode)) | |
6181 | - return VFIFO; | |
6182 | + return (VFIFO); | |
6183 | ||
6184 | if (S_ISLNK(mode)) | |
6185 | - return VLNK; | |
6186 | + return (VLNK); | |
6187 | ||
6188 | if (S_ISSOCK(mode)) | |
6189 | - return VSOCK; | |
6190 | + return (VSOCK); | |
6191 | ||
6192 | - return VNON; | |
6193 | + return (VNON); | |
6194 | } /* vn_mode_to_vtype() */ | |
6195 | EXPORT_SYMBOL(vn_mode_to_vtype); | |
6196 | ||
6197 | @@ -71,27 +71,27 @@ mode_t | |
6198 | vn_vtype_to_mode(vtype_t vtype) | |
6199 | { | |
6200 | if (vtype == VREG) | |
6201 | - return S_IFREG; | |
6202 | + return (S_IFREG); | |
6203 | ||
6204 | if (vtype == VDIR) | |
6205 | - return S_IFDIR; | |
6206 | + return (S_IFDIR); | |
6207 | ||
6208 | if (vtype == VCHR) | |
6209 | - return S_IFCHR; | |
6210 | + return (S_IFCHR); | |
6211 | ||
6212 | if (vtype == VBLK) | |
6213 | - return S_IFBLK; | |
6214 | + return (S_IFBLK); | |
6215 | ||
6216 | if (vtype == VFIFO) | |
6217 | - return S_IFIFO; | |
6218 | + return (S_IFIFO); | |
6219 | ||
6220 | if (vtype == VLNK) | |
6221 | - return S_IFLNK; | |
6222 | + return (S_IFLNK); | |
6223 | ||
6224 | if (vtype == VSOCK) | |
6225 | - return S_IFSOCK; | |
6226 | + return (S_IFSOCK); | |
6227 | ||
6228 | - return VNON; | |
6229 | + return (VNON); | |
6230 | } /* vn_vtype_to_mode() */ | |
6231 | EXPORT_SYMBOL(vn_vtype_to_mode); | |
6232 | ||
6233 | @@ -135,7 +135,8 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, | |
6234 | if (!(flags & FCREAT) && (flags & FWRITE)) | |
6235 | flags |= FEXCL; | |
6236 | ||
6237 | - /* Note for filp_open() the two low bits must be remapped to mean: | |
6238 | + /* | |
6239 | + * Note for filp_open() the two low bits must be remapped to mean: | |
6240 | * 01 - read-only -> 00 read-only | |
6241 | * 10 - write-only -> 01 write-only | |
6242 | * 11 - read-write -> 10 read-write | |
6243 | @@ -148,7 +149,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, | |
6244 | fp = filp_open(path, flags, mode); | |
6245 | ||
6246 | if (flags & FCREAT) | |
6247 | - (void)xchg(¤t->fs->umask, saved_umask); | |
6248 | + (void) xchg(¤t->fs->umask, saved_umask); | |
6249 | ||
6250 | if (IS_ERR(fp)) | |
6251 | return (-PTR_ERR(fp)); | |
6252 | @@ -187,7 +188,7 @@ EXPORT_SYMBOL(vn_open); | |
6253 | ||
6254 | int | |
6255 | vn_openat(const char *path, uio_seg_t seg, int flags, int mode, | |
6256 | - vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd) | |
6257 | + vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd) | |
6258 | { | |
6259 | char *realpath; | |
6260 | int len, rc; | |
6261 | @@ -199,7 +200,7 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode, | |
6262 | if (!realpath) | |
6263 | return (ENOMEM); | |
6264 | ||
6265 | - (void)snprintf(realpath, len, "/%s", path); | |
6266 | + (void) snprintf(realpath, len, "/%s", path); | |
6267 | rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2); | |
6268 | kfree(realpath); | |
6269 | ||
6270 | @@ -259,9 +260,11 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) | |
6271 | } /* vn_close() */ | |
6272 | EXPORT_SYMBOL(vn_close); | |
6273 | ||
6274 | -/* vn_seek() does not actually seek it only performs bounds checking on the | |
6275 | +/* | |
6276 | + * vn_seek() does not actually seek it only performs bounds checking on the | |
6277 | * proposed seek. We perform minimal checking and allow vn_rdwr() to catch | |
6278 | - * anything more serious. */ | |
6279 | + * anything more serious. | |
6280 | + */ | |
6281 | int | |
6282 | vn_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, void *ct) | |
6283 | { | |
6284 | @@ -293,26 +296,27 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) | |
6285 | if (rc) | |
6286 | return (-rc); | |
6287 | ||
6288 | - vap->va_type = vn_mode_to_vtype(stat.mode); | |
6289 | - vap->va_mode = stat.mode; | |
6290 | - vap->va_uid = KUID_TO_SUID(stat.uid); | |
6291 | - vap->va_gid = KGID_TO_SGID(stat.gid); | |
6292 | - vap->va_fsid = 0; | |
6293 | - vap->va_nodeid = stat.ino; | |
6294 | - vap->va_nlink = stat.nlink; | |
6295 | - vap->va_size = stat.size; | |
6296 | - vap->va_blksize = stat.blksize; | |
6297 | - vap->va_atime = stat.atime; | |
6298 | - vap->va_mtime = stat.mtime; | |
6299 | - vap->va_ctime = stat.ctime; | |
6300 | - vap->va_rdev = stat.rdev; | |
6301 | - vap->va_nblocks = stat.blocks; | |
6302 | + vap->va_type = vn_mode_to_vtype(stat.mode); | |
6303 | + vap->va_mode = stat.mode; | |
6304 | + vap->va_uid = KUID_TO_SUID(stat.uid); | |
6305 | + vap->va_gid = KGID_TO_SGID(stat.gid); | |
6306 | + vap->va_fsid = 0; | |
6307 | + vap->va_nodeid = stat.ino; | |
6308 | + vap->va_nlink = stat.nlink; | |
6309 | + vap->va_size = stat.size; | |
6310 | + vap->va_blksize = stat.blksize; | |
6311 | + vap->va_atime = stat.atime; | |
6312 | + vap->va_mtime = stat.mtime; | |
6313 | + vap->va_ctime = stat.ctime; | |
6314 | + vap->va_rdev = stat.rdev; | |
6315 | + vap->va_nblocks = stat.blocks; | |
6316 | ||
6317 | return (0); | |
6318 | } | |
6319 | EXPORT_SYMBOL(vn_getattr); | |
6320 | ||
6321 | -int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) | |
6322 | +int | |
6323 | +vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) | |
6324 | { | |
6325 | int datasync = 0; | |
6326 | int error; | |
6327 | @@ -412,22 +416,22 @@ EXPORT_SYMBOL(vn_space); | |
6328 | static file_t * | |
6329 | file_find(int fd, struct task_struct *task) | |
6330 | { | |
6331 | - file_t *fp; | |
6332 | + file_t *fp; | |
6333 | ||
6334 | - list_for_each_entry(fp, &vn_file_list, f_list) { | |
6335 | + list_for_each_entry(fp, &vn_file_list, f_list) { | |
6336 | if (fd == fp->f_fd && fp->f_task == task) { | |
6337 | ASSERT(atomic_read(&fp->f_ref) != 0); | |
6338 | - return fp; | |
6339 | + return (fp); | |
6340 | } | |
6341 | } | |
6342 | ||
6343 | - return NULL; | |
6344 | + return (NULL); | |
6345 | } /* file_find() */ | |
6346 | ||
6347 | file_t * | |
6348 | vn_getf(int fd) | |
6349 | { | |
6350 | - struct kstat stat; | |
6351 | + struct kstat stat; | |
6352 | struct file *lfp; | |
6353 | file_t *fp; | |
6354 | vnode_t *vp; | |
6355 | @@ -482,13 +486,14 @@ vn_getf(int fd) | |
6356 | goto out_fget; | |
6357 | ||
6358 | #if defined(HAVE_4ARGS_VFS_GETATTR) | |
6359 | - rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, AT_STATX_SYNC_AS_STAT); | |
6360 | + rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, | |
6361 | + AT_STATX_SYNC_AS_STAT); | |
6362 | #elif defined(HAVE_2ARGS_VFS_GETATTR) | |
6363 | rc = vfs_getattr(&lfp->f_path, &stat); | |
6364 | #else | |
6365 | rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat); | |
6366 | #endif | |
6367 | - if (rc) | |
6368 | + if (rc) | |
6369 | goto out_vnode; | |
6370 | ||
6371 | mutex_enter(&vp->v_lock); | |
6372 | @@ -515,7 +520,7 @@ out_mutex: | |
6373 | mutex_exit(&fp->f_lock); | |
6374 | kmem_cache_free(vn_file_cache, fp); | |
6375 | out: | |
6376 | - return (NULL); | |
6377 | + return (NULL); | |
6378 | } /* getf() */ | |
6379 | EXPORT_SYMBOL(getf); | |
6380 | ||
6381 | @@ -556,12 +561,10 @@ vn_areleasef(int fd, uf_info_t *fip) | |
6382 | return; | |
6383 | } | |
6384 | ||
6385 | - list_del(&fp->f_list); | |
6386 | + list_del(&fp->f_list); | |
6387 | releasef_locked(fp); | |
6388 | } | |
6389 | spin_unlock(&vn_file_lock); | |
6390 | - | |
6391 | - return; | |
6392 | } /* releasef() */ | |
6393 | EXPORT_SYMBOL(areleasef); | |
6394 | ||
6395 | @@ -596,34 +599,34 @@ vn_set_fs_pwd(struct fs_struct *fs, struct path *path) | |
6396 | int | |
6397 | vn_set_pwd(const char *filename) | |
6398 | { | |
6399 | - struct path path; | |
6400 | - mm_segment_t saved_fs; | |
6401 | - int rc; | |
6402 | - | |
6403 | - /* | |
6404 | - * user_path_dir() and __user_walk() both expect 'filename' to be | |
6405 | - * a user space address so we must briefly increase the data segment | |
6406 | - * size to ensure strncpy_from_user() does not fail with -EFAULT. | |
6407 | - */ | |
6408 | - saved_fs = get_fs(); | |
6409 | - set_fs(get_ds()); | |
6410 | - | |
6411 | - rc = user_path_dir(filename, &path); | |
6412 | - if (rc) | |
6413 | + struct path path; | |
6414 | + mm_segment_t saved_fs; | |
6415 | + int rc; | |
6416 | + | |
6417 | + /* | |
6418 | + * user_path_dir() and __user_walk() both expect 'filename' to be | |
6419 | + * a user space address so we must briefly increase the data segment | |
6420 | + * size to ensure strncpy_from_user() does not fail with -EFAULT. | |
6421 | + */ | |
6422 | + saved_fs = get_fs(); | |
6423 | + set_fs(get_ds()); | |
6424 | + | |
6425 | + rc = user_path_dir(filename, &path); | |
6426 | + if (rc) | |
6427 | goto out; | |
6428 | ||
6429 | - rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); | |
6430 | - if (rc) | |
6431 | + rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); | |
6432 | + if (rc) | |
6433 | goto dput_and_out; | |
6434 | ||
6435 | - vn_set_fs_pwd(current->fs, &path); | |
6436 | + vn_set_fs_pwd(current->fs, &path); | |
6437 | ||
6438 | dput_and_out: | |
6439 | - path_put(&path); | |
6440 | + path_put(&path); | |
6441 | out: | |
6442 | set_fs(saved_fs); | |
6443 | ||
6444 | - return (-rc); | |
6445 | + return (-rc); | |
6446 | } /* vn_set_pwd() */ | |
6447 | EXPORT_SYMBOL(vn_set_pwd); | |
6448 | ||
6449 | @@ -651,10 +654,10 @@ vn_file_cache_constructor(void *buf, void *cdrarg, int kmflags) | |
6450 | file_t *fp = buf; | |
6451 | ||
6452 | atomic_set(&fp->f_ref, 0); | |
6453 | - mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL); | |
6454 | + mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL); | |
6455 | INIT_LIST_HEAD(&fp->f_list); | |
6456 | ||
6457 | - return (0); | |
6458 | + return (0); | |
6459 | } /* file_cache_constructor() */ | |
6460 | ||
6461 | static void | |
6462 | @@ -669,29 +672,26 @@ int | |
6463 | spl_vn_init(void) | |
6464 | { | |
6465 | vn_cache = kmem_cache_create("spl_vn_cache", | |
6466 | - sizeof(struct vnode), 64, | |
6467 | - vn_cache_constructor, | |
6468 | - vn_cache_destructor, | |
6469 | - NULL, NULL, NULL, 0); | |
6470 | + sizeof (struct vnode), 64, vn_cache_constructor, | |
6471 | + vn_cache_destructor, NULL, NULL, NULL, 0); | |
6472 | ||
6473 | vn_file_cache = kmem_cache_create("spl_vn_file_cache", | |
6474 | - sizeof(file_t), 64, | |
6475 | - vn_file_cache_constructor, | |
6476 | - vn_file_cache_destructor, | |
6477 | - NULL, NULL, NULL, 0); | |
6478 | + sizeof (file_t), 64, vn_file_cache_constructor, | |
6479 | + vn_file_cache_destructor, NULL, NULL, NULL, 0); | |
6480 | + | |
6481 | return (0); | |
6482 | } /* vn_init() */ | |
6483 | ||
6484 | void | |
6485 | spl_vn_fini(void) | |
6486 | { | |
6487 | - file_t *fp, *next_fp; | |
6488 | + file_t *fp, *next_fp; | |
6489 | int leaked = 0; | |
6490 | ||
6491 | spin_lock(&vn_file_lock); | |
6492 | ||
6493 | - list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) { | |
6494 | - list_del(&fp->f_list); | |
6495 | + list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) { | |
6496 | + list_del(&fp->f_list); | |
6497 | releasef_locked(fp); | |
6498 | leaked++; | |
6499 | } | |
6500 | @@ -703,6 +703,4 @@ spl_vn_fini(void) | |
6501 | ||
6502 | kmem_cache_destroy(vn_file_cache); | |
6503 | kmem_cache_destroy(vn_cache); | |
6504 | - | |
6505 | - return; | |
6506 | } /* vn_fini() */ | |
6507 | diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c | |
6508 | index 9405dc8..7c166e9 100644 | |
6509 | --- a/module/spl/spl-xdr.c | |
6510 | +++ b/module/spl/spl-xdr.c | |
6511 | @@ -17,7 +17,7 @@ | |
6512 | * | |
6513 | * You should have received a copy of the GNU General Public License along | |
6514 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
6515 | - ***************************************************************************** | |
6516 | + * | |
6517 | * Solaris Porting Layer (SPL) XDR Implementation. | |
6518 | \*****************************************************************************/ | |
6519 | ||
6520 | @@ -163,12 +163,12 @@ xdrmem_control(XDR *xdrs, int req, void *info) | |
6521 | struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info; | |
6522 | ||
6523 | if (req != XDR_GET_BYTES_AVAIL) | |
6524 | - return FALSE; | |
6525 | + return (FALSE); | |
6526 | ||
6527 | rec->xc_is_last_record = TRUE; /* always TRUE in xdrmem streams */ | |
6528 | rec->xc_num_avail = xdrs->x_addr_end - xdrs->x_addr; | |
6529 | ||
6530 | - return TRUE; | |
6531 | + return (TRUE); | |
6532 | } | |
6533 | ||
6534 | static bool_t | |
6535 | @@ -178,13 +178,13 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
6536 | uint_t pad; | |
6537 | ||
6538 | if (size < cnt) | |
6539 | - return FALSE; /* Integer overflow */ | |
6540 | + return (FALSE); /* Integer overflow */ | |
6541 | ||
6542 | if (xdrs->x_addr > xdrs->x_addr_end) | |
6543 | - return FALSE; | |
6544 | + return (FALSE); | |
6545 | ||
6546 | if (xdrs->x_addr_end - xdrs->x_addr < size) | |
6547 | - return FALSE; | |
6548 | + return (FALSE); | |
6549 | ||
6550 | memcpy(xdrs->x_addr, cp, cnt); | |
6551 | ||
6552 | @@ -196,7 +196,7 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
6553 | xdrs->x_addr += pad; | |
6554 | } | |
6555 | ||
6556 | - return TRUE; | |
6557 | + return (TRUE); | |
6558 | } | |
6559 | ||
6560 | static bool_t | |
6561 | @@ -207,13 +207,13 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
6562 | uint_t pad; | |
6563 | ||
6564 | if (size < cnt) | |
6565 | - return FALSE; /* Integer overflow */ | |
6566 | + return (FALSE); /* Integer overflow */ | |
6567 | ||
6568 | if (xdrs->x_addr > xdrs->x_addr_end) | |
6569 | - return FALSE; | |
6570 | + return (FALSE); | |
6571 | ||
6572 | if (xdrs->x_addr_end - xdrs->x_addr < size) | |
6573 | - return FALSE; | |
6574 | + return (FALSE); | |
6575 | ||
6576 | memcpy(cp, xdrs->x_addr, cnt); | |
6577 | xdrs->x_addr += cnt; | |
6578 | @@ -222,38 +222,38 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) | |
6579 | if (pad > 0) { | |
6580 | /* An inverted memchr() would be useful here... */ | |
6581 | if (memcmp(&zero, xdrs->x_addr, pad) != 0) | |
6582 | - return FALSE; | |
6583 | + return (FALSE); | |
6584 | ||
6585 | xdrs->x_addr += pad; | |
6586 | } | |
6587 | ||
6588 | - return TRUE; | |
6589 | + return (TRUE); | |
6590 | } | |
6591 | ||
6592 | static bool_t | |
6593 | xdrmem_enc_uint32(XDR *xdrs, uint32_t val) | |
6594 | { | |
6595 | - if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end) | |
6596 | - return FALSE; | |
6597 | + if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end) | |
6598 | + return (FALSE); | |
6599 | ||
6600 | *((uint32_t *) xdrs->x_addr) = cpu_to_be32(val); | |
6601 | ||
6602 | - xdrs->x_addr += sizeof(uint32_t); | |
6603 | + xdrs->x_addr += sizeof (uint32_t); | |
6604 | ||
6605 | - return TRUE; | |
6606 | + return (TRUE); | |
6607 | } | |
6608 | ||
6609 | static bool_t | |
6610 | xdrmem_dec_uint32(XDR *xdrs, uint32_t *val) | |
6611 | { | |
6612 | - if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end) | |
6613 | - return FALSE; | |
6614 | + if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end) | |
6615 | + return (FALSE); | |
6616 | ||
6617 | *val = be32_to_cpu(*((uint32_t *) xdrs->x_addr)); | |
6618 | ||
6619 | - xdrs->x_addr += sizeof(uint32_t); | |
6620 | + xdrs->x_addr += sizeof (uint32_t); | |
6621 | ||
6622 | - return TRUE; | |
6623 | + return (TRUE); | |
6624 | } | |
6625 | ||
6626 | static bool_t | |
6627 | @@ -261,10 +261,10 @@ xdrmem_enc_char(XDR *xdrs, char *cp) | |
6628 | { | |
6629 | uint32_t val; | |
6630 | ||
6631 | - BUILD_BUG_ON(sizeof(char) != 1); | |
6632 | + BUILD_BUG_ON(sizeof (char) != 1); | |
6633 | val = *((unsigned char *) cp); | |
6634 | ||
6635 | - return xdrmem_enc_uint32(xdrs, val); | |
6636 | + return (xdrmem_enc_uint32(xdrs, val)); | |
6637 | } | |
6638 | ||
6639 | static bool_t | |
6640 | @@ -272,10 +272,10 @@ xdrmem_dec_char(XDR *xdrs, char *cp) | |
6641 | { | |
6642 | uint32_t val; | |
6643 | ||
6644 | - BUILD_BUG_ON(sizeof(char) != 1); | |
6645 | + BUILD_BUG_ON(sizeof (char) != 1); | |
6646 | ||
6647 | if (!xdrmem_dec_uint32(xdrs, &val)) | |
6648 | - return FALSE; | |
6649 | + return (FALSE); | |
6650 | ||
6651 | /* | |
6652 | * If any of the 3 other bytes are non-zero then val will be greater | |
6653 | @@ -283,19 +283,19 @@ xdrmem_dec_char(XDR *xdrs, char *cp) | |
6654 | * not have a char encoded in it. | |
6655 | */ | |
6656 | if (val > 0xff) | |
6657 | - return FALSE; | |
6658 | + return (FALSE); | |
6659 | ||
6660 | *((unsigned char *) cp) = val; | |
6661 | ||
6662 | - return TRUE; | |
6663 | + return (TRUE); | |
6664 | } | |
6665 | ||
6666 | static bool_t | |
6667 | xdrmem_enc_ushort(XDR *xdrs, unsigned short *usp) | |
6668 | { | |
6669 | - BUILD_BUG_ON(sizeof(unsigned short) != 2); | |
6670 | + BUILD_BUG_ON(sizeof (unsigned short) != 2); | |
6671 | ||
6672 | - return xdrmem_enc_uint32(xdrs, *usp); | |
6673 | + return (xdrmem_enc_uint32(xdrs, *usp)); | |
6674 | } | |
6675 | ||
6676 | static bool_t | |
6677 | @@ -303,48 +303,48 @@ xdrmem_dec_ushort(XDR *xdrs, unsigned short *usp) | |
6678 | { | |
6679 | uint32_t val; | |
6680 | ||
6681 | - BUILD_BUG_ON(sizeof(unsigned short) != 2); | |
6682 | + BUILD_BUG_ON(sizeof (unsigned short) != 2); | |
6683 | ||
6684 | if (!xdrmem_dec_uint32(xdrs, &val)) | |
6685 | - return FALSE; | |
6686 | + return (FALSE); | |
6687 | ||
6688 | /* | |
6689 | * Short ints are not in the RFC, but we assume similar logic as in | |
6690 | * xdrmem_dec_char(). | |
6691 | */ | |
6692 | if (val > 0xffff) | |
6693 | - return FALSE; | |
6694 | + return (FALSE); | |
6695 | ||
6696 | *usp = val; | |
6697 | ||
6698 | - return TRUE; | |
6699 | + return (TRUE); | |
6700 | } | |
6701 | ||
6702 | static bool_t | |
6703 | xdrmem_enc_uint(XDR *xdrs, unsigned *up) | |
6704 | { | |
6705 | - BUILD_BUG_ON(sizeof(unsigned) != 4); | |
6706 | + BUILD_BUG_ON(sizeof (unsigned) != 4); | |
6707 | ||
6708 | - return xdrmem_enc_uint32(xdrs, *up); | |
6709 | + return (xdrmem_enc_uint32(xdrs, *up)); | |
6710 | } | |
6711 | ||
6712 | static bool_t | |
6713 | xdrmem_dec_uint(XDR *xdrs, unsigned *up) | |
6714 | { | |
6715 | - BUILD_BUG_ON(sizeof(unsigned) != 4); | |
6716 | + BUILD_BUG_ON(sizeof (unsigned) != 4); | |
6717 | ||
6718 | - return xdrmem_dec_uint32(xdrs, (uint32_t *) up); | |
6719 | + return (xdrmem_dec_uint32(xdrs, (uint32_t *) up)); | |
6720 | } | |
6721 | ||
6722 | static bool_t | |
6723 | xdrmem_enc_ulonglong(XDR *xdrs, u_longlong_t *ullp) | |
6724 | { | |
6725 | - BUILD_BUG_ON(sizeof(u_longlong_t) != 8); | |
6726 | + BUILD_BUG_ON(sizeof (u_longlong_t) != 8); | |
6727 | ||
6728 | if (!xdrmem_enc_uint32(xdrs, *ullp >> 32)) | |
6729 | - return FALSE; | |
6730 | + return (FALSE); | |
6731 | ||
6732 | - return xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff); | |
6733 | + return (xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff)); | |
6734 | } | |
6735 | ||
6736 | static bool_t | |
6737 | @@ -352,16 +352,16 @@ xdrmem_dec_ulonglong(XDR *xdrs, u_longlong_t *ullp) | |
6738 | { | |
6739 | uint32_t low, high; | |
6740 | ||
6741 | - BUILD_BUG_ON(sizeof(u_longlong_t) != 8); | |
6742 | + BUILD_BUG_ON(sizeof (u_longlong_t) != 8); | |
6743 | ||
6744 | if (!xdrmem_dec_uint32(xdrs, &high)) | |
6745 | - return FALSE; | |
6746 | + return (FALSE); | |
6747 | if (!xdrmem_dec_uint32(xdrs, &low)) | |
6748 | - return FALSE; | |
6749 | + return (FALSE); | |
6750 | ||
6751 | *ullp = ((u_longlong_t) high << 32) | low; | |
6752 | ||
6753 | - return TRUE; | |
6754 | + return (TRUE); | |
6755 | } | |
6756 | ||
6757 | static bool_t | |
6758 | @@ -372,18 +372,18 @@ xdr_enc_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, | |
6759 | caddr_t addr = *arrp; | |
6760 | ||
6761 | if (*sizep > maxsize || *sizep > UINT_MAX / elsize) | |
6762 | - return FALSE; | |
6763 | + return (FALSE); | |
6764 | ||
6765 | if (!xdrmem_enc_uint(xdrs, sizep)) | |
6766 | - return FALSE; | |
6767 | + return (FALSE); | |
6768 | ||
6769 | for (i = 0; i < *sizep; i++) { | |
6770 | if (!elproc(xdrs, addr)) | |
6771 | - return FALSE; | |
6772 | + return (FALSE); | |
6773 | addr += elsize; | |
6774 | } | |
6775 | ||
6776 | - return TRUE; | |
6777 | + return (TRUE); | |
6778 | } | |
6779 | ||
6780 | static bool_t | |
6781 | @@ -395,23 +395,23 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, | |
6782 | caddr_t addr; | |
6783 | ||
6784 | if (!xdrmem_dec_uint(xdrs, sizep)) | |
6785 | - return FALSE; | |
6786 | + return (FALSE); | |
6787 | ||
6788 | size = *sizep; | |
6789 | ||
6790 | if (size > maxsize || size > UINT_MAX / elsize) | |
6791 | - return FALSE; | |
6792 | + return (FALSE); | |
6793 | ||
6794 | /* | |
6795 | * The Solaris man page says: "If *arrp is NULL when decoding, | |
6796 | * xdr_array() allocates memory and *arrp points to it". | |
6797 | */ | |
6798 | if (*arrp == NULL) { | |
6799 | - BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t)); | |
6800 | + BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t)); | |
6801 | ||
6802 | *arrp = kmem_alloc(size * elsize, KM_NOSLEEP); | |
6803 | if (*arrp == NULL) | |
6804 | - return FALSE; | |
6805 | + return (FALSE); | |
6806 | ||
6807 | alloc = TRUE; | |
6808 | } | |
6809 | @@ -422,12 +422,12 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, | |
6810 | if (!elproc(xdrs, addr)) { | |
6811 | if (alloc) | |
6812 | kmem_free(*arrp, size * elsize); | |
6813 | - return FALSE; | |
6814 | + return (FALSE); | |
6815 | } | |
6816 | addr += elsize; | |
6817 | } | |
6818 | ||
6819 | - return TRUE; | |
6820 | + return (TRUE); | |
6821 | } | |
6822 | ||
6823 | static bool_t | |
6824 | @@ -437,14 +437,14 @@ xdr_enc_string(XDR *xdrs, char **sp, const uint_t maxsize) | |
6825 | uint_t len; | |
6826 | ||
6827 | if (slen > maxsize) | |
6828 | - return FALSE; | |
6829 | + return (FALSE); | |
6830 | ||
6831 | len = slen; | |
6832 | ||
6833 | if (!xdrmem_enc_uint(xdrs, &len)) | |
6834 | - return FALSE; | |
6835 | + return (FALSE); | |
6836 | ||
6837 | - return xdrmem_enc_bytes(xdrs, *sp, len); | |
6838 | + return (xdrmem_enc_bytes(xdrs, *sp, len)); | |
6839 | } | |
6840 | ||
6841 | static bool_t | |
6842 | @@ -454,21 +454,21 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize) | |
6843 | bool_t alloc = FALSE; | |
6844 | ||
6845 | if (!xdrmem_dec_uint(xdrs, &size)) | |
6846 | - return FALSE; | |
6847 | + return (FALSE); | |
6848 | ||
6849 | if (size > maxsize || size > UINT_MAX - 1) | |
6850 | - return FALSE; | |
6851 | + return (FALSE); | |
6852 | ||
6853 | /* | |
6854 | * Solaris man page: "If *sp is NULL when decoding, xdr_string() | |
6855 | * allocates memory and *sp points to it". | |
6856 | */ | |
6857 | if (*sp == NULL) { | |
6858 | - BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t)); | |
6859 | + BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t)); | |
6860 | ||
6861 | *sp = kmem_alloc(size + 1, KM_NOSLEEP); | |
6862 | if (*sp == NULL) | |
6863 | - return FALSE; | |
6864 | + return (FALSE); | |
6865 | ||
6866 | alloc = TRUE; | |
6867 | } | |
6868 | @@ -481,34 +481,33 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize) | |
6869 | ||
6870 | (*sp)[size] = '\0'; | |
6871 | ||
6872 | - return TRUE; | |
6873 | + return (TRUE); | |
6874 | ||
6875 | fail: | |
6876 | if (alloc) | |
6877 | kmem_free(*sp, size + 1); | |
6878 | ||
6879 | - return FALSE; | |
6880 | + return (FALSE); | |
6881 | } | |
6882 | ||
6883 | static struct xdr_ops xdrmem_encode_ops = { | |
6884 | - .xdr_control = xdrmem_control, | |
6885 | - .xdr_char = xdrmem_enc_char, | |
6886 | - .xdr_u_short = xdrmem_enc_ushort, | |
6887 | - .xdr_u_int = xdrmem_enc_uint, | |
6888 | - .xdr_u_longlong_t = xdrmem_enc_ulonglong, | |
6889 | - .xdr_opaque = xdrmem_enc_bytes, | |
6890 | - .xdr_string = xdr_enc_string, | |
6891 | - .xdr_array = xdr_enc_array | |
6892 | + .xdr_control = xdrmem_control, | |
6893 | + .xdr_char = xdrmem_enc_char, | |
6894 | + .xdr_u_short = xdrmem_enc_ushort, | |
6895 | + .xdr_u_int = xdrmem_enc_uint, | |
6896 | + .xdr_u_longlong_t = xdrmem_enc_ulonglong, | |
6897 | + .xdr_opaque = xdrmem_enc_bytes, | |
6898 | + .xdr_string = xdr_enc_string, | |
6899 | + .xdr_array = xdr_enc_array | |
6900 | }; | |
6901 | ||
6902 | static struct xdr_ops xdrmem_decode_ops = { | |
6903 | - .xdr_control = xdrmem_control, | |
6904 | - .xdr_char = xdrmem_dec_char, | |
6905 | - .xdr_u_short = xdrmem_dec_ushort, | |
6906 | - .xdr_u_int = xdrmem_dec_uint, | |
6907 | - .xdr_u_longlong_t = xdrmem_dec_ulonglong, | |
6908 | - .xdr_opaque = xdrmem_dec_bytes, | |
6909 | - .xdr_string = xdr_dec_string, | |
6910 | - .xdr_array = xdr_dec_array | |
6911 | + .xdr_control = xdrmem_control, | |
6912 | + .xdr_char = xdrmem_dec_char, | |
6913 | + .xdr_u_short = xdrmem_dec_ushort, | |
6914 | + .xdr_u_int = xdrmem_dec_uint, | |
6915 | + .xdr_u_longlong_t = xdrmem_dec_ulonglong, | |
6916 | + .xdr_opaque = xdrmem_dec_bytes, | |
6917 | + .xdr_string = xdr_dec_string, | |
6918 | + .xdr_array = xdr_dec_array | |
6919 | }; | |
6920 | - | |
6921 | diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c | |
6922 | index 77c2a1d..37fedb1 100644 | |
6923 | --- a/module/spl/spl-zlib.c | |
6924 | +++ b/module/spl/spl-zlib.c | |
6925 | @@ -20,7 +20,8 @@ | |
6926 | * | |
6927 | * You should have received a copy of the GNU General Public License along | |
6928 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
6929 | - ***************************************************************************** | |
6930 | + * | |
6931 | + * | |
6932 | * z_compress_level/z_uncompress are nearly identical copies of the | |
6933 | * compress2/uncompress functions provided by the official zlib package | |
6934 | * available at http://zlib.net/. The only changes made we to slightly | |
6935 | @@ -72,7 +73,7 @@ static spl_kmem_cache_t *zlib_workspace_cache; | |
6936 | static void * | |
6937 | zlib_workspace_alloc(int flags) | |
6938 | { | |
6939 | - return kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS)); | |
6940 | + return (kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS))); | |
6941 | } | |
6942 | ||
6943 | static void | |
6944 | @@ -94,7 +95,7 @@ zlib_workspace_free(void *workspace) | |
6945 | */ | |
6946 | int | |
6947 | z_compress_level(void *dest, size_t *destLen, const void *source, | |
6948 | - size_t sourceLen, int level) | |
6949 | + size_t sourceLen, int level) | |
6950 | { | |
6951 | z_stream stream; | |
6952 | int err; | |
6953 | @@ -105,30 +106,30 @@ z_compress_level(void *dest, size_t *destLen, const void *source, | |
6954 | stream.avail_out = (uInt)*destLen; | |
6955 | ||
6956 | if ((size_t)stream.avail_out != *destLen) | |
6957 | - return Z_BUF_ERROR; | |
6958 | + return (Z_BUF_ERROR); | |
6959 | ||
6960 | stream.workspace = zlib_workspace_alloc(KM_SLEEP); | |
6961 | if (!stream.workspace) | |
6962 | - return Z_MEM_ERROR; | |
6963 | + return (Z_MEM_ERROR); | |
6964 | ||
6965 | err = zlib_deflateInit(&stream, level); | |
6966 | if (err != Z_OK) { | |
6967 | zlib_workspace_free(stream.workspace); | |
6968 | - return err; | |
6969 | + return (err); | |
6970 | } | |
6971 | ||
6972 | err = zlib_deflate(&stream, Z_FINISH); | |
6973 | if (err != Z_STREAM_END) { | |
6974 | zlib_deflateEnd(&stream); | |
6975 | zlib_workspace_free(stream.workspace); | |
6976 | - return err == Z_OK ? Z_BUF_ERROR : err; | |
6977 | + return (err == Z_OK ? Z_BUF_ERROR : err); | |
6978 | } | |
6979 | *destLen = stream.total_out; | |
6980 | ||
6981 | err = zlib_deflateEnd(&stream); | |
6982 | zlib_workspace_free(stream.workspace); | |
6983 | ||
6984 | - return err; | |
6985 | + return (err); | |
6986 | } | |
6987 | EXPORT_SYMBOL(z_compress_level); | |
6988 | ||
6989 | @@ -159,16 +160,16 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen) | |
6990 | stream.avail_out = (uInt)*destLen; | |
6991 | ||
6992 | if ((size_t)stream.avail_out != *destLen) | |
6993 | - return Z_BUF_ERROR; | |
6994 | + return (Z_BUF_ERROR); | |
6995 | ||
6996 | stream.workspace = zlib_workspace_alloc(KM_SLEEP); | |
6997 | if (!stream.workspace) | |
6998 | - return Z_MEM_ERROR; | |
6999 | + return (Z_MEM_ERROR); | |
7000 | ||
7001 | err = zlib_inflateInit(&stream); | |
7002 | if (err != Z_OK) { | |
7003 | zlib_workspace_free(stream.workspace); | |
7004 | - return err; | |
7005 | + return (err); | |
7006 | } | |
7007 | ||
7008 | err = zlib_inflate(&stream, Z_FINISH); | |
7009 | @@ -177,17 +178,17 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen) | |
7010 | zlib_workspace_free(stream.workspace); | |
7011 | ||
7012 | if (err == Z_NEED_DICT || | |
7013 | - (err == Z_BUF_ERROR && stream.avail_in == 0)) | |
7014 | - return Z_DATA_ERROR; | |
7015 | + (err == Z_BUF_ERROR && stream.avail_in == 0)) | |
7016 | + return (Z_DATA_ERROR); | |
7017 | ||
7018 | - return err; | |
7019 | + return (err); | |
7020 | } | |
7021 | *destLen = stream.total_out; | |
7022 | ||
7023 | err = zlib_inflateEnd(&stream); | |
7024 | zlib_workspace_free(stream.workspace); | |
7025 | ||
7026 | - return err; | |
7027 | + return (err); | |
7028 | } | |
7029 | EXPORT_SYMBOL(z_uncompress); | |
7030 | ||
7031 | @@ -203,15 +204,15 @@ spl_zlib_init(void) | |
7032 | "spl_zlib_workspace_cache", | |
7033 | size, 0, NULL, NULL, NULL, NULL, NULL, | |
7034 | KMC_VMEM | KMC_NOEMERGENCY); | |
7035 | - if (!zlib_workspace_cache) | |
7036 | + if (!zlib_workspace_cache) | |
7037 | return (1); | |
7038 | ||
7039 | - return (0); | |
7040 | + return (0); | |
7041 | } | |
7042 | ||
7043 | void | |
7044 | spl_zlib_fini(void) | |
7045 | { | |
7046 | kmem_cache_destroy(zlib_workspace_cache); | |
7047 | - zlib_workspace_cache = NULL; | |
7048 | + zlib_workspace_cache = NULL; | |
7049 | } | |
7050 | -- | |
7051 | 2.14.2 | |
7052 |