diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-03-24 06:15:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:19 -0500 |
commit | e8c96f8c29d89af0c13dc2819a9a00575846ca18 (patch) | |
tree | b90ed0da4803df56a91be5979580e335af2d697c /fs | |
parent | b5029622ac86bb441dc5e641226fb1152fca02d7 (diff) |
[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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/cmservice.c | 2 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 5 | ||||
-rw-r--r-- | fs/jfs/jfs_debug.c | 2 | ||||
-rw-r--r-- | fs/lockd/mon.c | 6 | ||||
-rw-r--r-- | fs/lockd/svc.c | 2 | ||||
-rw-r--r-- | fs/lockd/xdr.c | 2 | ||||
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/mount_clnt.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs2xdr.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs3xdr.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 2 | ||||
-rw-r--r-- | fs/nfsctl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs4acl.c | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 4 | ||||
-rw-r--r-- | fs/nls/nls_euc-jp.c | 6 | ||||
-rw-r--r-- | fs/reiserfs/prints.c | 9 | ||||
-rw-r--r-- | fs/sysv/super.c | 4 | ||||
-rw-r--r-- | fs/udf/super.c | 19 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_stats.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 2 |
23 files changed, 40 insertions, 51 deletions
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 9eef6bf156ab..3d097fddcb7a 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -94,7 +94,7 @@ static struct rxrpc_service AFSCM_service = { | |||
94 | .error_func = afscm_error, | 94 | .error_func = afscm_error, |
95 | .aemap_func = afscm_aemap, | 95 | .aemap_func = afscm_aemap, |
96 | .ops_begin = &AFSCM_ops[0], | 96 | .ops_begin = &AFSCM_ops[0], |
97 | .ops_end = &AFSCM_ops[sizeof(AFSCM_ops) / sizeof(AFSCM_ops[0])], | 97 | .ops_end = &AFSCM_ops[ARRAY_SIZE(AFSCM_ops)], |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static DECLARE_COMPLETION(kafscmd_alive); | 100 | static DECLARE_COMPLETION(kafscmd_alive); |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 7c031f00fd79..d2c38875ab29 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1522,8 +1522,7 @@ static struct { | |||
1522 | { ATM_QUERYLOOP32, ATM_QUERYLOOP } | 1522 | { ATM_QUERYLOOP32, ATM_QUERYLOOP } |
1523 | }; | 1523 | }; |
1524 | 1524 | ||
1525 | #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0])) | 1525 | #define NR_ATM_IOCTL ARRAY_SIZE(atm_ioctl_map) |
1526 | |||
1527 | 1526 | ||
1528 | static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg) | 1527 | static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg) |
1529 | { | 1528 | { |
@@ -1824,7 +1823,7 @@ static struct { | |||
1824 | { FDWERRORGET32, FDWERRORGET } | 1823 | { FDWERRORGET32, FDWERRORGET } |
1825 | }; | 1824 | }; |
1826 | 1825 | ||
1827 | #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0])) | 1826 | #define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table) |
1828 | 1827 | ||
1829 | static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | 1828 | static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
1830 | { | 1829 | { |
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index 4caea6b43b92..81f0e514c490 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c | |||
@@ -111,7 +111,7 @@ static struct { | |||
111 | { "loglevel", loglevel_read, loglevel_write } | 111 | { "loglevel", loglevel_read, loglevel_write } |
112 | #endif | 112 | #endif |
113 | }; | 113 | }; |
114 | #define NPROCENT (sizeof(Entries)/sizeof(Entries[0])) | 114 | #define NPROCENT ARRAY_SIZE(Entries) |
115 | 115 | ||
116 | void jfs_proc_init(void) | 116 | void jfs_proc_init(void) |
117 | { | 117 | { |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 0edc03e67966..a89cb8aa2c88 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -224,8 +224,8 @@ static struct rpc_procinfo nsm_procedures[] = { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | static struct rpc_version nsm_version1 = { | 226 | static struct rpc_version nsm_version1 = { |
227 | .number = 1, | 227 | .number = 1, |
228 | .nrprocs = sizeof(nsm_procedures)/sizeof(nsm_procedures[0]), | 228 | .nrprocs = ARRAY_SIZE(nsm_procedures), |
229 | .procs = nsm_procedures | 229 | .procs = nsm_procedures |
230 | }; | 230 | }; |
231 | 231 | ||
@@ -238,7 +238,7 @@ static struct rpc_stat nsm_stats; | |||
238 | static struct rpc_program nsm_program = { | 238 | static struct rpc_program nsm_program = { |
239 | .name = "statd", | 239 | .name = "statd", |
240 | .number = SM_PROGRAM, | 240 | .number = SM_PROGRAM, |
241 | .nrvers = sizeof(nsm_version)/sizeof(nsm_version[0]), | 241 | .nrvers = ARRAY_SIZE(nsm_version), |
242 | .version = nsm_version, | 242 | .version = nsm_version, |
243 | .stats = &nsm_stats | 243 | .stats = &nsm_stats |
244 | }; | 244 | }; |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 71a30b416d1a..5e85bde6c123 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -509,7 +509,7 @@ static struct svc_version * nlmsvc_version[] = { | |||
509 | 509 | ||
510 | static struct svc_stat nlmsvc_stats; | 510 | static struct svc_stat nlmsvc_stats; |
511 | 511 | ||
512 | #define NLM_NRVERS (sizeof(nlmsvc_version)/sizeof(nlmsvc_version[0])) | 512 | #define NLM_NRVERS ARRAY_SIZE(nlmsvc_version) |
513 | static struct svc_program nlmsvc_program = { | 513 | static struct svc_program nlmsvc_program = { |
514 | .pg_prog = NLM_PROGRAM, /* program number */ | 514 | .pg_prog = NLM_PROGRAM, /* program number */ |
515 | .pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */ | 515 | .pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */ |
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index 200fbda2c6d1..1d700a4dd0b5 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -599,7 +599,7 @@ static struct rpc_stat nlm_stats; | |||
599 | struct rpc_program nlm_program = { | 599 | struct rpc_program nlm_program = { |
600 | .name = "lockd", | 600 | .name = "lockd", |
601 | .number = NLM_PROGRAM, | 601 | .number = NLM_PROGRAM, |
602 | .nrvers = sizeof(nlm_versions) / sizeof(nlm_versions[0]), | 602 | .nrvers = ARRAY_SIZE(nlm_versions), |
603 | .version = nlm_versions, | 603 | .version = nlm_versions, |
604 | .stats = &nlm_stats, | 604 | .stats = &nlm_stats, |
605 | }; | 605 | }; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 37e55c328ebc..419d1d254f9f 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -103,7 +103,7 @@ static struct rpc_version * nfs_version[] = { | |||
103 | static struct rpc_program nfs_program = { | 103 | static struct rpc_program nfs_program = { |
104 | .name = "nfs", | 104 | .name = "nfs", |
105 | .number = NFS_PROGRAM, | 105 | .number = NFS_PROGRAM, |
106 | .nrvers = sizeof(nfs_version) / sizeof(nfs_version[0]), | 106 | .nrvers = ARRAY_SIZE(nfs_version), |
107 | .version = nfs_version, | 107 | .version = nfs_version, |
108 | .stats = &nfs_rpcstat, | 108 | .stats = &nfs_rpcstat, |
109 | .pipe_dir_name = "/nfs", | 109 | .pipe_dir_name = "/nfs", |
@@ -118,7 +118,7 @@ static struct rpc_version * nfsacl_version[] = { | |||
118 | struct rpc_program nfsacl_program = { | 118 | struct rpc_program nfsacl_program = { |
119 | .name = "nfsacl", | 119 | .name = "nfsacl", |
120 | .number = NFS_ACL_PROGRAM, | 120 | .number = NFS_ACL_PROGRAM, |
121 | .nrvers = sizeof(nfsacl_version) / sizeof(nfsacl_version[0]), | 121 | .nrvers = ARRAY_SIZE(nfsacl_version), |
122 | .version = nfsacl_version, | 122 | .version = nfsacl_version, |
123 | .stats = &nfsacl_rpcstat, | 123 | .stats = &nfsacl_rpcstat, |
124 | }; | 124 | }; |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index db99b8f678f8..0b9a78353d6e 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -174,7 +174,7 @@ static struct rpc_stat mnt_stats; | |||
174 | static struct rpc_program mnt_program = { | 174 | static struct rpc_program mnt_program = { |
175 | .name = "mount", | 175 | .name = "mount", |
176 | .number = NFS_MNT_PROGRAM, | 176 | .number = NFS_MNT_PROGRAM, |
177 | .nrvers = sizeof(mnt_version)/sizeof(mnt_version[0]), | 177 | .nrvers = ARRAY_SIZE(mnt_version), |
178 | .version = mnt_version, | 178 | .version = mnt_version, |
179 | .stats = &mnt_stats, | 179 | .stats = &mnt_stats, |
180 | }; | 180 | }; |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 7fc0560c89c9..6548a65de944 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -704,6 +704,6 @@ struct rpc_procinfo nfs_procedures[] = { | |||
704 | 704 | ||
705 | struct rpc_version nfs_version2 = { | 705 | struct rpc_version nfs_version2 = { |
706 | .number = 2, | 706 | .number = 2, |
707 | .nrprocs = sizeof(nfs_procedures)/sizeof(nfs_procedures[0]), | 707 | .nrprocs = ARRAY_SIZE(nfs_procedures), |
708 | .procs = nfs_procedures | 708 | .procs = nfs_procedures |
709 | }; | 709 | }; |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index b6c0b5012bce..5224a191efb6 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -1138,7 +1138,7 @@ struct rpc_procinfo nfs3_procedures[] = { | |||
1138 | 1138 | ||
1139 | struct rpc_version nfs_version3 = { | 1139 | struct rpc_version nfs_version3 = { |
1140 | .number = 3, | 1140 | .number = 3, |
1141 | .nrprocs = sizeof(nfs3_procedures)/sizeof(nfs3_procedures[0]), | 1141 | .nrprocs = ARRAY_SIZE(nfs3_procedures), |
1142 | .procs = nfs3_procedures | 1142 | .procs = nfs3_procedures |
1143 | }; | 1143 | }; |
1144 | 1144 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4bbf5ef57785..0a1bd36a4837 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4384,7 +4384,7 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
4384 | 4384 | ||
4385 | struct rpc_version nfs_version4 = { | 4385 | struct rpc_version nfs_version4 = { |
4386 | .number = 4, | 4386 | .number = 4, |
4387 | .nrprocs = sizeof(nfs4_procedures)/sizeof(nfs4_procedures[0]), | 4387 | .nrprocs = ARRAY_SIZE(nfs4_procedures), |
4388 | .procs = nfs4_procedures | 4388 | .procs = nfs4_procedures |
4389 | }; | 4389 | }; |
4390 | 4390 | ||
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index 1c72c7f85ddc..a5a18d4aca40 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -101,7 +101,7 @@ asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *r | |||
101 | if (version != NFSCTL_VERSION) | 101 | if (version != NFSCTL_VERSION) |
102 | return -EINVAL; | 102 | return -EINVAL; |
103 | 103 | ||
104 | if (cmd < 0 || cmd >= sizeof(map)/sizeof(map[0]) || !map[cmd].name) | 104 | if (cmd < 0 || cmd >= ARRAY_SIZE(map) || !map[cmd].name) |
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | 106 | ||
107 | file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY); | 107 | file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY); |
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 4a2105552ac4..7391f4aabedb 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -907,7 +907,7 @@ nfs4_acl_get_whotype(char *p, u32 len) | |||
907 | { | 907 | { |
908 | int i; | 908 | int i; |
909 | 909 | ||
910 | for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) { | 910 | for (i = 0; i < ARRAY_SIZE(s2t_map); i++) { |
911 | if (s2t_map[i].stringlen == len && | 911 | if (s2t_map[i].stringlen == len && |
912 | 0 == memcmp(s2t_map[i].string, p, len)) | 912 | 0 == memcmp(s2t_map[i].string, p, len)) |
913 | return s2t_map[i].type; | 913 | return s2t_map[i].type; |
@@ -920,7 +920,7 @@ nfs4_acl_write_who(int who, char *p) | |||
920 | { | 920 | { |
921 | int i; | 921 | int i; |
922 | 922 | ||
923 | for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) { | 923 | for (i = 0; i < ARRAY_SIZE(s2t_map); i++) { |
924 | if (s2t_map[i].type == who) { | 924 | if (s2t_map[i].type == who) { |
925 | memcpy(p, s2t_map[i].string, s2t_map[i].stringlen); | 925 | memcpy(p, s2t_map[i].string, s2t_map[i].stringlen); |
926 | return s2t_map[i].stringlen; | 926 | return s2t_map[i].stringlen; |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index d828662d737d..8d3d23c8a4d2 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -335,7 +335,7 @@ static struct rpc_procinfo nfs4_cb_procedures[] = { | |||
335 | 335 | ||
336 | static struct rpc_version nfs_cb_version4 = { | 336 | static struct rpc_version nfs_cb_version4 = { |
337 | .number = 1, | 337 | .number = 1, |
338 | .nrprocs = sizeof(nfs4_cb_procedures)/sizeof(nfs4_cb_procedures[0]), | 338 | .nrprocs = ARRAY_SIZE(nfs4_cb_procedures), |
339 | .procs = nfs4_cb_procedures | 339 | .procs = nfs4_cb_procedures |
340 | }; | 340 | }; |
341 | 341 | ||
@@ -411,7 +411,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
411 | /* Initialize rpc_program */ | 411 | /* Initialize rpc_program */ |
412 | program->name = "nfs4_cb"; | 412 | program->name = "nfs4_cb"; |
413 | program->number = cb->cb_prog; | 413 | program->number = cb->cb_prog; |
414 | program->nrvers = sizeof(nfs_cb_version)/sizeof(nfs_cb_version[0]); | 414 | program->nrvers = ARRAY_SIZE(nfs_cb_version); |
415 | program->version = nfs_cb_version; | 415 | program->version = nfs_cb_version; |
416 | program->stats = stat; | 416 | program->stats = stat; |
417 | 417 | ||
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 69d3501173a8..03857fd81126 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -992,7 +992,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
992 | if (argp->opcnt > 100) | 992 | if (argp->opcnt > 100) |
993 | goto xdr_error; | 993 | goto xdr_error; |
994 | 994 | ||
995 | if (argp->opcnt > sizeof(argp->iops)/sizeof(argp->iops[0])) { | 995 | if (argp->opcnt > ARRAY_SIZE(argp->iops)) { |
996 | argp->ops = kmalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); | 996 | argp->ops = kmalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); |
997 | if (!argp->ops) { | 997 | if (!argp->ops) { |
998 | argp->ops = argp->iops; | 998 | argp->ops = argp->iops; |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index a0871b3efeb7..c8960aff0968 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -105,7 +105,7 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu | |||
105 | char *data; | 105 | char *data; |
106 | ssize_t rv; | 106 | ssize_t rv; |
107 | 107 | ||
108 | if (ino >= sizeof(write_op)/sizeof(write_op[0]) || !write_op[ino]) | 108 | if (ino >= ARRAY_SIZE(write_op) || !write_op[ino]) |
109 | return -EINVAL; | 109 | return -EINVAL; |
110 | 110 | ||
111 | data = simple_transaction_get(file, buf, size); | 111 | data = simple_transaction_get(file, buf, size); |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 1d163b616915..3790727e5dfd 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -72,7 +72,7 @@ static struct svc_version * nfsd_acl_version[] = { | |||
72 | }; | 72 | }; |
73 | 73 | ||
74 | #define NFSD_ACL_MINVERS 2 | 74 | #define NFSD_ACL_MINVERS 2 |
75 | #define NFSD_ACL_NRVERS (sizeof(nfsd_acl_version)/sizeof(nfsd_acl_version[0])) | 75 | #define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version) |
76 | static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS]; | 76 | static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS]; |
77 | 77 | ||
78 | static struct svc_program nfsd_acl_program = { | 78 | static struct svc_program nfsd_acl_program = { |
@@ -101,7 +101,7 @@ static struct svc_version * nfsd_version[] = { | |||
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define NFSD_MINVERS 2 | 103 | #define NFSD_MINVERS 2 |
104 | #define NFSD_NRVERS (sizeof(nfsd_version)/sizeof(nfsd_version[0])) | 104 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) |
105 | static struct svc_version *nfsd_versions[NFSD_NRVERS]; | 105 | static struct svc_version *nfsd_versions[NFSD_NRVERS]; |
106 | 106 | ||
107 | struct svc_program nfsd_program = { | 107 | struct svc_program nfsd_program = { |
diff --git a/fs/nls/nls_euc-jp.c b/fs/nls/nls_euc-jp.c index 80f108ae6661..06640c3e4021 100644 --- a/fs/nls/nls_euc-jp.c +++ b/fs/nls/nls_euc-jp.c | |||
@@ -268,8 +268,6 @@ static unsigned char euc2sjisibm_g3upper_map[][2] = { | |||
268 | {0xFC, 0x4B}, | 268 | {0xFC, 0x4B}, |
269 | }; | 269 | }; |
270 | 270 | ||
271 | #define MAP_ELEMENT_OF(map) (sizeof(map) / sizeof(map[0])) | ||
272 | |||
273 | static inline int sjisibm2euc(unsigned char *euc, const unsigned char sjis_hi, | 271 | static inline int sjisibm2euc(unsigned char *euc, const unsigned char sjis_hi, |
274 | const unsigned char sjis_lo); | 272 | const unsigned char sjis_lo); |
275 | static inline int euc2sjisibm_jisx0212(unsigned char *sjis, const unsigned char euc_hi, | 273 | 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 | |||
310 | unsigned short euc; | 308 | unsigned short euc; |
311 | 309 | ||
312 | min_index = 0; | 310 | min_index = 0; |
313 | max_index = MAP_ELEMENT_OF(euc2sjisibm_jisx0212_map) - 1; | 311 | max_index = ARRAY_SIZE(euc2sjisibm_jisx0212_map) - 1; |
314 | euc = (euc_hi << 8) | euc_lo; | 312 | euc = (euc_hi << 8) | euc_lo; |
315 | 313 | ||
316 | while (min_index <= max_index) { | 314 | while (min_index <= max_index) { |
@@ -339,7 +337,7 @@ static inline int euc2sjisibm_g3upper(unsigned char *sjis, const unsigned char e | |||
339 | else | 337 | else |
340 | index = ((euc_hi << 8) | euc_lo) - 0xF4A1 + 12; | 338 | index = ((euc_hi << 8) | euc_lo) - 0xF4A1 + 12; |
341 | 339 | ||
342 | if ((index < 0) || (index >= MAP_ELEMENT_OF(euc2sjisibm_g3upper_map))) | 340 | if ((index < 0) || (index >= ARRAY_SIZE(euc2sjisibm_g3upper_map))) |
343 | return 0; | 341 | return 0; |
344 | 342 | ||
345 | sjis[0] = euc2sjisibm_g3upper_map[index][0]; | 343 | sjis[0] = euc2sjisibm_g3upper_map[index][0]; |
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c index d55e164bd5c2..78b40621b88b 100644 --- a/fs/reiserfs/prints.c +++ b/fs/reiserfs/prints.c | |||
@@ -601,8 +601,7 @@ void store_print_tb(struct tree_balance *tb) | |||
601 | tb->tb_mode, PATH_LAST_POSITION(tb->tb_path), | 601 | tb->tb_mode, PATH_LAST_POSITION(tb->tb_path), |
602 | tb->tb_path->pos_in_item); | 602 | tb->tb_path->pos_in_item); |
603 | 603 | ||
604 | for (h = 0; h < sizeof(tb->insert_size) / sizeof(tb->insert_size[0]); | 604 | for (h = 0; h < ARRAY_SIZE(tb->insert_size); h++) { |
605 | h++) { | ||
606 | if (PATH_H_PATH_OFFSET(tb->tb_path, h) <= | 605 | if (PATH_H_PATH_OFFSET(tb->tb_path, h) <= |
607 | tb->tb_path->path_length | 606 | tb->tb_path->path_length |
608 | && PATH_H_PATH_OFFSET(tb->tb_path, | 607 | && PATH_H_PATH_OFFSET(tb->tb_path, |
@@ -658,15 +657,13 @@ void store_print_tb(struct tree_balance *tb) | |||
658 | 657 | ||
659 | /* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */ | 658 | /* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */ |
660 | h = 0; | 659 | h = 0; |
661 | for (i = 0; i < sizeof(tb->FEB) / sizeof(tb->FEB[0]); i++) | 660 | for (i = 0; i < ARRAY_SIZE(tb->FEB); i++) |
662 | sprintf(print_tb_buf + strlen(print_tb_buf), | 661 | sprintf(print_tb_buf + strlen(print_tb_buf), |
663 | "%p (%llu %d)%s", tb->FEB[i], | 662 | "%p (%llu %d)%s", tb->FEB[i], |
664 | tb->FEB[i] ? (unsigned long long)tb->FEB[i]-> | 663 | tb->FEB[i] ? (unsigned long long)tb->FEB[i]-> |
665 | b_blocknr : 0ULL, | 664 | b_blocknr : 0ULL, |
666 | tb->FEB[i] ? atomic_read(&(tb->FEB[i]->b_count)) : 0, | 665 | tb->FEB[i] ? atomic_read(&(tb->FEB[i]->b_count)) : 0, |
667 | (i == | 666 | (i == ARRAY_SIZE(tb->FEB) - 1) ? "\n" : ", "); |
668 | sizeof(tb->FEB) / sizeof(tb->FEB[0]) - | ||
669 | 1) ? "\n" : ", "); | ||
670 | 667 | ||
671 | sprintf(print_tb_buf + strlen(print_tb_buf), | 668 | sprintf(print_tb_buf + strlen(print_tb_buf), |
672 | "======================== the end ====================================\n"); | 669 | "======================== the end ====================================\n"); |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index 59e76b51142b..e92b991e6dda 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
@@ -377,10 +377,10 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) | |||
377 | sbi->s_sb = sb; | 377 | sbi->s_sb = sb; |
378 | sbi->s_block_base = 0; | 378 | sbi->s_block_base = 0; |
379 | sb->s_fs_info = sbi; | 379 | sb->s_fs_info = sbi; |
380 | 380 | ||
381 | sb_set_blocksize(sb, BLOCK_SIZE); | 381 | sb_set_blocksize(sb, BLOCK_SIZE); |
382 | 382 | ||
383 | for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) { | 383 | for (i = 0; i < ARRAY_SIZE(flavours) && !size; i++) { |
384 | brelse(bh); | 384 | brelse(bh); |
385 | bh = sb_bread(sb, flavours[i].block); | 385 | bh = sb_bread(sb, flavours[i].block); |
386 | if (!bh) | 386 | if (!bh) |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 9303c50c5d55..0d555616c939 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -660,8 +660,7 @@ udf_find_anchor(struct super_block *sb) | |||
660 | * lastblock | 660 | * lastblock |
661 | * however, if the disc isn't closed, it could be 512 */ | 661 | * however, if the disc isn't closed, it could be 512 */ |
662 | 662 | ||
663 | for (i=0; (!lastblock && i<sizeof(last)/sizeof(int)); i++) | 663 | for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) { |
664 | { | ||
665 | if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) | 664 | if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) |
666 | { | 665 | { |
667 | ident = location = 0; | 666 | ident = location = 0; |
@@ -672,7 +671,7 @@ udf_find_anchor(struct super_block *sb) | |||
672 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 671 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); |
673 | udf_release_data(bh); | 672 | udf_release_data(bh); |
674 | } | 673 | } |
675 | 674 | ||
676 | if (ident == TAG_IDENT_AVDP) | 675 | if (ident == TAG_IDENT_AVDP) |
677 | { | 676 | { |
678 | if (location == last[i] - UDF_SB_SESSION(sb)) | 677 | if (location == last[i] - UDF_SB_SESSION(sb)) |
@@ -753,8 +752,7 @@ udf_find_anchor(struct super_block *sb) | |||
753 | } | 752 | } |
754 | } | 753 | } |
755 | 754 | ||
756 | for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++) | 755 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { |
757 | { | ||
758 | if (UDF_SB_ANCHOR(sb)[i]) | 756 | if (UDF_SB_ANCHOR(sb)[i]) |
759 | { | 757 | { |
760 | if (!(bh = udf_read_tagged(sb, | 758 | if (!(bh = udf_read_tagged(sb, |
@@ -1313,8 +1311,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1313 | if (!sb) | 1311 | if (!sb) |
1314 | return 1; | 1312 | return 1; |
1315 | 1313 | ||
1316 | for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++) | 1314 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { |
1317 | { | ||
1318 | if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb, | 1315 | if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb, |
1319 | UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident))) | 1316 | UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident))) |
1320 | { | 1317 | { |
@@ -1325,7 +1322,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1325 | main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength ); | 1322 | main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength ); |
1326 | main_e = main_e >> sb->s_blocksize_bits; | 1323 | main_e = main_e >> sb->s_blocksize_bits; |
1327 | main_e += main_s; | 1324 | main_e += main_s; |
1328 | 1325 | ||
1329 | /* Locate the reserve sequence */ | 1326 | /* Locate the reserve sequence */ |
1330 | reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation); | 1327 | reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation); |
1331 | reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); | 1328 | reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); |
@@ -1344,12 +1341,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1344 | } | 1341 | } |
1345 | } | 1342 | } |
1346 | 1343 | ||
1347 | if (i == sizeof(UDF_SB_ANCHOR(sb))/sizeof(int)) | 1344 | if (i == ARRAY_SIZE(UDF_SB_ANCHOR(sb))) { |
1348 | { | ||
1349 | udf_debug("No Anchor block found\n"); | 1345 | udf_debug("No Anchor block found\n"); |
1350 | return 1; | 1346 | return 1; |
1351 | } | 1347 | } else |
1352 | else | ||
1353 | udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]); | 1348 | udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]); |
1354 | 1349 | ||
1355 | for (i=0; i<UDF_SB_NUMPARTS(sb); i++) | 1350 | for (i=0; i<UDF_SB_NUMPARTS(sb); i++) |
diff --git a/fs/xfs/linux-2.6/xfs_stats.c b/fs/xfs/linux-2.6/xfs_stats.c index 713e6a7505d0..1f0589a05eca 100644 --- a/fs/xfs/linux-2.6/xfs_stats.c +++ b/fs/xfs/linux-2.6/xfs_stats.c | |||
@@ -56,7 +56,7 @@ xfs_read_xfsstats( | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* Loop over all stats groups */ | 58 | /* Loop over all stats groups */ |
59 | for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) { | 59 | for (i=j=len = 0; i < ARRAY_SIZE(xstats); i++) { |
60 | len += sprintf(buffer + len, xstats[i].desc); | 60 | len += sprintf(buffer + len, xstats[i].desc); |
61 | /* inner loop does each group */ | 61 | /* inner loop does each group */ |
62 | while (j < xstats[i].endpoint) { | 62 | while (j < xstats[i].endpoint) { |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index a478f42e63ff..0f0a64e81db9 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1335,7 +1335,7 @@ xfs_inactive_symlink_rmt( | |||
1335 | */ | 1335 | */ |
1336 | done = 0; | 1336 | done = 0; |
1337 | XFS_BMAP_INIT(&free_list, &first_block); | 1337 | XFS_BMAP_INIT(&free_list, &first_block); |
1338 | nmaps = sizeof(mval) / sizeof(mval[0]); | 1338 | nmaps = ARRAY_SIZE(mval); |
1339 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), | 1339 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), |
1340 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, | 1340 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, |
1341 | &free_list))) | 1341 | &free_list))) |