diff options
author | Michael Kjorling <[email protected]> | 2013-11-01 20:26:11 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-12-18 16:46:35 -0800 |
commit | d1d7e2689db9e03f11c069ebc9f1ba12829e5dac (patch) | |
tree | 75b9a2b23334d5f673fb31f142f74146d351865c /lib/libspl | |
parent | 8ffef572ed2ba97e0c2d6a8aa2240012e611dc6f (diff) |
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 <[email protected]>
Closes #1821
Diffstat (limited to 'lib/libspl')
65 files changed, 422 insertions, 332 deletions
diff --git a/lib/libspl/asm-generic/atomic.c b/lib/libspl/asm-generic/atomic.c index a3223eadc..f5eb4f34b 100644 --- a/lib/libspl/asm-generic/atomic.c +++ b/lib/libspl/asm-generic/atomic.c @@ -40,7 +40,7 @@ pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER; * Theses are the void returning variants */ -#define ATOMIC_INC(name, type) \ +#define ATOMIC_INC(name, type) \ void atomic_inc_##name(volatile type *target) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -59,7 +59,7 @@ ATOMIC_INC(ulong, ulong_t) ATOMIC_INC(64, uint64_t) -#define ATOMIC_DEC(name, type) \ +#define ATOMIC_DEC(name, type) \ void atomic_dec_##name(volatile type *target) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -78,7 +78,7 @@ ATOMIC_DEC(ulong, ulong_t) ATOMIC_DEC(64, uint64_t) -#define ATOMIC_ADD(name, type1, type2) \ +#define ATOMIC_ADD(name, type1, type2) \ void atomic_add_##name(volatile type1 *target, type2 bits) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -95,7 +95,8 @@ ATOMIC_ADD(int, uint_t, int) ATOMIC_ADD(long, ulong_t, long) ATOMIC_ADD(64, uint64_t, int64_t) -void atomic_add_ptr(volatile void *target, ssize_t bits) +void +atomic_add_ptr(volatile void *target, ssize_t bits) { VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); *(caddr_t *)target += bits; @@ -103,7 +104,7 @@ void atomic_add_ptr(volatile void *target, ssize_t bits) } -#define ATOMIC_SUB(name, type1, type2) \ +#define ATOMIC_SUB(name, type1, type2) \ void atomic_sub_##name(volatile type1 *target, type2 bits) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -120,7 +121,8 @@ ATOMIC_SUB(int, uint_t, int) ATOMIC_SUB(long, ulong_t, long) ATOMIC_SUB(64, uint64_t, int64_t) -void atomic_sub_ptr(volatile void *target, ssize_t bits) +void +atomic_sub_ptr(volatile void *target, ssize_t bits) { VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); *(caddr_t *)target -= bits; @@ -128,7 +130,7 @@ void atomic_sub_ptr(volatile void *target, ssize_t bits) } -#define ATOMIC_OR(name, type) \ +#define ATOMIC_OR(name, type) \ void atomic_or_##name(volatile type *target, type bits) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -146,7 +148,7 @@ ATOMIC_OR(ulong, ulong_t) ATOMIC_OR(64, uint64_t) -#define ATOMIC_AND(name, type) \ +#define ATOMIC_AND(name, type) \ void atomic_and_##name(volatile type *target, type bits) \ { \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ @@ -168,14 +170,14 @@ ATOMIC_AND(64, uint64_t) * New value returning variants */ -#define ATOMIC_INC_NV(name, type) \ +#define ATOMIC_INC_NV(name, type) \ type atomic_inc_##name##_nv(volatile type *target) \ { \ type rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (++(*target)); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_INC_NV(long, unsigned long) @@ -189,14 +191,14 @@ ATOMIC_INC_NV(ulong, ulong_t) ATOMIC_INC_NV(64, uint64_t) -#define ATOMIC_DEC_NV(name, type) \ +#define ATOMIC_DEC_NV(name, type) \ type atomic_dec_##name##_nv(volatile type *target) \ { \ type rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (--(*target)); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_DEC_NV(long, unsigned long) @@ -210,14 +212,14 @@ ATOMIC_DEC_NV(ulong, ulong_t) ATOMIC_DEC_NV(64, uint64_t) -#define ATOMIC_ADD_NV(name, type1, type2) \ +#define ATOMIC_ADD_NV(name, type1, type2) \ type1 atomic_add_##name##_nv(volatile type1 *target, type2 bits)\ { \ type1 rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (*target += bits); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_ADD_NV(8, uint8_t, int8_t) @@ -229,7 +231,8 @@ ATOMIC_ADD_NV(int, uint_t, int) ATOMIC_ADD_NV(long, ulong_t, long) ATOMIC_ADD_NV(64, uint64_t, int64_t) -void *atomic_add_ptr_nv(volatile void *target, ssize_t bits) +void * +atomic_add_ptr_nv(volatile void *target, ssize_t bits) { void *ptr; @@ -237,18 +240,18 @@ void *atomic_add_ptr_nv(volatile void *target, ssize_t bits) ptr = (*(caddr_t *)target += bits); VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return ptr; + return (ptr); } -#define ATOMIC_SUB_NV(name, type1, type2) \ +#define ATOMIC_SUB_NV(name, type1, type2) \ type1 atomic_sub_##name##_nv(volatile type1 *target, type2 bits)\ { \ type1 rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (*target -= bits); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_SUB_NV(8, uint8_t, int8_t) @@ -260,7 +263,8 @@ ATOMIC_SUB_NV(int, uint_t, int) ATOMIC_SUB_NV(long, ulong_t, long) ATOMIC_SUB_NV(64, uint64_t, int64_t) -void *atomic_sub_ptr_nv(volatile void *target, ssize_t bits) +void * +atomic_sub_ptr_nv(volatile void *target, ssize_t bits) { void *ptr; @@ -268,18 +272,18 @@ void *atomic_sub_ptr_nv(volatile void *target, ssize_t bits) ptr = (*(caddr_t *)target -= bits); VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return ptr; + return (ptr); } -#define ATOMIC_OR_NV(name, type) \ +#define ATOMIC_OR_NV(name, type) \ type atomic_or_##name##_nv(volatile type *target, type bits) \ { \ type rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (*target |= bits); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_OR_NV(long, unsigned long) @@ -293,14 +297,14 @@ ATOMIC_OR_NV(ulong, ulong_t) ATOMIC_OR_NV(64, uint64_t) -#define ATOMIC_AND_NV(name, type) \ +#define ATOMIC_AND_NV(name, type) \ type atomic_and_##name##_nv(volatile type *target, type bits) \ { \ type rc; \ VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); \ rc = (*target &= bits); \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return rc; \ + return (rc); \ } ATOMIC_AND_NV(long, unsigned long) @@ -318,7 +322,7 @@ ATOMIC_AND_NV(64, uint64_t) * If *arg1 == arg2, set *arg1 = arg3; return old value */ -#define ATOMIC_CAS(name, type) \ +#define ATOMIC_CAS(name, type) \ type atomic_cas_##name(volatile type *target, type arg1, type arg2) \ { \ type old; \ @@ -327,7 +331,7 @@ ATOMIC_AND_NV(64, uint64_t) if (old == arg1) \ *target = arg2; \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return old; \ + return (old); \ } ATOMIC_CAS(8, uint8_t) @@ -339,17 +343,18 @@ ATOMIC_CAS(uint, uint_t) ATOMIC_CAS(ulong, ulong_t) ATOMIC_CAS(64, uint64_t) -void *atomic_cas_ptr(volatile void *target, void *arg1, void *arg2) +void * +atomic_cas_ptr(volatile void *target, void *arg1, void *arg2) { void *old; VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0); old = *(void **)target; - if (old == arg1) - *(void **)target = arg2; + if (old == arg1) + *(void **)target = arg2; VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return old; + return (old); } @@ -357,7 +362,7 @@ void *atomic_cas_ptr(volatile void *target, void *arg1, void *arg2) * Swap target and return old value */ -#define ATOMIC_SWAP(name, type) \ +#define ATOMIC_SWAP(name, type) \ type atomic_swap_##name(volatile type *target, type bits) \ { \ type old; \ @@ -365,7 +370,7 @@ void *atomic_cas_ptr(volatile void *target, void *arg1, void *arg2) old = *target; \ *target = bits; \ VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); \ - return old; \ + return (old); \ } ATOMIC_SWAP(8, uint8_t) @@ -377,7 +382,8 @@ ATOMIC_SWAP(uint, uint_t) ATOMIC_SWAP(ulong, ulong_t) ATOMIC_SWAP(64, uint64_t) -void *atomic_swap_ptr(volatile void *target, void *bits) +void * +atomic_swap_ptr(volatile void *target, void *bits) { void *old; @@ -386,11 +392,12 @@ void *atomic_swap_ptr(volatile void *target, void *bits) *(void **)target = bits; VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return old; + return (old); } -int atomic_set_long_excl(volatile ulong_t *target, uint_t value) +int +atomic_set_long_excl(volatile ulong_t *target, uint_t value) { ulong_t bit; @@ -398,15 +405,16 @@ int atomic_set_long_excl(volatile ulong_t *target, uint_t value) bit = (1UL << value); if ((*target & bit) != 0) { VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return -1; + return (-1); } *target |= bit; VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return 0; + return (0); } -int atomic_clear_long_excl(volatile ulong_t *target, uint_t value) +int +atomic_clear_long_excl(volatile ulong_t *target, uint_t value) { ulong_t bit; @@ -414,67 +422,78 @@ int atomic_clear_long_excl(volatile ulong_t *target, uint_t value) bit = (1UL << value); if ((*target & bit) != 0) { VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return -1; + return (-1); } *target &= ~bit; VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0); - return 0; + return (0); } -void membar_enter(void) +void +membar_enter(void) { /* XXX - Implement me */ } -void membar_exit(void) +void +membar_exit(void) { /* XXX - Implement me */ } -void membar_producer(void) +void +membar_producer(void) { /* XXX - Implement me */ } -void membar_consumer(void) +void +membar_consumer(void) { /* XXX - Implement me */ } /* Legacy kernel interfaces; they will go away (eventually). */ -uint8_t cas8(uint8_t *target, uint8_t arg1, uint8_t arg2) +uint8_t +cas8(uint8_t *target, uint8_t arg1, uint8_t arg2) { - return atomic_cas_8(target, arg1, arg2); + return (atomic_cas_8(target, arg1, arg2)); } -uint32_t cas32(uint32_t *target, uint32_t arg1, uint32_t arg2) +uint32_t +cas32(uint32_t *target, uint32_t arg1, uint32_t arg2) { - return atomic_cas_32(target, arg1, arg2); + return (atomic_cas_32(target, arg1, arg2)); } -uint64_t cas64(uint64_t *target, uint64_t arg1, uint64_t arg2) +uint64_t +cas64(uint64_t *target, uint64_t arg1, uint64_t arg2) { - return atomic_cas_64(target, arg1, arg2); + return (atomic_cas_64(target, arg1, arg2)); } -ulong_t caslong(ulong_t *target, ulong_t arg1, ulong_t arg2) +ulong_t +caslong(ulong_t *target, ulong_t arg1, ulong_t arg2) { - return atomic_cas_ulong(target, arg1, arg2); + return (atomic_cas_ulong(target, arg1, arg2)); } -void *casptr(void *target, void *arg1, void *arg2) +void * +casptr(void *target, void *arg1, void *arg2) { - return atomic_cas_ptr(target, arg1, arg2); + return (atomic_cas_ptr(target, arg1, arg2)); } -void atomic_and_long(ulong_t *target, ulong_t bits) +void +atomic_and_long(ulong_t *target, ulong_t bits) { - return atomic_and_ulong(target, bits); + return (atomic_and_ulong(target, bits)); } -void atomic_or_long(ulong_t *target, ulong_t bits) +void +atomic_or_long(ulong_t *target, ulong_t bits) { - return atomic_or_ulong(target, bits); + return (atomic_or_ulong(target, bits)); } diff --git a/lib/libspl/getexecname.c b/lib/libspl/getexecname.c index c564eed05..478351ce7 100644 --- a/lib/libspl/getexecname.c +++ b/lib/libspl/getexecname.c @@ -41,7 +41,8 @@ getexecname(void) pthread_mutex_lock(&mtx); if (strlen(execname) == 0) { - rc = readlink("/proc/self/exe", execname, sizeof(execname) - 1); + rc = readlink("/proc/self/exe", + execname, sizeof (execname) - 1); if (rc == -1) { execname[0] = '\0'; } else { @@ -53,5 +54,5 @@ getexecname(void) } pthread_mutex_unlock(&mtx); - return ptr; + return (ptr); } diff --git a/lib/libspl/gethrestime.c b/lib/libspl/gethrestime.c index be163f86c..d37cc2d59 100644 --- a/lib/libspl/gethrestime.c +++ b/lib/libspl/gethrestime.c @@ -30,9 +30,9 @@ void gethrestime(timestruc_t *ts) { - struct timeval tv; + struct timeval tv; - gettimeofday(&tv, NULL); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC; + gettimeofday(&tv, NULL); + ts->tv_sec = tv.tv_sec; + ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC; } diff --git a/lib/libspl/gethrtime.c b/lib/libspl/gethrtime.c index c2fd5e034..95ceb18e1 100644 --- a/lib/libspl/gethrtime.c +++ b/lib/libspl/gethrtime.c @@ -38,8 +38,8 @@ gethrtime(void) rc = clock_gettime(CLOCK_MONOTONIC, &ts); if (rc) { fprintf(stderr, "Error: clock_gettime() = %d\n", rc); - abort(); + abort(); } - return (((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec; + return ((((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec); } diff --git a/lib/libspl/getmntany.c b/lib/libspl/getmntany.c index f0b1cda4b..d78357af5 100644 --- a/lib/libspl/getmntany.c +++ b/lib/libspl/getmntany.c @@ -37,23 +37,25 @@ #include <sys/stat.h> #include <unistd.h> -#define BUFSIZE (MNT_LINE_MAX + 2) +#define BUFSIZE (MNT_LINE_MAX + 2) __thread char buf[BUFSIZE]; -#define DIFF(xx) ((mrefp->xx != NULL) && \ - (mgetp->xx == NULL || strcmp(mrefp->xx, mgetp->xx) != 0)) +#define DIFF(xx) ( \ + (mrefp->xx != NULL) && \ + (mgetp->xx == NULL || strcmp(mrefp->xx, mgetp->xx) != 0)) int getmntany(FILE *fp, struct mnttab *mgetp, struct mnttab *mrefp) { int ret; - while (((ret = _sol_getmntent(fp, mgetp)) == 0) && - (DIFF(mnt_special) || DIFF(mnt_mountp) || - DIFF(mnt_fstype) || DIFF(mnt_mntopts))); + while ( + ((ret = _sol_getmntent(fp, mgetp)) == 0) && ( + DIFF(mnt_special) || DIFF(mnt_mountp) || + DIFF(mnt_fstype) || DIFF(mnt_mntopts))); - return ret; + return (ret); } int @@ -69,13 +71,13 @@ _sol_getmntent(FILE *fp, struct mnttab *mgetp) mgetp->mnt_mountp = mntbuf.mnt_dir; mgetp->mnt_fstype = mntbuf.mnt_type; mgetp->mnt_mntopts = mntbuf.mnt_opts; - return 0; + return (0); } if (feof(fp)) - return -1; + return (-1); - return MNT_TOOLONG; + return (MNT_TOOLONG); } int @@ -89,11 +91,11 @@ getextmntent(FILE *fp, struct extmnttab *mp, int len) if (stat64(mp->mnt_mountp, &st) != 0) { mp->mnt_major = 0; mp->mnt_minor = 0; - return ret; + return (ret); } mp->mnt_major = major(st.st_dev); mp->mnt_minor = minor(st.st_dev); } - return ret; + return (ret); } diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index 370416540..d749d1e9c 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -27,7 +27,7 @@ #include_next <assert.h> #ifndef _LIBSPL_ASSERT_H -#define _LIBSPL_ASSERT_H +#define _LIBSPL_ASSERT_H #include <stdio.h> #include <stdlib.h> diff --git a/lib/libspl/include/devid.h b/lib/libspl/include/devid.h index 9dfdae84b..5406c33b5 100644 --- a/lib/libspl/include/devid.h +++ b/lib/libspl/include/devid.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_DEVID_H -#define _LIBSPL_DEVID_H +#define _LIBSPL_DEVID_H #include <stdlib.h> @@ -36,13 +36,73 @@ typedef struct devid_nmlist { dev_t dev; } devid_nmlist_t; -static inline int devid_str_decode(char *devidstr, ddi_devid_t *retdevid, char **retminor_name) { abort(); } -static inline int devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid, char *minor_name, devid_nmlist_t **retlist) { abort(); } -static inline void devid_str_free(char *str) { abort(); } -static inline void devid_free(ddi_devid_t devid) { abort(); } -static inline void devid_free_nmlist(devid_nmlist_t *list) { abort(); } -static inline int devid_get(int fd, ddi_devid_t *retdevid) { return -1; } -static inline int devid_get_minor_name(int fd, char **retminor_name) { abort(); } -static inline char *devid_str_encode(ddi_devid_t devid, char *minor_name) { abort(); } +static inline +int +devid_str_decode( + char *devidstr, + ddi_devid_t *retdevid, + char **retminor_name) +{ + abort(); +} + +static inline +int +devid_deviceid_to_nmlist( + char *search_path, + ddi_devid_t devid, + char *minor_name, + devid_nmlist_t **retlist) +{ + abort(); +} + +static inline +void +devid_str_free(char *str) +{ + abort(); +} + +static inline +void +devid_free(ddi_devid_t devid) +{ + abort(); +} + +static inline +void +devid_free_nmlist(devid_nmlist_t *list) +{ + abort(); +} + +static inline +int +devid_get( + int fd, + ddi_devid_t *retdevid) +{ + return (-1); +} + +static inline +int +devid_get_minor_name( + int fd, + char **retminor_name) +{ + abort(); +} + +static inline +char * +devid_str_encode( + ddi_devid_t devid, + char *minor_name) +{ + abort(); +} #endif diff --git a/lib/libspl/include/libdevinfo.h b/lib/libspl/include/libdevinfo.h index f0f9d7e8e..be1d291f4 100644 --- a/lib/libspl/include/libdevinfo.h +++ b/lib/libspl/include/libdevinfo.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_LIBDEVINFO_H -#define _LIBSPL_LIBDEVINFO_H +#define _LIBSPL_LIBDEVINFO_H #endif /* _LIBSPL_LIBDEVINFO_H */ diff --git a/lib/libspl/include/libgen.h b/lib/libspl/include/libgen.h index 29e5400d4..7c03d81fd 100644 --- a/lib/libspl/include/libgen.h +++ b/lib/libspl/include/libgen.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_LIBGEN_H -#define _LIBSPL_LIBGEN_H +#define _LIBSPL_LIBGEN_H #include <sys/types.h> diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index a35bfacd7..4016ff031 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -24,7 +24,7 @@ * Use is subject to license terms. */ #ifndef _LIBSPL_LIBSHARE_H -#define _LIBSPL_LIBSHARE_H +#define _LIBSPL_LIBSHARE_H typedef void *sa_handle_t; /* opaque handle to access core functions */ typedef void *sa_group_t; diff --git a/lib/libspl/include/limits.h b/lib/libspl/include/limits.h index 341a2eba9..1a42cfec4 100644 --- a/lib/libspl/include/limits.h +++ b/lib/libspl/include/limits.h @@ -27,14 +27,14 @@ #include_next <limits.h> #ifndef _LIBSPL_LIMITS_H -#define _LIBSPL_LIMITS_H +#define _LIBSPL_LIMITS_H -#define DBL_DIG 15 -#define DBL_MAX 1.7976931348623157081452E+308 -#define DBL_MIN 2.2250738585072013830903E-308 +#define DBL_DIG 15 +#define DBL_MAX 1.7976931348623157081452E+308 +#define DBL_MIN 2.2250738585072013830903E-308 -#define FLT_DIG 6 -#define FLT_MAX 3.4028234663852885981170E+38F -#define FLT_MIN 1.1754943508222875079688E-38F +#define FLT_DIG 6 +#define FLT_MAX 3.4028234663852885981170E+38F +#define FLT_MIN 1.1754943508222875079688E-38F #endif /* _LIBSPL_LIMITS_H */ diff --git a/lib/libspl/include/locale.h b/lib/libspl/include/locale.h index 98ca330c3..6c74df720 100644 --- a/lib/libspl/include/locale.h +++ b/lib/libspl/include/locale.h @@ -27,7 +27,7 @@ #include_next <locale.h> #ifndef _LIBSPL_LOCALE_H -#define _LIBSPL_LOCALE_H +#define _LIBSPL_LOCALE_H #include <time.h> #include <sys/time.h> diff --git a/lib/libspl/include/note.h b/lib/libspl/include/note.h index ed6b4ba1c..cb6b33e1d 100644 --- a/lib/libspl/include/note.h +++ b/lib/libspl/include/note.h @@ -36,7 +36,7 @@ */ #ifndef _NOTE_H -#define _NOTE_H +#define _NOTE_H #include <sys/note.h> @@ -44,7 +44,7 @@ extern "C" { #endif -#define NOTE _NOTE +#define NOTE _NOTE #ifdef __cplusplus } diff --git a/lib/libspl/include/priv.h b/lib/libspl/include/priv.h index 3e8b138a0..15b76a400 100644 --- a/lib/libspl/include/priv.h +++ b/lib/libspl/include/priv.h @@ -25,12 +25,12 @@ */ #ifndef _LIBSPL_PRIV_H -#define _LIBSPL_PRIV_H +#define _LIBSPL_PRIV_H #include <sys/types.h> /* Couldn't find this definition in OpenGrok */ -#define PRIV_SYS_CONFIG "sys_config" +#define PRIV_SYS_CONFIG "sys_config" /* * priv_op_t indicates a privilege operation type diff --git a/lib/libspl/include/rpc/types.h b/lib/libspl/include/rpc/types.h index 68c17f103..aa9901fd1 100644 --- a/lib/libspl/include/rpc/types.h +++ b/lib/libspl/include/rpc/types.h @@ -24,7 +24,7 @@ */ #ifndef LIBSPL_RPC_TYPES_H -#define LIBSPL_RPC_TYPES_H +#define LIBSPL_RPC_TYPES_H #include_next <rpc/types.h> #include <sys/kmem.h> diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h index cd6680f57..99500d657 100644 --- a/lib/libspl/include/rpc/xdr.h +++ b/lib/libspl/include/rpc/xdr.h @@ -30,7 +30,7 @@ */ #ifndef LIBSPL_RPC_XDR_H -#define LIBSPL_RPC_XDR_H +#define LIBSPL_RPC_XDR_H #include_next <rpc/xdr.h> @@ -55,10 +55,10 @@ typedef struct xdr_bytesrec { * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in * the XDR stream moving over RDMA. */ -#define XDR_PEEK 2 -#define XDR_SKIPBYTES 3 -#define XDR_RDMAGET 4 -#define XDR_RDMASET 5 +#define XDR_PEEK 2 +#define XDR_SKIPBYTES 3 +#define XDR_RDMAGET 4 +#define XDR_RDMASET 5 extern bool_t xdr_control(XDR *xdrs, int request, void *info); diff --git a/lib/libspl/include/stdio.h b/lib/libspl/include/stdio.h index f80fdc009..6152b09f1 100644 --- a/lib/libspl/include/stdio.h +++ b/lib/libspl/include/stdio.h @@ -27,8 +27,8 @@ #include_next <stdio.h> #ifndef _LIBSPL_STDIO_H -#define _LIBSPL_STDIO_H +#define _LIBSPL_STDIO_H -#define enable_extended_FILE_stdio(fd, sig) ((void) 0) +#define enable_extended_FILE_stdio(fd, sig) ((void) 0) #endif diff --git a/lib/libspl/include/stdlib.h b/lib/libspl/include/stdlib.h index 67d6e96e0..a4ce4f781 100644 --- a/lib/libspl/include/stdlib.h +++ b/lib/libspl/include/stdlib.h @@ -27,7 +27,7 @@ #include_next <stdlib.h> #ifndef _LIBSPL_STDLIB_H -#define _LIBSPL_STDLIB_H +#define _LIBSPL_STDLIB_H extern const char *getexecname(void); diff --git a/lib/libspl/include/string.h b/lib/libspl/include/string.h index 213977d0e..9e5133e0e 100644 --- a/lib/libspl/include/string.h +++ b/lib/libspl/include/string.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_STRING_H -#define _LIBSPL_STRING_H +#define _LIBSPL_STRING_H #include_next <string.h> diff --git a/lib/libspl/include/strings.h b/lib/libspl/include/strings.h index 48944e142..3f35af4a4 100644 --- a/lib/libspl/include/strings.h +++ b/lib/libspl/include/strings.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_STRINGS_H -#define _LIBSPL_STRINGS_H +#define _LIBSPL_STRINGS_H #include <string.h> #include_next <strings.h> diff --git a/lib/libspl/include/synch.h b/lib/libspl/include/synch.h index 2da270a42..7ce2a53d4 100644 --- a/lib/libspl/include/synch.h +++ b/lib/libspl/include/synch.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_SYNCH_H -#define _LIBSPL_SYNCH_H +#define _LIBSPL_SYNCH_H #endif 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 <assert.h> 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 <sys/file.h> #include <sys/user.h> -#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 <sys/types.h> 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 <inttypes.h> 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 <inttypes.h> -#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 <stdio.h> #include <mntent.h> @@ -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 <sys/mount.h> #ifndef _LIBSPL_SYS_MOUNT_H -#define _LIBSPL_SYS_MOUNT_H +#define _LIBSPL_SYS_MOUNT_H #include <sys/mntent.h> #include <assert.h> @@ -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 <sys/param.h> #include <unistd.h> @@ -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 <pthread.h> -#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 <sys/stat.h> @@ -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 <sys/sysmacros.h> /* 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 <stddef.h> 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 <sys/time.h> #include <sys/types.h> #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 <sys/isa_defs.h> #include <sys/feature_tests.h> @@ -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 <sys/utsname.h> 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 <stdarg.h> 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 diff --git a/lib/libspl/include/thread.h b/lib/libspl/include/thread.h index a72f6d2b1..74694e23e 100644 --- a/lib/libspl/include/thread.h +++ b/lib/libspl/include/thread.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_THREAD_H -#define _LIBSPL_THREAD_H +#define _LIBSPL_THREAD_H #endif /* _LIBSPL_THREAD_H */ diff --git a/lib/libspl/include/tzfile.h b/lib/libspl/include/tzfile.h index 441b8cf8b..7bd4087cd 100644 --- a/lib/libspl/include/tzfile.h +++ b/lib/libspl/include/tzfile.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_TZFILE_H -#define _LIBSPL_TZFILE_H +#define _LIBSPL_TZFILE_H #include <sys/tzfile.h> diff --git a/lib/libspl/include/ucred.h b/lib/libspl/include/ucred.h index 4ca424ed3..8178fdec4 100644 --- a/lib/libspl/include/ucred.h +++ b/lib/libspl/include/ucred.h @@ -25,7 +25,7 @@ */ #ifndef _LIBSPL_UCRED_H -#define _LIBSPL_UCRED_H +#define _LIBSPL_UCRED_H typedef int ucred_t; diff --git a/lib/libspl/include/umem.h b/lib/libspl/include/umem.h index f102f662a..68ff9a576 100644 --- a/lib/libspl/include/umem.h +++ b/lib/libspl/include/umem.h @@ -25,9 +25,10 @@ */ #ifndef _LIBSPL_UMEM_H -#define _LIBSPL_UMEM_H +#define _LIBSPL_UMEM_H -/* XXX: We should use the real portable umem library if it is detected +/* + * XXX: We should use the real portable umem library if it is detected * at configure time. However, if the library is not available, we can * use a trivial malloc based implementation. This obviously impacts * performance, but unless you are using a full userspace build of zpool for @@ -48,18 +49,18 @@ typedef void vmem_t; /* * Flags for umem_alloc/umem_free */ -#define UMEM_DEFAULT 0x0000 /* normal -- may fail */ -#define UMEM_NOFAIL 0x0100 /* Never fails */ +#define UMEM_DEFAULT 0x0000 /* normal -- may fail */ +#define UMEM_NOFAIL 0x0100 /* Never fails */ /* * Flags for umem_cache_create() */ -#define UMC_NOTOUCH 0x00010000 -#define UMC_NODEBUG 0x00020000 -#define UMC_NOMAGAZINE 0x00040000 -#define UMC_NOHASH 0x00080000 +#define UMC_NOTOUCH 0x00010000 +#define UMC_NODEBUG 0x00020000 +#define UMC_NOMAGAZINE 0x00040000 +#define UMC_NOHASH 0x00080000 -#define UMEM_CACHE_NAMELEN 31 +#define UMEM_CACHE_NAMELEN 31 typedef int umem_nofail_callback_t(void); typedef int umem_constructor_t(void *, void *, int); @@ -87,7 +88,7 @@ umem_alloc(size_t size, int flags) ptr = malloc(size); } while (ptr == NULL && (flags & UMEM_NOFAIL)); - return ptr; + return (ptr); } static inline void * @@ -105,10 +106,10 @@ umem_alloc_aligned(size_t size, size_t align, int flags) __func__, align); if (flags & UMEM_NOFAIL) abort(); - return NULL; + return (NULL); } - return ptr; + return (ptr); } static inline void * @@ -120,7 +121,7 @@ umem_zalloc(size_t size, int flags) if (ptr) memset(ptr, 0, size); - return ptr; + return (ptr); } static inline void @@ -133,15 +134,16 @@ static inline void umem_nofail_callback(umem_nofail_callback_t *cb) {} static inline umem_cache_t * -umem_cache_create(char *name, size_t bufsize, size_t align, - umem_constructor_t *constructor, - umem_destructor_t *destructor, - umem_reclaim_t *reclaim, - void *priv, void *vmp, int cflags) +umem_cache_create( + char *name, size_t bufsize, size_t align, + umem_constructor_t *constructor, + umem_destructor_t *destructor, + umem_reclaim_t *reclaim, + void *priv, void *vmp, int cflags) { umem_cache_t *cp; - cp = umem_alloc(sizeof(umem_cache_t), UMEM_DEFAULT); + cp = umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT); if (cp) { strncpy(cp->cache_name, name, UMEM_CACHE_NAMELEN); cp->cache_bufsize = bufsize; @@ -154,13 +156,13 @@ umem_cache_create(char *name, size_t bufsize, size_t align, cp->cache_cflags = cflags; } - return cp; + return (cp); } static inline void umem_cache_destroy(umem_cache_t *cp) { - umem_free(cp, sizeof(umem_cache_t)); + umem_free(cp, sizeof (umem_cache_t)); } static inline void * @@ -169,14 +171,15 @@ umem_cache_alloc(umem_cache_t *cp, int flags) void *ptr; if (cp->cache_align != 0) - ptr = umem_alloc_aligned(cp->cache_bufsize, cp->cache_align, flags); + ptr = umem_alloc_aligned( + cp->cache_bufsize, cp->cache_align, flags); else ptr = umem_alloc(cp->cache_bufsize, flags); if (ptr && cp->cache_constructor) cp->cache_constructor(ptr, cp->cache_private, UMEM_DEFAULT); - return ptr; + return (ptr); } static inline void diff --git a/lib/libspl/include/unistd.h b/lib/libspl/include/unistd.h index dc95e28b5..53851f4ab 100644 --- a/lib/libspl/include/unistd.h +++ b/lib/libspl/include/unistd.h @@ -27,21 +27,21 @@ #include_next <unistd.h> #ifndef _LIBSPL_UNISTD_H -#define _LIBSPL_UNISTD_H +#define _LIBSPL_UNISTD_H #if !defined(HAVE_IOCTL_IN_UNISTD_H) -# if defined(HAVE_IOCTL_IN_SYS_IOCTL_H) -# include <sys/ioctl.h> -# elif defined(HAVE_IOCTL_IN_STROPTS_H) -# include <stropts.h> -# else -# error "System call ioctl() unavailable" -# endif -#endif +#if defined(HAVE_IOCTL_IN_SYS_IOCTL_H) +#include <sys/ioctl.h> +#elif defined(HAVE_IOCTL_IN_STROPTS_H) +#include <stropts.h> +#else /* HAVE_IOCTL_IN_STROPTS_H */ +#error "System call ioctl() unavailable" +#endif /* HAVE_IOCTL_IN_SYS_IOCTL_H */ +#endif /* !HAVE_IOCTL_IN_UNISTD_H */ #if !defined(HAVE_ISSETUGID) -# include <sys/types.h> -# define issetugid() (geteuid() == 0 || getegid() == 0) +#include <sys/types.h> +#define issetugid() (geteuid() == 0 || getegid() == 0) #endif #endif /* _LIBSPL_UNISTD_H */ diff --git a/lib/libspl/include/util/sscanf.h b/lib/libspl/include/util/sscanf.h index 9d13bf25f..ead36acab 100644 --- a/lib/libspl/include/util/sscanf.h +++ b/lib/libspl/include/util/sscanf.h @@ -25,6 +25,6 @@ */ #ifndef _LIBSPL_UTIL_SSCANF_H -#define _LIBSPL_UTIL_SSCANF_H +#define _LIBSPL_UTIL_SSCANF_H #endif diff --git a/lib/libspl/include/zone.h b/lib/libspl/include/zone.h index dd24a1bb2..b4a6deb40 100644 --- a/lib/libspl/include/zone.h +++ b/lib/libspl/include/zone.h @@ -36,8 +36,8 @@ extern "C" { #endif -#define GLOBAL_ZONEID 0 -#define GLOBAL_ZONEID_NAME "global" +#define GLOBAL_ZONEID 0 +#define GLOBAL_ZONEID_NAME "global" /* * Functions for mapping between id and name for active zones. diff --git a/lib/libspl/zone.c b/lib/libspl/zone.c index f4269a76c..5ca93b224 100644 --- a/lib/libspl/zone.c +++ b/lib/libspl/zone.c @@ -27,34 +27,37 @@ #include <string.h> #include <errno.h> -zoneid_t getzoneid() +zoneid_t +getzoneid() { - return GLOBAL_ZONEID; + return (GLOBAL_ZONEID); } -zoneid_t getzoneidbyname(const char *name) +zoneid_t +getzoneidbyname(const char *name) { - if(name == NULL) - return GLOBAL_ZONEID; + if (name == NULL) + return (GLOBAL_ZONEID); - if(strcmp(name, GLOBAL_ZONEID_NAME) == 0) - return GLOBAL_ZONEID; + if (strcmp(name, GLOBAL_ZONEID_NAME) == 0) + return (GLOBAL_ZONEID); - return EINVAL; + return (EINVAL); } -ssize_t getzonenamebyid(zoneid_t id, char *buf, size_t buflen) +ssize_t +getzonenamebyid(zoneid_t id, char *buf, size_t buflen) { - if(id != GLOBAL_ZONEID) - return EINVAL; + if (id != GLOBAL_ZONEID) + return (EINVAL); ssize_t ret = strlen(GLOBAL_ZONEID_NAME) + 1; - if(buf == NULL || buflen == 0) - return ret; + if (buf == NULL || buflen == 0) + return (ret); strncpy(buf, GLOBAL_ZONEID_NAME, buflen); buf[buflen - 1] = '\0'; - return ret; + return (ret); } |