codebase style improvements for OpenZFS 6459 port

This commit is contained in:
George Melikov 2017-01-21 00:17:55 +03:00 committed by Brian Behlendorf
parent ec441a9c53
commit 4ea3f86426
46 changed files with 202 additions and 135 deletions

View File

@ -2953,7 +2953,8 @@ struct stat_array {
}; };
static uint64_t static uint64_t
stat_histo_max(struct stat_array *nva, unsigned int len) { stat_histo_max(struct stat_array *nva, unsigned int len)
{
uint64_t max = 0; uint64_t max = 0;
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -2969,7 +2970,8 @@ stat_histo_max(struct stat_array *nva, unsigned int len) {
*/ */
static int static int
nvpair64_to_stat_array(nvlist_t *nvl, const char *name, nvpair64_to_stat_array(nvlist_t *nvl, const char *name,
struct stat_array *nva) { struct stat_array *nva)
{
nvpair_t *tmp; nvpair_t *tmp;
int ret; int ret;
@ -3871,7 +3873,8 @@ is_pool(char *name)
/* Are all our argv[] strings pool names? If so return 1, 0 otherwise. */ /* Are all our argv[] strings pool names? If so return 1, 0 otherwise. */
static int static int
are_all_pools(int argc, char **argv) { are_all_pools(int argc, char **argv)
{
if ((argc == 0) || !*argv) if ((argc == 0) || !*argv)
return (0); return (0);
@ -3952,7 +3955,8 @@ get_interval_count_filter_guids(int *argc, char **argv, float *interval,
* seconds. * seconds.
*/ */
static void static void
fsleep(float sec) { fsleep(float sec)
{
struct timespec req; struct timespec req;
req.tv_sec = floor(sec); req.tv_sec = floor(sec);
req.tv_nsec = (sec - (float)req.tv_sec) * NANOSEC; req.tv_nsec = (sec - (float)req.tv_sec) * NANOSEC;

View File

@ -88,7 +88,8 @@ num_logs(nvlist_t *nv)
/* Find the max element in an array of uint64_t values */ /* Find the max element in an array of uint64_t values */
uint64_t uint64_t
array64_max(uint64_t array[], unsigned int len) { array64_max(uint64_t array[], unsigned int len)
{
uint64_t max = 0; uint64_t max = 0;
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -102,7 +103,8 @@ array64_max(uint64_t array[], unsigned int len) {
* floating point numbers. * floating point numbers.
*/ */
int int
isnumber(char *str) { isnumber(char *str)
{
for (; *str; str++) for (; *str; str++)
if (!(isdigit(*str) || (*str == '.'))) if (!(isdigit(*str) || (*str == '.')))
return (0); return (0);

View File

@ -225,7 +225,8 @@ zpl_posix_acl_release(struct posix_acl *acl)
#define zpl_forget_cached_acl(ip, ty) forget_cached_acl(ip, ty) #define zpl_forget_cached_acl(ip, ty) forget_cached_acl(ip, ty)
#else #else
static inline void static inline void
zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer) { zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer)
{
struct posix_acl *older = NULL; struct posix_acl *older = NULL;
spin_lock(&ip->i_lock); spin_lock(&ip->i_lock);
@ -250,7 +251,8 @@ zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer) {
} }
static inline void static inline void
zpl_forget_cached_acl(struct inode *ip, int type) { zpl_forget_cached_acl(struct inode *ip, int type)
{
zpl_set_cached_acl(ip, type, (struct posix_acl *)ACL_NOT_CACHED); zpl_set_cached_acl(ip, type, (struct posix_acl *)ACL_NOT_CACHED);
} }
#endif /* HAVE_SET_CACHED_ACL_USABLE */ #endif /* HAVE_SET_CACHED_ACL_USABLE */
@ -261,7 +263,8 @@ zpl_forget_cached_acl(struct inode *ip, int type) {
#define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode) #define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode)
#else #else
static inline int static inline int
__posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) { __posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode)
{
struct posix_acl *oldacl = *acl; struct posix_acl *oldacl = *acl;
mode_t mode = umode; mode_t mode = umode;
int error; int error;
@ -282,7 +285,8 @@ __posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) {
} }
static inline int 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; struct posix_acl *oldacl = *acl;
mode_t mode = *umodep; mode_t mode = *umodep;
int error; int error;

View File

@ -139,9 +139,11 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_ACE_EVENT(name) \ #define DEFINE_ACE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_ace_class, name, \ DEFINE_EVENT(zfs_ace_class, name, \
TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched), \ TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched), \
TP_ARGS(zn, ace, mask_matched)) TP_ARGS(zn, ace, mask_matched))
/* END CSTYLED */
DEFINE_ACE_EVENT(zfs_zfs__ace__denies); DEFINE_ACE_EVENT(zfs_zfs__ace__denies);
DEFINE_ACE_EVENT(zfs_zfs__ace__allows); DEFINE_ACE_EVENT(zfs_zfs__ace__allows);

View File

@ -98,9 +98,11 @@ DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_ARC_BUF_HDR_EVENT(name) \ #define DEFINE_ARC_BUF_HDR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \ DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \
TP_PROTO(arc_buf_hdr_t *ab), \ TP_PROTO(arc_buf_hdr_t *ab), \
TP_ARGS(ab)) TP_ARGS(ab))
/* END CSTYLED */
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit); DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit);
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict); DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict);
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete); DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete);
@ -141,9 +143,11 @@ DECLARE_EVENT_CLASS(zfs_l2arc_rw_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_L2ARC_RW_EVENT(name) \ #define DEFINE_L2ARC_RW_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_rw_class, name, \ DEFINE_EVENT(zfs_l2arc_rw_class, name, \
TP_PROTO(vdev_t *vd, zio_t *zio), \ TP_PROTO(vdev_t *vd, zio_t *zio), \
TP_ARGS(vd, zio)) TP_ARGS(vd, zio))
/* END CSTYLED */
DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read); DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read);
DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write); DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write);
@ -166,9 +170,11 @@ DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_L2ARC_IODONE_EVENT(name) \ #define DEFINE_L2ARC_IODONE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_iodone_class, name, \ DEFINE_EVENT(zfs_l2arc_iodone_class, name, \
TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \ TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \
TP_ARGS(zio, cb)) TP_ARGS(zio, cb))
/* END CSTYLED */
DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone); DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone);
@ -278,10 +284,12 @@ DECLARE_EVENT_CLASS(zfs_arc_miss_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_ARC_MISS_EVENT(name) \ #define DEFINE_ARC_MISS_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_arc_miss_class, name, \ DEFINE_EVENT(zfs_arc_miss_class, name, \
TP_PROTO(arc_buf_hdr_t *hdr, \ TP_PROTO(arc_buf_hdr_t *hdr, \
const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \ const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \
TP_ARGS(hdr, bp, size, zb)) TP_ARGS(hdr, bp, size, zb))
/* END CSTYLED */
DEFINE_ARC_MISS_EVENT(zfs_arc__miss); DEFINE_ARC_MISS_EVENT(zfs_arc__miss);
/* /*
@ -337,10 +345,12 @@ DECLARE_EVENT_CLASS(zfs_l2arc_evict_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_L2ARC_EVICT_EVENT(name) \ #define DEFINE_L2ARC_EVICT_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_evict_class, name, \ DEFINE_EVENT(zfs_l2arc_evict_class, name, \
TP_PROTO(l2arc_dev_t *dev, \ TP_PROTO(l2arc_dev_t *dev, \
list_t *buflist, uint64_t taddr, boolean_t all), \ list_t *buflist, uint64_t taddr, boolean_t all), \
TP_ARGS(dev, buflist, taddr, all)) TP_ARGS(dev, buflist, taddr, all))
/* END CSTYLED */
DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict); DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict);
#endif /* _TRACE_ARC_H */ #endif /* _TRACE_ARC_H */

View File

@ -69,10 +69,12 @@ DECLARE_EVENT_CLASS(zfs_dprintf_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_DPRINTF_EVENT(name) \ #define DEFINE_DPRINTF_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dprintf_class, name, \ DEFINE_EVENT(zfs_dprintf_class, name, \
TP_PROTO(const char *file, const char *function, int line, \ TP_PROTO(const char *file, const char *function, int line, \
const char *msg), \ const char *msg), \
TP_ARGS(file, function, line, msg)) TP_ARGS(file, function, line, msg))
/* END CSTYLED */
DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf); DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf);
/* /*
@ -109,16 +111,20 @@ DECLARE_EVENT_CLASS(zfs_set_error_class,
#ifdef TP_CONDITION #ifdef TP_CONDITION
#define DEFINE_SET_ERROR_EVENT(name) \ #define DEFINE_SET_ERROR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT_CONDITION(zfs_set_error_class, name, \ DEFINE_EVENT_CONDITION(zfs_set_error_class, name, \
TP_PROTO(const char *file, const char *function, int line, \ TP_PROTO(const char *file, const char *function, int line, \
uintptr_t error), \ uintptr_t error), \
TP_ARGS(file, function, line, error), \ TP_ARGS(file, function, line, error), \
TP_CONDITION(error)) TP_CONDITION(error))
/* END CSTYLED */
#else #else
#define DEFINE_SET_ERROR_EVENT(name) \ #define DEFINE_SET_ERROR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_set_error_class, name, \ DEFINE_EVENT(zfs_set_error_class, name, \
TP_PROTO(const char *file, const char *function, int line, \ TP_PROTO(const char *file, const char *function, int line, \
uintptr_t error), \ uintptr_t error), \
TP_ARGS(file, function, line, error)) TP_ARGS(file, function, line, error))
/* END CSTYLED */
#endif #endif
DEFINE_SET_ERROR_EVENT(zfs_set__error); DEFINE_SET_ERROR_EVENT(zfs_set__error);

View File

@ -78,6 +78,7 @@
__entry->db_blkid, __entry->db_offset, \ __entry->db_blkid, __entry->db_offset, \
__entry->db_size, __entry->db_state, __entry->db_holds __entry->db_size, __entry->db_state, __entry->db_holds
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dbuf_class, DECLARE_EVENT_CLASS(zfs_dbuf_class,
TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), TP_PROTO(dmu_buf_impl_t *db, zio_t *zio),
TP_ARGS(db, zio), TP_ARGS(db, zio),
@ -85,13 +86,17 @@ DECLARE_EVENT_CLASS(zfs_dbuf_class,
TP_fast_assign(DBUF_TP_FAST_ASSIGN), TP_fast_assign(DBUF_TP_FAST_ASSIGN),
TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS) TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS)
); );
/* END CSTYLED */
#define DEFINE_DBUF_EVENT(name) \ #define DEFINE_DBUF_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dbuf_class, name, \ DEFINE_EVENT(zfs_dbuf_class, name, \
TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \ TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \
TP_ARGS(db, zio)) TP_ARGS(db, zio))
/* END CSTYLED */
DEFINE_DBUF_EVENT(zfs_blocked__read); DEFINE_DBUF_EVENT(zfs_blocked__read);
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class, DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class,
TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls),
TP_ARGS(db, mls), TP_ARGS(db, mls),
@ -99,11 +104,14 @@ DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class,
TP_fast_assign(DBUF_TP_FAST_ASSIGN), TP_fast_assign(DBUF_TP_FAST_ASSIGN),
TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS) TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS)
); );
/* END CSTYLED */
#define DEFINE_DBUF_EVICT_ONE_EVENT(name) \ #define DEFINE_DBUF_EVICT_ONE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dbuf_evict_one_class, name, \ DEFINE_EVENT(zfs_dbuf_evict_one_class, name, \
TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), \ TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), \
TP_ARGS(db, mls)) TP_ARGS(db, mls))
/* END CSTYLED */
DEFINE_DBUF_EVICT_ONE_EVENT(zfs_dbuf__evict__one); DEFINE_DBUF_EVICT_ONE_EVENT(zfs_dbuf__evict__one);
#endif /* _TRACE_DBUF_H */ #endif /* _TRACE_DBUF_H */

View File

