net: nfs: Share the file handle buffer for v2 / v3
The v3 handles can be larger than v2, but that doesn't mean we need a separate buffer. Reuse the same (larger) buffer for both. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
b0baca9820
commit
5280c76915
12
net/nfs.c
12
net/nfs.c
|
@ -52,10 +52,8 @@ static int nfs_len;
|
||||||
static ulong nfs_timeout = NFS_TIMEOUT;
|
static ulong nfs_timeout = NFS_TIMEOUT;
|
||||||
|
|
||||||
static char dirfh[NFS_FHSIZE]; /* NFSv2 / NFSv3 file handle of directory */
|
static char dirfh[NFS_FHSIZE]; /* NFSv2 / NFSv3 file handle of directory */
|
||||||
static char filefh[NFS_FHSIZE]; /* NFSv2 file handle */
|
static char filefh[NFS3_FHSIZE]; /* NFSv2 / NFSv3 file handle */
|
||||||
|
static int filefh3_length; /* (variable) length of filefh when NFSv3 */
|
||||||
static char filefh3[NFS3_FHSIZE]; /* NFSv3 file handle */
|
|
||||||
static int filefh3_length; /* (variable) length of filefh3 */
|
|
||||||
|
|
||||||
static enum net_loop_state nfs_download_state;
|
static enum net_loop_state nfs_download_state;
|
||||||
static struct in_addr nfs_server_ip;
|
static struct in_addr nfs_server_ip;
|
||||||
|
@ -316,7 +314,7 @@ static void nfs_readlink_req(void)
|
||||||
p += (NFS_FHSIZE / 4);
|
p += (NFS_FHSIZE / 4);
|
||||||
} else { /* NFSV3_FLAG */
|
} else { /* NFSV3_FLAG */
|
||||||
*p++ = htonl(filefh3_length);
|
*p++ = htonl(filefh3_length);
|
||||||
memcpy(p, filefh3, filefh3_length);
|
memcpy(p, filefh, filefh3_length);
|
||||||
p += (filefh3_length / 4);
|
p += (filefh3_length / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +386,7 @@ static void nfs_read_req(int offset, int readlen)
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
} else { /* NFSV3_FLAG */
|
} else { /* NFSV3_FLAG */
|
||||||
*p++ = htonl(filefh3_length);
|
*p++ = htonl(filefh3_length);
|
||||||
memcpy(p, filefh3, filefh3_length);
|
memcpy(p, filefh, filefh3_length);
|
||||||
p += (filefh3_length / 4);
|
p += (filefh3_length / 4);
|
||||||
*p++ = htonl(0); /* offset is 64-bit long, so fill with 0 */
|
*p++ = htonl(0); /* offset is 64-bit long, so fill with 0 */
|
||||||
*p++ = htonl(offset);
|
*p++ = htonl(offset);
|
||||||
|
@ -582,7 +580,7 @@ static int nfs_lookup_reply(uchar *pkt, unsigned len)
|
||||||
filefh3_length = ntohl(rpc_pkt.u.reply.data[1]);
|
filefh3_length = ntohl(rpc_pkt.u.reply.data[1]);
|
||||||
if (filefh3_length > NFS3_FHSIZE)
|
if (filefh3_length > NFS3_FHSIZE)
|
||||||
filefh3_length = NFS3_FHSIZE;
|
filefh3_length = NFS3_FHSIZE;
|
||||||
memcpy(filefh3, rpc_pkt.u.reply.data + 2, filefh3_length);
|
memcpy(filefh, rpc_pkt.u.reply.data + 2, filefh3_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue