-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NFS: Move the v4 getroot code to nfs4getroot.c
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
- Loading branch information
Bryan Schumaker
authored and
Trond Myklebust
committed
Jul 17, 2012
1 parent
ce4ef7c
commit a38a9ea
Showing
3 changed files
with
50 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. | ||
* Written by David Howells (dhowells@redhat.com) | ||
*/ | ||
|
||
#include <linux/nfs_fs.h> | ||
#include "nfs4_fs.h" | ||
|
||
#define NFSDBG_FACILITY NFSDBG_CLIENT | ||
|
||
int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh) | ||
{ | ||
struct nfs_fsinfo fsinfo; | ||
int ret = -ENOMEM; | ||
|
||
dprintk("--> nfs4_get_rootfh()\n"); | ||
|
||
fsinfo.fattr = nfs_alloc_fattr(); | ||
if (fsinfo.fattr == NULL) | ||
goto out; | ||
|
||
/* Start by getting the root filehandle from the server */ | ||
ret = nfs4_proc_get_rootfh(server, mntfh, &fsinfo); | ||
if (ret < 0) { | ||
dprintk("nfs4_get_rootfh: getroot error = %d\n", -ret); | ||
goto out; | ||
} | ||
|
||
if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_TYPE) | ||
|| !S_ISDIR(fsinfo.fattr->mode)) { | ||
printk(KERN_ERR "nfs4_get_rootfh:" | ||
" getroot encountered non-directory\n"); | ||
ret = -ENOTDIR; | ||
goto out; | ||
} | ||
|
||
if (fsinfo.fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) { | ||
printk(KERN_ERR "nfs4_get_rootfh:" | ||
" getroot obtained referral\n"); | ||
ret = -EREMOTE; | ||
goto out; | ||
} | ||
|
||
memcpy(&server->fsid, &fsinfo.fattr->fsid, sizeof(server->fsid)); | ||
out: | ||
nfs_free_fattr(fsinfo.fattr); | ||
dprintk("<-- nfs4_get_rootfh() = %d\n", ret); | ||
return ret; | ||
} |