@ -105,9 +105,11 @@ DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_DELAY_MINTIME_EVENT(name) \ #define DEFINE_DELAY_MINTIME_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_delay_mintime_class, name, \ DEFINE_EVENT(zfs_delay_mintime_class, name, \
TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \ TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \
TP_ARGS(tx, dirty, min_tx_time)) TP_ARGS(tx, dirty, min_tx_time))
/* END CSTYLED */
DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime); DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime);
#endif /* _TRACE_DMU_H */ #endif /* _TRACE_DMU_H */

View File

@ -105,9 +105,11 @@ DECLARE_EVENT_CLASS(zfs_dnode_move_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_DNODE_MOVE_EVENT(name) \ #define DEFINE_DNODE_MOVE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dnode_move_class, name, \ DEFINE_EVENT(zfs_dnode_move_class, name, \
TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), \ TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), \
TP_ARGS(dn, refcount, dbufs)) TP_ARGS(dn, refcount, dbufs))
/* END CSTYLED */
DEFINE_DNODE_MOVE_EVENT(zfs_dnode__move); DEFINE_DNODE_MOVE_EVENT(zfs_dnode__move);
#endif /* _TRACE_DNODE_H */ #endif /* _TRACE_DNODE_H */

View File

@ -63,9 +63,11 @@ DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \ #define DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \ DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \
TP_PROTO(multilist_t *ml, unsigned int sublist_idx, void *obj), \ TP_PROTO(multilist_t *ml, unsigned int sublist_idx, void *obj), \
TP_ARGS(ml, sublist_idx, obj)) TP_ARGS(ml, sublist_idx, obj))
/* END CSTYLED */
DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__insert); DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__insert);
DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__remove); DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__remove);

View File

@ -55,9 +55,11 @@ DECLARE_EVENT_CLASS(zfs_txg_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_TXG_EVENT(name) \ #define DEFINE_TXG_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_txg_class, name, \ DEFINE_EVENT(zfs_txg_class, name, \
TP_PROTO(dsl_pool_t *dp, uint64_t txg), \ TP_PROTO(dsl_pool_t *dp, uint64_t txg), \
TP_ARGS(dp, txg)) TP_ARGS(dp, txg))
/* END CSTYLED */
DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done); DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done);
DEFINE_TXG_EVENT(zfs_txg__quiescing); DEFINE_TXG_EVENT(zfs_txg__quiescing);
DEFINE_TXG_EVENT(zfs_txg__opened); DEFINE_TXG_EVENT(zfs_txg__opened);

View File

@ -114,11 +114,13 @@ DECLARE_EVENT_CLASS(zfs_zil_class,
/* END CSTYLED */ /* END CSTYLED */
#define DEFINE_ZIL_EVENT(name) \ #define DEFINE_ZIL_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_zil_class, name, \ DEFINE_EVENT(zfs_zil_class, name, \
TP_PROTO(zilog_t *zilog), \ TP_PROTO(zilog_t *zilog), \
TP_ARGS(zilog)) TP_ARGS(zilog))
DEFINE_ZIL_EVENT(zfs_zil__cw1); DEFINE_ZIL_EVENT(zfs_zil__cw1);
DEFINE_ZIL_EVENT(zfs_zil__cw2); DEFINE_ZIL_EVENT(zfs_zil__cw2);
/* END CSTYLED */
#endif /* _TRACE_ZIL_H */ #endif /* _TRACE_ZIL_H */

View File

