You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] fs: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove a duplicate of ARRAY_SIZE. Some trailing whitespaces are also deleted. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Cc: David Howells <dhowells@redhat.com> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Chris Mason <mason@suse.com> Cc: Jeff Mahoney <jeffm@suse.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Nathan Scott <nathans@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
b5029622ac
commit
e8c96f8c29
+1
-1
@@ -94,7 +94,7 @@ static struct rxrpc_service AFSCM_service = {
|
|||||||
.error_func = afscm_error,
|
.error_func = afscm_error,
|
||||||
.aemap_func = afscm_aemap,
|
.aemap_func = afscm_aemap,
|
||||||
.ops_begin = &AFSCM_ops[0],
|
.ops_begin = &AFSCM_ops[0],
|
||||||
.ops_end = &AFSCM_ops[sizeof(AFSCM_ops) / sizeof(AFSCM_ops[0])],
|
.ops_end = &AFSCM_ops[ARRAY_SIZE(AFSCM_ops)],
|
||||||
};
|
};
|
||||||
|
|
||||||
static DECLARE_COMPLETION(kafscmd_alive);
|
static DECLARE_COMPLETION(kafscmd_alive);
|
||||||
|
|||||||
+2
-3
@@ -1522,8 +1522,7 @@ static struct {
|
|||||||
{ ATM_QUERYLOOP32, ATM_QUERYLOOP }
|
{ ATM_QUERYLOOP32, ATM_QUERYLOOP }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0]))
|
#define NR_ATM_IOCTL ARRAY_SIZE(atm_ioctl_map)
|
||||||
|
|
||||||
|
|
||||||
static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg)
|
static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
@@ -1824,7 +1823,7 @@ static struct {
|
|||||||
{ FDWERRORGET32, FDWERRORGET }
|
{ FDWERRORGET32, FDWERRORGET }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
|
#define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table)
|
||||||
|
|
||||||
static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
|
static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ static struct {
|
|||||||
{ "loglevel", loglevel_read, loglevel_write }
|
{ "loglevel", loglevel_read, loglevel_write }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#define NPROCENT (sizeof(Entries)/sizeof(Entries[0]))
|
#define NPROCENT ARRAY_SIZE(Entries)
|
||||||
|
|
||||||
void jfs_proc_init(void)
|
void jfs_proc_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -224,8 +224,8 @@ static struct rpc_procinfo nsm_procedures[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct rpc_version nsm_version1 = {
|
static struct rpc_version nsm_version1 = {
|
||||||
.number = 1,
|
.number = 1,
|
||||||
.nrprocs = sizeof(nsm_procedures)/sizeof(nsm_procedures[0]),
|
.nrprocs = ARRAY_SIZE(nsm_procedures),
|
||||||
.procs = nsm_procedures
|
.procs = nsm_procedures
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ static struct rpc_stat nsm_stats;
|
|||||||
static struct rpc_program nsm_program = {
|
static struct rpc_program nsm_program = {
|
||||||
.name = "statd",
|
.name = "statd",
|
||||||
.number = SM_PROGRAM,
|
.number = SM_PROGRAM,
|
||||||
.nrvers = sizeof(nsm_version)/sizeof(nsm_version[0]),
|
.nrvers = ARRAY_SIZE(nsm_version),
|
||||||
.version = nsm_version,
|
.version = nsm_version,
|
||||||
.stats = &nsm_stats
|
.stats = &nsm_stats
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -509,7 +509,7 @@ static struct svc_version * nlmsvc_version[] = {
|
|||||||
|
|
||||||
static struct svc_stat nlmsvc_stats;
|
static struct svc_stat nlmsvc_stats;
|
||||||
|
|
||||||
#define NLM_NRVERS (sizeof(nlmsvc_version)/sizeof(nlmsvc_version[0]))
|
#define NLM_NRVERS ARRAY_SIZE(nlmsvc_version)
|
||||||
static struct svc_program nlmsvc_program = {
|
static struct svc_program nlmsvc_program = {
|
||||||
.pg_prog = NLM_PROGRAM, /* program number */
|
.pg_prog = NLM_PROGRAM, /* program number */
|
||||||
.pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
|
.pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
|
||||||
|
|||||||
+1
-1
@@ -599,7 +599,7 @@ static struct rpc_stat nlm_stats;
|
|||||||
struct rpc_program nlm_program = {
|
struct rpc_program nlm_program = {
|
||||||
.name = "lockd",
|
.name = "lockd",
|
||||||
.number = NLM_PROGRAM,
|
.number = NLM_PROGRAM,
|
||||||
.nrvers = sizeof(nlm_versions) / sizeof(nlm_versions[0]),
|
.nrvers = ARRAY_SIZE(nlm_versions),
|
||||||
.version = nlm_versions,
|
.version = nlm_versions,
|
||||||
.stats = &nlm_stats,
|
.stats = &nlm_stats,
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -103,7 +103,7 @@ static struct rpc_version * nfs_version[] = {
|
|||||||
static struct rpc_program nfs_program = {
|
static struct rpc_program nfs_program = {
|
||||||
.name = "nfs",
|
.name = "nfs",
|
||||||
.number = NFS_PROGRAM,
|
.number = NFS_PROGRAM,
|
||||||
.nrvers = sizeof(nfs_version) / sizeof(nfs_version[0]),
|
.nrvers = ARRAY_SIZE(nfs_version),
|
||||||
.version = nfs_version,
|
.version = nfs_version,
|
||||||
.stats = &nfs_rpcstat,
|
.stats = &nfs_rpcstat,
|
||||||
.pipe_dir_name = "/nfs",
|
.pipe_dir_name = "/nfs",
|
||||||
@@ -118,7 +118,7 @@ static struct rpc_version * nfsacl_version[] = {
|
|||||||
struct rpc_program nfsacl_program = {
|
struct rpc_program nfsacl_program = {
|
||||||
.name = "nfsacl",
|
.name = "nfsacl",
|
||||||
.number = NFS_ACL_PROGRAM,
|
.number = NFS_ACL_PROGRAM,
|
||||||
.nrvers = sizeof(nfsacl_version) / sizeof(nfsacl_version[0]),
|
.nrvers = ARRAY_SIZE(nfsacl_version),
|
||||||
.version = nfsacl_version,
|
.version = nfsacl_version,
|
||||||
.stats = &nfsacl_rpcstat,
|
.stats = &nfsacl_rpcstat,
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -174,7 +174,7 @@ static struct rpc_stat mnt_stats;
|
|||||||
static struct rpc_program mnt_program = {
|
static struct rpc_program mnt_program = {
|
||||||
.name = "mount",
|
.name = "mount",
|
||||||
.number = NFS_MNT_PROGRAM,
|
.number = NFS_MNT_PROGRAM,
|
||||||
.nrvers = sizeof(mnt_version)/sizeof(mnt_version[0]),
|
.nrvers = ARRAY_SIZE(mnt_version),
|
||||||
.version = mnt_version,
|
.version = mnt_version,
|
||||||
.stats = &mnt_stats,
|
.stats = &mnt_stats,
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -704,6 +704,6 @@ struct rpc_procinfo nfs_procedures[] = {
|
|||||||
|
|
||||||
struct rpc_version nfs_version2 = {
|
struct rpc_version nfs_version2 = {
|
||||||
.number = 2,
|
.number = 2,
|
||||||
.nrprocs = sizeof(nfs_procedures)/sizeof(nfs_procedures[0]),
|
.nrprocs = ARRAY_SIZE(nfs_procedures),
|
||||||
.procs = nfs_procedures
|
.procs = nfs_procedures
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1138,7 +1138,7 @@ struct rpc_procinfo nfs3_procedures[] = {
|
|||||||
|
|
||||||
struct rpc_version nfs_version3 = {
|
struct rpc_version nfs_version3 = {
|
||||||
.number = 3,
|
.number = 3,
|
||||||
.nrprocs = sizeof(nfs3_procedures)/sizeof(nfs3_procedures[0]),
|
.nrprocs = ARRAY_SIZE(nfs3_procedures),
|
||||||
.procs = nfs3_procedures
|
.procs = nfs3_procedures
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4384,7 +4384,7 @@ struct rpc_procinfo nfs4_procedures[] = {
|
|||||||
|
|
||||||
struct rpc_version nfs_version4 = {
|
struct rpc_version nfs_version4 = {
|
||||||
.number = 4,
|
.number = 4,
|
||||||
.nrprocs = sizeof(nfs4_procedures)/sizeof(nfs4_procedures[0]),
|
.nrprocs = ARRAY_SIZE(nfs4_procedures),
|
||||||
.procs = nfs4_procedures
|
.procs = nfs4_procedures
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *r
|
|||||||
if (version != NFSCTL_VERSION)
|
if (version != NFSCTL_VERSION)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (cmd < 0 || cmd >= sizeof(map)/sizeof(map[0]) || !map[cmd].name)
|
if (cmd < 0 || cmd >= ARRAY_SIZE(map) || !map[cmd].name)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY);
|
file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY);
|
||||||
|
|||||||
+2
-2
@@ -907,7 +907,7 @@ nfs4_acl_get_whotype(char *p, u32 len)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) {
|
for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
|
||||||
if (s2t_map[i].stringlen == len &&
|
if (s2t_map[i].stringlen == len &&
|
||||||
0 == memcmp(s2t_map[i].string, p, len))
|
0 == memcmp(s2t_map[i].string, p, len))
|
||||||
return s2t_map[i].type;
|
return s2t_map[i].type;
|
||||||
@@ -920,7 +920,7 @@ nfs4_acl_write_who(int who, char *p)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) {
|
for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
|
||||||
if (s2t_map[i].type == who) {
|
if (s2t_map[i].type == who) {
|
||||||
memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
|
memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
|
||||||
return s2t_map[i].stringlen;
|
return s2t_map[i].stringlen;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
|
|||||||
|
|
||||||
static struct rpc_version nfs_cb_version4 = {
|
static struct rpc_version nfs_cb_version4 = {
|
||||||
.number = 1,
|
.number = 1,
|
||||||
.nrprocs = sizeof(nfs4_cb_procedures)/sizeof(nfs4_cb_procedures[0]),
|
.nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
|
||||||
.procs = nfs4_cb_procedures
|
.procs = nfs4_cb_procedures
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
|
|||||||
/* Initialize rpc_program */
|
/* Initialize rpc_program */
|
||||||
program->name = "nfs4_cb";
|
program->name = "nfs4_cb";
|
||||||
program->number = cb->cb_prog;
|
program->number = cb->cb_prog;
|
||||||
program->nrvers = sizeof(nfs_cb_version)/sizeof(nfs_cb_version[0]);
|
program->nrvers = ARRAY_SIZE(nfs_cb_version);
|
||||||
program->version = nfs_cb_version;
|
program->version = nfs_cb_version;
|
||||||
program->stats = stat;
|
program->stats = stat;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -992,7 +992,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
|
|||||||
if (argp->opcnt > 100)
|
if (argp->opcnt > 100)
|
||||||
goto xdr_error;
|
goto xdr_error;
|
||||||
|
|
||||||
if (argp->opcnt > sizeof(argp->iops)/sizeof(argp->iops[0])) {
|
if (argp->opcnt > ARRAY_SIZE(argp->iops)) {
|
||||||
argp->ops = kmalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL);
|
argp->ops = kmalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL);
|
||||||
if (!argp->ops) {
|
if (!argp->ops) {
|
||||||
argp->ops = argp->iops;
|
argp->ops = argp->iops;
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu
|
|||||||
char *data;
|
char *data;
|
||||||
ssize_t rv;
|
ssize_t rv;
|
||||||
|
|
||||||
if (ino >= sizeof(write_op)/sizeof(write_op[0]) || !write_op[ino])
|
if (ino >= ARRAY_SIZE(write_op) || !write_op[ino])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
data = simple_transaction_get(file, buf, size);
|
data = simple_transaction_get(file, buf, size);
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ static struct svc_version * nfsd_acl_version[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define NFSD_ACL_MINVERS 2
|
#define NFSD_ACL_MINVERS 2
|
||||||
#define NFSD_ACL_NRVERS (sizeof(nfsd_acl_version)/sizeof(nfsd_acl_version[0]))
|
#define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version)
|
||||||
static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS];
|
static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS];
|
||||||
|
|
||||||
static struct svc_program nfsd_acl_program = {
|
static struct svc_program nfsd_acl_program = {
|
||||||
@@ -101,7 +101,7 @@ static struct svc_version * nfsd_version[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define NFSD_MINVERS 2
|
#define NFSD_MINVERS 2
|
||||||
#define NFSD_NRVERS (sizeof(nfsd_version)/sizeof(nfsd_version[0]))
|
#define NFSD_NRVERS ARRAY_SIZE(nfsd_version)
|
||||||
static struct svc_version *nfsd_versions[NFSD_NRVERS];
|
static struct svc_version *nfsd_versions[NFSD_NRVERS];
|
||||||
|
|
||||||
struct svc_program nfsd_program = {
|
struct svc_program nfsd_program = {
|
||||||
|
|||||||
+2
-4
@@ -268,8 +268,6 @@ static unsigned char euc2sjisibm_g3upper_map[][2] = {
|
|||||||
{0xFC, 0x4B},
|
{0xFC, 0x4B},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAP_ELEMENT_OF(map) (sizeof(map) / sizeof(map[0]))
|
|
||||||
|
|
||||||
static inline int sjisibm2euc(unsigned char *euc, const unsigned char sjis_hi,
|
static inline int sjisibm2euc(unsigned char *euc, const unsigned char sjis_hi,
|
||||||
const unsigned char sjis_lo);
|
const unsigned char sjis_lo);
|
||||||
static inline int euc2sjisibm_jisx0212(unsigned char *sjis, const unsigned char euc_hi,
|
static inline int euc2sjisibm_jisx0212(unsigned char *sjis, const unsigned char euc_hi,
|
||||||
@@ -310,7 +308,7 @@ static inline int euc2sjisibm_jisx0212(unsigned char *sjis, const unsigned char
|
|||||||
unsigned short euc;
|
unsigned short euc;
|
||||||
|
|
||||||
min_index = 0;
|
min_index = 0;
|
||||||
max_index = MAP_ELEMENT_OF(euc2sjisibm_jisx0212_map) - 1;
|
max_index = ARRAY_SIZE(euc2sjisibm_jisx0212_map) - 1;
|
||||||
euc = (euc_hi << 8) | euc_lo;
|
euc = (euc_hi << 8) | euc_lo;
|
||||||
|
|
||||||
while (min_index <= max_index) {
|
while (min_index <= max_index) {
|
||||||
@@ -339,7 +337,7 @@ static inline int euc2sjisibm_g3upper(unsigned char *sjis, const unsigned char e
|
|||||||
else
|
else
|
||||||
index = ((euc_hi << 8) | euc_lo) - 0xF4A1 + 12;
|
index = ((euc_hi << 8) | euc_lo) - 0xF4A1 + 12;
|
||||||
|
|
||||||
if ((index < 0) || (index >= MAP_ELEMENT_OF(euc2sjisibm_g3upper_map)))
|
if ((index < 0) || (index >= ARRAY_SIZE(euc2sjisibm_g3upper_map)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sjis[0] = euc2sjisibm_g3upper_map[index][0];
|
sjis[0] = euc2sjisibm_g3upper_map[index][0];
|
||||||
|
|||||||
@@ -601,8 +601,7 @@ void store_print_tb(struct tree_balance *tb)
|
|||||||
tb->tb_mode, PATH_LAST_POSITION(tb->tb_path),
|
tb->tb_mode, PATH_LAST_POSITION(tb->tb_path),
|
||||||
tb->tb_path->pos_in_item);
|
tb->tb_path->pos_in_item);
|
||||||
|
|
||||||
for (h = 0; h < sizeof(tb->insert_size) / sizeof(tb->insert_size[0]);
|
for (h = 0; h < ARRAY_SIZE(tb->insert_size); h++) {
|
||||||
h++) {
|
|
||||||
if (PATH_H_PATH_OFFSET(tb->tb_path, h) <=
|
if (PATH_H_PATH_OFFSET(tb->tb_path, h) <=
|
||||||
tb->tb_path->path_length
|
tb->tb_path->path_length
|
||||||
&& PATH_H_PATH_OFFSET(tb->tb_path,
|
&& PATH_H_PATH_OFFSET(tb->tb_path,
|
||||||
@@ -658,15 +657,13 @@ void store_print_tb(struct tree_balance *tb)
|
|||||||
|
|
||||||
/* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */
|
/* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */
|
||||||
h = 0;
|
h = 0;
|
||||||
for (i = 0; i < sizeof(tb->FEB) / sizeof(tb->FEB[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(tb->FEB); i++)
|
||||||
sprintf(print_tb_buf + strlen(print_tb_buf),
|
sprintf(print_tb_buf + strlen(print_tb_buf),
|
||||||
"%p (%llu %d)%s", tb->FEB[i],
|
"%p (%llu %d)%s", tb->FEB[i],
|
||||||
tb->FEB[i] ? (unsigned long long)tb->FEB[i]->
|
tb->FEB[i] ? (unsigned long long)tb->FEB[i]->
|
||||||
b_blocknr : 0ULL,
|
b_blocknr : 0ULL,
|
||||||
tb->FEB[i] ? atomic_read(&(tb->FEB[i]->b_count)) : 0,
|
tb->FEB[i] ? atomic_read(&(tb->FEB[i]->b_count)) : 0,
|
||||||
(i ==
|
(i == ARRAY_SIZE(tb->FEB) - 1) ? "\n" : ", ");
|
||||||
sizeof(tb->FEB) / sizeof(tb->FEB[0]) -
|
|
||||||
1) ? "\n" : ", ");
|
|
||||||
|
|
||||||
sprintf(print_tb_buf + strlen(print_tb_buf),
|
sprintf(print_tb_buf + strlen(print_tb_buf),
|
||||||
"======================== the end ====================================\n");
|
"======================== the end ====================================\n");
|
||||||
|
|||||||
+2
-2
@@ -377,10 +377,10 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
sbi->s_sb = sb;
|
sbi->s_sb = sb;
|
||||||
sbi->s_block_base = 0;
|
sbi->s_block_base = 0;
|
||||||
sb->s_fs_info = sbi;
|
sb->s_fs_info = sbi;
|
||||||
|
|
||||||
sb_set_blocksize(sb, BLOCK_SIZE);
|
sb_set_blocksize(sb, BLOCK_SIZE);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) {
|
for (i = 0; i < ARRAY_SIZE(flavours) && !size; i++) {
|
||||||
brelse(bh);
|
brelse(bh);
|
||||||
bh = sb_bread(sb, flavours[i].block);
|
bh = sb_bread(sb, flavours[i].block);
|
||||||
if (!bh)
|
if (!bh)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user