Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfs/nfs_commonsubs.c
Show First 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | |||||
* set_true == 1 if there should be an newnfs_true prepended on the file handle. | * set_true == 1 if there should be an newnfs_true prepended on the file handle. | ||||
* Return the number of bytes output, including XDR overhead. | * Return the number of bytes output, including XDR overhead. | ||||
*/ | */ | ||||
APPLESTATIC int | APPLESTATIC int | ||||
nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true) | nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true) | ||||
{ | { | ||||
u_int32_t *tl; | u_int32_t *tl; | ||||
u_int8_t *cp; | u_int8_t *cp; | ||||
int fullsiz, rem, bytesize = 0; | int fullsiz, bytesize = 0; | ||||
if (size == 0) | if (size == 0) | ||||
size = NFSX_MYFH; | size = NFSX_MYFH; | ||||
switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) { | switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) { | ||||
case ND_NFSV2: | case ND_NFSV2: | ||||
if (size > NFSX_V2FH) | if (size > NFSX_V2FH) | ||||
panic("fh size > NFSX_V2FH for NFSv2"); | panic("fh size > NFSX_V2FH for NFSv2"); | ||||
NFSM_BUILD(cp, u_int8_t *, NFSX_V2FH); | NFSM_BUILD(cp, u_int8_t *, NFSX_V2FH); | ||||
NFSBCOPY(fhp, cp, size); | NFSBCOPY(fhp, cp, size); | ||||
if (size < NFSX_V2FH) | if (size < NFSX_V2FH) | ||||
NFSBZERO(cp + size, NFSX_V2FH - size); | NFSBZERO(cp + size, NFSX_V2FH - size); | ||||
bytesize = NFSX_V2FH; | bytesize = NFSX_V2FH; | ||||
break; | break; | ||||
case ND_NFSV3: | case ND_NFSV3: | ||||
case ND_NFSV4: | case ND_NFSV4: | ||||
fullsiz = NFSM_RNDUP(size); | fullsiz = NFSM_RNDUP(size); | ||||
rem = fullsiz - size; | |||||
if (set_true) { | if (set_true) { | ||||
bytesize = 2 * NFSX_UNSIGNED + fullsiz; | bytesize = 2 * NFSX_UNSIGNED + fullsiz; | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); | NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); | ||||
*tl = newnfs_true; | *tl = newnfs_true; | ||||
} else { | } else { | ||||
bytesize = NFSX_UNSIGNED + fullsiz; | bytesize = NFSX_UNSIGNED + fullsiz; | ||||
} | } | ||||
(void) nfsm_strtom(nd, fhp, size); | (void) nfsm_strtom(nd, fhp, size); | ||||
▲ Show 20 Lines • Show All 3,748 Lines • Show Last 20 Lines |