@ -475,7 +475,8 @@ NVLIST_PRINTCTL_AREPLACE(nvlist_array, nvlist_t **)
*/ */
static const struct nvlist_printops defprtops = { static const struct nvlist_printops defprtops =
{
{ nvprint_boolean, NULL }, { nvprint_boolean, NULL },
{ nvprint_boolean_value, NULL }, { nvprint_boolean_value, NULL },
{ nvprint_byte, NULL }, { nvprint_byte, NULL },

View File

@ -108,7 +108,8 @@ libshare_init(void)
} }
static void static void
parse_sharetab(sa_handle_impl_t impl_handle) { parse_sharetab(sa_handle_impl_t impl_handle)
{
FILE *fp; FILE *fp;
char line[512]; char line[512];
char *eol, *pathname, *resource, *fstype, *options, *description; char *eol, *pathname, *resource, *fstype, *options, *description;
@ -759,7 +760,8 @@ alloc_share(const char *sharepath)
} }
static void static void
free_share(sa_share_impl_t impl_share) { free_share(sa_share_impl_t impl_share)
{
sa_fstype_t *fstype; sa_fstype_t *fstype;
fstype = fstypes; fstype = fstypes;

View File

@ -130,22 +130,26 @@ extern in_port_t ntohs(in_port_t);
#ifdef _BIG_ENDIAN #ifdef _BIG_ENDIAN
static __inline__ uint64_t static __inline__ uint64_t
htonll(uint64_t n) { htonll(uint64_t n)
{
return (n); return (n);
} }
static __inline__ uint64_t static __inline__ uint64_t
ntohll(uint64_t n) { ntohll(uint64_t n)
{
return (n); return (n);
} }
#else #else
static __inline__ uint64_t static __inline__ uint64_t
htonll(uint64_t n) { htonll(uint64_t n)
{
return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32));
} }
static __inline__ uint64_t static __inline__ uint64_t
ntohll(uint64_t n) { ntohll(uint64_t n)
{
return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
} }
#endif #endif

View File

@ -131,7 +131,8 @@ umem_free(void *ptr, size_t size)
} }
static inline void static inline void
umem_nofail_callback(umem_nofail_callback_t *cb) {} umem_nofail_callback(umem_nofail_callback_t *cb)
{}
static inline umem_cache_t * static inline umem_cache_t *
umem_cache_create( umem_cache_create(

View File

@ -988,7 +988,8 @@ aes_setupkeys(aes_key_t *key, const uint32_t *keyarr32, int keybits)
*/ */
static void static void
rijndael_encrypt(const uint32_t rk[], int Nr, const uint32_t pt[4], rijndael_encrypt(const uint32_t rk[], int Nr, const uint32_t pt[4],
uint32_t ct[4], int flags) { uint32_t ct[4], int flags)
{
if (flags & INTEL_AES_NI_CAPABLE) { if (flags & INTEL_AES_NI_CAPABLE) {
KPREEMPT_DISABLE; KPREEMPT_DISABLE;
aes_encrypt_intel(rk, Nr, pt, ct); aes_encrypt_intel(rk, Nr, pt, ct);
@ -1015,7 +1016,8 @@ rijndael_encrypt(const uint32_t rk[], int Nr, const uint32_t pt[4],
*/ */
static void static void
rijndael_decrypt(const uint32_t rk[], int Nr, const uint32_t ct[4], rijndael_decrypt(const uint32_t rk[], int Nr, const uint32_t ct[4],
uint32_t pt[4], int flags) { uint32_t pt[4], int flags)
{
if (flags & INTEL_AES_NI_CAPABLE) { if (flags & INTEL_AES_NI_CAPABLE) {
KPREEMPT_DISABLE; KPREEMPT_DISABLE;
aes_decrypt_intel(rk, Nr, ct, pt); aes_decrypt_intel(rk, Nr, ct, pt);

View File

@ -198,7 +198,7 @@ ctr_mode_final(ctr_ctx_t *ctx, crypto_data_t *out,
int int
ctr_init_ctx(ctr_ctx_t *ctr_ctx, ulong_t count, uint8_t *cb, ctr_init_ctx(ctr_ctx_t *ctr_ctx, ulong_t count, uint8_t *cb,
void (*copy_block)(uint8_t *, uint8_t *)) void (*copy_block)(uint8_t *, uint8_t *))
{ {
uint64_t upper_mask = 0; uint64_t upper_mask = 0;
uint64_t lower_mask = 0; uint64_t lower_mask = 0;

View File

@ -57,11 +57,10 @@
/* Skein_256 */ /* Skein_256 */
#if !(SKEIN_USE_ASM & 256) #if !(SKEIN_USE_ASM & 256)
void void
Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr, Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr,
size_t blkCnt, size_t byteCntAdd) size_t blkCnt, size_t byteCntAdd)
{ /* do it in C */ {
enum { enum {
WCNT = SKEIN_256_STATE_WORDS WCNT = SKEIN_256_STATE_WORDS
}; };
@ -239,8 +238,7 @@ Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr,
Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X); Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X);
ts[1] &= ~SKEIN_T1_FLAG_FIRST; ts[1] &= ~SKEIN_T1_FLAG_FIRST;
} } while (--blkCnt);
while (--blkCnt);
ctx->h.T[0] = ts[0]; ctx->h.T[0] = ts[0];
ctx->h.T[1] = ts[1]; ctx->h.T[1] = ts[1];
} }
@ -266,7 +264,7 @@ Skein_256_Unroll_Cnt(void)
void void
Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const uint8_t *blkPtr, Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const uint8_t *blkPtr,
size_t blkCnt, size_t byteCntAdd) size_t blkCnt, size_t byteCntAdd)
{ /* do it in C */ {
enum { enum {
WCNT = SKEIN_512_STATE_WORDS WCNT = SKEIN_512_STATE_WORDS
}; };
@ -470,8 +468,7 @@ Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const uint8_t *blkPtr,
Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X); Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X);
ts[1] &= ~SKEIN_T1_FLAG_FIRST; ts[1] &= ~SKEIN_T1_FLAG_FIRST;
} } while (--blkCnt);
while (--blkCnt);
ctx->h.T[0] = ts[0]; ctx->h.T[0] = ts[0];
ctx->h.T[1] = ts[1]; ctx->h.T[1] = ts[1];
} }

View File

@ -321,14 +321,16 @@ aes_provider_status(crypto_provider_handle_t provider, uint_t *status)
static int static int
aes_encrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism, aes_encrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
crypto_key_t *key, crypto_spi_ctx_template_t template, crypto_key_t *key, crypto_spi_ctx_template_t template,
crypto_req_handle_t req) { crypto_req_handle_t req)
{
return (aes_common_init(ctx, mechanism, key, template, req, B_TRUE)); return (aes_common_init(ctx, mechanism, key, template, req, B_TRUE));
} }
static int static int
aes_decrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism, aes_decrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
crypto_key_t *key, crypto_spi_ctx_template_t template, crypto_key_t *key, crypto_spi_ctx_template_t template,
crypto_req_handle_t req) { crypto_req_handle_t req)
{
return (aes_common_init(ctx, mechanism, key, template, req, B_FALSE)); return (aes_common_init(ctx, mechanism, key, template, req, B_FALSE));
} }

