NFS: Move nfs_copy_user_string
Subsystems (2)
PATCH 11/13 NFS: Move nfs_copy_user_string
Next patch will add a new function that calls nfs_copy_user_string.
Signed-off-by Chuck Lever <[email protected]>
---
fs/nfs/super.c | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-)
fs/nfs/super.c +21 -21
@@ -1622,6 +1622,27 @@ out_err:return ERR_PTR (-EINVAL ); } +static void *nfs_copy_user_string (char *dst,struct nfs_string *src,int maxlen) +{ +void *p =NULL ; + +if (!src->len) +return ERR_PTR (-EINVAL ); +if (src->len < maxlen) + maxlen = src->len; +if (dst ==NULL ) { + p = dst =kmalloc (maxlen +1 ,GFP_KERNEL ); +if (p ==NULL ) +return ERR_PTR (-ENOMEM ); + } +if (copy_from_user (dst, src->data, maxlen)) { +kfree (p); +return ERR_PTR (-EFAULT ); + } + dst[maxlen] ='\0' ; +return dst; +} +/* * Finish setting up a cloned NFS4 superblock */
@@ -1646,27 +1667,6 @@ static void nfs4_fill_super(struct super_block *sb)nfs_initialise_sb (sb); } -static void *nfs_copy_user_string (char *dst,struct nfs_string *src,int maxlen) -{ -void *p =NULL ; - -if (!src->len) -return ERR_PTR (-EINVAL ); -if (src->len < maxlen) - maxlen = src->len; -if (dst ==NULL ) { - p = dst =kmalloc (maxlen +1 ,GFP_KERNEL ); -if (p ==NULL ) -return ERR_PTR (-ENOMEM ); - } -if (copy_from_user (dst, src->data, maxlen)) { -kfree (p); -return ERR_PTR (-EFAULT ); - } - dst[maxlen] ='\0' ; -return dst; -} -/* * Get the superblock for an NFS4 mountpoint */