nfs_xdr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <vm/seg_kmem.h>
/*
* These are the XDR routines used to serialize and deserialize
* the various structures passed as parameters accross the network
* between NFS clients and servers.
*/
/*
* File access handle
* The fhandle struct is treated a opaque data on the wire
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
}
{
return (FALSE);
return (TRUE);
}
return (FALSE);
}
/*
* Arguments to remote write and writecache
*/
{
3 * BYTES_PER_XDR_UNIT);
/*
* It is just as efficient to xdr_bytes
* an array of unknown length as to inline copy it.
*/
}
}
3 * BYTES_PER_XDR_UNIT);
} else {
return (FALSE);
}
#if 0 /* notdef */
return (TRUE);
} else
}
/* else Fall thru for the xdr_bytes() */
}
/* wa_mblk == NULL || xdrs->x_ops != &xdrmblk_ops Fall thru */
#endif /* notdef */
NFS_MAXDATA));
}
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
/*
* File attributes
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
#ifdef _LITTLE_ENDIAN
{
return (TRUE);
return (FALSE);
return (TRUE);
}
#endif
/*
* Arguments to remote read
*/
{
return (TRUE);
} else {
}
return (FALSE);
return (TRUE);
}
return (FALSE);
return (TRUE);
}
return (FALSE);
}
/*
* Status OK portion of remote read reply
*/
{
return (FALSE);
int i, rndup;
if (rndup != BYTES_PER_XDR_UNIT)
for (i = 0; i < rndup; i++)
return (TRUE);
}
}
/*
* Fall thru for the xdr_bytes()
*
* Note: the mblk mp will be freed in rfs_rdfree
*/
}
return (ret);
}
};
/*
* Reply from remote read
*/
{
}
/*
* File attributes which can be set
*/
{
return (TRUE);
}
return (FALSE);
}
};
/*
* Reply status with file attributes
*/
{
}
/*
* Fast reply status with file attributes
*/
{
#if defined(_LITTLE_ENDIAN)
/*
* we deal with the discriminator; it's an enum
*/
return (FALSE);
#elif defined(_BIG_ENDIAN)
return (TRUE);
#endif
}
/*
* NFS_OK part of read sym link reply union
*/
{
/*
* It is just as efficient to xdr_bytes
* an array of unknown length as to inline copy it.
*/
}
};
/*
* Result of reading symbolic link
*/
{
}
/*
* Arguments to readdir
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
/*
* Directory read reply:
* union (enum status) {
* NFS_OK: entlist;
* boolean eof;
* default:
* }
*
* Directory entries
* struct direct {
* off_t d_off; * offset of next entry *
* u_int d_fileno; * inode number of entry *
* u_short d_reclen; * length of this record *
* u_short d_namlen; * length of string in d_name *
* char d_name[MAXNAMLEN + 1]; * name no longer than this *
* };
* are on the wire as:
* union entlist (boolean valid) {
* TRUE: struct otw_dirent;
* u_int nxtoffset;
* union entlist;
* FALSE:
* }
* where otw_dirent is:
* struct dirent {
* u_int de_fid;
* string de_name<NFS_MAXNAMELEN>;
* }
*/
#ifdef nextdp
#endif
#ifdef roundup
#endif
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
/*
* ENCODE ONLY
*/
{
char *name;
int size;
int entrysz;
int tofit;
int bufsize;
return (FALSE);
return (FALSE);
return (TRUE);
size > 0;
return (FALSE);
continue;
return (FALSE);
break;
}
return (FALSE);
}
}
return (FALSE);
return (FALSE);
return (TRUE);
}
/*
* DECODE ONLY
*/
{
int size;
return (FALSE);
return (FALSE);
return (TRUE);
for (;;) {
return (FALSE);
if (!valid)
break;
return (FALSE);
if (this_reclen > size) {
goto bufovflw;
}
return (FALSE);
}
}
return (FALSE);
return (TRUE);
}
/*
* Arguments for directory operations
*/
{
int i;
int rndup;
char *cptr;
1 * BYTES_PER_XDR_UNIT);
if (size > NFS_MAXNAMLEN)
return (FALSE);
if (nodesize == 0)
return (TRUE);
return (FALSE);
}
nodesize);
}
return (FALSE);
}
nodesize);
}
return (FALSE);
}
return (TRUE);
}
}
return (FALSE);
}
return (TRUE);
}
}
if (size > NFS_MAXNAMLEN)
return (FALSE);
(size % BYTES_PER_XDR_UNIT);
if (rndup != BYTES_PER_XDR_UNIT) {
for (i = 0; i < rndup; i++)
*cptr++ = '\0';
}
return (TRUE);
}
}
return (TRUE);
if (size > NFS_MAXNAMLEN)
return (FALSE);
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
/*
* NFS_OK part of directory operation result
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
#ifdef _LITTLE_ENDIAN
{
return (TRUE);
return (FALSE);
return (TRUE);
}
#endif
};
/*
* Results from directory operation
*/
{
}
/*
* Results from directory operation
*/
{
#if defined(_LITTLE_ENDIAN)
/*
* we deal with the discriminator; it's an enum
*/
return (FALSE);
#elif defined(_BIG_ENDIAN)
return (TRUE);
#endif
}
/*
* Time Structure, unsigned
*/
{
return (TRUE);
return (FALSE);
}
/*
* arguments to setattr
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
/*
* arguments to create and mkdir
*/
{
return (TRUE);
}
return (FALSE);
}
/*
* arguments to link
*/
{
return (TRUE);
}
return (FALSE);
}
/*
* arguments to rename
*/
{
return (TRUE);
return (FALSE);
}
/*
* arguments to symlink
*/
{
return (FALSE);
return (FALSE);
return (TRUE);
}
}
return (TRUE);
}
return (FALSE);
}
/*
* NFS_OK part of statfs operation
*/
{
return (TRUE);
} else {
}
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
#ifdef _LITTLE_ENDIAN
{
return (TRUE);
return (FALSE);
return (TRUE);
}
#endif
};
/*
* Results of statfs operation
*/
{
}
/*
* Results of statfs operation
*/
{
#if defined(_LITTLE_ENDIAN)
/*
* we deal with the discriminator; it's an enum
*/
return (FALSE);
#elif defined(_BIG_ENDIAN)
return (TRUE);
#endif
}
#ifdef _LITTLE_ENDIAN
/*
* XDR enumerations
*/
#ifndef lint
/* an enum */
#endif
{
return (TRUE);
return (FALSE);
#ifndef lint
/*
* enums are treated as ints
*/
if (sizeof (sizecheckvar) == sizeof (int32_t)) {
} else if (sizeof (sizecheckvar) == sizeof (short)) {
} else {
return (FALSE);
}
return (TRUE);
#else
#endif
}
#endif
static bool_t
{
}