View File

@ -57,6 +57,7 @@ edonr_mod_init(void)
} }
int int
edonr_mod_fini(void) { edonr_mod_fini(void)
{
return (mod_remove(&modlinkage)); return (mod_remove(&modlinkage));
} }

View File

@ -230,7 +230,8 @@ skein_mod_init(void)
} }
int int
skein_mod_fini(void) { skein_mod_fini(void)
{
int ret; int ret;
if (skein_prov_handle != 0) { if (skein_prov_handle != 0) {

View File

@ -1379,10 +1379,8 @@ SAFE_RETURN:
*/ */
static size_t static size_t
collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast, collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast,
boolean_t is_it_toupper, boolean_t is_it_toupper, boolean_t is_it_tolower,
boolean_t is_it_tolower, boolean_t canonical_decomposition, boolean_t compatibility_decomposition,
boolean_t canonical_decomposition,
boolean_t compatibility_decomposition,
boolean_t canonical_composition, boolean_t canonical_composition,
int *errnum, u8_normalization_states_t *state) int *errnum, u8_normalization_states_t *state)
{ {
@ -2134,7 +2132,8 @@ u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen,
#if defined(_KERNEL) && defined(HAVE_SPL) #if defined(_KERNEL) && defined(HAVE_SPL)
static int __init static int __init
unicode_init(void) { unicode_init(void)
{
return (0); return (0);
} }

View File

@ -50,12 +50,14 @@
#include <strings.h> #include <strings.h>
static void static void
fletcher_4_sse2_init(fletcher_4_ctx_t *ctx) { fletcher_4_sse2_init(fletcher_4_ctx_t *ctx)
{
bzero(ctx->sse, 4 * sizeof (zfs_fletcher_sse_t)); bzero(ctx->sse, 4 * sizeof (zfs_fletcher_sse_t));
} }
static void static void
fletcher_4_sse2_fini(fletcher_4_ctx_t *ctx, zio_cksum_t *zcp) { fletcher_4_sse2_fini(fletcher_4_ctx_t *ctx, zio_cksum_t *zcp)
{
uint64_t A, B, C, D; uint64_t A, B, C, D;
/* /*

View File

@ -423,7 +423,8 @@ struct scatterlist {
}; };
static void static void
sg_init_table(struct scatterlist *sg, int nr) { sg_init_table(struct scatterlist *sg, int nr)
{
memset(sg, 0, nr * sizeof (struct scatterlist)); memset(sg, 0, nr * sizeof (struct scatterlist));
sg[nr - 1].end = 1; sg[nr - 1].end = 1;
} }

View File

@ -4336,7 +4336,8 @@ arc_reclaim_thread(void)
* increase this negative difference. * increase this negative difference.
*/ */
static uint64_t static uint64_t
arc_evictable_memory(void) { arc_evictable_memory(void)
{
uint64_t arc_clean = uint64_t arc_clean =
refcount_count(&arc_mru->arcs_esize[ARC_BUFC_DATA]) + refcount_count(&arc_mru->arcs_esize[ARC_BUFC_DATA]) +
refcount_count(&arc_mru->arcs_esize[ARC_BUFC_METADATA]) + refcount_count(&arc_mru->arcs_esize[ARC_BUFC_METADATA]) +

View File

@ -1612,7 +1612,8 @@ spa_get_asize(spa_t *spa, uint64_t lsize)
* See the comment above spa_slop_shift for details. * See the comment above spa_slop_shift for details.
*/ */
uint64_t uint64_t
spa_get_slop_space(spa_t *spa) { spa_get_slop_space(spa_t *spa)
{
uint64_t space = spa_get_dspace(spa); uint64_t space = spa_get_dspace(spa);
return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1)); return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1));
} }

View File

@ -3676,9 +3676,10 @@ EXPORT_SYMBOL(vdev_degrade);
EXPORT_SYMBOL(vdev_online); EXPORT_SYMBOL(vdev_online);
EXPORT_SYMBOL(vdev_offline); EXPORT_SYMBOL(vdev_offline);
EXPORT_SYMBOL(vdev_clear); EXPORT_SYMBOL(vdev_clear);
/* BEGIN CSTYLED */
module_param(metaslabs_per_vdev, int, 0644); module_param(metaslabs_per_vdev, int, 0644);
MODULE_PARM_DESC(metaslabs_per_vdev, MODULE_PARM_DESC(metaslabs_per_vdev,
"Divide added vdev into approximately (but no more than) this number " "Divide added vdev into approximately (but no more than) this number "
"of metaslabs"); "of metaslabs");
/* END CSTYLED */
#endif #endif

View File

@ -646,6 +646,7 @@ vdev_ops_t vdev_spare_ops = {
}; };
#if defined(_KERNEL) && defined(HAVE_SPL) #if defined(_KERNEL) && defined(HAVE_SPL)
/* BEGIN CSTYLED */
module_param(zfs_vdev_mirror_rotating_inc, int, 0644); module_param(zfs_vdev_mirror_rotating_inc, int, 0644);
MODULE_PARM_DESC(zfs_vdev_mirror_rotating_inc, MODULE_PARM_DESC(zfs_vdev_mirror_rotating_inc,
"Rotating media load increment for non-seeking I/O's"); "Rotating media load increment for non-seeking I/O's");
@ -655,6 +656,7 @@ MODULE_PARM_DESC(zfs_vdev_mirror_rotating_seek_inc,
"Rotating media load increment for seeking I/O's"); "Rotating media load increment for seeking I/O's");
module_param(zfs_vdev_mirror_rotating_seek_offset, int, 0644); module_param(zfs_vdev_mirror_rotating_seek_offset, int, 0644);
MODULE_PARM_DESC(zfs_vdev_mirror_rotating_seek_offset, MODULE_PARM_DESC(zfs_vdev_mirror_rotating_seek_offset,
"Offset in bytes from the last I/O which " "Offset in bytes from the last I/O which "
"triggers a reduced rotating media seek increment"); "triggers a reduced rotating media seek increment");
@ -666,5 +668,5 @@ MODULE_PARM_DESC(zfs_vdev_mirror_non_rotating_inc,
module_param(zfs_vdev_mirror_non_rotating_seek_inc, int, 0644); module_param(zfs_vdev_mirror_non_rotating_seek_inc, int, 0644);
MODULE_PARM_DESC(zfs_vdev_mirror_non_rotating_seek_inc, MODULE_PARM_DESC(zfs_vdev_mirror_non_rotating_seek_inc,
"Non-rotating media load increment for seeking I/O's"); "Non-rotating media load increment for seeking I/O's");
/* END CSTYLED */
#endif #endif

View File

@ -223,7 +223,7 @@ const raidz_impl_ops_t vdev_raidz_aarch64_neon_impl = {
#if defined(__aarch64__) #if defined(__aarch64__)
/* BEGIN CSTYLED */
const uint8_t const uint8_t
__attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] = { __attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2275,5 +2275,5 @@ __attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] = {
{ 0x00, 0xff, 0xfe, 0x01, 0xfc, 0x03, 0x02, 0xfd, { 0x00, 0xff, 0xfe, 0x01, 0xfc, 0x03, 0x02, 0xfd,
0xf8, 0x07, 0x06, 0xf9, 0x04, 0xfb, 0xfa, 0x05 } 0xf8, 0x07, 0x06, 0xf9, 0x04, 0xfb, 0xfa, 0x05 }
}; };
/* END CSTYLED */
#endif /* defined(__aarch64__) */ #endif /* defined(__aarch64__) */

View File

@ -417,9 +417,10 @@ const raidz_impl_ops_t vdev_raidz_ssse3_impl = {
#if defined(__x86_64) #if defined(__x86_64)
#if defined(HAVE_SSSE3) || defined(HAVE_AVX2) || defined(HAVE_AVX512BW) #if defined(HAVE_SSSE3) || defined(HAVE_AVX2) || defined(HAVE_AVX512BW)
/* BEGIN CSTYLED */
const uint8_t const uint8_t
__attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] = { __attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2469,6 +2470,6 @@ __attribute__((aligned(256))) gf_clmul_mod_lt[4*256][16] = {
{ 0x00, 0xff, 0xfe, 0x01, 0xfc, 0x03, 0x02, 0xfd, { 0x00, 0xff, 0xfe, 0x01, 0xfc, 0x03, 0x02, 0xfd,
0xf8, 0x07, 0x06, 0xf9, 0x04, 0xfb, 0xfa, 0x05 } 0xf8, 0x07, 0x06, 0xf9, 0x04, 0xfb, 0xfa, 0x05 }
}; };
/* END CSTYLED */
#endif /* defined(HAVE_SSSE3) || defined(HAVE_AVX2) || defined(HAVE_AVX512BW) */ #endif /* defined(HAVE_SSSE3) || defined(HAVE_AVX2) || defined(HAVE_AVX512BW) */
#endif /* defined(__x86_64) */ #endif /* defined(__x86_64) */

View File

@ -1934,7 +1934,8 @@ typedef struct zvol_snapdev_cb_arg {
} zvol_snapdev_cb_arg_t; } zvol_snapdev_cb_arg_t;
static int static int
zvol_set_snapdev_cb(const char *dsname, void *param) { zvol_set_snapdev_cb(const char *dsname, void *param)
{
zvol_snapdev_cb_arg_t *arg = param; zvol_snapdev_cb_arg_t *arg = param;
if (strchr(dsname, '@') == NULL) if (strchr(dsname, '@') == NULL)

View File

@ -98,7 +98,8 @@ static char script[PATH_MAX] = "/bin/true";
static char xattrbytes[XATTR_SIZE_MAX]; static char xattrbytes[XATTR_SIZE_MAX];
static int static int
usage(int argc, char **argv) { usage(int argc, char **argv)
{
fprintf(stderr, fprintf(stderr,
"usage: %s [-hvycdrRk] [-n <nth>] [-f <files>] [-x <xattrs>]\n" "usage: %s [-hvycdrRk] [-n <nth>] [-f <files>] [-x <xattrs>]\n"
" [-s <bytes>] [-p <path>] [-t <script> ] [-o <phase>]\n", " [-s <bytes>] [-p <path>] [-t <script> ] [-o <phase>]\n",