From e8c96f8c29d89af0c13dc2819a9a00575846ca18 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 24 Mar 2006 03:15:34 -0800 Subject: [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 Cc: David Howells Cc: Dave Kleikamp Acked-by: Trond Myklebust Cc: Neil Brown Cc: Chris Mason Cc: Jeff Mahoney Cc: Christoph Hellwig Cc: Nathan Scott Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nfsd/nfs4acl.c | 4 ++-- fs/nfsd/nfs4callback.c | 4 ++-- fs/nfsd/nfs4xdr.c | 2 +- fs/nfsd/nfsctl.c | 2 +- fs/nfsd/nfssvc.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'fs/nfsd') 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) { 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 && 0 == memcmp(s2t_map[i].string, p, len)) return s2t_map[i].type; @@ -920,7 +920,7 @@ nfs4_acl_write_who(int who, char *p) { 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) { memcpy(p, s2t_map[i].string, s2t_map[i].stringlen); 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[] = { static struct rpc_version nfs_cb_version4 = { .number = 1, - .nrprocs = sizeof(nfs4_cb_procedures)/sizeof(nfs4_cb_procedures[0]), + .nrprocs = ARRAY_SIZE(nfs4_cb_procedures), .procs = nfs4_cb_procedures }; @@ -411,7 +411,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) /* Initialize rpc_program */ program->name = "nfs4_cb"; 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->stats = stat; 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) if (argp->opcnt > 100) 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); if (!argp->ops) { 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 char *data; 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; 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[] = { }; #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_program nfsd_acl_program = { @@ -101,7 +101,7 @@ static struct svc_version * nfsd_version[] = { }; #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]; struct svc_program nfsd_program = { -- cgit v1.2.3