Commit 35bba9a3 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: miscellaneous nfs4state.c style fixes

Fix various minor style violations.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 5ec7b46c
...@@ -339,21 +339,20 @@ STALE_CLIENTID(clientid_t *clid) ...@@ -339,21 +339,20 @@ STALE_CLIENTID(clientid_t *clid)
* This type of memory management is somewhat inefficient, but we use it * This type of memory management is somewhat inefficient, but we use it
* anyway since SETCLIENTID is not a common operation. * anyway since SETCLIENTID is not a common operation.
*/ */
static inline struct nfs4_client * static struct nfs4_client *alloc_client(struct xdr_netobj name)
alloc_client(struct xdr_netobj name)
{ {
struct nfs4_client *clp; struct nfs4_client *clp;
if ((clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) { clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL);
if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) { if (clp == NULL)
memcpy(clp->cl_name.data, name.data, name.len); return NULL;
clp->cl_name.len = name.len; clp->cl_name.data = kmalloc(name.len, GFP_KERNEL);
} if (clp->cl_name.data == NULL) {
else { kfree(clp);
kfree(clp); return NULL;
clp = NULL;
}
} }
memcpy(clp->cl_name.data, name.data, name.len);
clp->cl_name.len = name.len;
return clp; return clp;
} }
...@@ -421,12 +420,13 @@ expire_client(struct nfs4_client *clp) ...@@ -421,12 +420,13 @@ expire_client(struct nfs4_client *clp)
put_nfs4_client(clp); put_nfs4_client(clp);
} }
static struct nfs4_client * static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir)
create_client(struct xdr_netobj name, char *recdir) { {
struct nfs4_client *clp; struct nfs4_client *clp;
if (!(clp = alloc_client(name))) clp = alloc_client(name);
goto out; if (clp == NULL)
return NULL;
memcpy(clp->cl_recdir, recdir, HEXDIR_LEN); memcpy(clp->cl_recdir, recdir, HEXDIR_LEN);
atomic_set(&clp->cl_count, 1); atomic_set(&clp->cl_count, 1);
atomic_set(&clp->cl_callback.cb_set, 0); atomic_set(&clp->cl_callback.cb_set, 0);
...@@ -435,32 +435,30 @@ create_client(struct xdr_netobj name, char *recdir) { ...@@ -435,32 +435,30 @@ create_client(struct xdr_netobj name, char *recdir) {
INIT_LIST_HEAD(&clp->cl_openowners); INIT_LIST_HEAD(&clp->cl_openowners);
INIT_LIST_HEAD(&clp->cl_delegations); INIT_LIST_HEAD(&clp->cl_delegations);
INIT_LIST_HEAD(&clp->cl_lru); INIT_LIST_HEAD(&clp->cl_lru);
out:
return clp; return clp;
} }
static void static void copy_verf(struct nfs4_client *target, nfs4_verifier *source)
copy_verf(struct nfs4_client *target, nfs4_verifier *source) { {
memcpy(target->cl_verifier.data, source->data, sizeof(target->cl_verifier.data)); memcpy(target->cl_verifier.data, source->data,
sizeof(target->cl_verifier.data));
} }
static void static void copy_clid(struct nfs4_client *target, struct nfs4_client *source)
copy_clid(struct nfs4_client *target, struct nfs4_client *source) { {
target->cl_clientid.cl_boot = source->cl_clientid.cl_boot; target->cl_clientid.cl_boot = source->cl_clientid.cl_boot;
target->cl_clientid.cl_id = source->cl_clientid.cl_id; target->cl_clientid.cl_id = source->cl_clientid.cl_id;
} }
static void static void copy_cred(struct svc_cred *target, struct svc_cred *source)
copy_cred(struct svc_cred *target, struct svc_cred *source) { {
target->cr_uid = source->cr_uid; target->cr_uid = source->cr_uid;
target->cr_gid = source->cr_gid; target->cr_gid = source->cr_gid;
target->cr_group_info = source->cr_group_info; target->cr_group_info = source->cr_group_info;
get_group_info(target->cr_group_info); get_group_info(target->cr_group_info);
} }
static inline int static int same_name(const char *n1, const char *n2)
same_name(const char *n1, const char *n2)
{ {
return 0 == memcmp(n1, n2, HEXDIR_LEN); return 0 == memcmp(n1, n2, HEXDIR_LEN);
} }
...@@ -502,9 +500,8 @@ static void gen_confirm(struct nfs4_client *clp) ...@@ -502,9 +500,8 @@ static void gen_confirm(struct nfs4_client *clp)
*p++ = i++; *p++ = i++;
} }
static int static int check_name(struct xdr_netobj name)
check_name(struct xdr_netobj name) { {
if (name.len == 0) if (name.len == 0)
return 0; return 0;
if (name.len > NFS4_OPAQUE_LIMIT) { if (name.len > NFS4_OPAQUE_LIMIT) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment