From d1d7e2689db9e03f11c069ebc9f1ba12829e5dac Mon Sep 17 00:00:00 2001 From: Michael Kjorling Date: Fri, 1 Nov 2013 20:26:11 +0100 Subject: cstyle: Resolve C style issues The vast majority of these changes are in Linux specific code. They are the result of not having an automated style checker to validate the code when it was originally written. Others were caused when the common code was slightly adjusted for Linux. This patch contains no functional changes. It only refreshes the code to conform to style guide. Everyone submitting patches for inclusion upstream should now run 'make checkstyle' and resolve any warning prior to opening a pull request. The automated builders have been updated to fail a build if when 'make checkstyle' detects an issue. Signed-off-by: Brian Behlendorf Closes #1821 --- lib/libspl/include/sys/bitmap.h | 2 +- lib/libspl/include/sys/callb.h | 2 +- lib/libspl/include/sys/cmn_err.h | 2 +- lib/libspl/include/sys/compress.h | 2 +- lib/libspl/include/sys/cred.h | 2 +- lib/libspl/include/sys/debug.h | 2 +- lib/libspl/include/sys/feature_tests.h | 4 +-- lib/libspl/include/sys/file.h | 28 +++++++-------- lib/libspl/include/sys/frame.h | 2 +- lib/libspl/include/sys/int_limits.h | 2 +- lib/libspl/include/sys/int_types.h | 2 +- lib/libspl/include/sys/inttypes.h | 4 +-- lib/libspl/include/sys/isa_defs.h | 44 +++++++++++------------ lib/libspl/include/sys/kmem.h | 4 +-- lib/libspl/include/sys/mkdev.h | 2 +- lib/libspl/include/sys/mnttab.h | 10 +++--- lib/libspl/include/sys/mount.h | 16 ++++----- lib/libspl/include/sys/param.h | 24 ++++++------- lib/libspl/include/sys/priv.h | 2 +- lib/libspl/include/sys/processor.h | 4 +-- lib/libspl/include/sys/sdt.h | 12 +++---- lib/libspl/include/sys/stack.h | 20 ++++++----- lib/libspl/include/sys/stat.h | 8 ++--- lib/libspl/include/sys/stropts.h | 2 +- lib/libspl/include/sys/sysevent.h | 2 +- lib/libspl/include/sys/sysmacros.h | 66 +++++++++++++++++----------------- lib/libspl/include/sys/systeminfo.h | 8 ++--- lib/libspl/include/sys/systm.h | 2 +- lib/libspl/include/sys/time.h | 16 ++++----- lib/libspl/include/sys/types.h | 8 ++--- lib/libspl/include/sys/uio.h | 14 ++++---- lib/libspl/include/sys/utsname.h | 2 +- lib/libspl/include/sys/va_list.h | 2 +- lib/libspl/include/sys/varargs.h | 2 +- lib/libspl/include/sys/vnode.h | 2 +- lib/libspl/include/sys/zone.h | 2 +- 36 files changed, 165 insertions(+), 163 deletions(-) (limited to 'lib/libspl/include/sys') diff --git a/lib/libspl/include/sys/bitmap.h b/lib/libspl/include/sys/bitmap.h index 8fef7fcfe..95122ab8b 100644 --- a/lib/libspl/include/sys/bitmap.h +++ b/lib/libspl/include/sys/bitmap.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_BITMAP_H -#define _LIBSPL_SYS_BITMAP_H +#define _LIBSPL_SYS_BITMAP_H #endif diff --git a/lib/libspl/include/sys/callb.h b/lib/libspl/include/sys/callb.h index 29a6a6777..8ffd18788 100644 --- a/lib/libspl/include/sys/callb.h +++ b/lib/libspl/include/sys/callb.h @@ -25,6 +25,6 @@ */ #ifndef _SYS_CALLB_H -#define _SYS_CALLB_H +#define _SYS_CALLB_H #endif diff --git a/lib/libspl/include/sys/cmn_err.h b/lib/libspl/include/sys/cmn_err.h index d199361d7..63ff4eb29 100644 --- a/lib/libspl/include/sys/cmn_err.h +++ b/lib/libspl/include/sys/cmn_err.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_CMN_ERR_H -#define _LIBSPL_SYS_CMN_ERR_H +#define _LIBSPL_SYS_CMN_ERR_H #endif diff --git a/lib/libspl/include/sys/compress.h b/lib/libspl/include/sys/compress.h index 6e03e73a3..282f178ba 100644 --- a/lib/libspl/include/sys/compress.h +++ b/lib/libspl/include/sys/compress.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_COMPRESS_H -#define _LIBSPL_SYS_COMPRESS_H +#define _LIBSPL_SYS_COMPRESS_H #endif /* _LIBSPL_SYS_COMPRESS_H */ diff --git a/lib/libspl/include/sys/cred.h b/lib/libspl/include/sys/cred.h index 6a58315d4..463b3abfc 100644 --- a/lib/libspl/include/sys/cred.h +++ b/lib/libspl/include/sys/cred.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_SYS_CRED_H -#define _LIBSPL_SYS_CRED_H +#define _LIBSPL_SYS_CRED_H typedef struct cred cred_t; diff --git a/lib/libspl/include/sys/debug.h b/lib/libspl/include/sys/debug.h index 006962055..fde4a0120 100644 --- a/lib/libspl/include/sys/debug.h +++ b/lib/libspl/include/sys/debug.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_SYS_DEBUG_H -#define _LIBSPL_SYS_DEBUG_H +#define _LIBSPL_SYS_DEBUG_H #include diff --git a/lib/libspl/include/sys/feature_tests.h b/lib/libspl/include/sys/feature_tests.h index 96f627172..1a68b75f0 100644 --- a/lib/libspl/include/sys/feature_tests.h +++ b/lib/libspl/include/sys/feature_tests.h @@ -25,8 +25,8 @@ */ #ifndef _SYS_FEATURE_TESTS_H -#define _SYS_FEATURE_TESTS_H +#define _SYS_FEATURE_TESTS_H -#define __NORETURN __attribute__((__noreturn__)) +#define __NORETURN __attribute__((__noreturn__)) #endif diff --git a/lib/libspl/include/sys/file.h b/lib/libspl/include/sys/file.h index 9aaba35be..163a4dca6 100644 --- a/lib/libspl/include/sys/file.h +++ b/lib/libspl/include/sys/file.h @@ -25,26 +25,26 @@ */ #ifndef _LIBSPL_SYS_FILE_H -#define _LIBSPL_SYS_FILE_H +#define _LIBSPL_SYS_FILE_H #include_next #include -#define FREAD 1 -#define FWRITE 2 -//#define FAPPEND 8 +#define FREAD 1 +#define FWRITE 2 +// #define FAPPEND 8 -#define FCREAT O_CREAT -#define FTRUNC O_TRUNC -#define FOFFMAX O_LARGEFILE -#define FSYNC O_SYNC -#define FDSYNC O_DSYNC -#define FRSYNC O_RSYNC -#define FEXCL O_EXCL +#define FCREAT O_CREAT +#define FTRUNC O_TRUNC +#define FOFFMAX O_LARGEFILE +#define FSYNC O_SYNC +#define FDSYNC O_DSYNC +#define FRSYNC O_RSYNC +#define FEXCL O_EXCL -#define FNODSYNC 0x10000 /* fsync pseudo flag */ -#define FNOFOLLOW 0x20000 /* don't follow symlinks */ -#define FIGNORECASE 0x80000 /* request case-insensitive lookups */ +#define FNODSYNC 0x10000 /* fsync pseudo flag */ +#define FNOFOLLOW 0x20000 /* don't follow symlinks */ +#define FIGNORECASE 0x80000 /* request case-insensitive lookups */ #endif diff --git a/lib/libspl/include/sys/frame.h b/lib/libspl/include/sys/frame.h index f936ab825..a4c7d8bb5 100644 --- a/lib/libspl/include/sys/frame.h +++ b/lib/libspl/include/sys/frame.h @@ -25,7 +25,7 @@ */ #ifndef _SYS_FRAME_H -#define _SYS_FRAME_H +#define _SYS_FRAME_H #include diff --git a/lib/libspl/include/sys/int_limits.h b/lib/libspl/include/sys/int_limits.h index 2b50ddd1b..7af68cdb2 100644 --- a/lib/libspl/include/sys/int_limits.h +++ b/lib/libspl/include/sys/int_limits.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_INT_LIMITS_H -#define _LIBSPL_SYS_INT_LIMITS_H +#define _LIBSPL_SYS_INT_LIMITS_H #endif diff --git a/lib/libspl/include/sys/int_types.h b/lib/libspl/include/sys/int_types.h index b32512282..51e9e0285 100644 --- a/lib/libspl/include/sys/int_types.h +++ b/lib/libspl/include/sys/int_types.h @@ -25,7 +25,7 @@ */ #ifndef _SOL_SYS_INT_TYPES_H -#define _SOL_SYS_INT_TYPES_H +#define _SOL_SYS_INT_TYPES_H #include diff --git a/lib/libspl/include/sys/inttypes.h b/lib/libspl/include/sys/inttypes.h index 7630f2d4c..d7d063985 100644 --- a/lib/libspl/include/sys/inttypes.h +++ b/lib/libspl/include/sys/inttypes.h @@ -25,10 +25,10 @@ */ #ifndef _SOL_SYS_INTTYPES_H -#define _SOL_SYS_INTTYPES_H +#define _SOL_SYS_INTTYPES_H #include -#define _INT64_TYPE +#define _INT64_TYPE #endif diff --git a/lib/libspl/include/sys/isa_defs.h b/lib/libspl/include/sys/isa_defs.h index 4ab07eb2b..7c5df7737 100644 --- a/lib/libspl/include/sys/isa_defs.h +++ b/lib/libspl/include/sys/isa_defs.h @@ -35,91 +35,91 @@ extern "C" { #if defined(__x86_64) || defined(__x86_64__) #if !defined(__x86_64) -#define __x86_64 +#define __x86_64 #endif #if !defined(__amd64) -#define __amd64 +#define __amd64 #endif #if !defined(__x86) -#define __x86 +#define __x86 #endif #if !defined(_LP64) -#define _LP64 +#define _LP64 #endif #if !defined(_LITTLE_ENDIAN) -#define _LITTLE_ENDIAN +#define _LITTLE_ENDIAN #endif -#define _SUNOS_VTOC_16 +#define _SUNOS_VTOC_16 /* i386 arch specific defines */ #elif defined(__i386) || defined(__i386__) #if !defined(__i386) -#define __i386 +#define __i386 #endif #if !defined(__x86) -#define __x86 +#define __x86 #endif #if !defined(_ILP32) -#define _ILP32 +#define _ILP32 #endif #if !defined(_LITTLE_ENDIAN) -#define _LITTLE_ENDIAN +#define _LITTLE_ENDIAN #endif -#define _SUNOS_VTOC_16 +#define _SUNOS_VTOC_16 /* powerpc arch specific defines */ #elif defined(__powerpc) || defined(__powerpc__) #if !defined(__powerpc) -#define __powerpc +#define __powerpc #endif #if !defined(__powerpc__) -#define __powerpc__ +#define __powerpc__ #endif #if !defined(_LP64) #ifdef __powerpc64__ -#define _LP64 +#define _LP64 #else -#define _LP32 +#define _LP32 #endif #endif #if !defined(_BIG_ENDIAN) -#define _BIG_ENDIAN +#define _BIG_ENDIAN #endif -#define _SUNOS_VTOC_16 +#define _SUNOS_VTOC_16 /* arm arch specific defines */ #elif defined(__arm) || defined(__arm__) #if !defined(__arm) -#define __arm +#define __arm #endif #if !defined(__arm__) -#define __arm__ +#define __arm__ #endif #if defined(__ARMEL__) -#define _LITTLE_ENDIAN +#define _LITTLE_ENDIAN #else -#define _BIG_ENDIAN +#define _BIG_ENDIAN #endif -#define _SUNOS_VTOC_16 +#define _SUNOS_VTOC_16 #else /* Currently only x86_64, i386, arm, and powerpc arches supported */ #error "Unsupported ISA type" diff --git a/lib/libspl/include/sys/kmem.h b/lib/libspl/include/sys/kmem.h index 401e04072..83d47565a 100644 --- a/lib/libspl/include/sys/kmem.h +++ b/lib/libspl/include/sys/kmem.h @@ -35,8 +35,8 @@ extern "C" { #define KM_SLEEP 0x00000000 /* same as KM_SLEEP */ #define KM_NOSLEEP 0x00000001 /* same as KM_NOSLEEP */ -#define kmem_alloc(size, flags) malloc(size) -#define kmem_free(ptr, size) free(ptr) +#define kmem_alloc(size, flags) malloc(size) +#define kmem_free(ptr, size) free(ptr) #ifdef __cplusplus } diff --git a/lib/libspl/include/sys/mkdev.h b/lib/libspl/include/sys/mkdev.h index 76e3a4fff..5978de65d 100644 --- a/lib/libspl/include/sys/mkdev.h +++ b/lib/libspl/include/sys/mkdev.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_MKDEV_H -#define _LIBSPL_SYS_MKDEV_H +#define _LIBSPL_SYS_MKDEV_H #endif diff --git a/lib/libspl/include/sys/mnttab.h b/lib/libspl/include/sys/mnttab.h index a30549a72..6bfbdd69c 100644 --- a/lib/libspl/include/sys/mnttab.h +++ b/lib/libspl/include/sys/mnttab.h @@ -19,7 +19,7 @@ * * CDDL HEADER END */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T*/ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. @@ -28,7 +28,7 @@ /* Copyright 2006 Ricardo Correia */ #ifndef _SYS_MNTTAB_H -#define _SYS_MNTTAB_H +#define _SYS_MNTTAB_H #include #include @@ -77,10 +77,10 @@ static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt) mnt_new.mnt_opts = mnt->mnt_mntopts; - return hasmntopt(&mnt_new, opt); + return (hasmntopt(&mnt_new, opt)); } -#define hasmntopt _sol_hasmntopt -#define getmntent _sol_getmntent +#define hasmntopt _sol_hasmntopt +#define getmntent _sol_getmntent #endif diff --git a/lib/libspl/include/sys/mount.h b/lib/libspl/include/sys/mount.h index 0fa4f2554..41cd839b7 100644 --- a/lib/libspl/include/sys/mount.h +++ b/lib/libspl/include/sys/mount.h @@ -27,7 +27,7 @@ #include_next #ifndef _LIBSPL_SYS_MOUNT_H -#define _LIBSPL_SYS_MOUNT_H +#define _LIBSPL_SYS_MOUNT_H #include #include @@ -39,7 +39,7 @@ * and we don't want to require the kernel headers */ #if !defined(BLKGETSIZE64) -#define BLKGETSIZE64 _IOR(0x12, 114, size_t) +#define BLKGETSIZE64 _IOR(0x12, 114, size_t) #endif /* @@ -48,7 +48,7 @@ * headers define MS_DIRSYNC to be S_WRITE. */ #if !defined(MS_DIRSYNC) -#define MS_DIRSYNC S_WRITE +#define MS_DIRSYNC S_WRITE #endif /* @@ -71,15 +71,15 @@ * kernel back to 2.4.11 so we define them correctly if they are missing. */ #ifdef MNT_FORCE -# define MS_FORCE MNT_FORCE +#define MS_FORCE MNT_FORCE #else -# define MS_FORCE 0x00000001 +#define MS_FORCE 0x00000001 #endif /* MNT_FORCE */ #ifdef MNT_DETACH -# define MS_DETACH MNT_DETACH +#define MS_DETACH MNT_DETACH #else -# define MS_DETACH 0x00000002 +#define MS_DETACH 0x00000002 #endif /* MNT_DETACH */ /* @@ -87,6 +87,6 @@ * compatibility, MS_OVERLAY is defined to explicitly have the user * provide a flag (-O) to mount over a non empty directory. */ -#define MS_OVERLAY 0x00000004 +#define MS_OVERLAY 0x00000004 #endif /* _LIBSPL_SYS_MOUNT_H */ diff --git a/lib/libspl/include/sys/param.h b/lib/libspl/include/sys/param.h index 75cf0b757..4090cefe8 100644 --- a/lib/libspl/include/sys/param.h +++ b/lib/libspl/include/sys/param.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_SYS_PARAM_H -#define _LIBSPL_SYS_PARAM_H +#define _LIBSPL_SYS_PARAM_H #include_next #include @@ -43,20 +43,20 @@ * Note that the blocked devices are assumed to have DEV_BSIZE * "sectors" and that fragments must be some multiple of this size. */ -#define MAXBSIZE 8192 -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define MAXBSIZE 8192 +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define MAXNAMELEN 256 -#define MAXOFFSET_T LLONG_MAX +#define MAXNAMELEN 256 +#define MAXOFFSET_T LLONG_MAX -#define UID_NOBODY 60001 /* user ID no body */ -#define GID_NOBODY UID_NOBODY -#define UID_NOACCESS 60002 /* user ID no access */ +#define UID_NOBODY 60001 /* user ID no body */ +#define GID_NOBODY UID_NOBODY +#define UID_NOACCESS 60002 /* user ID no access */ -#define MAXUID UINT32_MAX /* max user id */ -#define MAXPROJID MAXUID /* max project id */ +#define MAXUID UINT32_MAX /* max user id */ +#define MAXPROJID MAXUID /* max project id */ -#define PAGESIZE (sysconf(_SC_PAGESIZE)) +#define PAGESIZE (sysconf(_SC_PAGESIZE)) #endif diff --git a/lib/libspl/include/sys/priv.h b/lib/libspl/include/sys/priv.h index 4a3ab9684..76c76d183 100644 --- a/lib/libspl/include/sys/priv.h +++ b/lib/libspl/include/sys/priv.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_PRIV_H -#define _LIBSPL_SYS_PRIV_H +#define _LIBSPL_SYS_PRIV_H #endif diff --git a/lib/libspl/include/sys/processor.h b/lib/libspl/include/sys/processor.h index 0af9dc06b..78e95d01f 100644 --- a/lib/libspl/include/sys/processor.h +++ b/lib/libspl/include/sys/processor.h @@ -25,9 +25,9 @@ */ #ifndef _LIBSPL_SYS_PROCESSOR_H -#define _LIBSPL_SYS_PROCESSOR_H +#define _LIBSPL_SYS_PROCESSOR_H -#define getcpuid() (-1) +#define getcpuid() (-1) typedef int processorid_t; diff --git a/lib/libspl/include/sys/sdt.h b/lib/libspl/include/sys/sdt.h index 79733eef0..f68f79040 100644 --- a/lib/libspl/include/sys/sdt.h +++ b/lib/libspl/include/sys/sdt.h @@ -25,12 +25,12 @@ */ #ifndef _LIBSPL_SYS_SDT_H -#define _LIBSPL_SYS_SDT_H +#define _LIBSPL_SYS_SDT_H -#define DTRACE_PROBE(a) ((void) 0) -#define DTRACE_PROBE1(a,b,c) ((void) 0) -#define DTRACE_PROBE2(a,b,c,d,e) ((void) 0) -#define DTRACE_PROBE3(a,b,c,d,e,f,g) ((void) 0) -#define DTRACE_PROBE4(a,b,c,d,e,f,g,h,i) ((void) 0) +#define DTRACE_PROBE(a) ((void) 0) +#define DTRACE_PROBE1(a, b, c) ((void) 0) +#define DTRACE_PROBE2(a, b, c, d, e) ((void) 0) +#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void) 0) +#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void) 0) #endif diff --git a/lib/libspl/include/sys/stack.h b/lib/libspl/include/sys/stack.h index 41f0beb16..59807e97b 100644 --- a/lib/libspl/include/sys/stack.h +++ b/lib/libspl/include/sys/stack.h @@ -23,11 +23,11 @@ * Portions Copyright 2008 Sun Microsystems, Inc. All Rights reserved. */ #ifndef _SYS_STACK_H -#define _SYS_STACK_H +#define _SYS_STACK_H #include -#define STACK_BIAS 0 +#define STACK_BIAS 0 #ifdef __USE_GNU @@ -39,7 +39,7 @@ stack_getbounds(stack_t *sp) rc = pthread_getattr_np(pthread_self(), &attr); if (rc) - return rc; + return (rc); rc = pthread_attr_getstack(&attr, &sp->ss_sp, &sp->ss_size); if (rc == 0) @@ -47,7 +47,7 @@ stack_getbounds(stack_t *sp) pthread_attr_destroy(&attr); - return rc; + return (rc); } static inline int @@ -57,15 +57,17 @@ thr_stksegment(stack_t *sp) rc = stack_getbounds(sp); if (rc) - return rc; + return (rc); - /* thr_stksegment() is expected to set sp.ss_sp to the high stack - * address, but the stack_getbounds() interface is expected to - * set sp.ss_sp to the low address. Adjust accordingly. */ + /* + * thr_stksegment() is expected to set sp.ss_sp to the high stack + * address, but the stack_getbounds() interface is expected to + * set sp.ss_sp to the low address. Adjust accordingly. + */ sp->ss_sp = (void *)(((uintptr_t)sp->ss_sp) + sp->ss_size); sp->ss_flags = 0; - return rc; + return (rc); } #endif /* __USE_GNU */ diff --git a/lib/libspl/include/sys/stat.h b/lib/libspl/include/sys/stat.h index b9ad152bc..3e8d27e4c 100644 --- a/lib/libspl/include/sys/stat.h +++ b/lib/libspl/include/sys/stat.h @@ -24,7 +24,7 @@ */ #ifndef _LIBSPL_SYS_STAT_H -#define _LIBSPL_SYS_STAT_H +#define _LIBSPL_SYS_STAT_H #include_next @@ -37,14 +37,14 @@ static inline int fstat64_blk(int fd, struct stat64 *st) { if (fstat64(fd, st) == -1) - return -1; + return (-1); /* In Linux we need to use an ioctl to get the size of a block device */ if (S_ISBLK(st->st_mode)) { if (ioctl(fd, BLKGETSIZE64, &st->st_size) != 0) - return -1; + return (-1); } - return 0; + return (0); } #endif /* _LIBSPL_SYS_STAT_H */ diff --git a/lib/libspl/include/sys/stropts.h b/lib/libspl/include/sys/stropts.h index e036b0ea2..08c2e79bc 100644 --- a/lib/libspl/include/sys/stropts.h +++ b/lib/libspl/include/sys/stropts.h @@ -24,6 +24,6 @@ */ #ifndef _LIBSPL_SYS_STROPTS_H -#define _LIBSPL_SYS_STROPTS_H +#define _LIBSPL_SYS_STROPTS_H #endif /* _LIBSPL_SYS_STROPTS_H */ diff --git a/lib/libspl/include/sys/sysevent.h b/lib/libspl/include/sys/sysevent.h index 980d14541..074d8419c 100644 --- a/lib/libspl/include/sys/sysevent.h +++ b/lib/libspl/include/sys/sysevent.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_SYSEVENT_H -#define _LIBSPL_SYS_SYSEVENT_H +#define _LIBSPL_SYS_SYSEVENT_H #endif diff --git a/lib/libspl/include/sys/sysmacros.h b/lib/libspl/include/sys/sysmacros.h index 07ab8c934..698b0a7a3 100644 --- a/lib/libspl/include/sys/sysmacros.h +++ b/lib/libspl/include/sys/sysmacros.h @@ -25,41 +25,41 @@ */ #ifndef _LIBSPL_SYS_SYSMACROS_H -#define _LIBSPL_SYS_SYSMACROS_H +#define _LIBSPL_SYS_SYSMACROS_H #include_next /* common macros */ #ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAX -#define MAX(a, b) ((a) < (b) ? (b) : (a)) +#define MAX(a, b) ((a) < (b) ? (b) : (a)) #endif #ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) +#define ABS(a) ((a) < 0 ? -(a) : (a)) #endif -#define makedevice(maj,min) makedev(maj,min) -#define _sysconf(a) sysconf(a) -#define __NORETURN __attribute__ ((noreturn)) +#define makedevice(maj, min) makedev(maj, min) +#define _sysconf(a) sysconf(a) +#define __NORETURN __attribute__((noreturn)) /* * Compatibility macros/typedefs needed for Solaris -> Linux port */ -#define P2ALIGN(x, align) ((x) & -(align)) -#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) -#define P2ROUNDUP_TYPED(x, align, type) \ +#define P2ALIGN(x, align) ((x) & -(align)) +#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) +#define P2ROUNDUP_TYPED(x, align, type) \ (-(-(type)(x) & -(type)(align))) -#define P2BOUNDARY(off, len, align) \ +#define P2BOUNDARY(off, len, align) \ (((off) ^ ((off) + (len) - 1)) > (align) - 1) -#define P2PHASE(x, align) ((x) & ((align) - 1)) -#define P2NPHASE(x, align) (-(x) & ((align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define P2NPHASE(x, align) (-(x) & ((align) - 1)) +#define P2NPHASE_TYPED(x, align, type) \ (-(type)(x) & ((type)(align) - 1)) -#define ISP2(x) (((x) & ((x) - 1)) == 0) -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) +#define ISP2(x) (((x) & ((x) - 1)) == 0) +#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) /* * Typed version of the P2* macros. These macros should be used to ensure @@ -72,22 +72,22 @@ * or * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t) */ -#define P2ALIGN_TYPED(x, align, type) \ - ((type)(x) & -(type)(align)) -#define P2PHASE_TYPED(x, align, type) \ - ((type)(x) & ((type)(align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ - (-(type)(x) & ((type)(align) - 1)) -#define P2ROUNDUP_TYPED(x, align, type) \ - (-(-(type)(x) & -(type)(align))) -#define P2END_TYPED(x, align, type) \ - (-(~(type)(x) & -(type)(align))) -#define P2PHASEUP_TYPED(x, align, phase, type) \ - ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) -#define P2CROSS_TYPED(x, y, align, type) \ - (((type)(x) ^ (type)(y)) > (type)(align) - 1) -#define P2SAMEHIGHBIT_TYPED(x, y, type) \ - (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) +#define P2ALIGN_TYPED(x, align, type) \ + ((type)(x) & -(type)(align)) +#define P2PHASE_TYPED(x, align, type) \ + ((type)(x) & ((type)(align) - 1)) +#define P2NPHASE_TYPED(x, align, type) \ + (-(type)(x) & ((type)(align) - 1)) +#define P2ROUNDUP_TYPED(x, align, type) \ + (-(-(type)(x) & -(type)(align))) +#define P2END_TYPED(x, align, type) \ + (-(~(type)(x) & -(type)(align))) +#define P2PHASEUP_TYPED(x, align, phase, type) \ + ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) +#define P2CROSS_TYPED(x, y, align, type) \ + (((type)(x) ^ (type)(y)) > (type)(align) - 1) +#define P2SAMEHIGHBIT_TYPED(x, y, type) \ + (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) /* avoid any possibility of clashing with version */ diff --git a/lib/libspl/include/sys/systeminfo.h b/lib/libspl/include/sys/systeminfo.h index 9f561aaa8..3f7cef5b9 100644 --- a/lib/libspl/include/sys/systeminfo.h +++ b/lib/libspl/include/sys/systeminfo.h @@ -25,13 +25,13 @@ */ #ifndef _LIBSPL_SYS_SYSTEMINFO_H -#define _LIBSPL_SYS_SYSTEMINFO_H +#define _LIBSPL_SYS_SYSTEMINFO_H -#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */ -#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ +#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */ +#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ /* to hold a decimal or hex */ /* hostid string */ -#define sysinfo(cmd,buf,cnt) (-1) +#define sysinfo(cmd, buf, cnt) (-1) #endif diff --git a/lib/libspl/include/sys/systm.h b/lib/libspl/include/sys/systm.h index 5cb088dcc..1ed031d4e 100644 --- a/lib/libspl/include/sys/systm.h +++ b/lib/libspl/include/sys/systm.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_SYSTM_H -#define _LIBSPL_SYS_SYSTM_H +#define _LIBSPL_SYS_SYSTM_H #endif /* _LIBSPL_SYS_SYSTM_H */ diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h index 852b2eff9..f0da440a2 100644 --- a/lib/libspl/include/sys/time.h +++ b/lib/libspl/include/sys/time.h @@ -25,37 +25,37 @@ */ #ifndef _LIBSPL_SYS_TIME_H -#define _LIBSPL_SYS_TIME_H +#define _LIBSPL_SYS_TIME_H #include_next #include #ifndef SEC -#define SEC 1 +#define SEC 1 #endif #ifndef MILLISEC -#define MILLISEC 1000 +#define MILLISEC 1000 #endif #ifndef MICROSEC -#define MICROSEC 1000000 +#define MICROSEC 1000000 #endif #ifndef NANOSEC -#define NANOSEC 1000000000 +#define NANOSEC 1000000000 #endif #ifndef NSEC_PER_USEC -#define NSEC_PER_USEC 1000L +#define NSEC_PER_USEC 1000L #endif #ifndef MSEC2NSEC -#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC)) +#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC)) #endif #ifndef NSEC2MSEC -#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) +#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) #endif extern hrtime_t gethrtime(void); diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h index 77a5b2359..bd34dec32 100644 --- a/lib/libspl/include/sys/types.h +++ b/lib/libspl/include/sys/types.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_SYS_TYPES_H -#define _LIBSPL_SYS_TYPES_H +#define _LIBSPL_SYS_TYPES_H #include #include @@ -53,9 +53,9 @@ typedef u_longlong_t u_offset_t; typedef u_longlong_t len_t; typedef longlong_t diskaddr_t; -typedef ulong_t pfn_t; /* page frame number */ -typedef ulong_t pgcnt_t; /* number of pages */ -typedef long spgcnt_t; /* signed number of pages */ +typedef ulong_t pfn_t; /* page frame number */ +typedef ulong_t pgcnt_t; /* number of pages */ +typedef long spgcnt_t; /* signed number of pages */ typedef longlong_t hrtime_t; typedef struct timespec timestruc_t; diff --git a/lib/libspl/include/sys/uio.h b/lib/libspl/include/sys/uio.h index 8adc923e5..97e8412ef 100644 --- a/lib/libspl/include/sys/uio.h +++ b/lib/libspl/include/sys/uio.h @@ -45,14 +45,14 @@ typedef struct iovec iovec_t; typedef enum uio_rw { - UIO_READ = 0, - UIO_WRITE = 1, + UIO_READ = 0, + UIO_WRITE = 1, } uio_rw_t; typedef enum uio_seg { - UIO_USERSPACE = 0, - UIO_SYSSPACE = 1, - UIO_USERISPACE= 2, + UIO_USERSPACE = 0, + UIO_SYSSPACE = 1, + UIO_USERISPACE = 2, } uio_seg_t; typedef struct uio { @@ -102,7 +102,7 @@ typedef struct xuio { } xu_ext; } xuio_t; -#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv -#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw +#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv +#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw #endif /* _SYS_UIO_H */ diff --git a/lib/libspl/include/sys/utsname.h b/lib/libspl/include/sys/utsname.h index fd323b96d..e16e22dbd 100644 --- a/lib/libspl/include/sys/utsname.h +++ b/lib/libspl/include/sys/utsname.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_UTSNAME_H -#define _LIBSPL_UTSNAME_H +#define _LIBSPL_UTSNAME_H #include_next diff --git a/lib/libspl/include/sys/va_list.h b/lib/libspl/include/sys/va_list.h index cf6045451..04ad1480e 100644 --- a/lib/libspl/include/sys/va_list.h +++ b/lib/libspl/include/sys/va_list.h @@ -25,7 +25,7 @@ */ #ifndef _SYS_VA_LIST_H -#define _SYS_VA_LIST_H +#define _SYS_VA_LIST_H #include diff --git a/lib/libspl/include/sys/varargs.h b/lib/libspl/include/sys/varargs.h index b8a63d8d7..3d00a3361 100644 --- a/lib/libspl/include/sys/varargs.h +++ b/lib/libspl/include/sys/varargs.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_VARARGS_H -#define _LIBSPL_SYS_VARARGS_H +#define _LIBSPL_SYS_VARARGS_H #endif diff --git a/lib/libspl/include/sys/vnode.h b/lib/libspl/include/sys/vnode.h index f25e9e9c4..efcdd2c5a 100644 --- a/lib/libspl/include/sys/vnode.h +++ b/lib/libspl/include/sys/vnode.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_VNODE_H -#define _LIBSPL_SYS_VNODE_H +#define _LIBSPL_SYS_VNODE_H #endif /* _LIBSPL_SYS_VNODE_H */ diff --git a/lib/libspl/include/sys/zone.h b/lib/libspl/include/sys/zone.h index ea7c8bde3..bbb964dce 100644 --- a/lib/libspl/include/sys/zone.h +++ b/lib/libspl/include/sys/zone.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYS_ZONE_H -#define _LIBSPL_SYS_ZONE_H +#define _LIBSPL_SYS_ZONE_H #endif -- cgit v1.2.3