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/nfsd | |
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/nfsd')
-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 |
5 files changed, 8 insertions, 8 deletions
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 = { |