1/* $NetBSD: nfs_prot_sunos5_6.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */ 2 3/* 4 * Copyright (c) 1997-2014 Erez Zadok 5 * Copyright (c) 1990 Jan-Simon Pendry 6 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 7 * Copyright (c) 1990 The Regents of the University of California. 8 * All rights reserved. 9 * 10 * This code is derived from software contributed to Berkeley by 11 * Jan-Simon Pendry at Imperial College, London. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * 38 * File: am-utils/conf/nfs_prot/nfs_prot_sunos5_6.h 39 * 40 */ 41 42#ifndef _AMU_NFS_PROT_H 43#define _AMU_NFS_PROT_H 44 45/* 46 * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because 47 * it will result in conflicts with <nfs/nfs.h>. The latter is a must 48 * for NFS V3 specs. 49 */ 50 51#ifdef HAVE_NFS_NFS_H 52# include <nfs/nfs.h> 53#endif /* HAVE_NFS_NFS_H */ 54 55#ifdef HAVE_RPCSVC_MOUNT_H 56# include <rpcsvc/mount.h> 57#endif /* HAVE_RPCSVC_MOUNT_H */ 58 59#ifdef HAVE_RPC_RPC_H 60# include <rpc/rpc.h> 61#endif /* HAVE_RPC_RPC_H */ 62 63 64/* 65 * MACROS 66 */ 67 68#define NFS_PORT 2049 69#define NFS_MAXDATA 8192 70#define NFS_MAXPATHLEN 1024 71#define NFS_MAXNAMLEN 255 72#define NFS_FHSIZE 32 73#define NFS_COOKIESIZE 4 74 75#define NFSMODE_FMT 0170000 76#define NFSMODE_DIR 0040000 77#define NFSMODE_CHR 0020000 78#define NFSMODE_BLK 0060000 79#define NFSMODE_REG 0100000 80#define NFSMODE_LNK 0120000 81#define NFSMODE_SOCK 0140000 82#define NFSMODE_FIFO 0010000 83 84#define NFSPROC_NULL ((unsigned long)(0)) 85#define NFSPROC_GETATTR ((unsigned long)(1)) 86#define NFSPROC_SETATTR ((unsigned long)(2)) 87#define NFSPROC_ROOT ((unsigned long)(3)) 88#define NFSPROC_LOOKUP ((unsigned long)(4)) 89#define NFSPROC_READLINK ((unsigned long)(5)) 90#define NFSPROC_READ ((unsigned long)(6)) 91#define NFSPROC_WRITECACHE ((unsigned long)(7)) 92#define NFSPROC_WRITE ((unsigned long)(8)) 93#define NFSPROC_CREATE ((unsigned long)(9)) 94#define NFSPROC_REMOVE ((unsigned long)(10)) 95#define NFSPROC_RENAME ((unsigned long)(11)) 96#define NFSPROC_LINK ((unsigned long)(12)) 97#define NFSPROC_SYMLINK ((unsigned long)(13)) 98#define NFSPROC_MKDIR ((unsigned long)(14)) 99#define NFSPROC_RMDIR ((unsigned long)(15)) 100#define NFSPROC_READDIR ((unsigned long)(16)) 101#define NFSPROC_STATFS ((unsigned long)(17)) 102 103#define AUTOFS_CONFTYPE "ticotsord" 104 105 106/* 107 * TYPEDEFS: 108 */ 109 110typedef char *filename; 111typedef char *nfspath; 112typedef char nfscookie[NFS_COOKIESIZE]; 113typedef enum nfsftype nfsftype; 114typedef enum nfsstat nfsstat; 115typedef struct attrstat nfsattrstat; 116typedef struct createargs nfscreateargs; 117typedef struct dirlist nfsdirlist; 118typedef struct diropargs nfsdiropargs; 119typedef struct diropokres nfsdiropokres; 120typedef struct diropres nfsdiropres; 121typedef struct entry nfsentry; 122typedef struct fattr nfsfattr; 123typedef struct linkargs nfslinkargs; 124typedef struct nfs_fh nfs_fh; 125typedef struct nfstime nfstime; 126typedef struct readargs nfsreadargs; 127typedef struct readdirargs nfsreaddirargs; 128typedef struct readdirres nfsreaddirres; 129typedef struct readlinkres nfsreadlinkres; 130typedef struct readokres nfsreadokres; 131typedef struct readres nfsreadres; 132typedef struct renameargs nfsrenameargs; 133typedef struct sattr nfssattr; 134typedef struct sattrargs nfssattrargs; 135typedef struct statfsokres nfsstatfsokres; 136typedef struct statfsres nfsstatfsres; 137typedef struct symlinkargs nfssymlinkargs; 138typedef struct writeargs nfswriteargs; 139 140 141/* 142 * EXTERNALS: 143 */ 144 145extern bool_t xdr_nfsstat(XDR *, nfsstat *); 146extern bool_t xdr_ftype(XDR *, nfsftype *); 147extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); 148extern bool_t xdr_nfstime(XDR *, nfstime *); 149extern bool_t xdr_fattr(XDR *, nfsfattr *); 150extern bool_t xdr_sattr(XDR *, nfssattr *); 151extern bool_t xdr_filename(XDR *, filename *); 152extern bool_t xdr_nfspath(XDR *, nfspath *); 153extern bool_t xdr_attrstat(XDR *, nfsattrstat *); 154extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); 155extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); 156extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); 157extern bool_t xdr_diropres(XDR *, nfsdiropres *); 158extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); 159extern bool_t xdr_readargs(XDR *, nfsreadargs *); 160extern bool_t xdr_readokres(XDR *, nfsreadokres *); 161extern bool_t xdr_readres(XDR *, nfsreadres *); 162extern bool_t xdr_writeargs(XDR *, nfswriteargs *); 163extern bool_t xdr_createargs(XDR *, nfscreateargs *); 164extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); 165extern bool_t xdr_linkargs(XDR *, nfslinkargs *); 166extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); 167extern bool_t xdr_nfscookie(XDR *, nfscookie); 168extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); 169extern bool_t xdr_entry(XDR *, nfsentry *); 170extern bool_t xdr_dirlist(XDR *, nfsdirlist *); 171extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); 172extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); 173extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); 174 175extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); 176extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); 177extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); 178extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); 179extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); 180extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); 181extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); 182extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); 183extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); 184extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); 185extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); 186extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); 187extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); 188extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); 189extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); 190extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); 191extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); 192extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); 193extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); 194extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); 195extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); 196extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); 197extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); 198extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); 199extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); 200extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); 201extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); 202extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); 203extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); 204extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); 205extern void *nfsproc_null_2(void *, CLIENT *); 206extern void *nfsproc_null_2_svc(void *, struct svc_req *); 207extern void *nfsproc_root_2(void *, CLIENT *); 208extern void *nfsproc_root_2_svc(void *, struct svc_req *); 209extern void *nfsproc_writecache_2(void *, CLIENT *); 210extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); 211extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); 212 213 214/* 215 * ENUMS: 216 */ 217 218 219/* 220 * STRUCTURES: 221 */ 222 223struct nfs_fh { 224 char fh_data[NFS_FHSIZE]; 225}; 226 227struct nfstime { 228 u_int nt_seconds; 229 u_int nt_useconds; 230}; 231 232struct fattr { 233 nfsftype na_type; 234 u_int na_mode; 235 u_int na_nlink; 236 u_int na_uid; 237 u_int na_gid; 238 u_int na_size; 239 u_int na_blocksize; 240 u_int na_rdev; 241 u_int na_blocks; 242 u_int na_fsid; 243 u_int na_fileid; 244 nfstime na_atime; 245 nfstime na_mtime; 246 nfstime na_ctime; 247}; 248 249struct sattr { 250 u_int sa_mode; 251 u_int sa_uid; 252 u_int sa_gid; 253 u_int sa_size; 254 nfstime sa_atime; 255 nfstime sa_mtime; 256}; 257 258struct attrstat { 259 nfsstat ns_status; 260 union { 261 nfsfattr ns_attr_u; 262 } ns_u; 263}; 264 265struct sattrargs { 266 nfs_fh sag_fhandle; 267 nfssattr sag_attributes; 268}; 269 270struct diropargs { 271 nfs_fh da_fhandle; /* was dir */ 272 filename da_name; 273}; 274 275struct diropokres { 276 nfs_fh drok_fhandle; 277 nfsfattr drok_attributes; 278}; 279 280struct diropres { 281 nfsstat dr_status; /* was status */ 282 union { 283 nfsdiropokres dr_drok_u; /* was diropres */ 284 } dr_u; /* was diropres_u */ 285}; 286 287struct readlinkres { 288 nfsstat rlr_status; 289 union { 290 nfspath rlr_data_u; 291 } rlr_u; 292}; 293 294struct readargs { 295 nfs_fh ra_fhandle; 296 u_int ra_offset; 297 u_int ra_count; 298 u_int ra_totalcount; 299}; 300 301struct readokres { 302 nfsfattr raok_attributes; 303 struct { 304 u_int raok_len_u; 305 char *raok_val_u; 306 } raok_u; 307}; 308 309struct readres { 310 nfsstat rr_status; 311 union { 312 nfsreadokres rr_reply_u; 313 } rr_u; 314}; 315 316struct writeargs { 317 nfs_fh wra_fhandle; 318 u_int wra_beginoffset; 319 u_int wra_offset; 320 u_int wra_totalcount; 321 struct { 322 u_int wra_len_u; 323 char *wra_val_u; 324 } wra_u; 325}; 326 327struct createargs { 328 nfsdiropargs ca_where; 329 nfssattr ca_attributes; 330}; 331 332struct renameargs { 333 nfsdiropargs rna_from; 334 nfsdiropargs rna_to; 335}; 336 337struct linkargs { 338 nfs_fh la_fhandle; 339 nfsdiropargs la_to; 340}; 341 342struct symlinkargs { 343 nfsdiropargs sla_from; 344 nfspath sla_to; 345 nfssattr sla_attributes; 346}; 347 348struct readdirargs { 349 nfs_fh rda_fhandle; 350 nfscookie rda_cookie; 351 u_int rda_count; 352}; 353 354struct entry { 355 u_int ne_fileid; 356 filename ne_name; 357 nfscookie ne_cookie; 358 nfsentry *ne_nextentry; 359}; 360 361struct dirlist { 362 nfsentry *dl_entries; 363 bool_t dl_eof; 364}; 365 366struct readdirres { 367 nfsstat rdr_status; 368 union { 369 nfsdirlist rdr_reply_u; 370 } rdr_u; 371}; 372 373struct statfsokres { 374 u_int sfrok_tsize; 375 u_int sfrok_bsize; 376 u_int sfrok_blocks; 377 u_int sfrok_bfree; 378 u_int sfrok_bavail; 379}; 380 381struct statfsres { 382 nfsstat sfr_status; 383 union { 384 nfsstatfsokres sfr_reply_u; 385 } sfr_u; 386}; 387#endif /* not _AMU_NFS_PROT_H */ 388