Use cstyle -cpP in make cstyle check

Enable picky cstyle checks and resolve the new warnings.  The vast
majority of the changes needed were to handle minor issues with
whitespace formatting.  This patch contains no functional changes.

Non-whitespace changes are as follows:

* 8 times ; to { } in for/while loop
* fix missing ; in cmd/zed/agents/zfs_diagnosis.c
* comment (confim -> confirm)
* change endline , to ; in cmd/zpool/zpool_main.c
* a number of /* BEGIN CSTYLED */ /* END CSTYLED */ blocks
* /* CSTYLED */ markers
* change == 0 to !
* ulong to unsigned long in module/zfs/dsl_scan.c
* rearrangement of module_param lines in module/zfs/metaslab.c
* add { } block around statement after for_each_online_node

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Håkan Johansson <f96hajo@chalmers.se>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5465
This commit is contained in:
Brian Behlendorf
2016-12-12 10:46:26 -08:00
committed by GitHub
parent d57f03e40e
commit 02730c333c
96 changed files with 501 additions and 478 deletions
+2 -1
View File
@@ -42,7 +42,7 @@
* zfs_ace_hdr_t *, ...,
* uint32_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_ace_class,
TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched),
TP_ARGS(zn, ace, mask_matched),
@@ -136,6 +136,7 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
__entry->z_type, __entry->z_flags, __entry->z_access_mask,
__entry->mask_matched)
);
/* END CSTYLED */
#define DEFINE_ACE_EVENT(name) \
DEFINE_EVENT(zfs_ace_class, name, \
+10 -5
View File
@@ -42,7 +42,7 @@
* DTRACE_PROBE1(...,
* arc_buf_hdr_t *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class,
TP_PROTO(arc_buf_hdr_t *ab),
TP_ARGS(ab),
@@ -95,6 +95,7 @@ DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class,
__entry->hdr_mfu_ghost_hits, __entry->hdr_l2_hits,
__entry->hdr_refcount)
);
/* END CSTYLED */
#define DEFINE_ARC_BUF_HDR_EVENT(name) \
DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \
@@ -117,7 +118,7 @@ DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__miss);
* vdev_t *, ...,
* zio_t *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_l2arc_rw_class,
TP_PROTO(vdev_t *vd, zio_t *zio),
TP_ARGS(vd, zio),
@@ -137,6 +138,7 @@ DECLARE_EVENT_CLASS(zfs_l2arc_rw_class,
ZIO_TP_PRINTK_FMT, __entry->vdev_id, __entry->vdev_guid,
__entry->vdev_state, ZIO_TP_PRINTK_ARGS)
);
/* END CSTYLED */
#define DEFINE_L2ARC_RW_EVENT(name) \
DEFINE_EVENT(zfs_l2arc_rw_class, name, \
@@ -153,7 +155,7 @@ DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write);
* zio_t *, ...,
* l2arc_write_callback_t *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class,
TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb),
TP_ARGS(zio, cb),
@@ -161,6 +163,7 @@ DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class,
TP_fast_assign(ZIO_TP_FAST_ASSIGN),
TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS)
);
/* END CSTYLED */
#define DEFINE_L2ARC_IODONE_EVENT(name) \
DEFINE_EVENT(zfs_l2arc_iodone_class, name, \
@@ -178,7 +181,7 @@ DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone);
* uint64_t,
* const zbookmark_phys_t *);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_arc_miss_class,
TP_PROTO(arc_buf_hdr_t *hdr,
const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb),
@@ -272,6 +275,7 @@ DECLARE_EVENT_CLASS(zfs_arc_miss_class,
__entry->bp_lsize, __entry->zb_objset, __entry->zb_object,
__entry->zb_level, __entry->zb_blkid)
);
/* END CSTYLED */
#define DEFINE_ARC_MISS_EVENT(name) \
DEFINE_EVENT(zfs_arc_miss_class, name, \
@@ -289,7 +293,7 @@ DEFINE_ARC_MISS_EVENT(zfs_arc__miss);
* uint64_t, ...,
* boolean_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_l2arc_evict_class,
TP_PROTO(l2arc_dev_t *dev,
list_t *buflist, uint64_t taddr, boolean_t all),
@@ -330,6 +334,7 @@ DECLARE_EVENT_CLASS(zfs_l2arc_evict_class,
__entry->l2ad_end, __entry->l2ad_first, __entry->l2ad_writing,
__entry->taddr, __entry->all)
);
/* END CSTYLED */
#define DEFINE_L2ARC_EVICT_EVENT(name) \
DEFINE_EVENT(zfs_l2arc_evict_class, name, \
+4 -2
View File
@@ -45,7 +45,7 @@
* int, ...,
* const char *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dprintf_class,
TP_PROTO(const char *file, const char *function, int line,
const char *msg),
@@ -66,6 +66,7 @@ DECLARE_EVENT_CLASS(zfs_dprintf_class,
TP_printk("%s:%d:%s(): %s", __get_str(file), __entry->line,
__get_str(function), __get_str(msg))
);
/* END CSTYLED */
#define DEFINE_DPRINTF_EVENT(name) \
DEFINE_EVENT(zfs_dprintf_class, name, \
@@ -83,7 +84,7 @@ DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf);
* int, ...,
* uintptr_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_set_error_class,
TP_PROTO(const char *file, const char *function, int line,
uintptr_t error),
@@ -104,6 +105,7 @@ DECLARE_EVENT_CLASS(zfs_set_error_class,
TP_printk("%s:%d:%s(): error 0x%lx", __get_str(file), __entry->line,
__get_str(function), __entry->error)
);
/* END CSTYLED */
#ifdef TP_CONDITION
#define DEFINE_SET_ERROR_EVENT(name) \
+2 -1
View File
@@ -41,7 +41,7 @@
* uint64_t, ...,
* uint64_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time),
TP_ARGS(tx, dirty, min_tx_time),
@@ -102,6 +102,7 @@ DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
#endif
__entry->dirty, __entry->min_tx_time)
);
/* END CSTYLED */
#define DEFINE_DELAY_MINTIME_EVENT(name) \
DEFINE_EVENT(zfs_delay_mintime_class, name, \
+2 -1
View File
@@ -41,7 +41,7 @@
* int64_t, ...,
* uint32_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dnode_move_class,
TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs),
TP_ARGS(dn, refcount, dbufs),
@@ -102,6 +102,7 @@ DECLARE_EVENT_CLASS(zfs_dnode_move_class,
__entry->dn_maxblkid, __entry->dn_tx_holds, __entry->dn_holds,
__entry->dn_have_spill, __entry->refcount, __entry->dbufs)
);
/* END CSTYLED */
#define DEFINE_DNODE_MOVE_EVENT(name) \
DEFINE_EVENT(zfs_dnode_move_class, name, \
+2 -1
View File
@@ -41,7 +41,7 @@
* unsigned int, ...,
* void *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class,
TP_PROTO(multilist_t *ml, unsigned sublist_idx, void *obj),
TP_ARGS(ml, sublist_idx, obj),
@@ -60,6 +60,7 @@ DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class,
TP_printk("ml { offset %ld numsublists %llu sublistidx %u } ",
__entry->ml_offset, __entry->ml_num_sublists, __entry->sublist_idx)
);
/* END CSTYLED */
#define DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \
DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \
+2 -1
View File
@@ -40,7 +40,7 @@
* dsl_pool_t *, ...,
* uint64_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_txg_class,
TP_PROTO(dsl_pool_t *dp, uint64_t txg),
TP_ARGS(dp, txg),
@@ -52,6 +52,7 @@ DECLARE_EVENT_CLASS(zfs_txg_class,
),
TP_printk("txg %llu", __entry->txg)
);
/* END CSTYLED */
#define DEFINE_TXG_EVENT(name) \
DEFINE_EVENT(zfs_txg_class, name, \
+2 -1
View File
@@ -39,7 +39,7 @@
* DTRACE_PROBE1(...,
* zilog_t *, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_zil_class,
TP_PROTO(zilog_t *zilog),
TP_ARGS(zilog),
@@ -111,6 +111,7 @@ DECLARE_EVENT_CLASS(zfs_zil_class,
__entry->zl_itx_list_sz, __entry->zl_cur_used,
__entry->zl_replay_time, __entry->zl_replay_blks)
);
/* END CSTYLED */
#define DEFINE_ZIL_EVENT(name) \
DEFINE_EVENT(zfs_zil_class, name, \
+2
View File
@@ -36,6 +36,7 @@
#include <sys/types.h>
#include <sys/trace_common.h> /* For ZIO macros */
/* BEGIN CSTYLED */
TRACE_EVENT(zfs_zio__delay__miss,
TP_PROTO(zio_t *zio, hrtime_t now),
TP_ARGS(zio, now),
@@ -75,6 +76,7 @@ TRACE_EVENT(zfs_zio__delay__skip,
TP_fast_assign(ZIO_TP_FAST_ASSIGN),
TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS)
);
/* END CSTYLED */
#endif /* _TRACE_ZIO_H */
+2 -1
View File
@@ -40,7 +40,7 @@
* zrlock_t *, ...,
* uint32_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_zrlock_class,
TP_PROTO(zrlock_t *zrl, uint32_t n),
TP_ARGS(zrl, n),
@@ -69,6 +69,7 @@ DECLARE_EVENT_CLASS(zfs_zrlock_class,
__entry->refcount, __entry->n)
#endif
);
/* END_CSTYLED */
#define DEFINE_ZRLOCK_EVENT(name) \
DEFINE_EVENT(zfs_zrlock_class, name, \
+11 -11
View File
@@ -40,22 +40,22 @@ struct kernel_param {};
/*
* vdev_raidz interface
*/
struct raidz_map * vdev_raidz_map_alloc(struct zio *, uint64_t, uint64_t,
struct raidz_map *vdev_raidz_map_alloc(struct zio *, uint64_t, uint64_t,
uint64_t);
void vdev_raidz_map_free(struct raidz_map *);
void vdev_raidz_generate_parity(struct raidz_map *);
int vdev_raidz_reconstruct(struct raidz_map *, const int *, int);
void vdev_raidz_map_free(struct raidz_map *);
void vdev_raidz_generate_parity(struct raidz_map *);
int vdev_raidz_reconstruct(struct raidz_map *, const int *, int);
/*
* vdev_raidz_math interface
*/
void vdev_raidz_math_init(void);
void vdev_raidz_math_fini(void);
struct raidz_impl_ops * vdev_raidz_math_get_ops(void);
int vdev_raidz_math_generate(struct raidz_map *);
int vdev_raidz_math_reconstruct(struct raidz_map *,
const int *, const int *, const int);
int vdev_raidz_impl_set(const char *);
void vdev_raidz_math_init(void);
void vdev_raidz_math_fini(void);
struct raidz_impl_ops *vdev_raidz_math_get_ops(void);
int vdev_raidz_math_generate(struct raidz_map *);
int vdev_raidz_math_reconstruct(struct raidz_map *, const int *, const int *,
const int);
int vdev_raidz_impl_set(const char *);
#ifdef __cplusplus
}
+15 -15
View File
@@ -178,12 +178,12 @@ extern const raidz_impl_ops_t vdev_raidz_aarch64_neonx2_impl;
* @code parity the function produce
* @impl name of the implementation
*/
#define _RAIDZ_GEN_WRAP(code, impl) \
#define _RAIDZ_GEN_WRAP(code, impl) \
static void \
impl ## _gen_ ## code(void *rmp) \
{ \
raidz_map_t *rm = (raidz_map_t *) rmp; \
raidz_generate_## code ## _impl(rm); \
raidz_map_t *rm = (raidz_map_t *)rmp; \
raidz_generate_## code ## _impl(rm); \
}
/*
@@ -192,11 +192,11 @@ impl ## _gen_ ## code(void *rmp) \
* @code parity the function produce
* @impl name of the implementation
*/
#define _RAIDZ_REC_WRAP(code, impl) \
static int \
#define _RAIDZ_REC_WRAP(code, impl) \
static int \
impl ## _rec_ ## code(void *rmp, const int *tgtidx) \
{ \
raidz_map_t *rm = (raidz_map_t *) rmp; \
raidz_map_t *rm = (raidz_map_t *)rmp; \
return (raidz_reconstruct_## code ## _impl(rm, tgtidx)); \
}
@@ -295,7 +295,7 @@ vdev_raidz_exp2(const uint8_t a, const unsigned exp)
if (a == 0)
return (0);
return (vdev_raidz_pow2[(exp + (unsigned) vdev_raidz_log2[a]) % 255]);
return (vdev_raidz_pow2[(exp + (unsigned)vdev_raidz_log2[a]) % 255]);
}
/*
@@ -318,9 +318,9 @@ gf_mul(const gf_t a, const gf_t b)
if (a == 0 || b == 0)
return (0);
logsum = (gf_log_t) vdev_raidz_log2[a] + (gf_log_t) vdev_raidz_log2[b];
logsum = (gf_log_t)vdev_raidz_log2[a] + (gf_log_t)vdev_raidz_log2[b];
return ((gf_t) vdev_raidz_pow2[logsum % 255]);
return ((gf_t)vdev_raidz_pow2[logsum % 255]);
}
static inline gf_t
@@ -332,10 +332,10 @@ gf_div(const gf_t a, const gf_t b)
if (a == 0)
return (0);
logsum = (gf_log_t) 255 + (gf_log_t) vdev_raidz_log2[a] -
(gf_log_t) vdev_raidz_log2[b];
logsum = (gf_log_t)255 + (gf_log_t)vdev_raidz_log2[a] -
(gf_log_t)vdev_raidz_log2[b];
return ((gf_t) vdev_raidz_pow2[logsum % 255]);
return ((gf_t)vdev_raidz_pow2[logsum % 255]);
}
static inline gf_t
@@ -345,9 +345,9 @@ gf_inv(const gf_t a)
ASSERT3U(a, >, 0);
logsum = (gf_log_t) 255 - (gf_log_t) vdev_raidz_log2[a];
logsum = (gf_log_t)255 - (gf_log_t)vdev_raidz_log2[a];
return ((gf_t) vdev_raidz_pow2[logsum]);
return ((gf_t)vdev_raidz_pow2[logsum]);
}
static inline gf_t
@@ -360,7 +360,7 @@ static inline gf_t
gf_exp4(gf_log_t exp)
{
ASSERT3U(exp, <=, 255);
return ((gf_t) vdev_raidz_pow2[(2 * exp) % 255]);
return ((gf_t)vdev_raidz_pow2[(2 * exp) % 255]);
}
#ifdef __cplusplus
+1 -2
View File
@@ -148,8 +148,7 @@ 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));
}
static inline bool