diff options
author | Michael Kjorling <[email protected]> | 2013-11-01 20:26:11 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-12-18 16:46:35 -0800 |
commit | d1d7e2689db9e03f11c069ebc9f1ba12829e5dac (patch) | |
tree | 75b9a2b23334d5f673fb31f142f74146d351865c /include | |
parent | 8ffef572ed2ba97e0c2d6a8aa2240012e611dc6f (diff) |
cstyle: Resolve C style issues
The vast majority of these changes are in Linux specific code.
They are the result of not having an automated style checker to
validate the code when it was originally written. Others were
caused when the common code was slightly adjusted for Linux.
This patch contains no functional changes. It only refreshes
the code to conform to style guide.
Everyone submitting patches for inclusion upstream should now
run 'make checkstyle' and resolve any warning prior to opening
a pull request. The automated builders have been updated to
fail a build if when 'make checkstyle' detects an issue.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1821
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev_compat.h | 136 | ||||
-rw-r--r-- | include/linux/dcache_compat.h | 14 | ||||
-rw-r--r-- | include/linux/vfs_compat.h | 38 | ||||
-rw-r--r-- | include/linux/xattr_compat.h | 32 | ||||
-rw-r--r-- | include/sys/dmu_tx.h | 4 | ||||
-rw-r--r-- | include/sys/fm/fs/zfs.h | 2 | ||||
-rw-r--r-- | include/sys/fm/util.h | 18 | ||||
-rw-r--r-- | include/sys/fs/zfs.h | 2 | ||||
-rw-r--r-- | include/sys/vdev_disk.h | 2 | ||||
-rw-r--r-- | include/sys/zfs_context.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_debug.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_delay.h | 2 | ||||
-rw-r--r-- | include/sys/zfs_ioctl.h | 2 | ||||
-rw-r--r-- | include/sys/zfs_sa.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_vfsops.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_znode.h | 4 | ||||
-rw-r--r-- | include/sys/zil.h | 4 | ||||
-rw-r--r-- | include/sys/zil_impl.h | 2 | ||||
-rw-r--r-- | include/sys/zio.h | 2 | ||||
-rw-r--r-- | include/sys/zpl.h | 23 | ||||
-rw-r--r-- | include/zpios-ctl.h | 113 | ||||
-rw-r--r-- | include/zpios-internal.h | 54 |
22 files changed, 231 insertions, 239 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index ec9926ffd..e45601bc8 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -27,7 +27,7 @@ */ #ifndef _ZFS_BLKDEV_H -#define _ZFS_BLKDEV_H +#define _ZFS_BLKDEV_H #include <linux/blkdev.h> #include <linux/elevator.h> @@ -46,7 +46,7 @@ blk_fetch_request(struct request_queue *q) if (req) blkdev_dequeue_request(req); - return req; + return (req); } #endif /* HAVE_BLK_FETCH_REQUEST */ @@ -79,7 +79,7 @@ __blk_end_request(struct request *req, int error, unsigned int nr_bytes) req->hard_cur_sectors = nr_bytes >> 9; end_request(req, ((error == 0) ? 1 : error)); - return 0; + return (0); } static inline bool @@ -92,17 +92,17 @@ blk_end_request(struct request *req, int error, unsigned int nr_bytes) rc = __blk_end_request(req, error, nr_bytes); spin_unlock_irq(q->queue_lock); - return rc; + return (rc); } #else -# ifdef HAVE_BLK_END_REQUEST_GPL_ONLY +#ifdef HAVE_BLK_END_REQUEST_GPL_ONLY /* * Define required to avoid conflicting 2.6.29 non-static prototype for a * GPL-only version of the helper. As of 2.6.31 the helper is available * to non-GPL modules and is not explicitly exported GPL-only. */ -# define __blk_end_request __blk_end_request_x -# define blk_end_request blk_end_request_x +#define __blk_end_request __blk_end_request_x +#define blk_end_request blk_end_request_x static inline bool __blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) @@ -115,7 +115,7 @@ __blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) req->hard_cur_sectors = nr_bytes >> 9; end_request(req, ((error == 0) ? 1 : error)); - return 0; + return (0); } static inline bool blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) @@ -127,9 +127,9 @@ blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) rc = __blk_end_request_x(req, error, nr_bytes); spin_unlock_irq(q->queue_lock); - return rc; + return (rc); } -# endif /* HAVE_BLK_END_REQUEST_GPL_ONLY */ +#endif /* HAVE_BLK_END_REQUEST_GPL_ONLY */ #endif /* HAVE_BLK_END_REQUEST */ /* @@ -141,7 +141,7 @@ blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) * that long term this function will be opened up. */ #if defined(HAVE_BLK_QUEUE_FLUSH) && defined(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY) -#define blk_queue_flush __blk_queue_flush +#define blk_queue_flush __blk_queue_flush static inline void __blk_queue_flush(struct request_queue *q, unsigned int flags) { @@ -153,7 +153,7 @@ __blk_queue_flush(struct request_queue *q, unsigned int flags) static inline sector_t blk_rq_pos(struct request *req) { - return req->sector; + return (req->sector); } #endif /* HAVE_BLK_RQ_POS */ @@ -161,7 +161,7 @@ blk_rq_pos(struct request *req) static inline unsigned int blk_rq_sectors(struct request *req) { - return req->nr_sectors; + return (req->nr_sectors); } #endif /* HAVE_BLK_RQ_SECTORS */ @@ -171,11 +171,11 @@ blk_rq_sectors(struct request *req) * GPL-only version of the helper. As of 2.6.31 the helper is available * to non-GPL modules in the form of a static inline in the header. */ -#define blk_rq_bytes __blk_rq_bytes +#define blk_rq_bytes __blk_rq_bytes static inline unsigned int __blk_rq_bytes(struct request *req) { - return blk_rq_sectors(req) << 9; + return (blk_rq_sectors(req) << 9); } #endif /* !HAVE_BLK_RQ_BYTES || HAVE_BLK_RQ_BYTES_GPL_ONLY */ @@ -186,7 +186,7 @@ __blk_rq_bytes(struct request *req) * macros are redefined here if they are missing from the kernel. */ #ifndef blk_fs_request -#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) +#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) #endif /* @@ -197,7 +197,7 @@ __blk_rq_bytes(struct request *req) * this legacy behavior. */ #ifndef blk_queue_stackable -#define blk_queue_stackable(q) ((q)->request_fn == NULL) +#define blk_queue_stackable(q) ((q)->request_fn == NULL) #endif /* @@ -205,7 +205,7 @@ __blk_rq_bytes(struct request *req) * The blk_queue_max_hw_sectors() function replaces blk_queue_max_sectors(). */ #ifndef HAVE_BLK_QUEUE_MAX_HW_SECTORS -#define blk_queue_max_hw_sectors __blk_queue_max_hw_sectors +#define blk_queue_max_hw_sectors __blk_queue_max_hw_sectors static inline void __blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors) { @@ -219,7 +219,7 @@ __blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors) * blk_queue_max_hw_segments() and blk_queue_max_phys_segments(). */ #ifndef HAVE_BLK_QUEUE_MAX_SEGMENTS -#define blk_queue_max_segments __blk_queue_max_segments +#define blk_queue_max_segments __blk_queue_max_segments static inline void __blk_queue_max_segments(struct request_queue *q, unsigned short max_segments) { @@ -235,7 +235,7 @@ __blk_queue_max_segments(struct request_queue *q, unsigned short max_segments) * a read-modify-write penalty. For older kernels this is a no-op. */ #ifndef HAVE_BLK_QUEUE_PHYSICAL_BLOCK_SIZE -#define blk_queue_physical_block_size(q, x) ((void)(0)) +#define blk_queue_physical_block_size(q, x) ((void)(0)) #endif /* @@ -244,7 +244,7 @@ __blk_queue_max_segments(struct request_queue *q, unsigned short max_segments) * I/O size for the device. For older kernels this is a no-op. */ #ifndef HAVE_BLK_QUEUE_IO_OPT -#define blk_queue_io_opt(q, x) ((void)(0)) +#define blk_queue_io_opt(q, x) ((void)(0)) #endif #ifndef HAVE_GET_DISK_RO @@ -256,7 +256,7 @@ get_disk_ro(struct gendisk *disk) if (disk->part[0]) policy = disk->part[0]->policy; - return policy; + return (policy); } #endif /* HAVE_GET_DISK_RO */ @@ -274,14 +274,14 @@ struct req_iterator { struct bio *bio; }; -# define for_each_bio(_bio) \ +#define for_each_bio(_bio) \ for (; _bio; _bio = _bio->bi_next) -# define __rq_for_each_bio(_bio, rq) \ +#define __rq_for_each_bio(_bio, rq) \ if ((rq->bio)) \ for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) -# define rq_for_each_segment(bvl, _rq, _iter) \ +#define rq_for_each_segment(bvl, _rq, _iter) \ __rq_for_each_bio(_iter.bio, _rq) \ bio_for_each_segment(bvl, _iter.bio, _iter.i) #endif /* HAVE_RQ_FOR_EACH_SEGMENT */ @@ -315,21 +315,23 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) #ifdef HAVE_BIO_RW_FAILFAST_DTD /* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */ - *flags |= - ((1 << BIO_RW_FAILFAST_DEV) | - (1 << BIO_RW_FAILFAST_TRANSPORT) | - (1 << BIO_RW_FAILFAST_DRIVER)); + *flags |= ( + (1 << BIO_RW_FAILFAST_DEV) | + (1 << BIO_RW_FAILFAST_TRANSPORT) | + (1 << BIO_RW_FAILFAST_DRIVER)); #else -# ifdef HAVE_BIO_RW_FAILFAST +#ifdef HAVE_BIO_RW_FAILFAST /* BIO_RW_FAILFAST preferred interface from 2.6.12 - 2.6.27 */ *flags |= (1 << BIO_RW_FAILFAST); -# else -# ifdef HAVE_REQ_FAILFAST_MASK - /* REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, - * the BIO_* and REQ_* flags were unified under REQ_* flags. */ +#else +#ifdef HAVE_REQ_FAILFAST_MASK + /* + * REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, + * the BIO_* and REQ_* flags were unified under REQ_* flags. + */ *flags |= REQ_FAILFAST_MASK; -# endif /* HAVE_REQ_FAILFAST_MASK */ -# endif /* HAVE_BIO_RW_FAILFAST */ +#endif /* HAVE_REQ_FAILFAST_MASK */ +#endif /* HAVE_BIO_RW_FAILFAST */ #endif /* HAVE_BIO_RW_FAILFAST_DTD */ } @@ -337,7 +339,7 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * Maximum disk label length, it may be undefined for some kernels. */ #ifndef DISK_NAME_LEN -#define DISK_NAME_LEN 32 +#define DISK_NAME_LEN 32 #endif /* DISK_NAME_LEN */ /* @@ -346,12 +348,14 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * macro's to ensure the prototype and return value are handled. */ #ifdef HAVE_2ARGS_BIO_END_IO_T -# define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z) -# define BIO_END_IO_RETURN(rc) return +#define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z) +#define BIO_END_IO_RETURN(rc) return #else -# define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \ - unsigned int y, int z) -# define BIO_END_IO_RETURN(rc) return rc +#define BIO_END_IO_PROTO(fn, x, y, z) static int fn( \ + struct bio *x, \ + unsigned int y, \ + int z) +#define BIO_END_IO_RETURN(rc) return rc #endif /* HAVE_2ARGS_BIO_END_IO_T */ /* @@ -370,15 +374,15 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * Used to exclusively open a block device from within the kernel. */ #if defined(HAVE_BLKDEV_GET_BY_PATH) -# define vdev_bdev_open(path, md, hld) blkdev_get_by_path(path, \ +#define vdev_bdev_open(path, md, hld) blkdev_get_by_path(path, \ (md) | FMODE_EXCL, hld) -# define vdev_bdev_close(bdev, md) blkdev_put(bdev, (md) | FMODE_EXCL) +#define vdev_bdev_close(bdev, md) blkdev_put(bdev, (md) | FMODE_EXCL) #elif defined(HAVE_OPEN_BDEV_EXCLUSIVE) -# define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld) -# define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md) +#define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld) +#define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md) #else -# define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld) -# define vdev_bdev_close(bdev, md) close_bdev_excl(bdev) +#define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld) +#define vdev_bdev_close(bdev, md) close_bdev_excl(bdev) #endif /* HAVE_BLKDEV_GET_BY_PATH | HAVE_OPEN_BDEV_EXCLUSIVE */ /* @@ -387,9 +391,9 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * it was unused. */ #ifdef HAVE_1ARG_INVALIDATE_BDEV -# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev) +#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev) #else -# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) +#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) #endif /* HAVE_1ARG_INVALIDATE_BDEV */ /* @@ -398,7 +402,7 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * symbol was not exported. */ #ifndef HAVE_LOOKUP_BDEV -# define lookup_bdev(path) ERR_PTR(-ENOTSUP) +#define lookup_bdev(path) ERR_PTR(-ENOTSUP) #endif /* @@ -416,13 +420,13 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * the logical block size interface and then the older hard sector size. */ #ifdef HAVE_BDEV_PHYSICAL_BLOCK_SIZE -# define vdev_bdev_block_size(bdev) bdev_physical_block_size(bdev) +#define vdev_bdev_block_size(bdev) bdev_physical_block_size(bdev) +#else +#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE +#define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev) #else -# ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE -# define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev) -# else -# define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev) -# endif /* HAVE_BDEV_LOGICAL_BLOCK_SIZE */ +#define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev) +#endif /* HAVE_BDEV_LOGICAL_BLOCK_SIZE */ #endif /* HAVE_BDEV_PHYSICAL_BLOCK_SIZE */ /* @@ -438,13 +442,13 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * compatibility macros. */ #ifdef WRITE_FLUSH_FUA -# define VDEV_WRITE_FLUSH_FUA WRITE_FLUSH_FUA -# define VDEV_REQ_FLUSH REQ_FLUSH -# define VDEV_REQ_FUA REQ_FUA +#define VDEV_WRITE_FLUSH_FUA WRITE_FLUSH_FUA +#define VDEV_REQ_FLUSH REQ_FLUSH +#define VDEV_REQ_FUA REQ_FUA #else -# define VDEV_WRITE_FLUSH_FUA WRITE_BARRIER -# define VDEV_REQ_FLUSH REQ_HARDBARRIER -# define VDEV_REQ_FUA REQ_HARDBARRIER +#define VDEV_WRITE_FLUSH_FUA WRITE_BARRIER +#define VDEV_REQ_FLUSH REQ_HARDBARRIER +#define VDEV_REQ_FUA REQ_HARDBARRIER #endif /* @@ -452,7 +456,7 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * Use the normal I/O patch for discards. */ #ifdef REQ_DISCARD -# define VDEV_REQ_DISCARD REQ_DISCARD +#define VDEV_REQ_DISCARD REQ_DISCARD #endif /* @@ -467,7 +471,7 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) q->limits.discard_granularity = dg; } #else -#define blk_queue_discard_granularity(x, dg) ((void)0) +#define blk_queue_discard_granularity(x, dg) ((void)0) #endif /* HAVE_DISCARD_GRANULARITY */ /* @@ -485,6 +489,6 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) * user space processes which don't pass this value will get EBUSY. This is * currently required for the correct operation of hot spares. */ -#define VDEV_HOLDER ((void *)0x2401de7) +#define VDEV_HOLDER ((void *)0x2401de7) #endif /* _ZFS_BLKDEV_H */ diff --git a/include/linux/dcache_compat.h b/include/linux/dcache_compat.h index 2b9e5c1c4..bdaa5db3e 100644 --- a/include/linux/dcache_compat.h +++ b/include/linux/dcache_compat.h @@ -24,15 +24,15 @@ */ #ifndef _ZFS_DCACHE_H -#define _ZFS_DCACHE_H +#define _ZFS_DCACHE_H #include <linux/dcache.h> -#define dname(dentry) ((char *)((dentry)->d_name.name)) -#define dlen(dentry) ((int)((dentry)->d_name.len)) +#define dname(dentry) ((char *)((dentry)->d_name.name)) +#define dlen(dentry) ((int)((dentry)->d_name.len)) #ifndef HAVE_D_MAKE_ROOT -#define d_make_root(inode) d_alloc_root(inode) +#define d_make_root(inode) d_alloc_root(inode) #endif /* HAVE_D_MAKE_ROOT */ /* @@ -74,9 +74,9 @@ d_clear_d_op(struct dentry *dentry) { #ifdef HAVE_D_SET_D_OP dentry->d_op = NULL; - dentry->d_flags &= - ~(DCACHE_OP_HASH | DCACHE_OP_COMPARE | - DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE); + dentry->d_flags &= ~( + DCACHE_OP_HASH | DCACHE_OP_COMPARE | + DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE); #endif /* HAVE_D_SET_D_OP */ } diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h index 8ec1bccad..4778491fa 100644 --- a/include/linux/vfs_compat.h +++ b/include/linux/vfs_compat.h @@ -24,7 +24,7 @@ */ #ifndef _ZFS_VFS_H -#define _ZFS_VFS_H +#define _ZFS_VFS_H /* * 2.6.28 API change, @@ -71,7 +71,10 @@ truncate_setsize(struct inode *ip, loff_t new) extern atomic_long_t zfs_bdi_seq; static inline int -bdi_setup_and_register(struct backing_dev_info *bdi,char *name,unsigned int cap) +bdi_setup_and_register( + struct backing_dev_info *bdi, + char *name, + unsigned int cap) { char tmp[32]; int error; @@ -99,7 +102,7 @@ bdi_setup_and_register(struct backing_dev_info *bdi,char *name,unsigned int cap) * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. */ #ifndef LOOKUP_RCU -#define LOOKUP_RCU 0x0 +#define LOOKUP_RCU 0x0 #endif /* LOOKUP_RCU */ /* @@ -136,7 +139,7 @@ typedef int zpl_umode_t; * configure check in config/kernel-clear-inode.m4 for full details. */ #if defined(HAVE_EVICT_INODE) && !defined(HAVE_CLEAR_INODE) -#define clear_inode(ip) end_writeback(ip) +#define clear_inode(ip) end_writeback(ip) #endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */ /* @@ -144,18 +147,21 @@ typedef int zpl_umode_t; * The sget() helper function now takes the mount flags as an argument. */ #ifdef HAVE_5ARG_SGET -#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd) +#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd) #else -#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd) +#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd) #endif /* HAVE_5ARG_SGET */ -#define ZFS_IOC_GETFLAGS FS_IOC_GETFLAGS -#define ZFS_IOC_SETFLAGS FS_IOC_SETFLAGS +#define ZFS_IOC_GETFLAGS FS_IOC_GETFLAGS +#define ZFS_IOC_SETFLAGS FS_IOC_SETFLAGS #if defined(SEEK_HOLE) && defined(SEEK_DATA) && !defined(HAVE_LSEEK_EXECUTE) static inline loff_t -lseek_execute(struct file *filp, struct inode *inode, - loff_t offset, loff_t maxsize) +lseek_execute( + struct file *filp, + struct inode *inode, + loff_t offset, + loff_t maxsize) { if (offset < 0 && !(filp->f_mode & FMODE_UNSIGNED_OFFSET)) return (-EINVAL); @@ -186,7 +192,7 @@ lseek_execute(struct file *filp, struct inode *inode, */ #include <linux/posix_acl.h> #ifndef HAVE_POSIX_ACL_CACHING -#define ACL_NOT_CACHED ((void *)(-1)) +#define ACL_NOT_CACHED ((void *)(-1)) #endif /* HAVE_POSIX_ACL_CACHING */ #if defined(HAVE_POSIX_ACL_RELEASE) && !defined(HAVE_POSIX_ACL_RELEASE_GPL_ONLY) @@ -224,14 +230,14 @@ zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer) { if ((newer != ACL_NOT_CACHED) && (newer != NULL)) posix_acl_dup(newer); - switch(type) { + switch (type) { case ACL_TYPE_ACCESS: older = ip->i_acl; - rcu_assign_pointer(ip->i_acl,newer); + rcu_assign_pointer(ip->i_acl, newer); break; case ACL_TYPE_DEFAULT: older = ip->i_default_acl; - rcu_assign_pointer(ip->i_default_acl,newer); + rcu_assign_pointer(ip->i_default_acl, newer); break; } @@ -276,11 +282,11 @@ posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) { *acl = NULL; } - return (error); + return (error); } static inline int -posix_acl_create(struct posix_acl** acl, int flags, umode_t* umodep) { +posix_acl_create(struct posix_acl **acl, int flags, umode_t *umodep) { struct posix_acl *oldacl = *acl; mode_t mode = *umodep; int error; diff --git a/include/linux/xattr_compat.h b/include/linux/xattr_compat.h index f06ba1fa0..a7371f946 100644 --- a/include/linux/xattr_compat.h +++ b/include/linux/xattr_compat.h @@ -24,7 +24,7 @@ */ #ifndef _ZFS_XATTR_H -#define _ZFS_XATTR_H +#define _ZFS_XATTR_H #include <linux/posix_acl_xattr.h> @@ -47,19 +47,19 @@ typedef struct xattr_handler xattr_handler_t; * instead of an inode, and a handler_flags argument was added. */ #ifdef HAVE_DENTRY_XATTR_GET -#define ZPL_XATTR_GET_WRAPPER(fn) \ +#define ZPL_XATTR_GET_WRAPPER(fn) \ static int \ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ int unused_handler_flags) \ { \ - return __ ## fn(dentry->d_inode, name, buffer, size); \ + return (__ ## fn(dentry->d_inode, name, buffer, size)); \ } #else -#define ZPL_XATTR_GET_WRAPPER(fn) \ +#define ZPL_XATTR_GET_WRAPPER(fn) \ static int \ fn(struct inode *ip, const char *name, void *buffer, size_t size) \ { \ - return __ ## fn(ip, name, buffer, size); \ + return (__ ## fn(ip, name, buffer, size)); \ } #endif /* HAVE_DENTRY_XATTR_GET */ @@ -69,28 +69,28 @@ fn(struct inode *ip, const char *name, void *buffer, size_t size) \ * instead of an inode, and a handler_flags argument was added. */ #ifdef HAVE_DENTRY_XATTR_SET -#define ZPL_XATTR_SET_WRAPPER(fn) \ +#define ZPL_XATTR_SET_WRAPPER(fn) \ static int \ fn(struct dentry *dentry, const char *name, const void *buffer, \ size_t size, int flags, int unused_handler_flags) \ { \ - return __ ## fn(dentry->d_inode, name, buffer, size, flags); \ + return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \ } #else -#define ZPL_XATTR_SET_WRAPPER(fn) \ +#define ZPL_XATTR_SET_WRAPPER(fn) \ static int \ fn(struct inode *ip, const char *name, const void *buffer, \ size_t size, int flags) \ { \ - return __ ## fn(ip, name, buffer, size, flags); \ + return (__ ## fn(ip, name, buffer, size, flags)); \ } #endif /* HAVE_DENTRY_XATTR_SET */ #ifdef HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY -#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ +#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ security_inode_init_security(ip, dip, qstr, nm, val, len) #else -#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ +#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ security_inode_init_security(ip, dip, nm, val, len) #endif /* HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY */ @@ -103,27 +103,27 @@ fn(struct inode *ip, const char *name, const void *buffer, \ static inline struct posix_acl * zpl_acl_from_xattr(const void *value, int size) { - return posix_acl_from_xattr(CRED()->user_ns, value, size); + return (posix_acl_from_xattr(CRED()->user_ns, value, size)); } static inline int zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size) { - return posix_acl_to_xattr(CRED()->user_ns,acl, value, size); + return (posix_acl_to_xattr(CRED()->user_ns, acl, value, size)); } #else static inline struct posix_acl * -zpl_acl_from_xattr(const void *value,int size) +zpl_acl_from_xattr(const void *value, int size) { - return posix_acl_from_xattr(value, size); + return (posix_acl_from_xattr(value, size)); } static inline int zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size) { - return posix_acl_to_xattr(acl, value, size); + return (posix_acl_to_xattr(acl, value, size)); } #endif /* HAVE_POSIX_ACL_FROM_XATTR_USERNS */ diff --git a/include/sys/dmu_tx.h b/include/sys/dmu_tx.h index f6a62af4b..59a147402 100644 --- a/include/sys/dmu_tx.h +++ b/include/sys/dmu_tx.h @@ -142,9 +142,9 @@ typedef struct dmu_tx_stats { extern dmu_tx_stats_t dmu_tx_stats; -#define DMU_TX_STAT_INCR(stat, val) \ +#define DMU_TX_STAT_INCR(stat, val) \ atomic_add_64(&dmu_tx_stats.stat.value.ui64, (val)); -#define DMU_TX_STAT_BUMP(stat) \ +#define DMU_TX_STAT_BUMP(stat) \ DMU_TX_STAT_INCR(stat, 1); /* diff --git a/include/sys/fm/fs/zfs.h b/include/sys/fm/fs/zfs.h index 741b99e62..d9122ac5f 100644 --- a/include/sys/fm/fs/zfs.h +++ b/include/sys/fm/fs/zfs.h @@ -39,7 +39,7 @@ extern "C" { #define FM_EREPORT_ZFS_CONFIG_SYNC "config.sync" #define FM_EREPORT_ZFS_POOL "zpool" #define FM_EREPORT_ZFS_POOL_DESTROY "zpool.destroy" -#define FM_EREPORT_ZFS_POOL_REGUID "zpool.reguid" +#define FM_EREPORT_ZFS_POOL_REGUID "zpool.reguid" #define FM_EREPORT_ZFS_DEVICE_UNKNOWN "vdev.unknown" #define FM_EREPORT_ZFS_DEVICE_OPEN_FAILED "vdev.open_failed" #define FM_EREPORT_ZFS_DEVICE_CORRUPT_DATA "vdev.corrupt_data" diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h index a3a8c3f86..2f03d1011 100644 --- a/include/sys/fm/util.h +++ b/include/sys/fm/util.h @@ -71,22 +71,22 @@ typedef struct erpt_dump { #ifdef _KERNEL -#define ZEVENT_SHUTDOWN 0x1 +#define ZEVENT_SHUTDOWN 0x1 typedef void zevent_cb_t(nvlist_t *, nvlist_t *); typedef struct zevent_s { - nvlist_t *ev_nvl; /* protected by the zevent_lock */ - nvlist_t *ev_detector; /* " */ - list_t ev_ze_list; /* " */ - list_node_t ev_node; /* " */ - zevent_cb_t *ev_cb; /* " */ + nvlist_t *ev_nvl; /* protected by the zevent_lock */ + nvlist_t *ev_detector; /* " */ + list_t ev_ze_list; /* " */ + list_node_t ev_node; /* " */ + zevent_cb_t *ev_cb; /* " */ } zevent_t; typedef struct zfs_zevent { - zevent_t *ze_zevent; /* protected by the zevent_lock */ - list_node_t ze_node; /* " */ - uint64_t ze_dropped; /* " */ + zevent_t *ze_zevent; /* protected by the zevent_lock */ + list_node_t ze_node; /* " */ + uint64_t ze_dropped; /* " */ } zfs_zevent_t; extern void fm_init(void); diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index b19ebb6fe..cfcc78b80 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -859,7 +859,7 @@ typedef enum zfs_ioc { /* * zvol ioctl to get dataset name */ -#define BLKZNAME _IOR(0x12,125,char[ZFS_MAXNAMELEN]) +#define BLKZNAME _IOR(0x12, 125, char[ZFS_MAXNAMELEN]) /* * Internal SPA load state. Used by FMA diagnosis engine. diff --git a/include/sys/vdev_disk.h b/include/sys/vdev_disk.h index daefed718..d5a1889d2 100644 --- a/include/sys/vdev_disk.h +++ b/include/sys/vdev_disk.h @@ -26,7 +26,7 @@ */ #ifndef _SYS_VDEV_DISK_H -#define _SYS_VDEV_DISK_H +#define _SYS_VDEV_DISK_H #ifdef _KERNEL #include <sys/vdev.h> diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 3fd9e1be0..fa12cea53 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -225,7 +225,7 @@ typedef void (*thread_func_t)(void *); typedef void (*thread_func_arg_t)(void *); typedef pthread_t kt_did_t; -#define kpreempt(x) ((void)0) +#define kpreempt(x) ((void)0) typedef struct kthread { kt_did_t t_tid; @@ -711,7 +711,7 @@ void ksiddomain_rele(ksiddomain_t *); #define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) \ sysevent_post_event(_c, _d, _b, "libzpool", _e, _f) -#define zfs_sleep_until(wakeup) \ +#define zfs_sleep_until(wakeup) \ do { \ hrtime_t delta = wakeup - gethrtime(); \ struct timespec ts; \ diff --git a/include/sys/zfs_debug.h b/include/sys/zfs_debug.h index 1013009fd..e51207955 100644 --- a/include/sys/zfs_debug.h +++ b/include/sys/zfs_debug.h @@ -75,7 +75,7 @@ extern int zfs_recover; * filtered based on the zfs_flags variable. */ #else -#define dprintf(...) \ +#define dprintf(...) \ if (zfs_flags & ZFS_DEBUG_DPRINTF) \ __dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) @@ -92,7 +92,7 @@ typedef struct zfs_dbgmsg { extern void zfs_dbgmsg_init(void); extern void zfs_dbgmsg_fini(void); #if defined(_KERNEL) && defined(__linux__) -#define zfs_dbgmsg(...) dprintf(__VA_ARGS__) +#define zfs_dbgmsg(...) dprintf(__VA_ARGS__) #else extern void zfs_dbgmsg(const char *fmt, ...); extern void zfs_dbgmsg_print(const char *tag); diff --git a/include/sys/zfs_delay.h b/include/sys/zfs_delay.h index 4c7663117..b56a7daa7 100644 --- a/include/sys/zfs_delay.h +++ b/include/sys/zfs_delay.h @@ -27,7 +27,7 @@ /* * Generic wrapper to sleep until a given time. */ -#define zfs_sleep_until(wakeup) \ +#define zfs_sleep_until(wakeup) \ do { \ hrtime_t delta = wakeup - gethrtime(); \ \ diff --git a/include/sys/zfs_ioctl.h b/include/sys/zfs_ioctl.h index 52557d210..dad611328 100644 --- a/include/sys/zfs_ioctl.h +++ b/include/sys/zfs_ioctl.h @@ -368,7 +368,7 @@ enum zfsdev_state_type { }; typedef struct zfsdev_state { - list_node_t zs_next; /* next zfsdev_state_t link */ + list_node_t zs_next; /* next zfsdev_state_t link */ struct file *zs_file; /* associated file struct */ minor_t zs_minor; /* made up minor number */ void *zs_onexit; /* onexit data */ diff --git a/include/sys/zfs_sa.h b/include/sys/zfs_sa.h index 0bac7808a..735d4b32a 100644 --- a/include/sys/zfs_sa.h +++ b/include/sys/zfs_sa.h @@ -128,8 +128,8 @@ typedef struct znode_phys { #ifdef _KERNEL -#define DXATTR_MAX_ENTRY_SIZE (32768) -#define DXATTR_MAX_SA_SIZE (SPA_MAXBLOCKSIZE >> 1) +#define DXATTR_MAX_ENTRY_SIZE (32768) +#define DXATTR_MAX_SA_SIZE (SPA_MAXBLOCKSIZE >> 1) int zfs_sa_readlink(struct znode *, uio_t *); void zfs_sa_symlink(struct znode *, char *link, int len, dmu_tx_t *); diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index c9e9ba7f9..7dca3369d 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -70,7 +70,7 @@ typedef struct zfs_sb { krwlock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all znodes in the fs */ uint64_t z_nr_znodes; /* number of znodes in the fs */ - unsigned long z_rollback_time;/* last online rollback time */ + unsigned long z_rollback_time; /* last online rollback time */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ struct inode *z_ctldir; /* .zfs directory inode */ avl_tree_t z_ctldir_snaps; /* .zfs/snapshot entries */ @@ -102,7 +102,7 @@ typedef struct zfs_sb { * this the inode->i_nlink member is defined as an unsigned int. To be * safe we use 2^31-1 as the limit. */ -#define ZFS_LINK_MAX ((1U << 31) - 1U) +#define ZFS_LINK_MAX ((1U << 31) - 1U) /* * Normal filesystems (those not under .zfs/snapshot) have a total diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h index 620244556..4b70f7d0c 100644 --- a/include/sys/zfs_znode.h +++ b/include/sys/zfs_znode.h @@ -210,8 +210,8 @@ typedef struct znode { kmutex_t z_acl_lock; /* acl data lock */ zfs_acl_t *z_acl_cached; /* cached acl */ krwlock_t z_xattr_lock; /* xattr data lock */ - nvlist_t *z_xattr_cached;/* cached xattrs */ - struct znode *z_xattr_parent;/* xattr parent znode */ + nvlist_t *z_xattr_cached; /* cached xattrs */ + struct znode *z_xattr_parent; /* xattr parent znode */ list_node_t z_link_node; /* all znodes in fs link */ sa_handle_t *z_sa_hdl; /* handle to sa data */ boolean_t z_is_sa; /* are we native sa? */ diff --git a/include/sys/zil.h b/include/sys/zil.h index b6718b93c..400074270 100644 --- a/include/sys/zil.h +++ b/include/sys/zil.h @@ -430,9 +430,9 @@ typedef struct zil_stats { extern zil_stats_t zil_stats; -#define ZIL_STAT_INCR(stat, val) \ +#define ZIL_STAT_INCR(stat, val) \ atomic_add_64(&zil_stats.stat.value.ui64, (val)); -#define ZIL_STAT_BUMP(stat) \ +#define ZIL_STAT_BUMP(stat) \ ZIL_STAT_INCR(stat, 1); typedef int zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, diff --git a/include/sys/zil_impl.h b/include/sys/zil_impl.h index f5b69b7ed..0db4b525c 100644 --- a/include/sys/zil_impl.h +++ b/include/sys/zil_impl.h @@ -41,7 +41,7 @@ extern "C" { typedef struct lwb { zilog_t *lwb_zilog; /* back pointer to log struct */ blkptr_t lwb_blk; /* on disk address of this log blk */ - boolean_t lwb_fastwrite; /* is blk marked for fastwrite? */ + boolean_t lwb_fastwrite; /* is blk marked for fastwrite? */ int lwb_nused; /* # used bytes in buffer */ int lwb_sz; /* size of block and buffer */ char *lwb_buf; /* log write buffer */ diff --git a/include/sys/zio.h b/include/sys/zio.h index cfb256f0f..d4350badc 100644 --- a/include/sys/zio.h +++ b/include/sys/zio.h @@ -124,7 +124,7 @@ enum zio_compress { /* * Default Linux timeout for a sd device. */ -#define ZIO_DELAY_MAX (30 * MILLISEC) +#define ZIO_DELAY_MAX (30 * MILLISEC) #define ZIO_FAILURE_MODE_WAIT 0 #define ZIO_FAILURE_MODE_CONTINUE 1 diff --git a/include/sys/zpl.h b/include/sys/zpl.h index 5a7e23d46..56bd9ae5e 100644 --- a/include/sys/zpl.h +++ b/include/sys/zpl.h @@ -77,7 +77,7 @@ extern int zpl_set_acl(struct inode *ip, int type, struct posix_acl *acl); extern struct posix_acl *zpl_get_acl(struct inode *ip, int type); #if !defined(HAVE_GET_ACL) #if defined(HAVE_CHECK_ACL_WITH_FLAGS) -extern int zpl_check_acl(struct inode *inode, int mask,unsigned int flags); +extern int zpl_check_acl(struct inode *inode, int mask, unsigned int flags); #elif defined(HAVE_CHECK_ACL) extern int zpl_check_acl(struct inode *inode, int mask); #elif defined(HAVE_PERMISSION_WITH_NAMEIDATA) @@ -122,7 +122,7 @@ extern const struct inode_operations zpl_ops_shares; #ifdef HAVE_VFS_ITERATE -#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \ +#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \ .actor = _actor, \ .pos = _pos, \ } @@ -135,7 +135,7 @@ typedef struct dir_context { loff_t pos; } dir_context_t; -#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \ +#define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \ .dirent = _dirent, \ .actor = _actor, \ .pos = _pos, \ @@ -145,21 +145,22 @@ static inline bool dir_emit(struct dir_context *ctx, const char *name, int namelen, uint64_t ino, unsigned type) { - return ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type) == 0; + return (ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type) + == 0); } static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx) { - return ctx->actor(ctx->dirent, ".", 1, ctx->pos, - file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0; + return (ctx->actor(ctx->dirent, ".", 1, ctx->pos, + file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0); } static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx) { - return ctx->actor(ctx->dirent, "..", 2, ctx->pos, - parent_ino(file->f_path.dentry), DT_DIR) == 0; + return (ctx->actor(ctx->dirent, "..", 2, ctx->pos, + parent_ino(file->f_path.dentry), DT_DIR) == 0); } static inline bool @@ -167,15 +168,15 @@ dir_emit_dots(struct file *file, struct dir_context *ctx) { if (ctx->pos == 0) { if (!dir_emit_dot(file, ctx)) - return false; + return (false); ctx->pos = 1; } if (ctx->pos == 1) { if (!dir_emit_dotdot(file, ctx)) - return false; + return (false); ctx->pos = 2; } - return true; + return (true); } #endif /* HAVE_VFS_ITERATE */ diff --git a/include/zpios-ctl.h b/include/zpios-ctl.h index 6744ae614..82a7fdfd4 100644 --- a/include/zpios-ctl.h +++ b/include/zpios-ctl.h @@ -1,4 +1,4 @@ -/*****************************************************************************\ +/* * ZPIOS is a heavily modified version of the original PIOS test code. * It is designed to have the test code running in the Linux kernel * against ZFS while still being flexibly controled from user space. @@ -29,48 +29,49 @@ * * You should have received a copy of the GNU General Public License along * with ZPIOS. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ + */ #ifndef _ZPIOS_CTL_H -#define _ZPIOS_CTL_H +#define _ZPIOS_CTL_H -/* Contains shared definitions which both the userspace +/* + * Contains shared definitions which both the userspace * and kernelspace portions of zpios must agree on. */ #ifndef _KERNEL #include <stdint.h> #endif -#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */ -#define ZPIOS_MINORS 1 -#define ZPIOS_NAME "zpios" -#define ZPIOS_DEV "/dev/zpios" - -#define DMU_IO 0x01 - -#define DMU_WRITE 0x0001 -#define DMU_READ 0x0002 -#define DMU_VERIFY 0x0004 -#define DMU_REMOVE 0x0008 -#define DMU_FPP 0x0010 -#define DMU_WRITE_ZC 0x0020 /* Incompatible w/DMU_VERIFY */ -#define DMU_READ_ZC 0x0040 /* Incompatible w/DMU_VERIFY */ -#define DMU_WRITE_NOWAIT 0x0080 -#define DMU_READ_NOPF 0x0100 - -#define ZPIOS_NAME_SIZE 16 -#define ZPIOS_PATH_SIZE 128 - -#define PHASE_PRE_RUN "pre-run" -#define PHASE_PRE_CREATE "pre-create" -#define PHASE_PRE_WRITE "pre-write" -#define PHASE_PRE_READ "pre-read" -#define PHASE_PRE_REMOVE "pre-remove" -#define PHASE_POST_RUN "post-run" -#define PHASE_POST_CREATE "post-create" -#define PHASE_POST_WRITE "post-write" -#define PHASE_POST_READ "post-read" -#define PHASE_POST_REMOVE "post-remove" +#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */ +#define ZPIOS_MINORS 1 +#define ZPIOS_NAME "zpios" +#define ZPIOS_DEV "/dev/zpios" + +#define DMU_IO 0x01 + +#define DMU_WRITE 0x0001 +#define DMU_READ 0x0002 +#define DMU_VERIFY 0x0004 +#define DMU_REMOVE 0x0008 +#define DMU_FPP 0x0010 +#define DMU_WRITE_ZC 0x0020 /* Incompatible w/DMU_VERIFY */ +#define DMU_READ_ZC 0x0040 /* Incompatible w/DMU_VERIFY */ +#define DMU_WRITE_NOWAIT 0x0080 +#define DMU_READ_NOPF 0x0100 + +#define ZPIOS_NAME_SIZE 16 +#define ZPIOS_PATH_SIZE 128 + +#define PHASE_PRE_RUN "pre-run" +#define PHASE_PRE_CREATE "pre-create" +#define PHASE_PRE_WRITE "pre-write" +#define PHASE_PRE_READ "pre-read" +#define PHASE_PRE_REMOVE "pre-remove" +#define PHASE_POST_RUN "post-run" +#define PHASE_POST_CREATE "post-create" +#define PHASE_POST_WRITE "post-write" +#define PHASE_POST_READ "post-read" +#define PHASE_POST_REMOVE "post-remove" #define ZPIOS_CFG_MAGIC 0x87237190U typedef struct zpios_cfg { @@ -117,27 +118,28 @@ typedef struct zpios_cmd { uint32_t cmd_chunk_noise; /* Chunk noise */ uint32_t cmd_thread_delay; /* Thread delay */ uint32_t cmd_flags; /* Test flags */ - char cmd_pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */ - char cmd_post[ZPIOS_PATH_SIZE]; /* Post-exec hook */ + char cmd_pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */ + char cmd_post[ZPIOS_PATH_SIZE]; /* Post-exec hook */ char cmd_log[ZPIOS_PATH_SIZE]; /* Requested log dir */ uint64_t cmd_data_size; /* Opaque data size */ char cmd_data_str[0]; /* Opaque data region */ } zpios_cmd_t; /* Valid ioctls */ -#define ZPIOS_CFG _IOWR('f', 101, zpios_cfg_t) -#define ZPIOS_CMD _IOWR('f', 102, zpios_cmd_t) +#define ZPIOS_CFG _IOWR('f', 101, zpios_cfg_t) +#define ZPIOS_CMD _IOWR('f', 102, zpios_cmd_t) /* Valid configuration commands */ -#define ZPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ -#define ZPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ +#define ZPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ +#define ZPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ #ifndef NSEC_PER_SEC -#define NSEC_PER_SEC 1000000000L +#define NSEC_PER_SEC 1000000000L #endif static inline -void zpios_timespec_normalize(zpios_timespec_t *ts, uint32_t sec, uint32_t nsec) +void +zpios_timespec_normalize(zpios_timespec_t *ts, uint32_t sec, uint32_t nsec) { while (nsec >= NSEC_PER_SEC) { nsec -= NSEC_PER_SEC; @@ -152,27 +154,30 @@ void zpios_timespec_normalize(zpios_timespec_t *ts, uint32_t sec, uint32_t nsec) } static inline -zpios_timespec_t zpios_timespec_add(zpios_timespec_t lhs, zpios_timespec_t rhs) +zpios_timespec_t +zpios_timespec_add(zpios_timespec_t lhs, zpios_timespec_t rhs) { zpios_timespec_t ts_delta; zpios_timespec_normalize(&ts_delta, lhs.ts_sec + rhs.ts_sec, - lhs.ts_nsec + rhs.ts_nsec); - return ts_delta; + lhs.ts_nsec + rhs.ts_nsec); + return (ts_delta); } static inline -zpios_timespec_t zpios_timespec_sub(zpios_timespec_t lhs, zpios_timespec_t rhs) +zpios_timespec_t +zpios_timespec_sub(zpios_timespec_t lhs, zpios_timespec_t rhs) { zpios_timespec_t ts_delta; zpios_timespec_normalize(&ts_delta, lhs.ts_sec - rhs.ts_sec, - lhs.ts_nsec - rhs.ts_nsec); - return ts_delta; + lhs.ts_nsec - rhs.ts_nsec); + return (ts_delta); } #ifdef _KERNEL static inline -zpios_timespec_t zpios_timespec_now(void) +zpios_timespec_t +zpios_timespec_now(void) { zpios_timespec_t zts_now; struct timespec ts_now; @@ -181,16 +186,18 @@ zpios_timespec_t zpios_timespec_now(void) zts_now.ts_sec = ts_now.tv_sec; zts_now.ts_nsec = ts_now.tv_nsec; - return zts_now; + return (zts_now); } #else static inline -double zpios_timespec_to_double(zpios_timespec_t ts) +double +zpios_timespec_to_double(zpios_timespec_t ts) { - return ((double)(ts.ts_sec) + - ((double)(ts.ts_nsec) / (double)(NSEC_PER_SEC))); + return + ((double)(ts.ts_sec) + + ((double)(ts.ts_nsec) / (double)(NSEC_PER_SEC))); } #endif /* _KERNEL */ diff --git a/include/zpios-internal.h b/include/zpios-internal.h index 24a2febb2..4b99b4ce3 100644 --- a/include/zpios-internal.h +++ b/include/zpios-internal.h @@ -1,4 +1,4 @@ -/*****************************************************************************\ +/* * ZPIOS is a heavily modified version of the original PIOS test code. * It is designed to have the test code running in the Linux kernel * against ZFS while still being flexibly controled from user space. @@ -29,14 +29,14 @@ * * You should have received a copy of the GNU General Public License along * with ZPIOS. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ + */ #ifndef _ZPIOS_INTERNAL_H -#define _ZPIOS_INTERNAL_H +#define _ZPIOS_INTERNAL_H #include "zpios-ctl.h" -#define OBJ_SIZE 64 +#define OBJ_SIZE 64 struct run_args; @@ -51,7 +51,7 @@ typedef struct thread_data { int thread_no; int rc; zpios_stats_t stats; - kmutex_t lock; + kmutex_t lock; } thread_data_t; /* region for IO data */ @@ -62,7 +62,7 @@ typedef struct zpios_region { __u64 max_offset; dmu_obj_t obj; zpios_stats_t stats; - kmutex_t lock; + kmutex_t lock; } zpios_region_t; /* arguments for one run */ @@ -85,9 +85,9 @@ typedef struct run_args { /* Control data */ objset_t *os; - wait_queue_head_t waitq; + wait_queue_head_t waitq; volatile uint64_t threads_done; - kmutex_t lock_work; + kmutex_t lock_work; kmutex_t lock_ctl; __u32 region_next; @@ -99,40 +99,14 @@ typedef struct run_args { zpios_region_t regions[0]; /* Must be last element */ } run_args_t; -#define ZPIOS_INFO_BUFFER_SIZE 65536 -#define ZPIOS_INFO_BUFFER_REDZONE 1024 +#define ZPIOS_INFO_BUFFER_SIZE 65536 +#define ZPIOS_INFO_BUFFER_REDZONE 1024 typedef struct zpios_info { - spinlock_t info_lock; - int info_size; - char *info_buffer; - char *info_head; /* Internal kernel use only */ + spinlock_t info_lock; + int info_size; + char *info_buffer; + char *info_head; /* Internal kernel use only */ } zpios_info_t; -#define zpios_print(file, format, args...) \ -({ zpios_info_t *_info_ = (zpios_info_t *)file->private_data; \ - int _rc_; \ - \ - ASSERT(_info_); \ - ASSERT(_info_->info_buffer); \ - \ - spin_lock(&_info_->info_lock); \ - \ - /* Don't allow the kernel to start a write in the red zone */ \ - if ((int)(_info_->info_head - _info_->info_buffer) > \ - (_info_->info_size - ZPIOS_INFO_BUFFER_REDZONE)) { \ - _rc_ = -EOVERFLOW; \ - } else { \ - _rc_ = sprintf(_info_->info_head, format, args); \ - if (_rc_ >= 0) \ - _info_->info_head += _rc_; \ - } \ - \ - spin_unlock(&_info_->info_lock); \ - _rc_; \ -}) - -#define zpios_vprint(file, test, format, args...) \ - zpios_print(file, "%*s: " format, ZPIOS_NAME_SIZE, test, args) - #endif /* _ZPIOS_INTERNAL_H */ |