am_xdr_func.h revision 285830
1/* 2 * Copyright (c) 1997-2006 Erez Zadok 3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgment: 21 * This product includes software developed by the University of 22 * California, Berkeley and its contributors. 23 * 4. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * 40 * File: am-utils/include/am_xdr_func.h 41 * 42 */ 43 44#ifdef HAVE_FS_NFS3 45 46#define AM_FHSIZE3 64 /* size in bytes of a file handle (v3) */ 47#define AM_MOUNTVERS3 ((unsigned long)(3)) 48 49/* NFSv3 handle */ 50struct am_nfs_fh3 { 51 u_int am_fh3_length; 52 char am_fh3_data[AM_FHSIZE3]; 53}; 54typedef struct am_nfs_fh3 am_nfs_fh3; 55 56#define AM_NFSPROC3_LOOKUP ((u_long) 3) 57enum am_nfsstat3 { 58 AM_NFS3_OK = 0, 59 AM_NFS3ERR_PERM = 1, 60 AM_NFS3ERR_NOENT = 2, 61 AM_NFS3ERR_IO = 5, 62 AM_NFS3ERR_NXIO = 6, 63 AM_NFS3ERR_ACCES = 13, 64 AM_NFS3ERR_EXIST = 17, 65 AM_NFS3ERR_XDEV = 18, 66 AM_NFS3ERR_NODEV = 19, 67 AM_NFS3ERR_NOTDIR = 20, 68 AM_NFS3ERR_ISDIR = 21, 69 AM_NFS3ERR_INVAL = 22, 70 AM_NFS3ERR_FBIG = 27, 71 AM_NFS3ERR_NOSPC = 28, 72 AM_NFS3ERR_ROFS = 30, 73 AM_NFS3ERR_MLINK = 31, 74 AM_NFS3ERR_NAMETOOLONG = 63, 75 AM_NFS3ERR_NOTEMPTY = 66, 76 AM_NFS3ERR_DQUOT = 69, 77 AM_NFS3ERR_STALE = 70, 78 AM_NFS3ERR_REMOTE = 71, 79 AM_NFS3ERR_BADHANDLE = 10001, 80 AM_NFS3ERR_NOT_SYNC = 10002, 81 AM_NFS3ERR_BAD_COOKIE = 10003, 82 AM_NFS3ERR_NOTSUPP = 10004, 83 AM_NFS3ERR_TOOSMALL = 10005, 84 AM_NFS3ERR_SERVERFAULT = 10006, 85 AM_NFS3ERR_BADTYPE = 10007, 86 AM_NFS3ERR_JUKEBOX = 10008 87}; 88typedef enum am_nfsstat3 am_nfsstat3; 89 90typedef struct { 91 u_int fhandle3_len; 92 char *fhandle3_val; 93} am_fhandle3; 94 95enum am_mountstat3 { 96 AM_MNT3_OK = 0, 97 AM_MNT3ERR_PERM = 1, 98 AM_MNT3ERR_NOENT = 2, 99 AM_MNT3ERR_IO = 5, 100 AM_MNT3ERR_ACCES = 13, 101 AM_MNT3ERR_NOTDIR = 20, 102 AM_MNT3ERR_INVAL = 22, 103 AM_MNT3ERR_NAMETOOLONG = 63, 104 AM_MNT3ERR_NOTSUPP = 10004, 105 AM_MNT3ERR_SERVERFAULT = 10006 106}; 107typedef enum am_mountstat3 am_mountstat3; 108 109struct am_mountres3_ok { 110 am_fhandle3 fhandle; 111 struct { 112 u_int auth_flavors_len; 113 int *auth_flavors_val; 114 } auth_flavors; 115}; 116typedef struct am_mountres3_ok am_mountres3_ok; 117 118struct am_mountres3 { 119 am_mountstat3 fhs_status; 120 union { 121 am_mountres3_ok mountinfo; 122 } mountres3_u; 123}; 124typedef struct am_mountres3 am_mountres3; 125 126typedef char *am_filename3; 127 128struct am_diropargs3 { 129 am_nfs_fh3 dir; 130 am_filename3 name; 131}; 132typedef struct am_diropargs3 am_diropargs3; 133 134struct am_LOOKUP3args { 135 am_diropargs3 what; 136}; 137typedef struct am_LOOKUP3args am_LOOKUP3args; 138 139struct am_LOOKUP3resok { 140 am_nfs_fh3 object; 141#if 0 142 post_op_attr obj_attributes; 143 post_op_attr dir_attributes; 144#endif 145}; 146typedef struct am_LOOKUP3resok am_LOOKUP3resok; 147 148struct am_LOOKUP3resfail { 149#if 0 150 post_op_attr dir_attributes; 151#else 152 char dummy; /* cannot have an empty declaration */ 153#endif 154}; 155typedef struct am_LOOKUP3resfail am_LOOKUP3resfail; 156 157struct am_LOOKUP3res { 158 am_nfsstat3 status; 159 union { 160 am_LOOKUP3resok ok; 161 am_LOOKUP3resfail fail; 162 } res_u; 163}; 164typedef struct am_LOOKUP3res am_LOOKUP3res; 165#endif /* HAVE_FS_NFS3 */ 166 167/* 168 * Multi-protocol NFS file handle 169 */ 170union am_nfs_handle { 171 /* placeholder for V4 file handle */ 172#ifdef HAVE_FS_NFS3 173 am_nfs_fh3 v3; /* NFS version 3 handle */ 174#endif /* HAVE_FS_NFS3 */ 175 am_nfs_fh v2; /* NFS version 2 handle */ 176}; 177typedef union am_nfs_handle am_nfs_handle_t; 178 179 180/* 181 * Definitions of all possible xdr functions that are otherwise 182 * not defined elsewhere. 183 */ 184 185#ifndef _AM_XDR_FUNC_H 186#define _AM_XDR_FUNC_H 187 188#ifndef HAVE_XDR_ATTRSTAT 189bool_t xdr_attrstat(XDR *xdrs, nfsattrstat *objp); 190#endif /* not HAVE_XDR_ATTRSTAT */ 191#ifndef HAVE_XDR_CREATEARGS 192bool_t xdr_createargs(XDR *xdrs, nfscreateargs *objp); 193#endif /* not HAVE_XDR_CREATEARGS */ 194#ifndef HAVE_XDR_DIRLIST 195bool_t xdr_dirlist(XDR *xdrs, nfsdirlist *objp); 196#endif /* not HAVE_XDR_DIRLIST */ 197#ifndef HAVE_XDR_DIROPARGS 198bool_t xdr_diropargs(XDR *xdrs, nfsdiropargs *objp); 199#endif /* not HAVE_XDR_DIROPARGS */ 200#ifndef HAVE_XDR_DIROPOKRES 201bool_t xdr_diropokres(XDR *xdrs, nfsdiropokres *objp); 202#endif /* not HAVE_XDR_DIROPOKRES */ 203#ifndef HAVE_XDR_DIROPRES 204bool_t xdr_diropres(XDR *xdrs, nfsdiropres *objp); 205#endif /* not HAVE_XDR_DIROPRES */ 206#ifndef HAVE_XDR_DIRPATH 207bool_t xdr_dirpath(XDR *xdrs, dirpath *objp); 208#endif /* not HAVE_XDR_DIRPATH */ 209#ifndef HAVE_XDR_ENTRY 210bool_t xdr_entry(XDR *xdrs, nfsentry *objp); 211#endif /* not HAVE_XDR_ENTRY */ 212#ifndef HAVE_XDR_EXPORTNODE 213bool_t xdr_exportnode(XDR *xdrs, exportnode *objp); 214#endif /* not HAVE_XDR_EXPORTNODE */ 215#ifndef HAVE_XDR_EXPORTS 216bool_t xdr_exports(XDR *xdrs, exports *objp); 217#endif /* not HAVE_XDR_EXPORTS */ 218#ifndef HAVE_XDR_FATTR 219bool_t xdr_fattr(XDR *xdrs, nfsfattr *objp); 220#endif /* not HAVE_XDR_FATTR */ 221#ifndef HAVE_XDR_FHANDLE 222bool_t xdr_fhandle(XDR *xdrs, fhandle objp); 223#endif /* not HAVE_XDR_FHANDLE */ 224#ifndef HAVE_XDR_FHSTATUS 225bool_t xdr_fhstatus(XDR *xdrs, fhstatus *objp); 226#endif /* not HAVE_XDR_FHSTATUS */ 227#ifndef HAVE_XDR_FILENAME 228bool_t xdr_filename(XDR *xdrs, filename *objp); 229#endif /* not HAVE_XDR_FILENAME */ 230#ifndef HAVE_XDR_FTYPE 231bool_t xdr_ftype(XDR *xdrs, nfsftype *objp); 232#endif /* not HAVE_XDR_FTYPE */ 233#ifndef HAVE_XDR_GROUPNODE 234bool_t xdr_groupnode(XDR *xdrs, groupnode *objp); 235#endif /* not HAVE_XDR_GROUPNODE */ 236#ifndef HAVE_XDR_GROUPS 237bool_t xdr_groups(XDR *xdrs, groups *objp); 238#endif /* not HAVE_XDR_GROUPS */ 239#ifndef HAVE_XDR_LINKARGS 240bool_t xdr_linkargs(XDR *xdrs, nfslinkargs *objp); 241#endif /* not HAVE_XDR_LINKARGS */ 242#ifndef HAVE_XDR_MOUNTBODY 243bool_t xdr_mountbody(XDR *xdrs, mountbody *objp); 244#endif /* not HAVE_XDR_MOUNTBODY */ 245#ifndef HAVE_XDR_MOUNTLIST 246bool_t xdr_mountlist(XDR *xdrs, mountlist *objp); 247#endif /* not HAVE_XDR_MOUNTLIST */ 248#ifndef HAVE_XDR_NAME 249bool_t xdr_name(XDR *xdrs, name *objp); 250#endif /* not HAVE_XDR_NAME */ 251#ifndef HAVE_XDR_NFS_FH 252bool_t xdr_nfs_fh(XDR *xdrs, am_nfs_fh *objp); 253#endif /* not HAVE_XDR_NFS_FH */ 254#ifndef HAVE_XDR_NFSCOOKIE 255bool_t xdr_nfscookie(XDR *xdrs, nfscookie objp); 256#endif /* not HAVE_XDR_NFSCOOKIE */ 257#ifndef HAVE_XDR_NFSPATH 258bool_t xdr_nfspath(XDR *xdrs, nfspath *objp); 259#endif /* not HAVE_XDR_NFSPATH */ 260#ifndef HAVE_XDR_NFSSTAT 261bool_t xdr_nfsstat(XDR *xdrs, nfsstat *objp); 262#endif /* not HAVE_XDR_NFSSTAT */ 263#ifndef HAVE_XDR_NFSTIME 264bool_t xdr_nfstime(XDR *xdrs, nfstime *objp); 265#endif /* not HAVE_XDR_NFSTIME */ 266#ifndef HAVE_XDR_POINTER 267bool_t xdr_pointer(register XDR *xdrs, char **objpp, u_int obj_size, XDRPROC_T_TYPE xdr_obj); 268#endif /* not HAVE_XDR_POINTER */ 269#ifndef HAVE_XDR_READARGS 270bool_t xdr_readargs(XDR *xdrs, nfsreadargs *objp); 271#endif /* not HAVE_XDR_READARGS */ 272#ifndef HAVE_XDR_READDIRARGS 273bool_t xdr_readdirargs(XDR *xdrs, nfsreaddirargs *objp); 274#endif /* not HAVE_XDR_READDIRARGS */ 275#ifndef HAVE_XDR_READDIRRES 276bool_t xdr_readdirres(XDR *xdrs, nfsreaddirres *objp); 277#endif /* not HAVE_XDR_READDIRRES */ 278#ifndef HAVE_XDR_READLINKRES 279bool_t xdr_readlinkres(XDR *xdrs, nfsreadlinkres *objp); 280#endif /* not HAVE_XDR_READLINKRES */ 281#ifndef HAVE_XDR_READOKRES 282bool_t xdr_readokres(XDR *xdrs, nfsreadokres *objp); 283#endif /* not HAVE_XDR_READOKRES */ 284#ifndef HAVE_XDR_READRES 285bool_t xdr_readres(XDR *xdrs, nfsreadres *objp); 286#endif /* not HAVE_XDR_READRES */ 287#ifndef HAVE_XDR_RENAMEARGS 288bool_t xdr_renameargs(XDR *xdrs, nfsrenameargs *objp); 289#endif /* not HAVE_XDR_RENAMEARGS */ 290#ifndef HAVE_XDR_SATTR 291bool_t xdr_sattr(XDR *xdrs, nfssattr *objp); 292#endif /* not HAVE_XDR_SATTR */ 293#ifndef HAVE_XDR_SATTRARGS 294bool_t xdr_sattrargs(XDR *xdrs, nfssattrargs *objp); 295#endif /* not HAVE_XDR_SATTRARGS */ 296#ifndef HAVE_XDR_STATFSOKRES 297bool_t xdr_statfsokres(XDR *xdrs, nfsstatfsokres *objp); 298#endif /* not HAVE_XDR_STATFSOKRES */ 299#ifndef HAVE_XDR_STATFSRES 300bool_t xdr_statfsres(XDR *xdrs, nfsstatfsres *objp); 301#endif /* not HAVE_XDR_STATFSRES */ 302#ifndef HAVE_XDR_SYMLINKARGS 303bool_t xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp); 304#endif /* not HAVE_XDR_SYMLINKARGS */ 305#ifndef HAVE_XDR_WRITEARGS 306bool_t xdr_writeargs(XDR *xdrs, nfswriteargs *objp); 307#endif /* not HAVE_XDR_WRITEARGS */ 308 309/* 310 * NFS3 XDR FUNCTIONS: 311 */ 312#ifdef HAVE_FS_NFS3 313bool_t xdr_am_fhandle3(XDR *xdrs, am_fhandle3 *objp); 314bool_t xdr_am_mountstat3(XDR *xdrs, am_mountstat3 *objp); 315bool_t xdr_am_mountres3_ok(XDR *xdrs, am_mountres3_ok *objp); 316bool_t xdr_am_mountres3(XDR *xdrs, am_mountres3 *objp); 317bool_t xdr_am_diropargs3(XDR *xdrs, am_diropargs3 *objp); 318bool_t xdr_am_filename3(XDR *xdrs, am_filename3 *objp); 319bool_t xdr_am_LOOKUP3args(XDR *xdrs, am_LOOKUP3args *objp); 320bool_t xdr_am_LOOKUP3res(XDR *xdrs, am_LOOKUP3res *objp); 321bool_t xdr_am_LOOKUP3resfail(XDR *xdrs, am_LOOKUP3resfail *objp); 322bool_t xdr_am_LOOKUP3resok(XDR *xdrs, am_LOOKUP3resok *objp); 323bool_t xdr_am_nfsstat3(XDR *xdrs, am_nfsstat3 *objp); 324bool_t xdr_am_nfs_fh3(XDR *xdrs, am_nfs_fh3 *objp); 325#endif /* HAVE_FS_NFS3 */ 326 327#endif /* not _AM_XDR_FUNC_H */ 328