(This is a reimplementation from scratch of libnbd commit b5101fbc59cb, "use space consistently in function and function-like macro invocations", 2023-02-22.) We intend to place a space character between the function designator and the opening parenthesis in a function call. We've been executing on that mostly consistently; fix the few exceptions now. The same convention should be applied to the invocations of function-like macros, and to instances of "__attribute__ ((attr))". (The latter is exemplified, although not consistently, by the GCC manual.) Implement this, by inserting the necessary spaces. Furthermore, the C standard calls "defined" -- as in "#if defined identifier" and (equivalently) "#if defined (identifier)" -- a unary preprocessing operator. We can spell the parenthesized form as defined (identifier) rather than defined(identifier) so choose the former. While at it, touch up the following space-related warts: - The parameter / argument lists of the STUB() and OPTIONAL_STUB() macros, used in VDDK code, lack spaces after the commas; supply them. - There is a single backslash in the definition of each of the ACQUIRE_LOCK_FOR_CURRENT_SCOPE(), ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE(), ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE(), and GET_HANDLE_FOR_CURRENT_SCOPE() macros. Each backslash is preceded by many spaces, even though there are no multiple backslashes that should be aligned. Squeeze the space characters. I collected the locations possibly missing spaces with: git grep -EHn '\<[a-zA-Z0-9_]+\(' -- '*.c' '*.h' and then manually updated each as necessary (this time using negative look-behind regexes in xnedit, for excluding "#define MACRO(...)" matches). I didn't change occurrences in comments (no comment seemed to indicate copying and pasting an expression into new code). "git show -w" outputs nothing for this patch. The test suite passes. Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- include/nbdkit-common.h | 16 +- server/internal.h | 98 +++++----- common/include/array-size.h | 2 +- common/include/byte-swapping.h | 24 +-- common/include/checked-overflow.h | 42 ++--- common/include/compiler-macros.h | 2 +- common/include/iszero.h | 2 +- common/include/minmax.h | 4 +- common/include/nextnonzero.h | 2 +- common/include/random.h | 4 +- common/include/test-array-size.c | 26 +-- common/include/test-random.c | 192 ++++++++++---------- common/allocators/allocator-internal.h | 2 +- common/allocators/allocator.h | 18 +- common/bitmap/bitmap.h | 16 +- common/gpt/efi-crc32.h | 2 +- common/protocol/nbd-protocol.h | 12 +- common/regions/regions.h | 12 +- common/replacements/strndup.h | 2 +- common/utils/cleanup.h | 24 +-- common/utils/const-string-vector.h | 4 +- common/utils/nbdkit-string.h | 4 +- common/utils/string-vector.h | 6 +- common/utils/utils.h | 2 +- common/utils/vector.h | 22 +-- server/connections.c | 2 +- server/crypto.c | 2 +- server/exports.c | 2 +- server/extents.c | 6 +- server/main.c | 4 +- server/protocol-handshake-newstyle.c | 2 +- server/public.c | 6 +- server/socket-activation.c | 2 +- server/sockets.c | 2 +- server/test-public.c | 2 +- server/usergroup.c | 2 +- common/allocators/allocator.c | 2 +- common/allocators/malloc.c | 4 +- common/allocators/sparse.c | 4 +- common/allocators/zstd.c | 4 +- common/bitmap/bitmap.c | 2 +- common/regions/regions.c | 2 +- common/replacements/open_memstream.c | 4 +- common/replacements/strndup.c | 2 +- common/utils/exit-with-parent.c | 6 +- common/utils/test-vector.c | 4 +- common/utils/utils.c | 2 +- plugins/curl/curldefs.h | 2 +- plugins/floppy/virtual-floppy.h | 30 +-- plugins/linuxdisk/virtual-disk.h | 6 +- plugins/ocaml/callbacks.h | 68 +++---- plugins/ocaml/plugin.h | 2 +- plugins/partitioning/virtual-disk.h | 8 +- plugins/python/plugin.h | 4 +- plugins/sh/call.h | 6 +- plugins/vddk/vddk.h | 10 +- plugins/blkio/blkio.c | 4 +- plugins/cc/cc.c | 4 +- plugins/cdi/cdi.c | 2 +- plugins/curl/curl.c | 6 +- plugins/curl/pool.c | 2 +- plugins/data/data.c | 10 +- plugins/data/format.c | 6 +- plugins/eval/eval.c | 4 +- plugins/example1/example1.c | 2 +- plugins/example2/example2.c | 2 +- plugins/example2/winexample2.c | 2 +- plugins/example3/example3.c | 2 +- plugins/file/file.c | 8 +- plugins/file/winfile.c | 2 +- plugins/floppy/floppy.c | 2 +- plugins/floppy/virtual-floppy.c | 8 +- plugins/full/full.c | 2 +- plugins/guestfs/guestfs-plugin.c | 2 +- plugins/info/info.c | 4 +- plugins/iso/iso.c | 2 +- plugins/libvirt/libvirt-plugin.c | 2 +- plugins/linuxdisk/linuxdisk.c | 2 +- plugins/lua/lua.c | 2 +- plugins/memory/memory.c | 2 +- plugins/null/null.c | 2 +- plugins/ocaml/plugin.c | 2 +- plugins/ondemand/ondemand.c | 2 +- plugins/partitioning/partitioning.c | 2 +- plugins/pattern/pattern.c | 2 +- plugins/perl/perl.c | 32 ++-- plugins/python/modfunctions.c | 4 +- plugins/random/random.c | 2 +- plugins/ruby/ruby.c | 4 +- plugins/sh/sh.c | 2 +- plugins/sparse-random/sparse-random.c | 4 +- plugins/split/split.c | 2 +- plugins/ssh/ssh.c | 2 +- plugins/tcl/tcl.c | 2 +- plugins/tmpdisk/tmpdisk.c | 2 +- plugins/vddk/stats.c | 10 +- plugins/vddk/vddk.c | 16 +- plugins/zero/zero.c | 2 +- filters/cache/blk.h | 12 +- filters/cow/blk.h | 10 +- filters/ext2/io.h | 4 +- filters/log/log.h | 8 +- filters/readahead/readahead.h | 2 +- filters/scan/scan.h | 2 +- filters/xz/blkcache.h | 8 +- filters/blocksize-policy/policy.c | 2 +- filters/blocksize/blocksize.c | 2 +- filters/cache/cache.c | 2 +- filters/cache/reclaim.c | 2 +- filters/checkwrite/checkwrite.c | 2 +- filters/cow/cow.c | 2 +- filters/ddrescue/ddrescue.c | 4 +- filters/delay/delay.c | 4 +- filters/error/error.c | 2 +- filters/exitlast/exitlast.c | 2 +- filters/exitwhen/exitwhen.c | 8 +- filters/exportname/exportname.c | 2 +- filters/ext2/ext2.c | 2 +- filters/extentlist/extentlist.c | 4 +- filters/fua/fua.c | 2 +- filters/gzip/gzip.c | 2 +- filters/ip/ip.c | 12 +- filters/limit/limit.c | 2 +- filters/log/log.c | 2 +- filters/luks/luks-encryption.c | 4 +- filters/luks/luks.c | 2 +- filters/multi-conn/multi-conn.c | 6 +- filters/nocache/nocache.c | 2 +- filters/noextents/noextents.c | 2 +- filters/nofilter/nofilter.c | 2 +- filters/noparallel/noparallel.c | 2 +- filters/nozero/nozero.c | 2 +- filters/offset/offset.c | 2 +- filters/partition/partition-gpt.c | 4 +- filters/partition/partition.c | 2 +- filters/pause/pause.c | 2 +- filters/protect/protect.c | 4 +- filters/rate/rate.c | 4 +- filters/readahead/readahead.c | 2 +- filters/retry-request/retry-request.c | 2 +- filters/retry/retry.c | 2 +- filters/scan/scan.c | 2 +- filters/swab/swab.c | 2 +- filters/tar/tar.c | 2 +- filters/tls-fallback/tls-fallback.c | 2 +- filters/truncate/truncate.c | 2 +- filters/xz/xz.c | 2 +- tests/cc-shebang.c | 2 +- tests/dummy-vddk.c | 4 +- tests/test-ansi-c-plugin.c | 2 +- tests/test-disconnect-plugin.c | 2 +- tests/test-flush-plugin.c | 2 +- tests/test-layers-filter.c | 2 +- tests/test-layers-plugin.c | 2 +- tests/test-layers.c | 6 +- tests/test-read-password-plugin.c | 2 +- tests/test-shutdown-plugin.c | 2 +- tests/test-stdio-plugin.c | 2 +- tests/test.h | 4 +- tests/web-server.h | 2 +- wrapper.c | 6 +- 161 files changed, 563 insertions(+), 563 deletions(-) diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h index dfdbab68d50d..fa23c235b904 100644 --- a/include/nbdkit-common.h +++ b/include/nbdkit-common.h @@ -41,8 +41,8 @@ #include <stdint.h> #include <errno.h> -#if !defined(_WIN32) && !defined(__MINGW32__) && \ - !defined(__CYGWIN__) && !defined(_MSC_VER) +#if !defined (_WIN32) && !defined (__MINGW32__) && \ + !defined (__CYGWIN__) && !defined (_MSC_VER) #include <sys/socket.h> #else #include <ws2tcpip.h> @@ -54,10 +54,10 @@ extern "C" { #endif -#if (defined(__GNUC__) || defined(__clang__)) && \ - defined(HAVE_VFPRINTF_PERCENT_M) +#if (defined (__GNUC__) || defined (__clang__)) && \ + defined (HAVE_VFPRINTF_PERCENT_M) #define ATTRIBUTE_FORMAT_PRINTF(fmtpos, argpos) \ - __attribute__((__format__ (__printf__, fmtpos, argpos))) + __attribute__ ((__format__ (__printf__, fmtpos, argpos))) #else #define ATTRIBUTE_FORMAT_PRINTF(fmtpos, argpos) #endif @@ -85,11 +85,11 @@ extern "C" { #ifndef WIN32 #define NBDKIT_EXTERN_DECL(ret, fn, args) extern ret fn args -#define NBDKIT_DLL_PUBLIC __attribute__((__visibility__("default"))) +#define NBDKIT_DLL_PUBLIC __attribute__ ((__visibility__ ("default"))) #else #define NBDKIT_EXTERN_DECL(ret, fn, args) \ - extern __declspec(dllexport) ret fn args -#define NBDKIT_DLL_PUBLIC __declspec(dllexport) + extern __declspec (dllexport) ret fn args +#define NBDKIT_DLL_PUBLIC __declspec (dllexport) #endif NBDKIT_EXTERN_DECL (void, nbdkit_error, diff --git a/server/internal.h b/server/internal.h index af5d86772f31..634fc7cbaeaf 100644 --- a/server/internal.h +++ b/server/internal.h @@ -56,7 +56,7 @@ /* Define unlikely macro, but only for GCC. These are used to move * debug and error handling code out of hot paths. */ -#if defined(__GNUC__) +#if defined (__GNUC__) #define unlikely(x) __builtin_expect (!!(x), 0) #define if_verbose if (unlikely (verbose)) #else @@ -64,7 +64,7 @@ #define if_verbose if (verbose) #endif -#if defined(__SANITIZE_ADDRESS__) +#if defined (__SANITIZE_ADDRESS__) # define DO_DLCLOSE 0 #elif ENABLE_LIBFUZZER /* XXX This causes dlopen in the server to leak during fuzzing. @@ -92,7 +92,7 @@ #define container_of(ptr, type, member) ({ \ const typeof (((type *) 0)->member) *__mptr = (ptr); \ - (type *) ((char *) __mptr - offsetof(type, member)); \ + (type *) ((char *) __mptr - offsetof (type, member)); \ }) /* Maximum read or write request that we will handle. */ @@ -194,10 +194,10 @@ enum { }; typedef int (*connection_recv_function) (void *buf, size_t len) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); typedef int (*connection_send_function) (const void *buf, size_t len, int flags) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); typedef void (*connection_close_function) (int how); /* struct context stores data per connection and backend. Primarily @@ -287,7 +287,7 @@ extern bool connection_set_status (conn_status value); extern int protocol_handshake (void); extern int protocol_common_open (uint64_t *exportsize, uint16_t *flags, const char *exportname) - __attribute__((__nonnull__ (1, 2, 3))); + __attribute__ ((__nonnull__ (1, 2, 3))); /* protocol-handshake-oldstyle.c */ extern int protocol_handshake_oldstyle (void); @@ -323,16 +323,16 @@ extern void log_verror (const char *fs, va_list args); /* log-*.c */ extern void log_stderr_verror (const char *fs, va_list args) - ATTRIBUTE_FORMAT_PRINTF(1, 0); + ATTRIBUTE_FORMAT_PRINTF (1, 0); extern void log_syslog_verror (const char *fs, va_list args) - ATTRIBUTE_FORMAT_PRINTF(1, 0); + ATTRIBUTE_FORMAT_PRINTF (1, 0); /* vfprintf.c */ #if !HAVE_VFPRINTF_PERCENT_M #include <stdio.h> #define vfprintf replace_vfprintf extern int replace_vfprintf (FILE *f, const char *fmt, va_list args) - __attribute__((__format__ (printf, 2, 0))); + __attribute__ ((__format__ (printf, 2, 0))); #endif /* backend.c */ @@ -420,18 +420,18 @@ struct backend { extern void backend_init (struct backend *b, struct backend *next, size_t index, const char *filename, void *dl, const char *type) - __attribute__((__nonnull__ (1, 4, 5, 6))); + __attribute__ ((__nonnull__ (1, 4, 5, 6))); extern void backend_load (struct backend *b, const char *name, void (*load) (void)) - __attribute__((__nonnull__ (1 /* not 2 */))); + __attribute__ ((__nonnull__ (1 /* not 2 */))); extern void backend_unload (struct backend *b, void (*unload) (void)) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_list_exports (struct backend *b, int readonly, struct nbdkit_exports *exports) - __attribute__((__nonnull__ (1, 3))); + __attribute__ ((__nonnull__ (1, 3))); extern const char *backend_default_export (struct backend *b, int readonly) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* exportname is only valid for this call and almost certainly will be * freed on return of this function, so backends must save the * exportname if they need to refer to it later. @@ -439,84 +439,84 @@ extern const char *backend_default_export (struct backend *b, int readonly) extern struct context *backend_open (struct backend *b, int readonly, const char *exportname, int shared) - __attribute__((__nonnull__ (1, 3))); + __attribute__ ((__nonnull__ (1, 3))); extern int backend_prepare (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_finalize (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern void backend_close (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern bool backend_valid_range (struct context *c, uint64_t offset, uint32_t count) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern const char *backend_export_description (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int64_t backend_get_size (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_block_size (struct context *c, uint32_t *minimum, uint32_t *preferred, uint32_t *maximum) - __attribute__((__nonnull__ (1, 2, 3, 4))); + __attribute__ ((__nonnull__ (1, 2, 3, 4))); extern int backend_can_write (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_flush (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_is_rotational (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_trim (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_zero (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_fast_zero (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_extents (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_fua (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_multi_conn (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_can_cache (struct context *c) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int backend_pread (struct context *c, void *buf, uint32_t count, uint64_t offset, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 2, 6))); + __attribute__ ((__nonnull__ (1, 2, 6))); extern int backend_pwrite (struct context *c, const void *buf, uint32_t count, uint64_t offset, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 2, 6))); + __attribute__ ((__nonnull__ (1, 2, 6))); extern int backend_flush (struct context *c, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 3))); + __attribute__ ((__nonnull__ (1, 3))); extern int backend_trim (struct context *c, uint32_t count, uint64_t offset, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 5))); + __attribute__ ((__nonnull__ (1, 5))); extern int backend_zero (struct context *c, uint32_t count, uint64_t offset, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 5))); + __attribute__ ((__nonnull__ (1, 5))); extern int backend_extents (struct context *c, uint32_t count, uint64_t offset, uint32_t flags, struct nbdkit_extents *extents, int *err) - __attribute__((__nonnull__ (1, 5, 6))); + __attribute__ ((__nonnull__ (1, 5, 6))); extern int backend_cache (struct context *c, uint32_t count, uint64_t offset, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 5))); + __attribute__ ((__nonnull__ (1, 5))); /* plugins.c */ extern struct backend *plugin_register (size_t index, const char *filename, void *dl, struct nbdkit_plugin *(*plugin_init) (void)) - __attribute__((__nonnull__ (2, 3, 4))); + __attribute__ ((__nonnull__ (2, 3, 4))); /* filters.c */ extern struct backend *filter_register (struct backend *next, size_t index, const char *filename, void *dl, struct nbdkit_filter *(*filter_init) (void)) - __attribute__((__nonnull__ (1, 3, 4, 5))); + __attribute__ ((__nonnull__ (1, 3, 4, 5))); /* locks.c */ extern unsigned thread_model; @@ -530,18 +530,18 @@ extern void lock_unload (void); extern void unlock_unload (void); /* sockets.c */ -DEFINE_VECTOR_TYPE(sockets, int); -extern void bind_unix_socket (sockets *) __attribute__((__nonnull__ (1))); -extern void bind_tcpip_socket (sockets *) __attribute__((__nonnull__ (1))); -extern void bind_vsock (sockets *) __attribute__((__nonnull__ (1))); +DEFINE_VECTOR_TYPE (sockets, int); +extern void bind_unix_socket (sockets *) __attribute__ ((__nonnull__ (1))); +extern void bind_tcpip_socket (sockets *) __attribute__ ((__nonnull__ (1))); +extern void bind_vsock (sockets *) __attribute__ ((__nonnull__ (1))); extern void accept_incoming_connections (const sockets *socks) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* threadlocal.c */ extern void threadlocal_init (void); extern void threadlocal_new_server_thread (void); extern void threadlocal_set_name (const char *name) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern const char *threadlocal_get_name (void); extern void threadlocal_set_instance_num (size_t instance_num); extern size_t threadlocal_get_instance_num (void); @@ -554,10 +554,10 @@ extern struct context *threadlocal_get_context (void); extern struct context *threadlocal_push_context (struct context *ctx); extern void threadlocal_pop_context (struct context **ctx); -#define CLEANUP_CONTEXT_POP __attribute__((cleanup (threadlocal_pop_context))) +#define CLEANUP_CONTEXT_POP __attribute__ ((cleanup (threadlocal_pop_context))) #define PUSH_CONTEXT_FOR_SCOPE(ctx) \ CLEANUP_CONTEXT_POP CLANG_UNUSED_VARIABLE_WORKAROUND \ - struct context *NBDKIT_UNIQUE_NAME(_ctx) = threadlocal_push_context (ctx) + struct context *NBDKIT_UNIQUE_NAME (_ctx) = threadlocal_push_context (ctx) /* Macro which sets local variable struct connection *conn from * thread-local storage, asserting that it is non-NULL. If you want diff --git a/common/include/array-size.h b/common/include/array-size.h index 3212d9dc6cdb..6f0a1ae87233 100644 --- a/common/include/array-size.h +++ b/common/include/array-size.h @@ -36,6 +36,6 @@ #include "compiler-macros.h" #define ARRAY_SIZE(a) \ - ((sizeof (a) / sizeof ((a)[0])) + BUILD_BUG_UNLESS_TRUE (TYPE_IS_ARRAY(a))) + ((sizeof (a) / sizeof ((a)[0])) + BUILD_BUG_UNLESS_TRUE (TYPE_IS_ARRAY (a))) #endif /* NBDKIT_ARRAY_SIZE_H */ diff --git a/common/include/byte-swapping.h b/common/include/byte-swapping.h index c53fba2e8f24..fce56df585ca 100644 --- a/common/include/byte-swapping.h +++ b/common/include/byte-swapping.h @@ -58,20 +58,20 @@ #ifdef __HAIKU__ #include <ByteOrder.h> -#define htobe16(x) B_HOST_TO_BENDIAN_INT16(x) -#define htole16(x) B_HOST_TO_LENDIAN_INT16(x) -#define be16toh(x) B_BENDIAN_TO_HOST_INT16(x) -#define le16toh(x) B_LENDIAN_TO_HOST_INT16(x) +#define htobe16(x) B_HOST_TO_BENDIAN_INT16 (x) +#define htole16(x) B_HOST_TO_LENDIAN_INT16 (x) +#define be16toh(x) B_BENDIAN_TO_HOST_INT16 (x) +#define le16toh(x) B_LENDIAN_TO_HOST_INT16 (x) -#define htobe32(x) B_HOST_TO_BENDIAN_INT32(x) -#define htole32(x) B_HOST_TO_LENDIAN_INT32(x) -#define be32toh(x) B_BENDIAN_TO_HOST_INT32(x) -#define le32toh(x) B_LENDIAN_TO_HOST_INT32(x) +#define htobe32(x) B_HOST_TO_BENDIAN_INT32 (x) +#define htole32(x) B_HOST_TO_LENDIAN_INT32 (x) +#define be32toh(x) B_BENDIAN_TO_HOST_INT32 (x) +#define le32toh(x) B_LENDIAN_TO_HOST_INT32 (x) -#define htobe64(x) B_HOST_TO_BENDIAN_INT64(x) -#define htole64(x) B_HOST_TO_LENDIAN_INT64(x) -#define be64toh(x) B_BENDIAN_TO_HOST_INT64(x) -#define le64toh(x) B_LENDIAN_TO_HOST_INT64(x) +#define htobe64(x) B_HOST_TO_BENDIAN_INT64 (x) +#define htole64(x) B_HOST_TO_LENDIAN_INT64 (x) +#define be64toh(x) B_BENDIAN_TO_HOST_INT64 (x) +#define le64toh(x) B_LENDIAN_TO_HOST_INT64 (x) #endif /* If we didn't define bswap_16, bswap_32 and bswap_64 already above, diff --git a/common/include/checked-overflow.h b/common/include/checked-overflow.h index 546c930b33d2..a1852adcdc7a 100644 --- a/common/include/checked-overflow.h +++ b/common/include/checked-overflow.h @@ -46,7 +46,7 @@ #ifndef NBDKIT_CHECKED_OVERFLOW_H #define NBDKIT_CHECKED_OVERFLOW_H -#if !defined(__GNUC__) && !defined(__clang__) +#if !defined (__GNUC__) && !defined (__clang__) #error "this file may need to be ported to your compiler" #endif @@ -66,9 +66,9 @@ * mathematical sum are stored to "*r". */ #if HAVE_DECL___BUILTIN_ADD_OVERFLOW -#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_BUILTIN((a), (b), (r)) +#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_BUILTIN ((a), (b), (r)) #else -#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_FALLBACK((a), (b), (r)) +#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_FALLBACK ((a), (b), (r)) #endif /* Multiply "a" and "b", both of (possibly different) unsigned integer types, @@ -83,9 +83,9 @@ * the mathematical product are stored to "*r". */ #if HAVE_DECL___BUILTIN_MUL_OVERFLOW -#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_BUILTIN((a), (b), (r)) +#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_BUILTIN ((a), (b), (r)) #else -#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_FALLBACK((a), (b), (r)) +#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_FALLBACK ((a), (b), (r)) #endif /* The ADD_OVERFLOW_BUILTIN and MUL_OVERFLOW_BUILTIN function-like macros @@ -99,22 +99,22 @@ * variably modified type. */ #if HAVE_DECL___BUILTIN_ADD_OVERFLOW -#define ADD_OVERFLOW_BUILTIN(a, b, r) \ - ({ \ - STATIC_ASSERT_UNSIGNED_INT (a); \ - STATIC_ASSERT_UNSIGNED_INT (b); \ - STATIC_ASSERT_UNSIGNED_INT (*(r)); \ - __builtin_add_overflow((a), (b), (r)); \ +#define ADD_OVERFLOW_BUILTIN(a, b, r) \ + ({ \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + __builtin_add_overflow ((a), (b), (r)); \ }) #endif #if HAVE_DECL___BUILTIN_MUL_OVERFLOW -#define MUL_OVERFLOW_BUILTIN(a, b, r) \ - ({ \ - STATIC_ASSERT_UNSIGNED_INT (a); \ - STATIC_ASSERT_UNSIGNED_INT (b); \ - STATIC_ASSERT_UNSIGNED_INT (*(r)); \ - __builtin_mul_overflow((a), (b), (r)); \ +#define MUL_OVERFLOW_BUILTIN(a, b, r) \ + ({ \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + __builtin_mul_overflow ((a), (b), (r)); \ }) #endif @@ -173,10 +173,10 @@ * * The expression "x" is not evaluated, unless it has variably modified type. */ -#define STATIC_ASSERT_UNSIGNED_INT(x) \ - do { \ - typedef char NBDKIT_UNIQUE_NAME(_x_has_uint_type)[(typeof (x))-1 > 0 ? 1 : -1] \ - __attribute__((__unused__)); \ +#define STATIC_ASSERT_UNSIGNED_INT(x) \ + do { \ + typedef char NBDKIT_UNIQUE_NAME (_x_has_uint_type)[(typeof (x))-1 > 0 ? 1 : -1] \ + __attribute__ ((__unused__)); \ } while (0) /* Assign the sum "a + b" to "*r", using uintmax_t modular arithmetic. diff --git a/common/include/compiler-macros.h b/common/include/compiler-macros.h index d41166614f95..7933bb87a5bf 100644 --- a/common/include/compiler-macros.h +++ b/common/include/compiler-macros.h @@ -48,7 +48,7 @@ #define BUILD_BUG_STRUCT_SIZE(cond) \ (sizeof (struct { int: (cond) ? 1 : -1; })) #define BUILD_BUG_UNLESS_TRUE(cond) \ - (BUILD_BUG_STRUCT_SIZE(cond) - BUILD_BUG_STRUCT_SIZE(cond)) + (BUILD_BUG_STRUCT_SIZE (cond) - BUILD_BUG_STRUCT_SIZE (cond)) #define TYPE_IS_ARRAY(a) \ (!__builtin_types_compatible_p (typeof (a), typeof (&(a)[0]))) diff --git a/common/include/iszero.h b/common/include/iszero.h index 7fdbb52c2a03..657ed5bac4ef 100644 --- a/common/include/iszero.h +++ b/common/include/iszero.h @@ -45,7 +45,7 @@ * See also: * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69908 */ -static inline bool __attribute__((__nonnull__ (1))) +static inline bool __attribute__ ((__nonnull__ (1))) is_zero (const char *buffer, size_t size) { size_t i; diff --git a/common/include/minmax.h b/common/include/minmax.h index 8d1fbf19bc23..8b0e6b7a4dbb 100644 --- a/common/include/minmax.h +++ b/common/include/minmax.h @@ -48,10 +48,10 @@ #undef MIN #define MIN(x, y) \ - MIN_1((x), (y), NBDKIT_UNIQUE_NAME(_x), NBDKIT_UNIQUE_NAME(_y)) + MIN_1 ((x), (y), NBDKIT_UNIQUE_NAME (_x), NBDKIT_UNIQUE_NAME (_y)) #undef MAX #define MAX(x, y) \ - MAX_1((x), (y), NBDKIT_UNIQUE_NAME(_x), NBDKIT_UNIQUE_NAME(_y)) + MAX_1 ((x), (y), NBDKIT_UNIQUE_NAME (_x), NBDKIT_UNIQUE_NAME (_y)) #ifdef HAVE_AUTO_TYPE diff --git a/common/include/nextnonzero.h b/common/include/nextnonzero.h index cf4ca3caa53a..fb62cb48225d 100644 --- a/common/include/nextnonzero.h +++ b/common/include/nextnonzero.h @@ -44,7 +44,7 @@ * https://sourceware.org/bugzilla/show_bug.cgi?id=19920 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69908 */ -static inline const char * __attribute__((__nonnull__ (1))) +static inline const char * __attribute__ ((__nonnull__ (1))) next_non_zero (const char *buffer, size_t size) { size_t i; diff --git a/common/include/random.h b/common/include/random.h index 58b6219c8803..2b849d63192a 100644 --- a/common/include/random.h +++ b/common/include/random.h @@ -66,7 +66,7 @@ snext (uint64_t *seed) } /* Seed the random state from a 64 bit seed. */ -static inline void __attribute__((__nonnull__ (2))) +static inline void __attribute__ ((__nonnull__ (2))) xsrandom (uint64_t seed, struct random_state *state) { state->s[0] = snext (&seed); @@ -85,7 +85,7 @@ rotl (const uint64_t x, int k) } /* Returns 64 random bits. Updates the state. */ -static inline uint64_t __attribute__((__nonnull__ (1))) +static inline uint64_t __attribute__ ((__nonnull__ (1))) xrandom (struct random_state *state) { const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; diff --git a/common/include/test-array-size.c b/common/include/test-array-size.c index 1ce2142cd39c..8b0972aaabe1 100644 --- a/common/include/test-array-size.c +++ b/common/include/test-array-size.c @@ -41,21 +41,21 @@ struct st { const char *s; int i; }; -static const char *s0[] __attribute__((__unused__)) = { }; -static const char *s1[] __attribute__((__unused__)) = { "a" }; -static const char *s3[] __attribute__((__unused__)) = { "a", "b", "c" }; -static const char *s4[4] __attribute__((__unused__)) = { "a", "b", "c", "d" }; -static int i0[] __attribute__((__unused__)) = { }; -static int i1[] __attribute__((__unused__)) = { 1 }; -static int i3[] __attribute__((__unused__)) = { 1, 2, 3 }; -static int i4[4] __attribute__((__unused__)) = { 1, 2, 3, 4 }; -static struct st st0[] __attribute__((__unused__)) = { }; -static struct st st1[] __attribute__((__unused__)) = { { "a", 1 } }; -static struct st st3[] __attribute__((__unused__)) = +static const char *s0[] __attribute__ ((__unused__)) = { }; +static const char *s1[] __attribute__ ((__unused__)) = { "a" }; +static const char *s3[] __attribute__ ((__unused__)) = { "a", "b", "c" }; +static const char *s4[4] __attribute__ ((__unused__)) = { "a", "b", "c", "d" }; +static int i0[] __attribute__ ((__unused__)) = { }; +static int i1[] __attribute__ ((__unused__)) = { 1 }; +static int i3[] __attribute__ ((__unused__)) = { 1, 2, 3 }; +static int i4[4] __attribute__ ((__unused__)) = { 1, 2, 3, 4 }; +static struct st st0[] __attribute__ ((__unused__)) = { }; +static struct st st1[] __attribute__ ((__unused__)) = { { "a", 1 } }; +static struct st st3[] __attribute__ ((__unused__)) = { { "a", 1 }, { "b", 2 }, { "c", 3 } }; -static struct st st4[4] __attribute__((__unused__)) = +static struct st st4[4] __attribute__ ((__unused__)) = { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } }; -static struct st st4_0[4] __attribute__((__unused__)); +static struct st st4_0[4] __attribute__ ((__unused__)); int main (void) diff --git a/common/include/test-random.c b/common/include/test-random.c index f8fe38043a0e..7962b153c545 100644 --- a/common/include/test-random.c +++ b/common/include/test-random.c @@ -52,112 +52,112 @@ struct { uint64_t vector[LEN]; } tests[] = { { 0, { -UINT64_C(0x99ec5f36cb75f2b4), -UINT64_C(0xbf6e1f784956452a), -UINT64_C(0x1a5f849d4933e6e0), -UINT64_C(0x6aa594f1262d2d2c), -UINT64_C(0xbba5ad4a1f842e59), -UINT64_C(0xffef8375d9ebcaca), -UINT64_C(0x6c160deed2f54c98), -UINT64_C(0x8920ad648fc30a3f), -UINT64_C(0xdb032c0ba7539731), -UINT64_C(0xeb3a475a3e749a3d), -UINT64_C(0x1d42993fa43f2a54), -UINT64_C(0x11361bf526a14bb5), -UINT64_C(0x1b4f07a5ab3d8e9c), -UINT64_C(0xa7a3257f6986db7f), -UINT64_C(0x7efdaa95605dfc9c), -UINT64_C(0x4bde97c0a78eaab8), +UINT64_C (0x99ec5f36cb75f2b4), +UINT64_C (0xbf6e1f784956452a), +UINT64_C (0x1a5f849d4933e6e0), +UINT64_C (0x6aa594f1262d2d2c), +UINT64_C (0xbba5ad4a1f842e59), +UINT64_C (0xffef8375d9ebcaca), +UINT64_C (0x6c160deed2f54c98), +UINT64_C (0x8920ad648fc30a3f), +UINT64_C (0xdb032c0ba7539731), +UINT64_C (0xeb3a475a3e749a3d), +UINT64_C (0x1d42993fa43f2a54), +UINT64_C (0x11361bf526a14bb5), +UINT64_C (0x1b4f07a5ab3d8e9c), +UINT64_C (0xa7a3257f6986db7f), +UINT64_C (0x7efdaa95605dfc9c), +UINT64_C (0x4bde97c0a78eaab8), } }, { 1, { -UINT64_C(0xb3f2af6d0fc710c5), -UINT64_C(0x853b559647364cea), -UINT64_C(0x92f89756082a4514), -UINT64_C(0x642e1c7bc266a3a7), -UINT64_C(0xb27a48e29a233673), -UINT64_C(0x24c123126ffda722), -UINT64_C(0x123004ef8df510e6), -UINT64_C(0x61954dcc47b1e89d), -UINT64_C(0xddfdb48ab9ed4a21), -UINT64_C(0x8d3cdb8c3aa5b1d0), -UINT64_C(0xeebd114bd87226d1), -UINT64_C(0xf50c3ff1e7d7e8a6), -UINT64_C(0xeeca3115e23bc8f1), -UINT64_C(0xab49ed3db4c66435), -UINT64_C(0x99953c6c57808dd7), -UINT64_C(0xe3fa941b05219325), +UINT64_C (0xb3f2af6d0fc710c5), +UINT64_C (0x853b559647364cea), +UINT64_C (0x92f89756082a4514), +UINT64_C (0x642e1c7bc266a3a7), +UINT64_C (0xb27a48e29a233673), +UINT64_C (0x24c123126ffda722), +UINT64_C (0x123004ef8df510e6), +UINT64_C (0x61954dcc47b1e89d), +UINT64_C (0xddfdb48ab9ed4a21), +UINT64_C (0x8d3cdb8c3aa5b1d0), +UINT64_C (0xeebd114bd87226d1), +UINT64_C (0xf50c3ff1e7d7e8a6), +UINT64_C (0xeeca3115e23bc8f1), +UINT64_C (0xab49ed3db4c66435), +UINT64_C (0x99953c6c57808dd7), +UINT64_C (0xe3fa941b05219325), } }, { 2, { -UINT64_C(0x1a28690da8a8d057), -UINT64_C(0xb9bb8042daedd58a), -UINT64_C(0x2f1829af001ef205), -UINT64_C(0xbf733e63d139683d), -UINT64_C(0xafa78247c6a82034), -UINT64_C(0x3c69a1b6d15cf0d0), -UINT64_C(0xa5a9fdd18948c400), -UINT64_C(0x3813d2654a981e91), -UINT64_C(0x9be35597c9c97bfa), -UINT64_C(0xbfc5e80fd0b75f32), -UINT64_C(0xbee02daaac716557), -UINT64_C(0x5afed6f12b594dbe), -UINT64_C(0xae346b9196e12cc7), -UINT64_C(0xf5f45afc1af068ed), -UINT64_C(0xff75eccacfb37519), -UINT64_C(0x1adca5a0b2e766c5), +UINT64_C (0x1a28690da8a8d057), +UINT64_C (0xb9bb8042daedd58a), +UINT64_C (0x2f1829af001ef205), +UINT64_C (0xbf733e63d139683d), +UINT64_C (0xafa78247c6a82034), +UINT64_C (0x3c69a1b6d15cf0d0), +UINT64_C (0xa5a9fdd18948c400), +UINT64_C (0x3813d2654a981e91), +UINT64_C (0x9be35597c9c97bfa), +UINT64_C (0xbfc5e80fd0b75f32), +UINT64_C (0xbee02daaac716557), +UINT64_C (0x5afed6f12b594dbe), +UINT64_C (0xae346b9196e12cc7), +UINT64_C (0xf5f45afc1af068ed), +UINT64_C (0xff75eccacfb37519), +UINT64_C (0x1adca5a0b2e766c5), } }, { 3, { -UINT64_C(0xb0cdabdae5668cc0), -UINT64_C(0xa3fd1dea5e1864ee), -UINT64_C(0x37e00afb3229fd51), -UINT64_C(0x88b1b58b236f3bea), -UINT64_C(0x6cb24c8fb224980a), -UINT64_C(0x6646287ee2a98083), -UINT64_C(0x35cd8bb5e1fa7256), -UINT64_C(0xb72fe6e16b6fb4e6), -UINT64_C(0xf1397a9f1db4f5d9), -UINT64_C(0x31f25047faa8e5d4), -UINT64_C(0xec616a6e46e96dec), -UINT64_C(0xae0c5e0f7b5d1449), -UINT64_C(0xa517e799c5c6e32f), -UINT64_C(0xc1276908f843b688), -UINT64_C(0xaf7e924d738d87ec), -UINT64_C(0x1c3f3ba863d5c7d1), +UINT64_C (0xb0cdabdae5668cc0), +UINT64_C (0xa3fd1dea5e1864ee), +UINT64_C (0x37e00afb3229fd51), +UINT64_C (0x88b1b58b236f3bea), +UINT64_C (0x6cb24c8fb224980a), +UINT64_C (0x6646287ee2a98083), +UINT64_C (0x35cd8bb5e1fa7256), +UINT64_C (0xb72fe6e16b6fb4e6), +UINT64_C (0xf1397a9f1db4f5d9), +UINT64_C (0x31f25047faa8e5d4), +UINT64_C (0xec616a6e46e96dec), +UINT64_C (0xae0c5e0f7b5d1449), +UINT64_C (0xa517e799c5c6e32f), +UINT64_C (0xc1276908f843b688), +UINT64_C (0xaf7e924d738d87ec), +UINT64_C (0x1c3f3ba863d5c7d1), } }, { 4, { -UINT64_C(0x437057a4eb7c3a13), -UINT64_C(0xe95a0d7fd8c1832c), -UINT64_C(0x71807ff81a0c627e), -UINT64_C(0xfa40f34634632cd2), -UINT64_C(0x39cf61fc694b95b7), -UINT64_C(0x9ca3d6e037621a02), -UINT64_C(0x7be965236729c7d3), -UINT64_C(0xb95fba07afa980ac), -UINT64_C(0x91424978ab94232), -UINT64_C(0x565eb8170fdae341), -UINT64_C(0x0744508beb95a6bb), -UINT64_C(0xf2426b33aa0a601d), -UINT64_C(0x7ddc1fcd0bfec893), -UINT64_C(0x9e09fedd4af1ff3d), -UINT64_C(0xbe77c1bed02132e7), -UINT64_C(0x61e4f6e3e88d34d4), +UINT64_C (0x437057a4eb7c3a13), +UINT64_C (0xe95a0d7fd8c1832c), +UINT64_C (0x71807ff81a0c627e), +UINT64_C (0xfa40f34634632cd2), +UINT64_C (0x39cf61fc694b95b7), +UINT64_C (0x9ca3d6e037621a02), +UINT64_C (0x7be965236729c7d3), +UINT64_C (0xb95fba07afa980ac), +UINT64_C (0x91424978ab94232), +UINT64_C (0x565eb8170fdae341), +UINT64_C (0x0744508beb95a6bb), +UINT64_C (0xf2426b33aa0a601d), +UINT64_C (0x7ddc1fcd0bfec893), +UINT64_C (0x9e09fedd4af1ff3d), +UINT64_C (0xbe77c1bed02132e7), +UINT64_C (0x61e4f6e3e88d34d4), } }, { UINT64_MAX, { -UINT64_C(0x8f5520d52a7ead08), -UINT64_C(0xc476a018caa1802d), -UINT64_C(0x81de31c0d260469e), -UINT64_C(0xbf658d7e065f3c2f), -UINT64_C(0x913593fda1bca32a), -UINT64_C(0xbb535e93941ba525), -UINT64_C(0x5ecda415c3c6dfde), -UINT64_C(0xc487398fc9de9ae2), -UINT64_C(0xa06746dbb57c4d62), -UINT64_C(0x9d414196fdf05c8a), -UINT64_C(0x41cf1af9a178c669), -UINT64_C(0x0b3b3a95e78839f9), -UINT64_C(0x7aaab30444aefc7e), -UINT64_C(0x7b251ec961f341b1), -UINT64_C(0x30ed32acf367205f), -UINT64_C(0xc6ca62fc772728b0), +UINT64_C (0x8f5520d52a7ead08), +UINT64_C (0xc476a018caa1802d), +UINT64_C (0x81de31c0d260469e), +UINT64_C (0xbf658d7e065f3c2f), +UINT64_C (0x913593fda1bca32a), +UINT64_C (0xbb535e93941ba525), +UINT64_C (0x5ecda415c3c6dfde), +UINT64_C (0xc487398fc9de9ae2), +UINT64_C (0xa06746dbb57c4d62), +UINT64_C (0x9d414196fdf05c8a), +UINT64_C (0x41cf1af9a178c669), +UINT64_C (0x0b3b3a95e78839f9), +UINT64_C (0x7aaab30444aefc7e), +UINT64_C (0x7b251ec961f341b1), +UINT64_C (0x30ed32acf367205f), +UINT64_C (0xc6ca62fc772728b0), } }, }; diff --git a/common/allocators/allocator-internal.h b/common/allocators/allocator-internal.h index 728bdbf04151..f73291ab83f7 100644 --- a/common/allocators/allocator-internal.h +++ b/common/allocators/allocator-internal.h @@ -36,7 +36,7 @@ #include "vector.h" struct key_value { char *key, *value; }; -DEFINE_VECTOR_TYPE(allocator_parameters, struct key_value); +DEFINE_VECTOR_TYPE (allocator_parameters, struct key_value); extern void register_allocator (const struct allocator_functions *); diff --git a/common/allocators/allocator.h b/common/allocators/allocator.h index 5d7d3a3d2287..c8ec1af1ba88 100644 --- a/common/allocators/allocator.h +++ b/common/allocators/allocator.h @@ -75,32 +75,32 @@ struct allocator_functions { * nor does it implement bounds checking. */ int (*set_size_hint) (struct allocator *a, uint64_t size) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Read bytes from [offset, offset+count-1] and copy into buf. */ int (*read) (struct allocator *a, void *buf, uint64_t count, uint64_t offset) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); /* Write bytes from buf to [offset, offset+count-1]. Because this * can allocate memory, it can fail (returning -1). */ int (*write) (struct allocator *a, const void *buf, uint64_t count, uint64_t offset) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); /* Fill range [offset, offset+count-1] with a single byte ‘c’. * If c == '\0', this is the same as .zero below. */ int (*fill) (struct allocator *a, char c, uint64_t count, uint64_t offset) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Zero range [offset, offset+count-1]. For all allocators zero and * trim are the same operation. */ int (*zero) (struct allocator *a, uint64_t count, uint64_t offset) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Blit (copy) between two allocators. Copy count bytes from * a1.[offset1, offset1+count-1] to a2.[offset2, offset2+count-1]. @@ -114,13 +114,13 @@ struct allocator_functions { */ int (*blit) (struct allocator *a1, struct allocator *a2, uint64_t count, uint64_t offset1, uint64_t offset2) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); /* Return information about allocated pages and holes. */ int (*extents) (struct allocator *a, uint64_t count, uint64_t offset, struct nbdkit_extents *extents) - __attribute__((__nonnull__ (1, 4))); + __attribute__ ((__nonnull__ (1, 4))); }; struct allocator { @@ -144,10 +144,10 @@ struct allocator { * On error, calls nbdkit_error and returns NULL. */ extern struct allocator *create_allocator (const char *type, bool debug) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); #define CLEANUP_FREE_ALLOCATOR \ - __attribute__((cleanup (cleanup_free_allocator))) + __attribute__ ((cleanup (cleanup_free_allocator))) extern void cleanup_free_allocator (struct allocator **ap); #endif /* NBDKIT_ALLOCATOR_H */ diff --git a/common/bitmap/bitmap.h b/common/bitmap/bitmap.h index c18ae93ac66a..379aa1b7d72c 100644 --- a/common/bitmap/bitmap.h +++ b/common/bitmap/bitmap.h @@ -64,7 +64,7 @@ struct bitmap { size_t size; /* Size of bitmap in bytes. */ }; -static inline void __attribute__((__nonnull__ (1))) +static inline void __attribute__ ((__nonnull__ (1))) bitmap_init (struct bitmap *bm, unsigned blocksize, unsigned bpb) { assert (is_power_of_2 (blocksize)); @@ -99,10 +99,10 @@ bitmap_free (struct bitmap *bm) * Returns -1 on error, setting nbdkit_error. */ extern int bitmap_resize (struct bitmap *bm, uint64_t new_size) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Clear the bitmap (set everything to zero). */ -static inline void __attribute__((__nonnull__ (1))) +static inline void __attribute__ ((__nonnull__ (1))) bitmap_clear (struct bitmap *bm) { memset (bm->bitmap, 0, bm->size); @@ -125,7 +125,7 @@ bitmap_clear (struct bitmap *bm) /* Return the bit(s) associated with the given block. * If the request is out of range, returns the default value. */ -static inline unsigned __attribute__((__nonnull__ (1))) +static inline unsigned __attribute__ ((__nonnull__ (1))) bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) { BITMAP_OFFSET_BIT_MASK (bm, blk); @@ -139,7 +139,7 @@ bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) } /* As above but works with virtual disk offset in bytes. */ -static inline unsigned __attribute__((__nonnull__ (1))) +static inline unsigned __attribute__ ((__nonnull__ (1))) bitmap_get (const struct bitmap *bm, uint64_t offset, unsigned default_) { return bitmap_get_blk (bm, offset / bm->blksize, default_); @@ -148,7 +148,7 @@ bitmap_get (const struct bitmap *bm, uint64_t offset, unsigned default_) /* Set the bit(s) associated with the given block. * If out of range, it is ignored. */ -static inline void __attribute__((__nonnull__ (1))) +static inline void __attribute__ ((__nonnull__ (1))) bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v) { BITMAP_OFFSET_BIT_MASK (bm, blk); @@ -163,7 +163,7 @@ bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v) } /* As above bit works with virtual disk offset in bytes. */ -static inline void __attribute__((__nonnull__ (1))) +static inline void __attribute__ ((__nonnull__ (1))) bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v) { return bitmap_set_blk (bm, offset / bm->blksize, v); @@ -178,6 +178,6 @@ bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v) * bitmap. */ extern int64_t bitmap_next (const struct bitmap *bm, uint64_t blk) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); #endif /* NBDKIT_BITMAP_H */ diff --git a/common/gpt/efi-crc32.h b/common/gpt/efi-crc32.h index e0332ea16878..ea0554958db8 100644 --- a/common/gpt/efi-crc32.h +++ b/common/gpt/efi-crc32.h @@ -36,6 +36,6 @@ #include <stdint.h> extern uint32_t efi_crc32 (const void *buf, size_t len) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); #endif /* NBDKIT_EFI_CRC32_H */ diff --git a/common/protocol/nbd-protocol.h b/common/protocol/nbd-protocol.h index e5d6404b8eaa..9353668605ff 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -40,8 +40,8 @@ * these structures. */ -#if defined(__GNUC__) || defined(__clang__) -#define NBD_ATTRIBUTE_PACKED __attribute__((__packed__)) +#if defined (__GNUC__) || defined (__clang__) +#define NBD_ATTRIBUTE_PACKED __attribute__ ((__packed__)) #else #error "Please port to your compiler's notion of a packed struct" #endif @@ -58,8 +58,8 @@ struct nbd_old_handshake { char zeroes[124]; /* must be sent as zero bytes */ } NBD_ATTRIBUTE_PACKED; -#define NBD_MAGIC UINT64_C(0x4e42444d41474943) /* ASCII "NBDMAGIC" */ -#define NBD_OLD_VERSION UINT64_C(0x0000420281861253) +#define NBD_MAGIC UINT64_C (0x4e42444d41474943) /* ASCII "NBDMAGIC" */ +#define NBD_OLD_VERSION UINT64_C (0x0000420281861253) /* New-style handshake. */ struct nbd_new_handshake { @@ -68,7 +68,7 @@ struct nbd_new_handshake { uint16_t gflags; /* global flags */ } NBD_ATTRIBUTE_PACKED; -#define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) /* ASCII "IHAVEOPT" */ +#define NBD_NEW_VERSION UINT64_C (0x49484156454F5054) /* ASCII "IHAVEOPT" */ /* New-style handshake option (sent by the client to us). */ struct nbd_new_option { @@ -95,7 +95,7 @@ struct nbd_fixed_new_option_reply { uint32_t replylen; } NBD_ATTRIBUTE_PACKED; -#define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) +#define NBD_REP_MAGIC UINT64_C (0x3e889045565a9) /* Global flags. */ #define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) diff --git a/common/regions/regions.h b/common/regions/regions.h index 3d5623165884..1325324be803 100644 --- a/common/regions/regions.h +++ b/common/regions/regions.h @@ -73,22 +73,22 @@ struct region { }; /* Vector of struct region. */ -DEFINE_VECTOR_TYPE(regions, struct region); +DEFINE_VECTOR_TYPE (regions, struct region); extern void init_regions (regions *regions) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern void free_regions (regions *regions) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Return the number of regions. */ -static inline size_t __attribute__((__nonnull__ (1))) +static inline size_t __attribute__ ((__nonnull__ (1))) nr_regions (regions *rs) { return rs->len; } /* Return the virtual size of the disk. */ -static inline int64_t __attribute__((__nonnull__ (1))) +static inline int64_t __attribute__ ((__nonnull__ (1))) virtual_size (regions *rs) { if (rs->len == 0) @@ -102,7 +102,7 @@ virtual_size (regions *rs) */ extern const struct region *find_region (const regions *regions, uint64_t offset) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* Append one region of a given length, plus up to two optional * padding regions. diff --git a/common/replacements/strndup.h b/common/replacements/strndup.h index e8a6d4a6ffb0..65bcde07e1ff 100644 --- a/common/replacements/strndup.h +++ b/common/replacements/strndup.h @@ -40,7 +40,7 @@ #ifndef HAVE_STRNDUP -char *strndup(const char *s, size_t n); +char *strndup (const char *s, size_t n); #endif diff --git a/common/utils/cleanup.h b/common/utils/cleanup.h index 87eda8101eaa..0ee12276a80b 100644 --- a/common/utils/cleanup.h +++ b/common/utils/cleanup.h @@ -44,20 +44,20 @@ extern "C" { /* Work around clang bug: https://bugs.llvm.org/show_bug.cgi?id=43482 */ #ifdef __clang__ -#define CLANG_UNUSED_VARIABLE_WORKAROUND __attribute__((__unused__)) +#define CLANG_UNUSED_VARIABLE_WORKAROUND __attribute__ ((__unused__)) #else #define CLANG_UNUSED_VARIABLE_WORKAROUND #endif /* cleanup.c */ extern void cleanup_free (void *ptr); -#define CLEANUP_FREE __attribute__((cleanup (cleanup_free))) +#define CLEANUP_FREE __attribute__ ((cleanup (cleanup_free))) extern void cleanup_mutex_unlock (pthread_mutex_t **ptr); -#define CLEANUP_MUTEX_UNLOCK __attribute__((cleanup (cleanup_mutex_unlock))) +#define CLEANUP_MUTEX_UNLOCK __attribute__ ((cleanup (cleanup_mutex_unlock))) -#define ACQUIRE_LOCK_FOR_CURRENT_SCOPE(mutex) \ - ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1((mutex), NBDKIT_UNIQUE_NAME(_lock)) +#define ACQUIRE_LOCK_FOR_CURRENT_SCOPE(mutex) \ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1 ((mutex), NBDKIT_UNIQUE_NAME (_lock)) #define ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1(mutex, lock) \ CLEANUP_MUTEX_UNLOCK pthread_mutex_t *lock = mutex; \ do { \ @@ -66,10 +66,10 @@ extern void cleanup_mutex_unlock (pthread_mutex_t **ptr); } while (0) extern void cleanup_rwlock_unlock (pthread_rwlock_t **ptr); -#define CLEANUP_RWLOCK_UNLOCK __attribute__((cleanup (cleanup_rwlock_unlock))) +#define CLEANUP_RWLOCK_UNLOCK __attribute__ ((cleanup (cleanup_rwlock_unlock))) -#define ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE(rwlock) \ - ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE_1((rwlock), NBDKIT_UNIQUE_NAME(_lock)) +#define ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE(rwlock) \ + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE_1 ((rwlock), NBDKIT_UNIQUE_NAME (_lock)) #define ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE_1(rwlock, lock) \ CLEANUP_RWLOCK_UNLOCK pthread_rwlock_t *lock = rwlock; \ do { \ @@ -77,8 +77,8 @@ extern void cleanup_rwlock_unlock (pthread_rwlock_t **ptr); assert (!_r); \ } while (0) -#define ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE(rwlock) \ - ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE_1((rwlock), NBDKIT_UNIQUE_NAME(_lock)) +#define ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE(rwlock) \ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE_1 ((rwlock), NBDKIT_UNIQUE_NAME (_lock)) #define ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE_1(rwlock, lock) \ CLEANUP_RWLOCK_UNLOCK pthread_rwlock_t *lock = rwlock; \ do { \ @@ -89,10 +89,10 @@ extern void cleanup_rwlock_unlock (pthread_rwlock_t **ptr); /* cleanup-nbdkit.c */ struct nbdkit_extents; extern void cleanup_extents_free (struct nbdkit_extents **ptr); -#define CLEANUP_EXTENTS_FREE __attribute__((cleanup (cleanup_extents_free))) +#define CLEANUP_EXTENTS_FREE __attribute__ ((cleanup (cleanup_extents_free))) struct nbdkit_exports; extern void cleanup_exports_free (struct nbdkit_exports **ptr); -#define CLEANUP_EXPORTS_FREE __attribute__((cleanup (cleanup_exports_free))) +#define CLEANUP_EXPORTS_FREE __attribute__ ((cleanup (cleanup_exports_free))) #ifdef __cplusplus } /* extern "C" */ diff --git a/common/utils/const-string-vector.h b/common/utils/const-string-vector.h index 5db21927c607..d6d847a8b39d 100644 --- a/common/utils/const-string-vector.h +++ b/common/utils/const-string-vector.h @@ -37,10 +37,10 @@ #include "vector.h" -DEFINE_VECTOR_TYPE(const_string_vector, const char *); +DEFINE_VECTOR_TYPE (const_string_vector, const char *); /* This frees only the array. */ #define CLEANUP_FREE_CONST_STRING_VECTOR \ - __attribute__((cleanup (const_string_vector_reset))) + __attribute__ ((cleanup (const_string_vector_reset))) #endif /* CONST_STRING_VECTOR_H */ diff --git a/common/utils/nbdkit-string.h b/common/utils/nbdkit-string.h index de8abd9ae5e3..d455010663db 100644 --- a/common/utils/nbdkit-string.h +++ b/common/utils/nbdkit-string.h @@ -37,7 +37,7 @@ #include "vector.h" -DEFINE_VECTOR_TYPE(string, char); -#define CLEANUP_FREE_STRING __attribute__((cleanup (string_reset))) +DEFINE_VECTOR_TYPE (string, char); +#define CLEANUP_FREE_STRING __attribute__ ((cleanup (string_reset))) #endif /* NBDKIT_STRING_H */ diff --git a/common/utils/string-vector.h b/common/utils/string-vector.h index 42340b1def0f..7309ca4aa13d 100644 --- a/common/utils/string-vector.h +++ b/common/utils/string-vector.h @@ -37,13 +37,13 @@ #include "vector.h" -DEFINE_VECTOR_TYPE(string_vector, char *); +DEFINE_VECTOR_TYPE (string_vector, char *); /* This frees both the array and the strings. */ #define CLEANUP_FREE_STRING_VECTOR \ - __attribute__((cleanup (cleanup_free_string_vector))) + __attribute__ ((cleanup (cleanup_free_string_vector))) -static void __attribute__((__unused__)) +static void __attribute__ ((__unused__)) cleanup_free_string_vector (string_vector *v) { string_vector_iter (v, (void*)free); diff --git a/common/utils/utils.h b/common/utils/utils.h index 83397ae10bb1..9aa6155acc62 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -38,7 +38,7 @@ extern void uri_quote (const char *str, FILE *fp); extern int exit_status_to_nbd_error (int status, const char *cmd); extern int set_cloexec (int fd); extern int set_nonblock (int fd); -extern char **copy_environ (char **env, ...) __attribute__((__sentinel__)); +extern char **copy_environ (char **env, ...) __attribute__ ((__sentinel__)); extern char *make_temporary_directory (void); extern ssize_t full_pread (int fd, void *buf, size_t count, off_t offset); extern ssize_t full_pwrite (int fd, const void *buf, size_t count, off_t offset); diff --git a/common/utils/vector.h b/common/utils/vector.h index d3a669251fa8..90bbabd64c56 100644 --- a/common/utils/vector.h +++ b/common/utils/vector.h @@ -52,7 +52,7 @@ /* Use of this macro defines a new type called ‘name’ containing an * extensible vector of ‘type’ elements. For example: * - * DEFINE_VECTOR_TYPE(string_vector, char *) + * DEFINE_VECTOR_TYPE (string_vector, char *) * * defines a new type called ‘string_vector’ as a vector of ‘char *’. * You can create variables of this type: @@ -94,7 +94,7 @@ * allocated and capacity is increased, but the vector length is \ * not increased and the new elements are not initialized. \ */ \ - static inline int __attribute__((__unused__)) \ + static inline int __attribute__ ((__unused__)) \ name##_reserve (name *v, size_t n) \ { \ return generic_vector_reserve ((struct generic_vector *)v, n, \ @@ -104,7 +104,7 @@ /* Same as _reserve, but the allocation will be page aligned. Note \ * that the machine page size must be divisible by sizeof (type). \ */ \ - static inline int __attribute__((__unused__)) \ + static inline int __attribute__ ((__unused__)) \ name##_reserve_page_aligned (name *v, size_t n) \ { \ return generic_vector_reserve_page_aligned ((struct generic_vector *)v, \ @@ -112,7 +112,7 @@ } \ \ /* Insert at i'th element. i=0 => beginning i=len => append */ \ - static inline int __attribute__((__unused__)) \ + static inline int __attribute__ ((__unused__)) \ name##_insert (name *v, type elem, size_t i) \ { \ assert (i <= v->len); \ @@ -126,14 +126,14 @@ } \ \ /* Append a new element to the end of the vector. */ \ - static inline int __attribute__((__unused__)) \ + static inline int __attribute__ ((__unused__)) \ name##_append (name *v, type elem) \ { \ return name##_insert (v, elem, v->len); \ } \ \ /* Remove i'th element. i=0 => beginning i=len-1 => end */ \ - static inline void __attribute__((__unused__)) \ + static inline void __attribute__ ((__unused__)) \ name##_remove (name *v, size_t i) \ { \ assert (i < v->len); \ @@ -142,7 +142,7 @@ } \ \ /* Remove all elements and deallocate the vector. */ \ - static inline void __attribute__((__unused__)) \ + static inline void __attribute__ ((__unused__)) \ name##_reset (name *v) \ { \ free (v->ptr); \ @@ -151,7 +151,7 @@ } \ \ /* Iterate over the vector, calling f() on each element. */ \ - static inline void __attribute__((__unused__)) \ + static inline void __attribute__ ((__unused__)) \ name##_iter (name *v, void (*f) (type elem)) \ { \ size_t i; \ @@ -160,7 +160,7 @@ } \ \ /* Sort the elements of the vector. */ \ - static inline void __attribute__((__unused__)) \ + static inline void __attribute__ ((__unused__)) \ name##_sort (name *v, \ int (*compare) (const type *p1, const type *p2)) \ { \ @@ -170,7 +170,7 @@ /* Search for an exactly matching element in the vector using a \ * binary search. Returns a pointer to the element or NULL. \ */ \ - static inline type * __attribute__((__unused__)) \ + static inline type * __attribute__ ((__unused__)) \ name##_search (const name *v, const void *key, \ int (*compare) (const void *key, const type *v)) \ { \ @@ -179,7 +179,7 @@ } \ \ /* Make a new vector with the same elements. */ \ - static inline int __attribute__((__unused__)) \ + static inline int __attribute__ ((__unused__)) \ name##_duplicate (name *v, name *copy) \ { \ /* Note it's allowed for v and copy to be the same pointer. */ \ diff --git a/server/connections.c b/server/connections.c index 6d9f6a961be3..2d146646837a 100644 --- a/server/connections.c +++ b/server/connections.c @@ -333,7 +333,7 @@ new_connection (int sockin, int sockout, int nworkers) return conn; -#if defined(HAVE_PIPE2) || defined(HAVE_PIPE) +#if defined (HAVE_PIPE2) || defined (HAVE_PIPE) error2: #endif if (conn->status_pipe[0] >= 0) diff --git a/server/crypto.c b/server/crypto.c index 51c9deff27b5..873fcd32ab54 100644 --- a/server/crypto.c +++ b/server/crypto.c @@ -73,7 +73,7 @@ static gnutls_certificate_credentials_t x509_creds; static gnutls_psk_server_credentials_t psk_creds; static void print_gnutls_error (int err, const char *fs, ...) - ATTRIBUTE_FORMAT_PRINTF(2, 3); + ATTRIBUTE_FORMAT_PRINTF (2, 3); static void print_gnutls_error (int err, const char *fs, ...) diff --git a/server/exports.c b/server/exports.c index 12c8a879870b..5184696a3a83 100644 --- a/server/exports.c +++ b/server/exports.c @@ -48,7 +48,7 @@ #define MAX_EXPORTS 10000 /* Appendable list of exports. */ -DEFINE_VECTOR_TYPE(exports, struct nbdkit_export); +DEFINE_VECTOR_TYPE (exports, struct nbdkit_export); struct nbdkit_exports { exports exports; diff --git a/server/extents.c b/server/extents.c index e180e31358b7..f2c8673b050c 100644 --- a/server/extents.c +++ b/server/extents.c @@ -56,7 +56,7 @@ #define MAX_EXTENTS (1 * 1024 * 1024) /* Appendable list of extents. */ -DEFINE_VECTOR_TYPE(extents, struct nbdkit_extent); +DEFINE_VECTOR_TYPE (extents, struct nbdkit_extent); struct nbdkit_extents { extents extents; @@ -221,14 +221,14 @@ nbdkit_extents_aligned (struct context *next_c, size_t i; struct nbdkit_extent *e, *e2; - assert (IS_ALIGNED(count | offset, align)); + assert (IS_ALIGNED (count | offset, align)); /* Perform an initial query, then scan for the first unaligned extent. */ if (next->extents (next_c, count, offset, flags, exts, err) == -1) return -1; for (i = 0; i < exts->extents.len; ++i) { e = &exts->extents.ptr[i]; - if (!IS_ALIGNED(e->length, align)) { + if (!IS_ALIGNED (e->length, align)) { /* If the unalignment is past align, just truncate and return early */ if (e->offset + e->length > offset + align) { e->length = ROUND_DOWN (e->length, align); diff --git a/server/main.c b/server/main.c index c9b2f9d92066..a213f6d59c09 100644 --- a/server/main.c +++ b/server/main.c @@ -372,7 +372,7 @@ main (int argc, char *argv[]) break; case VSOCK_OPTION: -#if defined(AF_VSOCK) && defined(VMADDR_CID_ANY) +#if defined (AF_VSOCK) && defined (VMADDR_CID_ANY) vsock = true; break; #else @@ -1092,7 +1092,7 @@ error_if_stdio_closed (void) static void switch_stdio (void) { -#if defined(F_DUPFD_CLOEXEC) || defined(F_DUPFD) +#if defined (F_DUPFD_CLOEXEC) || defined (F_DUPFD) fflush (stdin); fflush (NULL); if (listen_stdin || run) { diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c index 4e16b72cf36d..4b4a13599367 100644 --- a/server/protocol-handshake-newstyle.c +++ b/server/protocol-handshake-newstyle.c @@ -261,7 +261,7 @@ send_newstyle_option_reply_meta_context (uint32_t option, uint32_t reply, /* Sub-function during negotiate_handshake_newstyle, to uniformly handle * a client hanging up on a message boundary. */ -static int ATTRIBUTE_FORMAT_PRINTF(3, 4) +static int ATTRIBUTE_FORMAT_PRINTF (3, 4) conn_recv_full (void *buf, size_t len, const char *fmt, ...) { GET_CONN; diff --git a/server/public.c b/server/public.c index 74ac18a1da72..5dfdfbf92ad9 100644 --- a/server/public.c +++ b/server/public.c @@ -711,7 +711,7 @@ nbdkit_nanosleep (unsigned sec, unsigned nsec) /* Block all signals to this thread during the poll, so we don't * have to worry about EINTR */ - if (sigfillset(&all)) + if (sigfillset (&all)) abort (); switch (ppoll (fds, ARRAY_SIZE (fds), &ts, &all)) { case -1: @@ -826,8 +826,8 @@ nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen) return 0; } -#if defined(SO_PEERCRED) && \ - (defined(HAVE_STRUCT_UCRED_UID) || defined(HAVE_STRUCT_SOCKPEERCRED_UID)) +#if defined (SO_PEERCRED) && \ + (defined (HAVE_STRUCT_UCRED_UID) || defined (HAVE_STRUCT_SOCKPEERCRED_UID)) #define GET_PEERCRED_DEFINED 1 diff --git a/server/socket-activation.c b/server/socket-activation.c index a49e1cc0c981..379355d9b7e7 100644 --- a/server/socket-activation.c +++ b/server/socket-activation.c @@ -100,7 +100,7 @@ get_socket_activation (void) */ fprintf (stderr, "%s: socket activation: " "invalid file descriptor fd = %d: %s\n", - program_name, fd, strerror(errno)); + program_name, fd, strerror (errno)); exit (EXIT_FAILURE); } } diff --git a/server/sockets.c b/server/sockets.c index 08f46e6b4eef..8272be8f13be 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -278,7 +278,7 @@ bind_tcpip_socket (sockets *socks) void bind_vsock (sockets *socks) { -#if defined(AF_VSOCK) && defined(VMADDR_CID_ANY) +#if defined (AF_VSOCK) && defined (VMADDR_CID_ANY) uint32_t vsock_port; int sock; struct sockaddr_vm addr; diff --git a/server/test-public.c b/server/test-public.c index e0249fc74e3f..56174460e18e 100644 --- a/server/test-public.c +++ b/server/test-public.c @@ -205,7 +205,7 @@ test_nbdkit_parse_ints (void) { bool pass = true; -#define PARSE(...) PARSE_(__VA_ARGS__) +#define PARSE(...) PARSE_ (__VA_ARGS__) #define PARSE_(TYPE, FORMAT, TEST, RET, EXPECTED) \ do { \ error_flagged = false; \ diff --git a/server/usergroup.c b/server/usergroup.c index 1bede73f565d..279e565bf018 100644 --- a/server/usergroup.c +++ b/server/usergroup.c @@ -50,7 +50,7 @@ #include "internal.h" -#if defined(HAVE_PWD_H) && defined(HAVE_GRP_H) +#if defined (HAVE_PWD_H) && defined (HAVE_GRP_H) static uid_t parseuser (const char *); static gid_t parsegroup (const char *); diff --git a/common/allocators/allocator.c b/common/allocators/allocator.c index 880954d7e911..ab742f4e66dd 100644 --- a/common/allocators/allocator.c +++ b/common/allocators/allocator.c @@ -45,7 +45,7 @@ #include "vector.h" /* The list of registered allocators. */ -DEFINE_VECTOR_TYPE(allocator_list, const struct allocator_functions *); +DEFINE_VECTOR_TYPE (allocator_list, const struct allocator_functions *); static allocator_list allocators = empty_vector; void diff --git a/common/allocators/malloc.c b/common/allocators/malloc.c index 19df666afaff..52dea4106a55 100644 --- a/common/allocators/malloc.c +++ b/common/allocators/malloc.c @@ -55,7 +55,7 @@ * malloc, with optional mlock. */ -DEFINE_VECTOR_TYPE(bytearray, uint8_t); +DEFINE_VECTOR_TYPE (bytearray, uint8_t); struct m_alloc { struct allocator a; /* Must come first. */ @@ -315,7 +315,7 @@ static struct allocator_functions functions = { .extents = m_alloc_extents, }; -static void register_malloc (void) __attribute__((constructor)); +static void register_malloc (void) __attribute__ ((constructor)); static void register_malloc (void) diff --git a/common/allocators/sparse.c b/common/allocators/sparse.c index fd89549dafdf..de90c6a67b9b 100644 --- a/common/allocators/sparse.c +++ b/common/allocators/sparse.c @@ -124,7 +124,7 @@ struct l1_entry { struct l2_entry *l2_dir; /* Pointer to L2 directory (L2_SIZE entries). */ }; -DEFINE_VECTOR_TYPE(l1_dir, struct l1_entry); +DEFINE_VECTOR_TYPE (l1_dir, struct l1_entry); struct sparse_array { struct allocator a; /* Must come first. */ @@ -541,7 +541,7 @@ static struct allocator_functions functions = { .extents = sparse_array_extents, }; -static void register_sparse_array (void) __attribute__((constructor)); +static void register_sparse_array (void) __attribute__ ((constructor)); static void register_sparse_array (void) diff --git a/common/allocators/zstd.c b/common/allocators/zstd.c index 1675d21c695e..ff2e950e337b 100644 --- a/common/allocators/zstd.c +++ b/common/allocators/zstd.c @@ -85,7 +85,7 @@ struct l1_entry { struct l2_entry *l2_dir; /* Pointer to L2 directory (L2_SIZE entries). */ }; -DEFINE_VECTOR_TYPE(l1_dir, struct l1_entry); +DEFINE_VECTOR_TYPE (l1_dir, struct l1_entry); struct zstd_array { struct allocator a; /* Must come first. */ @@ -645,7 +645,7 @@ static struct allocator_functions functions = { .extents = zstd_array_extents, }; -static void register_zstd_array (void) __attribute__((constructor)); +static void register_zstd_array (void) __attribute__ ((constructor)); static void register_zstd_array (void) diff --git a/common/bitmap/bitmap.c b/common/bitmap/bitmap.c index 2cc625cb2cb8..89c815cac788 100644 --- a/common/bitmap/bitmap.c +++ b/common/bitmap/bitmap.c @@ -52,7 +52,7 @@ bitmap_resize (struct bitmap *bm, uint64_t new_size) size_t new_bm_size; new_bm_size_u64 = DIV_ROUND_UP (new_size, - bm->blksize * UINT64_C(8) / bm->bpb); + bm->blksize * UINT64_C (8) / bm->bpb); if (new_bm_size_u64 > SIZE_MAX) { nbdkit_error ("bitmap too large for this architecture"); return -1; diff --git a/common/regions/regions.c b/common/regions/regions.c index 841c5c40f5fe..26f9c95e44ae 100644 --- a/common/regions/regions.c +++ b/common/regions/regions.c @@ -82,7 +82,7 @@ find_region (const regions *rs, uint64_t offset) * and contiguous) is maintained. Note it is not possible to * construct regions out of order using this function. */ -static int __attribute__((__nonnull__ (1))) +static int __attribute__ ((__nonnull__ (1))) append_one_region (regions *rs, struct region region) { /* The assertions in this function are meant to maintain the diff --git a/common/replacements/open_memstream.c b/common/replacements/open_memstream.c index 82ff13153773..e2d556e59fa2 100644 --- a/common/replacements/open_memstream.c +++ b/common/replacements/open_memstream.c @@ -62,7 +62,7 @@ struct file_to_memstream { char **ptr; size_t *size; }; -DEFINE_VECTOR_TYPE(file_vector, struct file_to_memstream) +DEFINE_VECTOR_TYPE (file_vector, struct file_to_memstream) static file_vector files = empty_vector; FILE * @@ -77,7 +77,7 @@ open_memstream (char **ptr, size_t *size) if (ret > MAX_PATH || ret == 0) return NULL; - ret = GetTempFileName (tmppath, TEXT("nbdkit"), 0, f2m.tmpname); + ret = GetTempFileName (tmppath, TEXT ("nbdkit"), 0, f2m.tmpname); if (!ret) return NULL; diff --git a/common/replacements/strndup.c b/common/replacements/strndup.c index 976a25f4fe58..c6b59b53fea9 100644 --- a/common/replacements/strndup.c +++ b/common/replacements/strndup.c @@ -48,7 +48,7 @@ strndup (const char *str, size_t n) for (len = 0; len < n && str[len]; len++) continue; - if (!(copy = malloc(len + 1))) + if (!(copy = malloc (len + 1))) return NULL; memcpy (copy, str, len); copy[len] = '\0'; diff --git a/common/utils/exit-with-parent.c b/common/utils/exit-with-parent.c index 2d6d6e3d8f2a..c16a31cf0875 100644 --- a/common/utils/exit-with-parent.c +++ b/common/utils/exit-with-parent.c @@ -48,7 +48,7 @@ #include <sys/procctl.h> #endif -#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_PDEATHSIG) +#if defined (HAVE_SYS_PRCTL_H) && defined (PR_SET_PDEATHSIG) /* For Linux >= 2.1.57. */ @@ -64,7 +64,7 @@ can_exit_with_parent (void) return true; } -#elif defined(HAVE_SYS_PROCCTL_H) && defined(PROC_PDEATHSIG_CTL) +#elif defined (HAVE_SYS_PROCCTL_H) && defined (PROC_PDEATHSIG_CTL) /* For FreeBSD >= 11.2 */ @@ -81,7 +81,7 @@ can_exit_with_parent (void) return true; } -#elif defined(__APPLE__) +#elif defined (__APPLE__) /* For macOS. */ diff --git a/common/utils/test-vector.c b/common/utils/test-vector.c index 5249acd594f6..9078efb55347 100644 --- a/common/utils/test-vector.c +++ b/common/utils/test-vector.c @@ -50,8 +50,8 @@ #define APPENDS 1000000 -DEFINE_VECTOR_TYPE(int64_vector, int64_t); -DEFINE_VECTOR_TYPE(uint32_vector, uint32_t); +DEFINE_VECTOR_TYPE (int64_vector, int64_t); +DEFINE_VECTOR_TYPE (uint32_vector, uint32_t); static int compare (const int64_t *a, const int64_t *b) diff --git a/common/utils/utils.c b/common/utils/utils.c index 95b8c6ea07bd..896594dd7066 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -211,7 +211,7 @@ make_temporary_directory (void) return NULL; } - ret = GetTempFileName (tmppath, TEXT("nbdkit"), 0, tmpname); + ret = GetTempFileName (tmppath, TEXT ("nbdkit"), 0, tmpname); if (!ret) { fprintf (stderr, "mkdtemp: GetTempFileName: %lu\n", GetLastError ()); return NULL; diff --git a/plugins/curl/curldefs.h b/plugins/curl/curldefs.h index ea718e664b51..13d31e9d21b6 100644 --- a/plugins/curl/curldefs.h +++ b/plugins/curl/curldefs.h @@ -41,7 +41,7 @@ * macro isn't present then Curl is very old. */ #ifdef CURL_AT_LEAST_VERSION -#if CURL_AT_LEAST_VERSION(7, 55, 0) +#if CURL_AT_LEAST_VERSION (7, 55, 0) #define HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T #endif #endif diff --git a/plugins/floppy/virtual-floppy.h b/plugins/floppy/virtual-floppy.h index b8c555f88eb5..3be7c096cf7c 100644 --- a/plugins/floppy/virtual-floppy.h +++ b/plugins/floppy/virtual-floppy.h @@ -39,7 +39,7 @@ #include "regions.h" #include "vector.h" -DEFINE_VECTOR_TYPE(idxs, size_t); +DEFINE_VECTOR_TYPE (idxs, size_t); struct partition_entry { uint8_t bootable; /* 0x00 or 0x80 if bootable */ @@ -48,7 +48,7 @@ struct partition_entry { uint8_t chs2[3]; /* always set to chs_too_large */ uint32_t start_sector; /* 2048 */ uint32_t num_sectors; -} __attribute__((packed)); +} __attribute__ ((packed)); struct bootsector { uint8_t jmp_insn[3]; @@ -91,7 +91,7 @@ struct bootsector { struct partition_entry partition[4]; /* 0x01BE - partition table */ uint8_t boot_signature[2]; /* 0x01FE - 0x55 0xAA */ -} __attribute__((packed)); +} __attribute__ ((packed)); struct fsinfo { uint8_t signature[4]; /* 0x52 0x52 0x61 0x41 "RRaA" */ @@ -101,7 +101,7 @@ struct fsinfo { uint32_t last_free_cluster; uint8_t reserved2[12]; uint8_t signature3[4]; /* 0x00 0x00 0x55 0xAA */ -} __attribute__((packed)); +} __attribute__ ((packed)); struct file { char *name; /* Filename. */ @@ -111,7 +111,7 @@ struct file { uint32_t nr_clusters; /* Number of clusters. */ }; -DEFINE_VECTOR_TYPE(files, struct file); +DEFINE_VECTOR_TYPE (files, struct file); /* On disk directory entry (non-LFN). */ struct dir_entry { @@ -133,9 +133,9 @@ struct dir_entry { uint16_t mdate; /* 0x18 */ uint16_t cluster_lo; /* 0x1A - first cluster (low word) */ uint32_t size; /* 0x1C - file size */ -} __attribute__((packed)); +} __attribute__ ((packed)); -DEFINE_VECTOR_TYPE(dir_entries, struct dir_entry); +DEFINE_VECTOR_TYPE (dir_entries, struct dir_entry); /* On disk directory entry (LFN). */ struct lfn_entry { @@ -147,7 +147,7 @@ struct lfn_entry { uint16_t name2[6]; /* next six UTF-16LE characters */ uint16_t cluster_lo; /* 0x1A - always 0x0000 */ uint16_t name3[2]; /* last two UTF-16LE characters */ -} __attribute__((packed)); +} __attribute__ ((packed)); struct dir { size_t pdi; /* Link to parent directory (for root, 0). */ @@ -170,7 +170,7 @@ struct dir { dir_entries table; }; -DEFINE_VECTOR_TYPE(dirs, struct dir); +DEFINE_VECTOR_TYPE (dirs, struct dir); struct virtual_floppy { /* Virtual disk layout. */ @@ -228,20 +228,20 @@ struct virtual_floppy { #define CLUSTER_SIZE (SECTOR_SIZE * SECTORS_PER_CLUSTER) extern void init_virtual_floppy (struct virtual_floppy *floppy) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int create_virtual_floppy (const char *dir, const char *label, uint64_t size, struct virtual_floppy *floppy) - __attribute__((__nonnull__ (1, 2, 4))); + __attribute__ ((__nonnull__ (1, 2, 4))); extern void free_virtual_floppy (struct virtual_floppy *floppy) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int create_directory (size_t di, const char *label, struct virtual_floppy *floppy) - __attribute__((__nonnull__ (2, 3))); + __attribute__ ((__nonnull__ (2, 3))); extern int update_directory_first_cluster (size_t di, struct virtual_floppy *floppy) - __attribute__((__nonnull__ (2))); + __attribute__ ((__nonnull__ (2))); extern void pad_string (const char *label, size_t n, uint8_t *out) - __attribute__((__nonnull__ (1, 3))); + __attribute__ ((__nonnull__ (1, 3))); #endif /* NBDKIT_VIRTUAL_FLOPPY_H */ diff --git a/plugins/linuxdisk/virtual-disk.h b/plugins/linuxdisk/virtual-disk.h index 3f62b5c63869..1faae4b8baec 100644 --- a/plugins/linuxdisk/virtual-disk.h +++ b/plugins/linuxdisk/virtual-disk.h @@ -76,11 +76,11 @@ struct virtual_disk { /* virtual-disk.c */ extern void init_virtual_disk (struct virtual_disk *disk) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern int create_virtual_disk (struct virtual_disk *disk) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern void free_virtual_disk (struct virtual_disk *disk) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); /* partition-gpt.c */ extern int create_partition_table (struct virtual_disk *disk); diff --git a/plugins/ocaml/callbacks.h b/plugins/ocaml/callbacks.h index 1f53143d89dc..46bf548d1fdd 100644 --- a/plugins/ocaml/callbacks.h +++ b/plugins/ocaml/callbacks.h @@ -33,37 +33,37 @@ /* This is not a header file. It is included at various places in * plugin.c as a convenient way to define per-callback things. */ -CB(after_fork) -CB(block_size) -CB(cache) -CB(can_cache) -CB(can_extents) -CB(can_fast_zero) -CB(can_flush) -CB(can_fua) -CB(can_multi_conn) -CB(can_trim) -CB(can_write) -CB(can_zero) -CB(cleanup) -CB(close) -CB(config) -CB(config_complete) -CB(default_export) -CB(dump_plugin) -CB(export_description) -CB(extents) -CB(flush) -CB(get_ready) -CB(get_size) -CB(is_rotational) -CB(list_exports) -CB(load) -CB(open) -CB(pread) -CB(preconnect) -CB(pwrite) -CB(thread_model) -CB(trim) -CB(unload) -CB(zero) +CB (after_fork) +CB (block_size) +CB (cache) +CB (can_cache) +CB (can_extents) +CB (can_fast_zero) +CB (can_flush) +CB (can_fua) +CB (can_multi_conn) +CB (can_trim) +CB (can_write) +CB (can_zero) +CB (cleanup) +CB (close) +CB (config) +CB (config_complete) +CB (default_export) +CB (dump_plugin) +CB (export_description) +CB (extents) +CB (flush) +CB (get_ready) +CB (get_size) +CB (is_rotational) +CB (list_exports) +CB (load) +CB (open) +CB (pread) +CB (preconnect) +CB (pwrite) +CB (thread_model) +CB (trim) +CB (unload) +CB (zero) diff --git a/plugins/ocaml/plugin.h b/plugins/ocaml/plugin.h index eae84311c2aa..cd9d3fd64ecc 100644 --- a/plugins/ocaml/plugin.h +++ b/plugins/ocaml/plugin.h @@ -52,7 +52,7 @@ caml_alloc_initialized_string (mlsize_t len, const char *p) * ensures that the calls are paired properly. */ #define LEAVE_BLOCKING_SECTION_FOR_CURRENT_SCOPE() \ - __attribute__((unused, cleanup (cleanup_enter_blocking_section))) \ + __attribute__ ((unused, cleanup (cleanup_enter_blocking_section))) \ int _unused; \ caml_leave_blocking_section () static inline void diff --git a/plugins/partitioning/virtual-disk.h b/plugins/partitioning/virtual-disk.h index d56c2b867d3e..8bafd467a0ad 100644 --- a/plugins/partitioning/virtual-disk.h +++ b/plugins/partitioning/virtual-disk.h @@ -42,7 +42,7 @@ #include "gpt.h" #include "regions.h" -#define SECTOR_SIZE UINT64_C(512) +#define SECTOR_SIZE UINT64_C (512) /* Maximum size of MBR disks. This is an approximation based on the * known limit (2^32 sectors) and an estimate based on the amount of @@ -88,7 +88,7 @@ struct file { char type_guid[16]; /* partition type GUID of this partition */ }; -DEFINE_VECTOR_TYPE(files, struct file); +DEFINE_VECTOR_TYPE (files, struct file); extern files the_files; extern regions the_regions; @@ -101,7 +101,7 @@ extern int create_virtual_disk_layout (void); * characteristics which make them unlike general GUIDs. */ extern int parse_guid (const char *str, char *out) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); /* Internal function for creating a single MBR PTE. The GPT code * calls this for creating the protective MBR. @@ -109,7 +109,7 @@ extern int parse_guid (const char *str, char *out) extern void create_mbr_partition_table_entry (const struct region *, bool bootable, int partition_id, unsigned char *) - __attribute__((__nonnull__ (1, 4))); + __attribute__ ((__nonnull__ (1, 4))); /* Create MBR or GPT layout. */ extern void create_mbr_layout (void); diff --git a/plugins/python/plugin.h b/plugins/python/plugin.h index 57ab2cb6e7a3..819558c4acee 100644 --- a/plugins/python/plugin.h +++ b/plugins/python/plugin.h @@ -47,9 +47,9 @@ * https://docs.python.org/3/c-api/init.html#non-python-created-threads */ #define ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE \ - __attribute__((cleanup (cleanup_release))) \ + __attribute__ ((cleanup (cleanup_release))) \ CLANG_UNUSED_VARIABLE_WORKAROUND \ - PyGILState_STATE gstate = PyGILState_Ensure() + PyGILState_STATE gstate = PyGILState_Ensure () static inline void cleanup_release (PyGILState_STATE *gstateptr) { diff --git a/plugins/sh/call.h b/plugins/sh/call.h index 6abfda852aa9..8a2fe8de94bc 100644 --- a/plugins/sh/call.h +++ b/plugins/sh/call.h @@ -62,11 +62,11 @@ typedef enum exit_code { } exit_code; extern exit_code call (const char **argv) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); extern exit_code call_read (string *rbuf, const char **argv) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); extern exit_code call_write (const char *wbuf, size_t wbuflen, const char **argv) - __attribute__((__nonnull__ (1, 3))); + __attribute__ ((__nonnull__ (1, 3))); #endif /* NBDKIT_CALL_H */ diff --git a/plugins/vddk/vddk.h b/plugins/vddk/vddk.h index 8effaaf64a18..e8cd4bfde1f8 100644 --- a/plugins/vddk/vddk.h +++ b/plugins/vddk/vddk.h @@ -80,8 +80,8 @@ extern int vddk_debug_extents; extern int vddk_debug_datapath; extern int vddk_debug_stats; -#define STUB(fn,ret,args) extern ret (*fn) args -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) extern ret (*fn) args +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB @@ -146,7 +146,7 @@ struct command { enum { SUBMITTED, SUCCEEDED, FAILED } status; }; -DEFINE_VECTOR_TYPE(command_queue, struct command *) +DEFINE_VECTOR_TYPE (command_queue, struct command *) /* The per-connection handle. */ struct vddk_handle { @@ -181,8 +181,8 @@ struct vddk_stat { uint64_t bytes; /* bytes transferred, datapath calls only */ }; extern pthread_mutex_t stats_lock; -#define STUB(fn,ret,args) extern struct vddk_stat stats_##fn; -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) extern struct vddk_stat stats_##fn; +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB diff --git a/plugins/blkio/blkio.c b/plugins/blkio/blkio.c index 3a1215233462..68430d222650 100644 --- a/plugins/blkio/blkio.c +++ b/plugins/blkio/blkio.c @@ -57,7 +57,7 @@ struct property { char *value; bool value_needs_free; }; -DEFINE_VECTOR_TYPE(properties, struct property) +DEFINE_VECTOR_TYPE (properties, struct property) static const char *driver = NULL; /* driver name - required */ static properties props = empty_vector; /* other command line params */ @@ -555,4 +555,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 0, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/cc/cc.c b/plugins/cc/cc.c index 8dec5e30103f..fdc6934df544 100644 --- a/plugins/cc/cc.c +++ b/plugins/cc/cc.c @@ -64,7 +64,7 @@ static const char *extra_cflags; /* List of parameters for the subplugin. */ struct key_value { const char *key, *value; }; -DEFINE_VECTOR_TYPE(params_vector, struct key_value); +DEFINE_VECTOR_TYPE (params_vector, struct key_value); static params_vector params = empty_vector; /* The subplugin. */ @@ -643,4 +643,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/cdi/cdi.c b/plugins/cdi/cdi.c index 371e7f9e3cdf..b5d885df16df 100644 --- a/plugins/cdi/cdi.c +++ b/plugins/cdi/cdi.c @@ -265,4 +265,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c index b5927b5b4caa..b5e6277ce736 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c @@ -554,9 +554,9 @@ curl_close (void *handle) /* Calls get_handle() ... put_handle() to get a handle for the length * of the current scope. */ -#define GET_HANDLE_FOR_CURRENT_SCOPE(ch) \ +#define GET_HANDLE_FOR_CURRENT_SCOPE(ch) \ CLEANUP_PUT_HANDLE struct curl_handle *ch = get_handle (); -#define CLEANUP_PUT_HANDLE __attribute__((cleanup (cleanup_put_handle))) +#define CLEANUP_PUT_HANDLE __attribute__ ((cleanup (cleanup_put_handle))) static void cleanup_put_handle (void *chp) { @@ -694,4 +694,4 @@ static struct nbdkit_plugin plugin = { .pwrite = curl_pwrite, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/curl/pool.c b/plugins/curl/pool.c index f7ceab385519..1eb4db6404bf 100644 --- a/plugins/curl/pool.c +++ b/plugins/curl/pool.c @@ -84,7 +84,7 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; * handles are requested. Currently it does not shrink. It may grow * up to 'connections' in length. */ -DEFINE_VECTOR_TYPE(curl_handle_list, struct curl_handle *) +DEFINE_VECTOR_TYPE (curl_handle_list, struct curl_handle *) static curl_handle_list curl_handles = empty_vector; /* The condition is used when the curl handles vector is full and diff --git a/plugins/data/data.c b/plugins/data/data.c index c0c0349a17c3..3ff722fa541e 100644 --- a/plugins/data/data.c +++ b/plugins/data/data.c @@ -38,7 +38,7 @@ #include <inttypes.h> #include <string.h> -#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) +#if defined (HAVE_GNUTLS) && defined (HAVE_GNUTLS_BASE64_DECODE2) #include <gnutls/gnutls.h> #endif @@ -70,7 +70,7 @@ NBDKIT_DLL_PUBLIC int data_debug_dir; /* Collect extra parameters for data $VARs. */ struct param { const char *key; const char *value; }; -DEFINE_VECTOR_TYPE(param_list, struct param); +DEFINE_VECTOR_TYPE (param_list, struct param); static param_list params; /* On unload, free the sparse array. */ @@ -85,7 +85,7 @@ data_unload (void) static int read_base64 (const char *value, uint64_t *size_ret) { -#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) +#if defined (HAVE_GNUTLS) && defined (HAVE_GNUTLS_BASE64_DECODE2) gnutls_datum_t in, out; int err; @@ -242,7 +242,7 @@ data_get_ready (void) static void data_dump_plugin (void) { -#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) +#if defined (HAVE_GNUTLS) && defined (HAVE_GNUTLS_BASE64_DECODE2) printf ("data_base64=yes\n"); #endif #ifdef HAVE_MLOCK @@ -386,4 +386,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/data/format.c b/plugins/data/format.c index 2319ea09475c..b8b7d995d294 100644 --- a/plugins/data/format.c +++ b/plugins/data/format.c @@ -85,7 +85,7 @@ substring (string s, size_t offset, size_t len) } typedef size_t node_id; /* references a node in expr_table below */ -DEFINE_VECTOR_TYPE(node_ids, node_id); +DEFINE_VECTOR_TYPE (node_ids, node_id); enum expr_type { EXPR_NULL = 0, /* null expression, no effect */ @@ -151,7 +151,7 @@ struct expr { * explicitly, in particular because if the table hasn't yet been * allocated then there is no zeroth element). */ -DEFINE_VECTOR_TYPE(expr_list, expr_t); +DEFINE_VECTOR_TYPE (expr_list, expr_t); static expr_list expr_table; /* Add the expression to the table, returning the node_id. */ @@ -1480,7 +1480,7 @@ exprs_can_combine (expr_t e0, expr_t e1, node_id *id_rtn) switch (e1.t) { case EXPR_BYTE: /* byte byte => fill | string */ if (e0.b == e1.b) { - *id_rtn = new_node (expr (EXPR_FILL, e0.b, UINT64_C(2))); + *id_rtn = new_node (expr (EXPR_FILL, e0.b, UINT64_C (2))); } else { if (string_append (&s, e0.b) == -1 || diff --git a/plugins/eval/eval.c b/plugins/eval/eval.c index 15ae1f986b9c..5df0bad564f1 100644 --- a/plugins/eval/eval.c +++ b/plugins/eval/eval.c @@ -97,7 +97,7 @@ struct method_script { const char *method; char *script; }; -DEFINE_VECTOR_TYPE(method_script_list, struct method_script); +DEFINE_VECTOR_TYPE (method_script_list, struct method_script); static method_script_list method_scripts; static int @@ -430,4 +430,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/example1/example1.c b/plugins/example1/example1.c index b55f4025f44d..efd01acb8bc4 100644 --- a/plugins/example1/example1.c +++ b/plugins/example1/example1.c @@ -170,4 +170,4 @@ static struct nbdkit_plugin plugin = { .pread = example1_pread, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/example2/example2.c b/plugins/example2/example2.c index 1c5f6293ac39..d7f8ed47fb67 100644 --- a/plugins/example2/example2.c +++ b/plugins/example2/example2.c @@ -228,4 +228,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/example2/winexample2.c b/plugins/example2/winexample2.c index bc39dd880329..5ad8e9d18775 100644 --- a/plugins/example2/winexample2.c +++ b/plugins/example2/winexample2.c @@ -226,4 +226,4 @@ static struct nbdkit_plugin plugin = { .pread = example2_pread, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/example3/example3.c b/plugins/example3/example3.c index a12c5bbe6335..19a3106cd329 100644 --- a/plugins/example3/example3.c +++ b/plugins/example3/example3.c @@ -237,4 +237,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/file/file.c b/plugins/file/file.c index 0cfc4284bac1..2fcf7c5cd6b8 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -162,7 +162,7 @@ static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER; /* to enable: -D file.zero=1 */ NBDKIT_DLL_PUBLIC int file_debug_zero; -static bool __attribute__((unused)) +static bool __attribute__ ((unused)) is_enotsup (int err) { return err == ENOTSUP || err == EOPNOTSUPP; @@ -887,7 +887,7 @@ do_fallocate (int fd, int mode_, off_t offset, off_t len) static int file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) { - struct handle *h __attribute__((unused)) = handle; + struct handle *h __attribute__ ((unused)) = handle; #ifdef FALLOC_FL_PUNCH_HOLE if (h->can_punch_hole && (flags & NBDKIT_FLAG_MAY_TRIM)) { @@ -997,7 +997,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) return -1; #ifdef __clang__ - __attribute__((unused)) + __attribute__ ((unused)) #endif out: if ((flags & NBDKIT_FLAG_FUA) && file_flush (handle, 0) == -1) @@ -1182,4 +1182,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/file/winfile.c b/plugins/file/winfile.c index c3c5fe2a5360..ea7ebe82d2df 100644 --- a/plugins/file/winfile.c +++ b/plugins/file/winfile.c @@ -473,4 +473,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, /* XXX ? */ }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/floppy/floppy.c b/plugins/floppy/floppy.c index 56e730ec712d..9747ca006adb 100644 --- a/plugins/floppy/floppy.c +++ b/plugins/floppy/floppy.c @@ -231,4 +231,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/floppy/virtual-floppy.c b/plugins/floppy/virtual-floppy.c index 9ab810c9b1cf..2245cc0a073a 100644 --- a/plugins/floppy/virtual-floppy.c +++ b/plugins/floppy/virtual-floppy.c @@ -140,8 +140,8 @@ create_virtual_floppy (const char *dir, const char *label, uint64_t size, if (size > 0) { uint64_t data_size = size - (2080 * SECTOR_SIZE); - data_size = data_size - 2 * DIV_ROUND_UP((data_size / CLUSTER_SIZE + 2) * 4, - CLUSTER_SIZE) * CLUSTER_SIZE; + data_size = data_size - 2 * DIV_ROUND_UP ((data_size / CLUSTER_SIZE + 2) * 4, + CLUSTER_SIZE) * CLUSTER_SIZE; if (data_used_size > data_size) { nbdkit_error ("filesystem is larger than \"size\" bytes"); return -1; @@ -337,12 +337,12 @@ visit (const char *dir, struct virtual_floppy *floppy) closedir (DIR); error1: err = errno; -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined (__GNUC__) && __GNUC__ >= 5 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-result" #endif chdir (origdir); -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined (__GNUC__) && __GNUC__ >= 5 #pragma GCC diagnostic pop #endif errno = err; diff --git a/plugins/full/full.c b/plugins/full/full.c index e2c414b4415b..d0046fd67824 100644 --- a/plugins/full/full.c +++ b/plugins/full/full.c @@ -177,4 +177,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/guestfs/guestfs-plugin.c b/plugins/guestfs/guestfs-plugin.c index 946c1d97b4c1..a81a2275df47 100644 --- a/plugins/guestfs/guestfs-plugin.c +++ b/plugins/guestfs/guestfs-plugin.c @@ -600,4 +600,4 @@ static struct nbdkit_plugin plugin = { .flush = plugin_guestfs_flush, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/info/info.c b/plugins/info/info.c index 48a8a6357346..f2b464d70732 100644 --- a/plugins/info/info.c +++ b/plugins/info/info.c @@ -49,7 +49,7 @@ #include <arpa/inet.h> #endif -#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) +#if defined (HAVE_GNUTLS) && defined (HAVE_GNUTLS_BASE64_DECODE2) #include <gnutls/gnutls.h> #define HAVE_BASE64 1 #endif @@ -475,4 +475,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/iso/iso.c b/plugins/iso/iso.c index 87e654e6c707..e8c915a4677e 100644 --- a/plugins/iso/iso.c +++ b/plugins/iso/iso.c @@ -271,4 +271,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/libvirt/libvirt-plugin.c b/plugins/libvirt/libvirt-plugin.c index 689ef4721bf7..354ab4e83eab 100644 --- a/plugins/libvirt/libvirt-plugin.c +++ b/plugins/libvirt/libvirt-plugin.c @@ -217,4 +217,4 @@ static struct nbdkit_plugin plugin = { .pread = virt_pread, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/linuxdisk/linuxdisk.c b/plugins/linuxdisk/linuxdisk.c index 44bcd425a121..b30d61c46728 100644 --- a/plugins/linuxdisk/linuxdisk.c +++ b/plugins/linuxdisk/linuxdisk.c @@ -243,4 +243,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 63ab16d2b3ec..0b68d75cfcd7 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -551,4 +551,4 @@ static struct nbdkit_plugin plugin = { .zero = lua_plugin_zero, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/memory/memory.c b/plugins/memory/memory.c index b0b81140cfdc..66a285aebb54 100644 --- a/plugins/memory/memory.c +++ b/plugins/memory/memory.c @@ -253,4 +253,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/null/null.c b/plugins/null/null.c index 3d75e0f91ee3..4db108e4bd9c 100644 --- a/plugins/null/null.c +++ b/plugins/null/null.c @@ -188,4 +188,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/ocaml/plugin.c b/plugins/ocaml/plugin.c index 2fe4e460d952..056702542f3e 100644 --- a/plugins/ocaml/plugin.c +++ b/plugins/ocaml/plugin.c @@ -56,7 +56,7 @@ /* This constructor runs when the plugin loads, and initializes the * OCaml runtime, and lets the plugin set up its callbacks. */ -static void constructor (void) __attribute__((constructor)); +static void constructor (void) __attribute__ ((constructor)); static void constructor (void) { diff --git a/plugins/ondemand/ondemand.c b/plugins/ondemand/ondemand.c index fcc09ce2f0c0..0e3b28b3756a 100644 --- a/plugins/ondemand/ondemand.c +++ b/plugins/ondemand/ondemand.c @@ -666,4 +666,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/partitioning/partitioning.c b/plugins/partitioning/partitioning.c index 3c6f1f382e52..52ffb1b6f2ca 100644 --- a/plugins/partitioning/partitioning.c +++ b/plugins/partitioning/partitioning.c @@ -454,4 +454,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/pattern/pattern.c b/plugins/pattern/pattern.c index fac44cc4ce76..4a8b79c101af 100644 --- a/plugins/pattern/pattern.c +++ b/plugins/pattern/pattern.c @@ -144,4 +144,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 26de0e542c2c..a89444572301 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -136,7 +136,7 @@ check_perl_failure (void) return 0; } -XS(xs_debug) +XS (xs_debug) { dXSARGS; if (items >= 1) @@ -146,7 +146,7 @@ XS(xs_debug) static int last_error; -XS(xs_set_error) +XS (xs_set_error) { dXSARGS; /* Is it worth adding error checking for bad arguments? */ @@ -176,23 +176,23 @@ xs_init (pTHX) #define DEFINE_FLAG(n) \ gv = gv_fetchpv ("Nbdkit::" #n, TRUE, SVt_PV); \ GvMULTI_on (gv); \ - sv_setiv (GvSV(gv), NBDKIT_ ## n) + sv_setiv (GvSV (gv), NBDKIT_ ## n) - DEFINE_FLAG(FLAG_MAY_TRIM); - DEFINE_FLAG(FLAG_FUA); - DEFINE_FLAG(FLAG_REQ_ONE); - DEFINE_FLAG(FLAG_FAST_ZERO); + DEFINE_FLAG (FLAG_MAY_TRIM); + DEFINE_FLAG (FLAG_FUA); + DEFINE_FLAG (FLAG_REQ_ONE); + DEFINE_FLAG (FLAG_FAST_ZERO); - DEFINE_FLAG(FUA_NONE); - DEFINE_FLAG(FUA_EMULATE); - DEFINE_FLAG(FUA_NATIVE); + DEFINE_FLAG (FUA_NONE); + DEFINE_FLAG (FUA_EMULATE); + DEFINE_FLAG (FUA_NATIVE); - DEFINE_FLAG(CACHE_NONE); - DEFINE_FLAG(CACHE_EMULATE); - DEFINE_FLAG(CACHE_NATIVE); + DEFINE_FLAG (CACHE_NONE); + DEFINE_FLAG (CACHE_EMULATE); + DEFINE_FLAG (CACHE_NATIVE); - DEFINE_FLAG(EXTENT_HOLE); - DEFINE_FLAG(EXTENT_ZERO); + DEFINE_FLAG (EXTENT_HOLE); + DEFINE_FLAG (EXTENT_ZERO); } static void @@ -685,4 +685,4 @@ static struct nbdkit_plugin plugin = { .zero = perl_zero, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/python/modfunctions.c b/plugins/python/modfunctions.c index ac693923dc8f..a80adafa60b0 100644 --- a/plugins/python/modfunctions.c +++ b/plugins/python/modfunctions.c @@ -113,13 +113,13 @@ parse_size (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s:parse_size", &s)) return NULL; - int64_t size = nbdkit_parse_size(s); + int64_t size = nbdkit_parse_size (s); if (size == -1) { PyErr_SetString (PyExc_ValueError, "Unable to parse string as size"); return NULL; } - return PyLong_FromSize_t((size_t)size); + return PyLong_FromSize_t ((size_t)size); } static PyMethodDef NbdkitMethods[] = { diff --git a/plugins/random/random.c b/plugins/random/random.c index fa8403672e88..f9efeabba16b 100644 --- a/plugins/random/random.c +++ b/plugins/random/random.c @@ -218,4 +218,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/ruby/ruby.c b/plugins/ruby/ruby.c index 6aaf03e407f3..eba88748f348 100644 --- a/plugins/ruby/ruby.c +++ b/plugins/ruby/ruby.c @@ -55,7 +55,7 @@ set_error (VALUE self, VALUE arg) int err; VALUE v; - if (TYPE(arg) == T_CLASS) { + if (TYPE (arg) == T_CLASS) { v = rb_const_get (arg, rb_intern ("Errno")); err = NUM2INT (v); } else if (TYPE (arg) == T_OBJECT) { @@ -545,4 +545,4 @@ static struct nbdkit_plugin plugin = { .zero = plugin_rb_zero, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c index 8b038e87c192..ba5f159d5758 100644 --- a/plugins/sh/sh.c +++ b/plugins/sh/sh.c @@ -329,4 +329,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/sparse-random/sparse-random.c b/plugins/sparse-random/sparse-random.c index 9a26d2825517..92496914e13c 100644 --- a/plugins/sparse-random/sparse-random.c +++ b/plugins/sparse-random/sparse-random.c @@ -54,7 +54,7 @@ static int64_t size = 0; /* Size of the disk in bytes. */ static uint32_t seed; /* Random seed. */ static double percent = 10; /* Percentage of data. */ static uint64_t runlength = /* Expected average run length of data (bytes)*/ - UINT64_C(16*1024*1024); + UINT64_C (16*1024*1024); static int random_content; /* false: Repeat same byte true: Random bytes*/ /* We need to store 1 bit per block. Using a 4K block size means we @@ -568,4 +568,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/split/split.c b/plugins/split/split.c index 04170de348da..3d909cdf6b12 100644 --- a/plugins/split/split.c +++ b/plugins/split/split.c @@ -466,4 +466,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/ssh/ssh.c b/plugins/ssh/ssh.c index 5a132d8f2319..4967bf005999 100644 --- a/plugins/ssh/ssh.c +++ b/plugins/ssh/ssh.c @@ -776,4 +776,4 @@ static struct nbdkit_plugin plugin = { .can_multi_conn = ssh_can_multi_conn, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/tcl/tcl.c b/plugins/tcl/tcl.c index 4b3c50a7b310..cc8e5b22785f 100644 --- a/plugins/tcl/tcl.c +++ b/plugins/tcl/tcl.c @@ -560,4 +560,4 @@ static struct nbdkit_plugin plugin = { .zero = tcl_zero, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/tmpdisk/tmpdisk.c b/plugins/tmpdisk/tmpdisk.c index e869d10c20e9..aab70085547c 100644 --- a/plugins/tmpdisk/tmpdisk.c +++ b/plugins/tmpdisk/tmpdisk.c @@ -520,4 +520,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/vddk/stats.c b/plugins/vddk/stats.c index bb5401b100a1..fb23c6a5bbfe 100644 --- a/plugins/vddk/stats.c +++ b/plugins/vddk/stats.c @@ -54,13 +54,13 @@ pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER; /* For each VDDK API define a variable to store the time taken (used * to implement -D vddk.stats=1). */ -#define STUB(fn,ret,args) struct vddk_stat stats_##fn = { .name = #fn } -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) struct vddk_stat stats_##fn = { .name = #fn } +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB -DEFINE_VECTOR_TYPE(statlist, struct vddk_stat) +DEFINE_VECTOR_TYPE (statlist, struct vddk_stat) static int stat_compare (const void *vp1, const void *vp2) @@ -88,8 +88,8 @@ display_stats (void) if (!vddk_debug_stats) return; -#define STUB(fn,ret,args) statlist_append (&stats, stats_##fn) -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) statlist_append (&stats, stats_##fn) +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c index 9e29075fcf57..2c6836de7fde 100644 --- a/plugins/vddk/vddk.c +++ b/plugins/vddk/vddk.c @@ -64,8 +64,8 @@ NBDKIT_DLL_PUBLIC int vddk_debug_datapath = 1; /* For each VDDK API define a global variable. These globals are * initialized when the plugin is loaded (by vddk_get_ready). */ -#define STUB(fn,ret,args) ret (*fn) args -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) ret (*fn) args +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB @@ -463,13 +463,13 @@ load_library (bool load_error_is_fatal) assert (library_version >= 6); /* Load symbols. */ -#define STUB(fn,ret,args) \ +#define STUB(fn, ret, args) \ do { \ fn = dlsym (dl, #fn); \ if (fn == NULL) \ missing_required_symbol (#fn); \ } while (0) -#define OPTIONAL_STUB(fn,ret,args) fn = dlsym (dl, #fn) +#define OPTIONAL_STUB(fn, ret, args) fn = dlsym (dl, #fn) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB @@ -592,7 +592,7 @@ vddk_dump_plugin (void) if (library_version > 0) printf ("vddk_library_version=%d\n", library_version); -#if defined(HAVE_DLADDR) +#if defined (HAVE_DLADDR) /* It would be nice to print the version of VDDK from the shared * library, but VDDK does not provide it. Instead we can get the * path to the library using the glibc extension dladdr, and then @@ -613,8 +613,8 @@ vddk_dump_plugin (void) * ones. That is so if we update the baseline VDDK in future and * make optional into required APIs, the output doesn't change. */ -#define STUB(fn,ret,args) if (fn != NULL) printf ("%s=1\n", #fn); -#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args) +#define STUB(fn, ret, args) if (fn != NULL) printf ("%s=1\n", #fn); +#define OPTIONAL_STUB(fn, ret, args) STUB (fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB @@ -1051,4 +1051,4 @@ static struct nbdkit_plugin plugin = { .extents = vddk_extents, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/plugins/zero/zero.c b/plugins/zero/zero.c index a81a0e1b9ad0..56a8e1a2c69a 100644 --- a/plugins/zero/zero.c +++ b/plugins/zero/zero.c @@ -97,4 +97,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/filters/cache/blk.h b/filters/cache/blk.h index 1ee33ed72f61..d521582eb190 100644 --- a/filters/cache/blk.h +++ b/filters/cache/blk.h @@ -53,24 +53,24 @@ extern int blk_set_size (uint64_t new_size); * also ensure it is cached. */ extern int blk_read (nbdkit_next *next, uint64_t blknum, uint8_t *block, int *err) - __attribute__((__nonnull__ (1, 3, 4))); + __attribute__ ((__nonnull__ (1, 3, 4))); /* As above, but read multiple blocks. */ extern int blk_read_multiple (nbdkit_next *next, uint64_t blknum, uint64_t nrblocks, uint8_t *block, int *err) - __attribute__((__nonnull__ (1, 4, 5))); + __attribute__ ((__nonnull__ (1, 4, 5))); /* If a single block is not cached, copy it from the plugin. */ extern int blk_cache (nbdkit_next *next, uint64_t blknum, uint8_t *block, int *err) - __attribute__((__nonnull__ (1, 3, 4))); + __attribute__ ((__nonnull__ (1, 3, 4))); /* Write to the cache and the plugin. */ extern int blk_writethrough (nbdkit_next *next, uint64_t blknum, const uint8_t *block, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 3, 5))); + __attribute__ ((__nonnull__ (1, 3, 5))); /* Write a whole block. * @@ -83,11 +83,11 @@ extern int blk_writethrough (nbdkit_next *next, extern int blk_write (nbdkit_next *next, uint64_t blknum, const uint8_t *block, uint32_t flags, int *err) - __attribute__((__nonnull__ (1, 3, 5))); + __attribute__ ((__nonnull__ (1, 3, 5))); /* Iterates over each dirty block in the cache. */ typedef int (*block_callback) (uint64_t blknum, void *vp); extern int for_each_dirty_block (block_callback f, void *vp) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); #endif /* NBDKIT_BLK_H */ diff --git a/filters/cow/blk.h b/filters/cow/blk.h index 62fb5416308c..5708d501cbf2 100644 --- a/filters/cow/blk.h +++ b/filters/cow/blk.h @@ -49,14 +49,14 @@ extern void blk_status (uint64_t blknum, bool *present, bool *trimmed); extern int blk_read (nbdkit_next *next, uint64_t blknum, uint8_t *block, bool cow_on_read, int *err) - __attribute__((__nonnull__ (1, 3, 5))); + __attribute__ ((__nonnull__ (1, 3, 5))); /* Read multiple blocks from the overlay or plugin. */ extern int blk_read_multiple (nbdkit_next *next, uint64_t blknum, uint64_t nrblocks, uint8_t *block, bool cow_on_read, int *err) - __attribute__((__nonnull__ (1, 4, 6))); + __attribute__ ((__nonnull__ (1, 4, 6))); /* Cache mode for blocks not already in overlay */ enum cache_mode { @@ -70,14 +70,14 @@ enum cache_mode { extern int blk_cache (nbdkit_next *next, uint64_t blknum, uint8_t *block, enum cache_mode, int *err) - __attribute__((__nonnull__ (1, 3, 5))); + __attribute__ ((__nonnull__ (1, 3, 5))); /* Write a single block. */ extern int blk_write (uint64_t blknum, const uint8_t *block, int *err) - __attribute__((__nonnull__ (2, 3))); + __attribute__ ((__nonnull__ (2, 3))); /* Trim a single block. */ extern int blk_trim (uint64_t blknum, int *err) - __attribute__((__nonnull__ (2))); + __attribute__ ((__nonnull__ (2))); #endif /* NBDKIT_BLK_H */ diff --git a/filters/ext2/io.h b/filters/ext2/io.h index 845cffdb9831..a87287bf11c6 100644 --- a/filters/ext2/io.h +++ b/filters/ext2/io.h @@ -40,9 +40,9 @@ #define EXT2_ET_MAGIC_NBDKIT_IO_CHANNEL EXT2_ET_MAGIC_RESERVED_19 /* Utility functions for encoding nbdkit_next as a name usable by ext2fs */ -extern char *nbdkit_io_encode(const nbdkit_next *next) +extern char *nbdkit_io_encode (const nbdkit_next *next) __attribute__ ((__nonnull__ (1))); -extern int nbdkit_io_decode(const char *name, nbdkit_next **out) +extern int nbdkit_io_decode (const char *name, nbdkit_next **out) __attribute__ ((__nonnull__ (1, 2))); /* Custom io manager that performs all ext2fs I/O on the next nbdkit layer */ diff --git a/filters/log/log.h b/filters/log/log.h index 9ec4fbec75bc..a8222715f934 100644 --- a/filters/log/log.h +++ b/filters/log/log.h @@ -71,13 +71,13 @@ get_id (struct handle *h) */ extern void enter (struct handle *h, log_id_t id, const char *act, const char *fmt, ...) - ATTRIBUTE_FORMAT_PRINTF(4, 5); + ATTRIBUTE_FORMAT_PRINTF (4, 5); extern void leave (struct handle *h, log_id_t id, const char *act, const char *fmt, ...) - ATTRIBUTE_FORMAT_PRINTF(4, 5); + ATTRIBUTE_FORMAT_PRINTF (4, 5); extern void print (struct handle *h, const char *act, const char *fmt, ...) - ATTRIBUTE_FORMAT_PRINTF(3, 4); + ATTRIBUTE_FORMAT_PRINTF (3, 4); /* In the case where leave() only has to print result-or-error, this * simplified version is used instead. @@ -100,7 +100,7 @@ extern void leave_simple2 (struct leave_simple_params *params); #define LOG(h, act, r, err, ...) \ log_id_t id = get_id (h); \ - __attribute__((cleanup (leave_simple2))) \ + __attribute__ ((cleanup (leave_simple2))) \ CLANG_UNUSED_VARIABLE_WORKAROUND \ struct leave_simple_params _params = { h, id, act, &r, err }; \ enter ((h), id, (act), ##__VA_ARGS__) diff --git a/filters/readahead/readahead.h b/filters/readahead/readahead.h index a68204d54007..4ae726dc478a 100644 --- a/filters/readahead/readahead.h +++ b/filters/readahead/readahead.h @@ -46,7 +46,7 @@ struct command { uint64_t offset; uint32_t count; }; -DEFINE_VECTOR_TYPE(command_queue, struct command); +DEFINE_VECTOR_TYPE (command_queue, struct command); struct bgthread_ctrl { command_queue cmds; /* Command queue. */ diff --git a/filters/scan/scan.h b/filters/scan/scan.h index 98c0228bf74b..e9ac4cf29dec 100644 --- a/filters/scan/scan.h +++ b/filters/scan/scan.h @@ -49,7 +49,7 @@ struct command { enum { CMD_QUIT, CMD_NOTIFY_PREAD } type; uint64_t offset; }; -DEFINE_VECTOR_TYPE(command_queue, struct command); +DEFINE_VECTOR_TYPE (command_queue, struct command); struct bgthread_ctrl { command_queue cmds; /* Command queue. */ diff --git a/filters/xz/blkcache.h b/filters/xz/blkcache.h index 6fe4f01a86dd..27da2137e8a7 100644 --- a/filters/xz/blkcache.h +++ b/filters/xz/blkcache.h @@ -41,13 +41,13 @@ typedef struct blkcache_stats { } blkcache_stats; extern blkcache *new_blkcache (size_t maxdepth); -extern void free_blkcache (blkcache *) __attribute__((__nonnull__ (1))); +extern void free_blkcache (blkcache *) __attribute__ ((__nonnull__ (1))); extern char *get_block (blkcache *, uint64_t offset, uint64_t *start, uint64_t *size) - __attribute__((__nonnull__ (1, 3, 4))); + __attribute__ ((__nonnull__ (1, 3, 4))); extern int put_block (blkcache *, uint64_t start, uint64_t size, char *data) - __attribute__((__nonnull__ (1, 4))); + __attribute__ ((__nonnull__ (1, 4))); extern void blkcache_get_stats (blkcache *, blkcache_stats *ret) - __attribute__((__nonnull__ (1, 2))); + __attribute__ ((__nonnull__ (1, 2))); #endif /* NBDKIT_XZFILE_H */ diff --git a/filters/blocksize-policy/policy.c b/filters/blocksize-policy/policy.c index 7e6f2a9685d0..06d23698bc3f 100644 --- a/filters/blocksize-policy/policy.c +++ b/filters/blocksize-policy/policy.c @@ -395,4 +395,4 @@ static struct nbdkit_filter filter = { .extents = policy_extents, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/blocksize/blocksize.c b/filters/blocksize/blocksize.c index 1c81d5e338a6..33f5f6b02722 100644 --- a/filters/blocksize/blocksize.c +++ b/filters/blocksize/blocksize.c @@ -546,4 +546,4 @@ static struct nbdkit_filter filter = { .cache = blocksize_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cache/cache.c b/filters/cache/cache.c index d7b61023958d..aa82a85200a2 100644 --- a/filters/cache/cache.c +++ b/filters/cache/cache.c @@ -750,4 +750,4 @@ static struct nbdkit_filter filter = { .cache = cache_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cache/reclaim.c b/filters/cache/reclaim.c index eca7387ab26f..2c20950c3ded 100644 --- a/filters/cache/reclaim.c +++ b/filters/cache/reclaim.c @@ -104,7 +104,7 @@ reclaim (int fd, struct bitmap *bm) nbdkit_debug ("cache: fstat: %m"); return; } - cache_allocated = statbuf.st_blocks * UINT64_C(512); + cache_allocated = statbuf.st_blocks * UINT64_C (512); if (reclaiming) { /* Keep reclaiming until the cache size drops below the low threshold. */ diff --git a/filters/checkwrite/checkwrite.c b/filters/checkwrite/checkwrite.c index ce8fa137aa80..609a29feadd1 100644 --- a/filters/checkwrite/checkwrite.c +++ b/filters/checkwrite/checkwrite.c @@ -272,4 +272,4 @@ static struct nbdkit_filter filter = { .zero = checkwrite_trim_zero, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cow/cow.c b/filters/cow/cow.c index e8c6fee4a9bd..e813d5065f52 100644 --- a/filters/cow/cow.c +++ b/filters/cow/cow.c @@ -801,4 +801,4 @@ static struct nbdkit_filter filter = { .extents = cow_extents, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/ddrescue/ddrescue.c b/filters/ddrescue/ddrescue.c index 218c8ee54378..081f56712093 100644 --- a/filters/ddrescue/ddrescue.c +++ b/filters/ddrescue/ddrescue.c @@ -52,7 +52,7 @@ struct range { int64_t size; char status; }; -DEFINE_VECTOR_TYPE(ranges, struct range); +DEFINE_VECTOR_TYPE (ranges, struct range); struct mapfile { int ranges_count; @@ -208,4 +208,4 @@ static struct nbdkit_filter filter = { .pread = ddrescue_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/delay/delay.c b/filters/delay/delay.c index e805abcf7adb..ac6323b9ae98 100644 --- a/filters/delay/delay.c +++ b/filters/delay/delay.c @@ -74,7 +74,7 @@ parse_delay (const char *key, const char *value, unsigned *r) else { if (nbdkit_parse_unsigned (key, value, r) == -1) return -1; - if (*r * UINT64_C(1000) > UINT_MAX) { + if (*r * UINT64_C (1000) > UINT_MAX) { nbdkit_error ("seconds parameter %s is too large: %s", key, value); return -1; } @@ -367,4 +367,4 @@ static struct nbdkit_filter filter = { .cache = delay_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/error/error.c b/filters/error/error.c index 95eb562282e2..fe81d6c30a32 100644 --- a/filters/error/error.c +++ b/filters/error/error.c @@ -388,4 +388,4 @@ static struct nbdkit_filter filter = { .cache = error_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/exitlast/exitlast.c b/filters/exitlast/exitlast.c index 125712421418..e473125ac3bb 100644 --- a/filters/exitlast/exitlast.c +++ b/filters/exitlast/exitlast.c @@ -77,4 +77,4 @@ static struct nbdkit_filter filter = { .close = exitlast_close, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/exitwhen/exitwhen.c b/filters/exitwhen/exitwhen.c index a6bed1c31eb2..9e915735c0c6 100644 --- a/filters/exitwhen/exitwhen.c +++ b/filters/exitwhen/exitwhen.c @@ -81,7 +81,7 @@ struct event { #endif } u; }; -DEFINE_VECTOR_TYPE(event_list, struct event); +DEFINE_VECTOR_TYPE (event_list, struct event); static event_list events = empty_vector; static void @@ -317,7 +317,7 @@ check_for_event_script (const struct event *event) * This always polls every pollsecs seconds, but only checks for * events when there are no connections. */ -static void * __attribute__((noreturn)) +static void * __attribute__ ((noreturn)) polling_thread (void *vp) { for (;;) { @@ -341,7 +341,7 @@ exitwhen_config (nbdkit_next_config *next, nbdkit_backend *nxdata, struct event event; if (0) ; -#if defined(EVENT_FILE_CREATED) && defined(EVENT_FILE_DELETED) +#if defined (EVENT_FILE_CREATED) && defined (EVENT_FILE_DELETED) else if (strcmp (key, "exit-when-file-created") == 0 || strcmp (key, "exit-when-file-deleted") == 0) { char c = key[15]; @@ -511,4 +511,4 @@ static struct nbdkit_filter filter = { .close = exitwhen_close, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/exportname/exportname.c b/filters/exportname/exportname.c index 277b8125b1f1..39ad65bfc4d8 100644 --- a/filters/exportname/exportname.c +++ b/filters/exportname/exportname.c @@ -342,4 +342,4 @@ static struct nbdkit_filter filter = { .export_description = exportname_export_description, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/ext2/ext2.c b/filters/ext2/ext2.c index 9484fb58d23e..37ea67a80969 100644 --- a/filters/ext2/ext2.c +++ b/filters/ext2/ext2.c @@ -528,4 +528,4 @@ static struct nbdkit_filter filter = { .flush = ext2_flush, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/extentlist/extentlist.c b/filters/extentlist/extentlist.c index c91fbfea5b49..85ee82e9def9 100644 --- a/filters/extentlist/extentlist.c +++ b/filters/extentlist/extentlist.c @@ -58,7 +58,7 @@ struct extent { uint64_t offset, length; uint32_t type; }; -DEFINE_VECTOR_TYPE(extent_list, struct extent); +DEFINE_VECTOR_TYPE (extent_list, struct extent); static extent_list extents; static void @@ -328,4 +328,4 @@ static struct nbdkit_filter filter = { .extents = extentlist_extents, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/fua/fua.c b/filters/fua/fua.c index 7f9eb760f4e7..84351653b1c8 100644 --- a/filters/fua/fua.c +++ b/filters/fua/fua.c @@ -290,4 +290,4 @@ static struct nbdkit_filter filter = { .zero = fua_zero, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/gzip/gzip.c b/filters/gzip/gzip.c index 276df571dac6..df6e34372c9e 100644 --- a/filters/gzip/gzip.c +++ b/filters/gzip/gzip.c @@ -376,4 +376,4 @@ static struct nbdkit_filter filter = { .pread = gzip_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/ip/ip.c b/filters/ip/ip.c index 99d8e099ff04..4db902e07a02 100644 --- a/filters/ip/ip.c +++ b/filters/ip/ip.c @@ -86,7 +86,7 @@ static struct rule *deny_rules, *deny_rules_last; static void print_rule (const char *name, const struct rule *rule, const char *suffix) { -#if defined(INET_NTOP) +#if defined (INET_NTOP) union { char addr4[INET_ADDRSTRLEN]; char addr6[INET6_ADDRSTRLEN]; @@ -103,7 +103,7 @@ print_rule (const char *name, const struct rule *rule, const char *suffix) case ANYV6: nbdkit_debug ("%s=anyipv6%s", name, suffix); break; -#if defined(INET_NTOP) +#if defined (INET_NTOP) case IPV4: inet_ntop (AF_INET, &rule->u.ipv4, u.addr4, sizeof u.addr4); nbdkit_debug ("%s=ipv4:%s/%u%s", name, u.addr4, rule->prefixlen, suffix); @@ -479,7 +479,7 @@ matches_rule (const struct rule *rule, const struct sockaddr_in *sin; uint32_t cin, rin, mask; const struct sockaddr_in6 *sin6; -#if defined(AF_VSOCK) && defined(VMADDR_CID_ANY) +#if defined (AF_VSOCK) && defined (VMADDR_CID_ANY) const struct sockaddr_vm *svm; #endif @@ -522,7 +522,7 @@ matches_rule (const struct rule *rule, if (family != AF_UNIX) return false; return nbdkit_peer_gid () == rule->u.id; -#if defined(AF_VSOCK) && defined(VMADDR_CID_ANY) +#if defined (AF_VSOCK) && defined (VMADDR_CID_ANY) case ANYVSOCK: return family == AF_VSOCK; @@ -576,7 +576,7 @@ check_if_allowed (const struct sockaddr *addr) * sockets, see the manual. */ if (family != AF_INET && family != AF_INET6 && family != AF_UNIX -#if defined(AF_VSOCK) && defined(VMADDR_CID_ANY) +#if defined (AF_VSOCK) && defined (VMADDR_CID_ANY) && family != AF_VSOCK #endif ) @@ -633,4 +633,4 @@ static struct nbdkit_filter filter = { .preconnect = ip_preconnect, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/limit/limit.c b/filters/limit/limit.c index dc07f4361f34..fc0dcadabe65 100644 --- a/filters/limit/limit.c +++ b/filters/limit/limit.c @@ -126,4 +126,4 @@ static struct nbdkit_filter filter = { .close = limit_close, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/log/log.c b/filters/log/log.c index 4255f85f6b04..4a9291b200f3 100644 --- a/filters/log/log.c +++ b/filters/log/log.c @@ -470,4 +470,4 @@ static struct nbdkit_filter filter = { .cache = log_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/luks/luks-encryption.c b/filters/luks/luks-encryption.c index 6f33e76ed86c..5ce3cb3ae425 100644 --- a/filters/luks/luks-encryption.c +++ b/filters/luks/luks-encryption.c @@ -69,7 +69,7 @@ struct luks_keyslot { char password_salt[LUKS_SALTSIZE]; uint32_t key_material_offset; uint32_t stripes; -} __attribute__((__packed__)); +} __attribute__ ((__packed__)); /* LUKS superblock. */ struct luks_phdr { @@ -86,7 +86,7 @@ struct luks_phdr { uint8_t uuid[40]; struct luks_keyslot keyslot[LUKS_NUMKEYS]; /* Key slots. */ -} __attribute__((__packed__)); +} __attribute__ ((__packed__)); /* Block cipher mode of operation. * https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation diff --git a/filters/luks/luks.c b/filters/luks/luks.c index 8ad3f4ecc96b..c84dbf4261cc 100644 --- a/filters/luks/luks.c +++ b/filters/luks/luks.c @@ -447,4 +447,4 @@ static struct nbdkit_filter filter = { .pwrite = luks_pwrite, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/multi-conn/multi-conn.c b/filters/multi-conn/multi-conn.c index 99ae51c6895c..126297425320 100644 --- a/filters/multi-conn/multi-conn.c +++ b/filters/multi-conn/multi-conn.c @@ -78,13 +78,13 @@ struct handle { char *name; /* Used when byname==true to assign group */ struct group *group; /* All connections grouped with this one */ }; -DEFINE_VECTOR_TYPE(conns_vector, struct handle *); +DEFINE_VECTOR_TYPE (conns_vector, struct handle *); struct group { conns_vector conns; char *name; bool dirty; /* True if any connection in group is dirty */ }; -DEFINE_VECTOR_TYPE(group_vector, struct group *); +DEFINE_VECTOR_TYPE (group_vector, struct group *); static group_vector groups = empty_vector; /* Accept 'multi-conn-mode=mode', 'multi-conn-track-dirty=level', and @@ -524,4 +524,4 @@ static struct nbdkit_filter filter = { .flush = multi_conn_flush, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/nocache/nocache.c b/filters/nocache/nocache.c index 169fc37d38ba..87f7728672e2 100644 --- a/filters/nocache/nocache.c +++ b/filters/nocache/nocache.c @@ -107,4 +107,4 @@ static struct nbdkit_filter filter = { .cache = nocache_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/noextents/noextents.c b/filters/noextents/noextents.c index f304480911ac..56cd21b769f6 100644 --- a/filters/noextents/noextents.c +++ b/filters/noextents/noextents.c @@ -47,4 +47,4 @@ static struct nbdkit_filter filter = { .can_extents = noextents_can_extents, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/nofilter/nofilter.c b/filters/nofilter/nofilter.c index d76ea8ac6478..d6acf71ec8d8 100644 --- a/filters/nofilter/nofilter.c +++ b/filters/nofilter/nofilter.c @@ -39,4 +39,4 @@ static struct nbdkit_filter filter = { .longname = "nbdkit nofilter filter", }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/noparallel/noparallel.c b/filters/noparallel/noparallel.c index 1a24b1064fd2..b839d325d26b 100644 --- a/filters/noparallel/noparallel.c +++ b/filters/noparallel/noparallel.c @@ -81,4 +81,4 @@ static struct nbdkit_filter filter = { .thread_model = noparallel_thread_model, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/nozero/nozero.c b/filters/nozero/nozero.c index 5c04975bb9b2..96da2551470e 100644 --- a/filters/nozero/nozero.c +++ b/filters/nozero/nozero.c @@ -185,4 +185,4 @@ static struct nbdkit_filter filter = { .zero = nozero_zero, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/offset/offset.c b/filters/offset/offset.c index ff0b858c99f2..5b1253ae1940 100644 --- a/filters/offset/offset.c +++ b/filters/offset/offset.c @@ -190,4 +190,4 @@ static struct nbdkit_filter filter = { .cache = offset_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/partition/partition-gpt.c b/filters/partition/partition-gpt.c index 555483c3c68b..370318227db8 100644 --- a/filters/partition/partition-gpt.c +++ b/filters/partition/partition-gpt.c @@ -92,8 +92,8 @@ find_gpt_partition (nbdkit_next *next, * array (twice) plus other GPT overheads. Otherwise it is likely * that the GPT header is bogus. */ - if (size < INT64_C(3)*SECTOR_SIZE + - INT64_C(2) * nr_partition_entries * size_partition_entry) { + if (size < INT64_C (3) * SECTOR_SIZE + + INT64_C (2) * nr_partition_entries * size_partition_entry) { nbdkit_error ("GPT partition table is too large for this disk"); return -1; } diff --git a/filters/partition/partition.c b/filters/partition/partition.c index 4f91d04b0ea9..9c2351246985 100644 --- a/filters/partition/partition.c +++ b/filters/partition/partition.c @@ -305,4 +305,4 @@ static struct nbdkit_filter filter = { .cache = partition_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/pause/pause.c b/filters/pause/pause.c index 3bc35e5250d9..b55a5d89ce32 100644 --- a/filters/pause/pause.c +++ b/filters/pause/pause.c @@ -370,4 +370,4 @@ static struct nbdkit_filter filter = { .cache = pause_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/protect/protect.c b/filters/protect/protect.c index ea7bc99df8c5..4e22a24bbcc9 100644 --- a/filters/protect/protect.c +++ b/filters/protect/protect.c @@ -57,7 +57,7 @@ * 'range_list' stores the list of protected ranges, unsorted. */ struct range { uint64_t start, end; const char *description; }; -DEFINE_VECTOR_TYPE(ranges, struct range) +DEFINE_VECTOR_TYPE (ranges, struct range) static ranges range_list; /* region_list covers the whole address space with protected and @@ -364,4 +364,4 @@ static struct nbdkit_filter filter = { .zero = protect_zero, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/rate/rate.c b/filters/rate/rate.c index 26082f8c57b4..f04eb008f253 100644 --- a/filters/rate/rate.c +++ b/filters/rate/rate.c @@ -265,7 +265,7 @@ maybe_sleep (struct bucket *bucket, pthread_mutex_t *lock, * multiply this by 10 to include start/stop but let's not * second-guess the transport layers underneath. */ - bits = count * UINT64_C(8); + bits = count * UINT64_C (8); while (bits > 0) { /* Run the token bucket algorithm. */ @@ -336,4 +336,4 @@ static struct nbdkit_filter filter = { .pwrite = rate_pwrite, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/readahead/readahead.c b/filters/readahead/readahead.c index 1d7ae111523b..b4e02d5a4b32 100644 --- a/filters/readahead/readahead.c +++ b/filters/readahead/readahead.c @@ -248,4 +248,4 @@ static struct nbdkit_filter filter = { .pread = readahead_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/retry-request/retry-request.c b/filters/retry-request/retry-request.c index 7297ade3a8ff..28a65564ff2f 100644 --- a/filters/retry-request/retry-request.c +++ b/filters/retry-request/retry-request.c @@ -276,4 +276,4 @@ static struct nbdkit_filter filter = { .cache = retry_request_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/retry/retry.c b/filters/retry/retry.c index 34a799247982..c94598a2643f 100644 --- a/filters/retry/retry.c +++ b/filters/retry/retry.c @@ -512,4 +512,4 @@ static struct nbdkit_filter filter = { .cache = retry_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/scan/scan.c b/filters/scan/scan.c index 8a966577993d..342257d2652b 100644 --- a/filters/scan/scan.c +++ b/filters/scan/scan.c @@ -271,4 +271,4 @@ static struct nbdkit_filter filter = { .pread = scan_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/swab/swab.c b/filters/swab/swab.c index 6e8dc981bee8..7c5dfe4a59cf 100644 --- a/filters/swab/swab.c +++ b/filters/swab/swab.c @@ -250,4 +250,4 @@ static struct nbdkit_filter filter = { .cache = swab_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/tar/tar.c b/filters/tar/tar.c index deda79e2e701..85507d82c172 100644 --- a/filters/tar/tar.c +++ b/filters/tar/tar.c @@ -429,4 +429,4 @@ static struct nbdkit_filter filter = { .cache = tar_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/tls-fallback/tls-fallback.c b/filters/tls-fallback/tls-fallback.c index e55fc24f517e..982dea6c7d79 100644 --- a/filters/tls-fallback/tls-fallback.c +++ b/filters/tls-fallback/tls-fallback.c @@ -243,4 +243,4 @@ static struct nbdkit_filter filter = { .pread = tls_fallback_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/truncate/truncate.c b/filters/truncate/truncate.c index 10fb2fc98a0d..116b4affab3e 100644 --- a/filters/truncate/truncate.c +++ b/filters/truncate/truncate.c @@ -435,4 +435,4 @@ static struct nbdkit_filter filter = { .cache = truncate_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/xz/xz.c b/filters/xz/xz.c index 5e717a8f3a74..bb04c8133095 100644 --- a/filters/xz/xz.c +++ b/filters/xz/xz.c @@ -283,4 +283,4 @@ static struct nbdkit_filter filter = { .pread = xz_pread, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/tests/cc-shebang.c b/tests/cc-shebang.c index 50e07f841d85..de2730f676e1 100755 --- a/tests/cc-shebang.c +++ b/tests/cc-shebang.c @@ -49,4 +49,4 @@ static struct nbdkit_plugin plugin = { .pwrite = my_pwrite, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/dummy-vddk.c b/tests/dummy-vddk.c index 0c5e505fb3da..be321a88e5b4 100644 --- a/tests/dummy-vddk.c +++ b/tests/dummy-vddk.c @@ -46,8 +46,8 @@ #include "vddk-structs.h" -#define STUB(fn,ret,args) extern ret fn args; -#define OPTIONAL_STUB(fn,ret,args) +#define STUB(fn, ret, args) extern ret fn args; +#define OPTIONAL_STUB(fn, ret, args) #include "vddk-stubs.h" #undef STUB #undef OPTIONAL_STUB diff --git a/tests/test-ansi-c-plugin.c b/tests/test-ansi-c-plugin.c index 9f78306d2f32..14599c4fb004 100644 --- a/tests/test-ansi-c-plugin.c +++ b/tests/test-ansi-c-plugin.c @@ -172,4 +172,4 @@ static struct nbdkit_plugin plugin = { ansi_c_pread }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-disconnect-plugin.c b/tests/test-disconnect-plugin.c index 181b262f084c..c69aafbc254c 100644 --- a/tests/test-disconnect-plugin.c +++ b/tests/test-disconnect-plugin.c @@ -92,4 +92,4 @@ static struct nbdkit_plugin plugin = { .pwrite = disconnect_pwrite, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-flush-plugin.c b/tests/test-flush-plugin.c index 6ac4ac7fe99a..1258ebdc8945 100644 --- a/tests/test-flush-plugin.c +++ b/tests/test-flush-plugin.c @@ -116,4 +116,4 @@ static struct nbdkit_plugin plugin = { .flush = flush_flush, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-layers-filter.c b/tests/test-layers-filter.c index 380e3cea5050..3c7b83fddbb6 100644 --- a/tests/test-layers-filter.c +++ b/tests/test-layers-filter.c @@ -458,4 +458,4 @@ static struct nbdkit_filter filter = { .cache = test_layers_filter_cache, }; -NBDKIT_REGISTER_FILTER(filter) +NBDKIT_REGISTER_FILTER (filter) diff --git a/tests/test-layers-plugin.c b/tests/test-layers-plugin.c index 1716b5b9c1f2..72c99cc9ea81 100644 --- a/tests/test-layers-plugin.c +++ b/tests/test-layers-plugin.c @@ -313,4 +313,4 @@ static struct nbdkit_plugin plugin = { .errno_is_preserved = 1, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-layers.c b/tests/test-layers.c index a2fd64dd8a0a..ed718325a617 100644 --- a/tests/test-layers.c +++ b/tests/test-layers.c @@ -73,7 +73,7 @@ static void *start_log_capture (void *); static void log_verify_seen (const char *msg); static void log_verify_seen_in_order (const char *msg, ...) - __attribute__((sentinel)); + __attribute__ ((sentinel)); static void log_free (void); static void short_sleep (void); @@ -697,7 +697,7 @@ static void short_sleep (void) * NB: The log buffer is NOT \0-terminated. */ -static void no_message_error (const char *msg) __attribute__((noreturn)); +static void no_message_error (const char *msg) __attribute__ ((noreturn)); static void no_message_error (const char *msg) @@ -716,7 +716,7 @@ log_verify_seen (const char *msg) } static void messages_out_of_order (const char *msg1, const char *msg2) - __attribute__((noreturn)); + __attribute__ ((noreturn)); static void messages_out_of_order (const char *msg1, const char *msg2) diff --git a/tests/test-read-password-plugin.c b/tests/test-read-password-plugin.c index 7520f5cdc27c..88f6221fdbfa 100755 --- a/tests/test-read-password-plugin.c +++ b/tests/test-read-password-plugin.c @@ -133,4 +133,4 @@ static struct nbdkit_plugin plugin = { .pread = password_pread, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-shutdown-plugin.c b/tests/test-shutdown-plugin.c index 9653dddedcdb..b7981a10b9b6 100644 --- a/tests/test-shutdown-plugin.c +++ b/tests/test-shutdown-plugin.c @@ -86,4 +86,4 @@ static struct nbdkit_plugin plugin = { .pwrite = shutdown_pwrite, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test-stdio-plugin.c b/tests/test-stdio-plugin.c index 09382a094a0e..93dfe46a3f87 100644 --- a/tests/test-stdio-plugin.c +++ b/tests/test-stdio-plugin.c @@ -179,4 +179,4 @@ static struct nbdkit_plugin plugin = { .pread = stdio_pread, }; -NBDKIT_REGISTER_PLUGIN(plugin) +NBDKIT_REGISTER_PLUGIN (plugin) diff --git a/tests/test.h b/tests/test.h index cf74d148d393..dd78334a62f6 100644 --- a/tests/test.h +++ b/tests/test.h @@ -44,8 +44,8 @@ extern const char *server[2]; /* server parameter for add_drive */ /* Can be called more than once (useful for nbd plugin) */ extern int test_start_nbdkit (const char *arg, ...) - __attribute__((__nonnull__ (1))) - __attribute__((__sentinel__)); + __attribute__ ((__nonnull__ (1))) + __attribute__ ((__sentinel__)); /* Declare program_name. */ #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 diff --git a/tests/web-server.h b/tests/web-server.h index 6400169cdc8c..b7333fcf58c5 100644 --- a/tests/web-server.h +++ b/tests/web-server.h @@ -61,6 +61,6 @@ typedef void (*check_request_t) (const char *request); extern const char *web_server (const char *filename, check_request_t check_request) - __attribute__((__nonnull__ (1))); + __attribute__ ((__nonnull__ (1))); #endif /* NBDKIT_WEB_SERVER_H */ diff --git a/wrapper.c b/wrapper.c index 176e2e356940..cf1d52ae4fad 100644 --- a/wrapper.c +++ b/wrapper.c @@ -105,7 +105,7 @@ passthru (const char *s) abort (); } -static void __attribute__((format (printf, 1, 2))) +static void __attribute__ ((format (printf, 1, 2))) passthru_format (const char *fs, ...) { va_list args; @@ -233,9 +233,9 @@ main (int argc, char *argv[]) #endif /* Needed for plugins written in OCaml. */ -#if defined(WIN32) +#if defined (WIN32) #define LD_LIBRARY_PATH "PATH" -#elif defined(__APPLE__) +#elif defined (__APPLE__) #define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH" #else #define LD_LIBRARY_PATH "LD_LIBRARY_PATH"