diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2010-05-17 01:41:11 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2010-05-17 01:41:11 +0000 |
commit | 0eeb821b1ae4109c832fd1b555f436d649d3be02 (patch) | |
tree | 6a2b5858afab03a5f07a0e5bc048459fcc4a6a4b | |
parent | 7f3db98fba4e727a5c118996b65ca379e4977488 (diff) | |
download | FreeBSD-src-0eeb821b1ae4109c832fd1b555f436d649d3be02.zip FreeBSD-src-0eeb821b1ae4109c832fd1b555f436d649d3be02.tar.gz |
MFC: r207764
Patch the experimental NFS client so that it works for NFSv2
by adding the necessary mapping from NFSv3 procedure numbers
to NFSv2 procedure numbers when doing NFSv2 RPCs.
-rw-r--r-- | sys/fs/nfs/nfs_commonkrpc.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 384bdb4..b0756e0 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -97,14 +97,37 @@ static void nfs_up(struct nfsmount *, struct thread *, const char *, int, int); static int nfs_msg(struct thread *, const char *, const char *, int); -extern int nfsv2_procid[]; - struct nfs_cached_auth { int ca_refs; /* refcount, including 1 from the cache */ uid_t ca_uid; /* uid that corresponds to this auth */ AUTH *ca_auth; /* RPC auth handle */ }; +static int nfsv2_procid[NFS_V3NPROCS] = { + NFSV2PROC_NULL, + NFSV2PROC_GETATTR, + NFSV2PROC_SETATTR, + NFSV2PROC_LOOKUP, + NFSV2PROC_NOOP, + NFSV2PROC_READLINK, + NFSV2PROC_READ, + NFSV2PROC_WRITE, + NFSV2PROC_CREATE, + NFSV2PROC_MKDIR, + NFSV2PROC_SYMLINK, + NFSV2PROC_CREATE, + NFSV2PROC_REMOVE, + NFSV2PROC_RMDIR, + NFSV2PROC_RENAME, + NFSV2PROC_LINK, + NFSV2PROC_READDIR, + NFSV2PROC_NOOP, + NFSV2PROC_STATFS, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, +}; + /* * Initialize sockets and congestion for a new NFS connection. * We do not free the sockaddr if error. @@ -533,6 +556,15 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, if (nmp != NULL) { NFSINCRGLOBAL(newnfsstats.rpcrequests); + + /* Map the procnum to the old NFSv2 one, as required. */ + if ((nd->nd_flag & ND_NFSV2) != 0) { + if (nd->nd_procnum < NFS_V3NPROCS) + procnum = nfsv2_procid[nd->nd_procnum]; + else + procnum = NFSV2PROC_NOOP; + } + /* * Now only used for the R_DONTRECOVER case, but until that is * supported within the krpc code, I need to keep a queue of |