aboutsummaryrefslogtreecommitdiffstats
path: root/include/os/freebsd/spl/sys
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-01-21 17:07:15 +0100
committerBrian Behlendorf <[email protected]>2022-01-26 11:38:52 -0800
commit7ada752a934f79d87fb9ef998455f26fd07f59a7 (patch)
treefadcb89e9710da5b7ad2d5b6f26c94eb1ca96d50 /include/os/freebsd/spl/sys
parenta3fecf4f1059f4afcead0e7a502ffe8babb1e39c (diff)
Clean up CSTYLEDs
69 CSTYLED BEGINs remain, appx. 30 of which can be removed if cstyle(1) had a useful policy regarding CALL(ARG1, ARG2, ARG3); above 2 lines. As it stands, it spits out *both* sysctl_os.c: 385: continuation line should be indented by 4 spaces sysctl_os.c: 385: indent by spaces instead of tabs which is very cool Another >10 could be fixed by removing "ulong" &al. handling. I don't foresee anyone actually using it intentionally (does it even exist in modern headers? why did it in the first place?). Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12993
Diffstat (limited to 'include/os/freebsd/spl/sys')
-rw-r--r--include/os/freebsd/spl/sys/ccompat.h7
-rw-r--r--include/os/freebsd/spl/sys/ctype.h12
-rw-r--r--include/os/freebsd/spl/sys/debug.h54
-rw-r--r--include/os/freebsd/spl/sys/mod_os.h35
-rw-r--r--include/os/freebsd/spl/sys/rwlock.h6
-rw-r--r--include/os/freebsd/spl/sys/sdt.h2
-rw-r--r--include/os/freebsd/spl/sys/types.h2
7 files changed, 56 insertions, 62 deletions
diff --git a/include/os/freebsd/spl/sys/ccompat.h b/include/os/freebsd/spl/sys/ccompat.h
index 59abe921d..eaee9159e 100644
--- a/include/os/freebsd/spl/sys/ccompat.h
+++ b/include/os/freebsd/spl/sys/ccompat.h
@@ -82,18 +82,17 @@ typedef struct {
volatile int counter;
} atomic_t;
- /* BEGIN CSTYLED */
#define hlist_for_each(p, head) \
for (p = (head)->first; p; p = (p)->next)
#define hlist_entry(ptr, type, field) container_of(ptr, type, field)
#define container_of(ptr, type, member) \
+/* CSTYLED */ \
({ \
- const __typeof(((type *)0)->member) *__p = (ptr); \
- (type *)((uintptr_t)__p - offsetof(type, member)); \
+ const __typeof(((type *)0)->member) *__p = (ptr); \
+ (type *)((uintptr_t)__p - offsetof(type, member)); \
})
- /* END CSTYLED */
static inline void
hlist_add_head(struct hlist_node *n, struct hlist_head *h)
diff --git a/include/os/freebsd/spl/sys/ctype.h b/include/os/freebsd/spl/sys/ctype.h
index f22585807..53afd8b8b 100644
--- a/include/os/freebsd/spl/sys/ctype.h
+++ b/include/os/freebsd/spl/sys/ctype.h
@@ -34,12 +34,10 @@
#define isalnum(ch) (isalpha(ch) || isdigit(ch))
#define iscntrl(C) (uchar(C) <= 0x1f || uchar(C) == 0x7f)
#define isgraph(C) ((C) >= 0x21 && (C) <= 0x7E)
-/* BEGIN CSTYLED */
-#define ispunct(C) \
- (((C) >= 0x21 && (C) <= 0x2F) || \
- ((C) >= 0x3A && (C) <= 0x40) || \
- ((C) >= 0x5B && (C) <= 0x60) || \
- ((C) >= 0x7B && (C) <= 0x7E))
-/* END CSTYLED */
+#define ispunct(C) \
+ (((C) >= 0x21 && (C) <= 0x2F) || \
+ ((C) >= 0x3A && (C) <= 0x40) || \
+ ((C) >= 0x5B && (C) <= 0x60) || \
+ ((C) >= 0x7B && (C) <= 0x7E))
#endif
diff --git a/include/os/freebsd/spl/sys/debug.h b/include/os/freebsd/spl/sys/debug.h
index c3d7a6e83..6b440ed31 100644
--- a/include/os/freebsd/spl/sys/debug.h
+++ b/include/os/freebsd/spl/sys/debug.h
@@ -64,69 +64,68 @@ void spl_dumpstack(void);
#define likely(expr) expect((expr) != 0, 1)
#define unlikely(expr) expect((expr) != 0, 0)
-/* BEGIN CSTYLED */
#define PANIC(fmt, a...) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
-#define VERIFY(cond) \
- (void) (unlikely(!(cond)) && \
+#define VERIFY(cond) \
+ (void) (unlikely(!(cond)) && \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"%s", "VERIFY(" #cond ") failed\n"))
-#define VERIFY3B(LEFT, OP, RIGHT) do { \
+#define VERIFY3B(LEFT, OP, RIGHT) do { \
const boolean_t _verify3_left = (boolean_t)(LEFT); \
- const boolean_t _verify3_right = (boolean_t)(RIGHT);\
+ const boolean_t _verify3_right = (boolean_t)(RIGHT); \
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (%d " #OP " %d)\n", \
- (boolean_t) (_verify3_left), \
- (boolean_t) (_verify3_right)); \
+ "failed (%d " #OP " %d)\n", \
+ (boolean_t)(_verify3_left), \
+ (boolean_t)(_verify3_right)); \
} while (0)
-#define VERIFY3S(LEFT, OP, RIGHT) do { \
+#define VERIFY3S(LEFT, OP, RIGHT) do { \
const int64_t _verify3_left = (int64_t)(LEFT); \
const int64_t _verify3_right = (int64_t)(RIGHT); \
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (%lld " #OP " %lld)\n", \
- (long long) (_verify3_left), \
- (long long) (_verify3_right)); \
+ "failed (%lld " #OP " %lld)\n", \
+ (long long) (_verify3_left), \
+ (long long) (_verify3_right)); \
} while (0)
-#define VERIFY3U(LEFT, OP, RIGHT) do { \
+#define VERIFY3U(LEFT, OP, RIGHT) do { \
const uint64_t _verify3_left = (uint64_t)(LEFT); \
const uint64_t _verify3_right = (uint64_t)(RIGHT); \
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (%llu " #OP " %llu)\n", \
- (unsigned long long) (_verify3_left), \
- (unsigned long long) (_verify3_right)); \
+ "failed (%llu " #OP " %llu)\n", \
+ (unsigned long long) (_verify3_left), \
+ (unsigned long long) (_verify3_right)); \
} while (0)
-#define VERIFY3P(LEFT, OP, RIGHT) do { \
+#define VERIFY3P(LEFT, OP, RIGHT) do { \
const uintptr_t _verify3_left = (uintptr_t)(LEFT); \
- const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\
+ const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (%px " #OP " %px)\n", \
- (void *) (_verify3_left), \
- (void *) (_verify3_right)); \
+ "failed (%px " #OP " %px)\n", \
+ (void *) (_verify3_left), \
+ (void *) (_verify3_right)); \
} while (0)
-#define VERIFY0(RIGHT) do { \
- const int64_t _verify3_left = (int64_t)(0); \
+#define VERIFY0(RIGHT) do { \
+ const int64_t _verify3_left = (int64_t)(0); \
const int64_t _verify3_right = (int64_t)(RIGHT); \
if (unlikely(!(_verify3_left == _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3(0 == " #RIGHT ") " \
- "failed (0 == %lld)\n", \
- (long long) (_verify3_right)); \
+ "VERIFY3(0 == " #RIGHT ") " \
+ "failed (0 == %lld)\n", \
+ (long long) (_verify3_right)); \
} while (0)
-#define CTASSERT_GLOBAL(x) CTASSERT(x)
+#define CTASSERT_GLOBAL(x) CTASSERT(x)
/*
* Debugging disabled (--disable-debug)
@@ -167,7 +166,6 @@ void spl_dumpstack(void);
((void)(likely(!!(A) == !!(B)) || \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"(" #A ") is equivalent to (" #B ")")))
-/* END CSTYLED */
#endif /* NDEBUG */
diff --git a/include/os/freebsd/spl/sys/mod_os.h b/include/os/freebsd/spl/sys/mod_os.h
index 5695abee7..293bd7d2b 100644
--- a/include/os/freebsd/spl/sys/mod_os.h
+++ b/include/os/freebsd/spl/sys/mod_os.h
@@ -43,10 +43,10 @@
#define ZMOD_RW CTLFLAG_RWTUN
#define ZMOD_RD CTLFLAG_RDTUN
-/* BEGIN CSTYLED */
#define ZFS_MODULE_PARAM(scope_prefix, name_prefix, name, type, perm, desc) \
SYSCTL_DECL(_vfs_ ## scope_prefix); \
- SYSCTL_##type(_vfs_ ## scope_prefix, OID_AUTO, name, perm, &name_prefix ## name, 0, desc)
+ SYSCTL_##type(_vfs_ ## scope_prefix, OID_AUTO, name, perm, \
+ &name_prefix ## name, 0, desc)
#define ZFS_MODULE_PARAM_ARGS SYSCTL_HANDLER_ARGS
@@ -54,8 +54,10 @@
SYSCTL_DECL(parent); \
SYSCTL_PROC(parent, OID_AUTO, name, perm | args, desc)
-#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, func, _, perm, desc) \
- ZFS_MODULE_PARAM_CALL_IMPL(_vfs_ ## scope_prefix, name, perm, func ## _args(name_prefix ## name), desc)
+#define ZFS_MODULE_PARAM_CALL( \
+ scope_prefix, name_prefix, name, func, _, perm, desc) \
+ ZFS_MODULE_PARAM_CALL_IMPL(_vfs_ ## scope_prefix, name, perm, \
+ func ## _args(name_prefix ## name), desc)
#define ZFS_MODULE_VIRTUAL_PARAM_CALL ZFS_MODULE_PARAM_CALL
@@ -96,29 +98,28 @@
CTLTYPE_STRING, NULL, 0, fletcher_4_param, "A"
#include <sys/kernel.h>
-#define module_init(fn) \
+#define module_init(fn) \
static void \
wrap_ ## fn(void *dummy __unused) \
-{ \
- fn(); \
-} \
+{ \
+ fn(); \
+} \
SYSINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL)
-#define module_init_early(fn) \
+#define module_init_early(fn) \
static void \
wrap_ ## fn(void *dummy __unused) \
-{ \
- fn(); \
-} \
+{ \
+ fn(); \
+} \
SYSINIT(zfs_ ## fn, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_FIRST, wrap_ ## fn, NULL)
-#define module_exit(fn) \
+#define module_exit(fn) \
static void \
wrap_ ## fn(void *dummy __unused) \
-{ \
- fn(); \
-} \
+{ \
+ fn(); \
+} \
SYSUNINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL)
-/* END CSTYLED */
#endif /* SPL_MOD_H */
diff --git a/include/os/freebsd/spl/sys/rwlock.h b/include/os/freebsd/spl/sys/rwlock.h
index 10107a9be..ca87f2fa5 100644
--- a/include/os/freebsd/spl/sys/rwlock.h
+++ b/include/os/freebsd/spl/sys/rwlock.h
@@ -57,13 +57,12 @@ typedef struct sx krwlock_t;
#define RW_WRITE_HELD(x) (rw_write_held((x)))
#define RW_LOCK_HELD(x) (rw_lock_held((x)))
#define RW_ISWRITER(x) (rw_iswriter(x))
-/* BEGIN CSTYLED */
#define rw_init(lock, desc, type, arg) do { \
const char *_name; \
ASSERT((type) == 0 || (type) == RW_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
- bzero((lock), sizeof(struct sx)); \
+ bzero((lock), sizeof (struct sx)); \
for (_name = #lock; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
@@ -87,11 +86,10 @@ typedef struct sx krwlock_t;
#define rw_tryupgrade(lock) sx_try_upgrade(lock)
#define rw_read_held(lock) \
((lock)->sx_lock != SX_LOCK_UNLOCKED && \
- ((lock)->sx_lock & SX_LOCK_SHARED))
+ ((lock)->sx_lock & SX_LOCK_SHARED))
#define rw_write_held(lock) sx_xlocked(lock)
#define rw_lock_held(lock) (rw_read_held(lock) || rw_write_held(lock))
#define rw_iswriter(lock) sx_xlocked(lock)
#define rw_owner(lock) sx_xholder(lock)
-/* END CSTYLED */
#endif /* _OPENSOLARIS_SYS_RWLOCK_H_ */
diff --git a/include/os/freebsd/spl/sys/sdt.h b/include/os/freebsd/spl/sys/sdt.h
index 496fc58d7..2daa6de1a 100644
--- a/include/os/freebsd/spl/sys/sdt.h
+++ b/include/os/freebsd/spl/sys/sdt.h
@@ -30,8 +30,8 @@
#define _OPENSOLARIS_SYS_SDT_H_
#include_next <sys/sdt.h>
-/* BEGIN CSTYLED */
#ifdef KDTRACE_HOOKS
+/* CSTYLED */
SDT_PROBE_DECLARE(sdt, , , set__error);
#define SET_ERROR(err) \
diff --git a/include/os/freebsd/spl/sys/types.h b/include/os/freebsd/spl/sys/types.h
index ecb91fd1b..b2897978c 100644
--- a/include/os/freebsd/spl/sys/types.h
+++ b/include/os/freebsd/spl/sys/types.h
@@ -64,8 +64,8 @@ typedef u_int uint_t;
typedef u_char uchar_t;
typedef u_short ushort_t;
typedef u_long ulong_t;
-typedef int minor_t;
/* END CSTYLED */
+typedef int minor_t;
#ifndef _OFF64_T_DECLARED
#define _OFF64_T_DECLARED
typedef off_t off64_t;