From: Chuck Lever In preparation for supporting NFSv2 and NFSv3 mount option handling in the kernel NFS client, convert mount_clnt.c to be a permanent part of the NFS client, instead of built only when CONFIG_ROOT_NFS is enabled. Signed-off-by: Chuck Lever Cc: Trond Myklebust Cc: "J. Bruce Fields" Signed-off-by: Andrew Morton --- fs/nfs/Makefile | 4 ++-- fs/nfs/mount_clnt.c | 18 +++++++++++++----- fs/nfs/nfsroot.c | 2 +- include/linux/nfs_fs.h | 4 +--- 4 files changed, 17 insertions(+), 11 deletions(-) diff -puN fs/nfs/Makefile~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client fs/nfs/Makefile --- a/fs/nfs/Makefile~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client +++ a/fs/nfs/Makefile @@ -6,8 +6,8 @@ obj-$(CONFIG_NFS_FS) += nfs.o nfs-y := client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \ pagelist.o proc.o read.o symlink.o unlink.o \ - write.o namespace.o -nfs-$(CONFIG_ROOT_NFS) += nfsroot.o mount_clnt.o + write.o namespace.o mount_clnt.o +nfs-$(CONFIG_ROOT_NFS) += nfsroot.o nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ diff -puN fs/nfs/mount_clnt.c~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client fs/nfs/mount_clnt.c --- a/fs/nfs/mount_clnt.c~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client +++ a/fs/nfs/mount_clnt.c @@ -37,12 +37,20 @@ struct mnt_fhstatus { struct nfs_fh * fh; }; -/* - * Obtain an NFS file handle for the given host and path +/** + * nfs_mount - Obtain an NFS file handle for the given host and path + * @addr: pointer to server's address + * @path: pointer to string containing export path to mount + * @fh: pointer to location to place returned file handle + * @version: mount version to use for this request + * @protocol: transport protocol to use for thie request + * + * Uses default timeout parameters specified by underlying transport. + * + * XXX: Needs to support IPv6 */ -int -nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, - int version, int protocol) +int nfs_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, + int version, int protocol) { struct rpc_clnt *mnt_clnt; struct mnt_fhstatus result = { diff -puN fs/nfs/nfsroot.c~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client fs/nfs/nfsroot.c --- a/fs/nfs/nfsroot.c~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client +++ a/fs/nfs/nfsroot.c @@ -496,7 +496,7 @@ static int __init root_nfs_get_handle(vo NFS_MNT3_VERSION : NFS_MNT_VERSION; set_sockaddr(&sin, servaddr, htons(mount_port)); - status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); + status = nfs_mount(&sin, nfs_path, &fh, version, protocol); if (status < 0) printk(KERN_ERR "Root-NFS: Server returned error %d " "while mounting %s\n", status, nfs_path); diff -puN include/linux/nfs_fs.h~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client include/linux/nfs_fs.h --- a/include/linux/nfs_fs.h~nfs-remake-nfsroot_mount-as-a-permanent-part-of-nfs-client +++ a/include/linux/nfs_fs.h @@ -497,10 +497,8 @@ static inline void nfs3_forget_cached_ac /* * linux/fs/mount_clnt.c - * (Used only by nfsroot module) */ -extern int nfsroot_mount(struct sockaddr_in *, char *, struct nfs_fh *, - int, int); +extern int nfs_mount(struct sockaddr_in *, char *, struct nfs_fh *, int, int); /* * inline functions _