1 /* $NetBSD: nfs_prot_sunos5_5.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_5.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 /* 60 * MACROS 61 */ 62 63 #define NFS_PORT 2049 64 #define NFS_MAXDATA 8192 65 #define NFS_MAXPATHLEN 1024 66 #define NFS_MAXNAMLEN 255 67 #define NFS_FHSIZE 32 68 #define NFS_COOKIESIZE 4 69 70 #define NFSMODE_FMT 0170000 71 #define NFSMODE_DIR 0040000 72 #define NFSMODE_CHR 0020000 73 #define NFSMODE_BLK 0060000 74 #define NFSMODE_REG 0100000 75 #define NFSMODE_LNK 0120000 76 #define NFSMODE_SOCK 0140000 77 #define NFSMODE_FIFO 0010000 78 79 #define NFSPROC_NULL ((unsigned long)(0)) 80 #define NFSPROC_GETATTR ((unsigned long)(1)) 81 #define NFSPROC_SETATTR ((unsigned long)(2)) 82 #define NFSPROC_ROOT ((unsigned long)(3)) 83 #define NFSPROC_LOOKUP ((unsigned long)(4)) 84 #define NFSPROC_READLINK ((unsigned long)(5)) 85 #define NFSPROC_READ ((unsigned long)(6)) 86 #define NFSPROC_WRITECACHE ((unsigned long)(7)) 87 #define NFSPROC_WRITE ((unsigned long)(8)) 88 #define NFSPROC_CREATE ((unsigned long)(9)) 89 #define NFSPROC_REMOVE ((unsigned long)(10)) 90 #define NFSPROC_RENAME ((unsigned long)(11)) 91 #define NFSPROC_LINK ((unsigned long)(12)) 92 #define NFSPROC_SYMLINK ((unsigned long)(13)) 93 #define NFSPROC_MKDIR ((unsigned long)(14)) 94 #define NFSPROC_RMDIR ((unsigned long)(15)) 95 #define NFSPROC_READDIR ((unsigned long)(16)) 96 #define NFSPROC_STATFS ((unsigned long)(17)) 97 98 #define AUTOFS_CONFTYPE "ticlts" 99 100 101 /* 102 * TYPEDEFS: 103 */ 104 105 typedef char *filename; 106 typedef char *nfspath; 107 typedef char nfscookie[NFS_COOKIESIZE]; 108 typedef enum nfsftype nfsftype; 109 typedef enum nfsstat nfsstat; 110 typedef struct attrstat nfsattrstat; 111 typedef struct createargs nfscreateargs; 112 typedef struct dirlist nfsdirlist; 113 typedef struct diropargs nfsdiropargs; 114 typedef struct diropokres nfsdiropokres; 115 typedef struct diropres nfsdiropres; 116 typedef struct entry nfsentry; 117 typedef struct fattr nfsfattr; 118 typedef struct linkargs nfslinkargs; 119 typedef struct nfs_fh nfs_fh; 120 typedef struct nfstime nfstime; 121 typedef struct readargs nfsreadargs; 122 typedef struct readdirargs nfsreaddirargs; 123 typedef struct readdirres nfsreaddirres; 124 typedef struct readlinkres nfsreadlinkres; 125 typedef struct readokres nfsreadokres; 126 typedef struct readres nfsreadres; 127 typedef struct renameargs nfsrenameargs; 128 typedef struct sattr nfssattr; 129 typedef struct sattrargs nfssattrargs; 130 typedef struct statfsokres nfsstatfsokres; 131 typedef struct statfsres nfsstatfsres; 132 typedef struct symlinkargs nfssymlinkargs; 133 typedef struct writeargs nfswriteargs; 134 135 136 /* 137 * EXTERNALS: 138 */ 139 140 extern bool_t xdr_nfsstat(XDR *, nfsstat *); 141 extern bool_t xdr_ftype(XDR *, nfsftype *); 142 extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); 143 extern bool_t xdr_nfstime(XDR *, nfstime *); 144 extern bool_t xdr_fattr(XDR *, nfsfattr *); 145 extern bool_t xdr_sattr(XDR *, nfssattr *); 146 extern bool_t xdr_filename(XDR *, filename *); 147 extern bool_t xdr_nfspath(XDR *, nfspath *); 148 extern bool_t xdr_attrstat(XDR *, nfsattrstat *); 149 extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); 150 extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); 151 extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); 152 extern bool_t xdr_diropres(XDR *, nfsdiropres *); 153 extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); 154 extern bool_t xdr_readargs(XDR *, nfsreadargs *); 155 extern bool_t xdr_readokres(XDR *, nfsreadokres *); 156 extern bool_t xdr_readres(XDR *, nfsreadres *); 157 extern bool_t xdr_writeargs(XDR *, nfswriteargs *); 158 extern bool_t xdr_createargs(XDR *, nfscreateargs *); 159 extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); 160 extern bool_t xdr_linkargs(XDR *, nfslinkargs *); 161 extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); 162 extern bool_t xdr_nfscookie(XDR *, nfscookie); 163 extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); 164 extern bool_t xdr_entry(XDR *, nfsentry *); 165 extern bool_t xdr_dirlist(XDR *, nfsdirlist *); 166 extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); 167 extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); 168 extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); 169 170 extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); 171 extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); 172 extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); 173 extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); 174 extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); 175 extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); 176 extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); 177 extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); 178 extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); 179 extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); 180 extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); 181 extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); 182 extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); 183 extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); 184 extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); 185 extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); 186 extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); 187 extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); 188 extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); 189 extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); 190 extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); 191 extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); 192 extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); 193 extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); 194 extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); 195 extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); 196 extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); 197 extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); 198 extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); 199 extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); 200 extern void *nfsproc_null_2(void *, CLIENT *); 201 extern void *nfsproc_null_2_svc(void *, struct svc_req *); 202 extern void *nfsproc_root_2(void *, CLIENT *); 203 extern void *nfsproc_root_2_svc(void *, struct svc_req *); 204 extern void *nfsproc_writecache_2(void *, CLIENT *); 205 extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); 206 extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); 207 208 209 /* 210 * ENUMS: 211 */ 212 213 214 /* 215 * STRUCTURES: 216 */ 217 218 struct nfs_fh { 219 char fh_data[NFS_FHSIZE]; 220 }; 221 222 struct nfstime { 223 u_int nt_seconds; 224 u_int nt_useconds; 225 }; 226 227 struct fattr { 228 nfsftype na_type; 229 u_int na_mode; 230 u_int na_nlink; 231 u_int na_uid; 232 u_int na_gid; 233 u_int na_size; 234 u_int na_blocksize; 235 u_int na_rdev; 236 u_int na_blocks; 237 u_int na_fsid; 238 u_int na_fileid; 239 nfstime na_atime; 240 nfstime na_mtime; 241 nfstime na_ctime; 242 }; 243 244 struct sattr { 245 u_int sa_mode; 246 u_int sa_uid; 247 u_int sa_gid; 248 u_int sa_size; 249 nfstime sa_atime; 250 nfstime sa_mtime; 251 }; 252 253 struct attrstat { 254 nfsstat ns_status; 255 union { 256 nfsfattr ns_attr_u; 257 } ns_u; 258 }; 259 260 struct sattrargs { 261 nfs_fh sag_fhandle; 262 nfssattr sag_attributes; 263 }; 264 265 struct diropargs { 266 nfs_fh da_fhandle; /* was dir */ 267 filename da_name; 268 }; 269 270 struct diropokres { 271 nfs_fh drok_fhandle; 272 nfsfattr drok_attributes; 273 }; 274 275 struct diropres { 276 nfsstat dr_status; /* was status */ 277 union { 278 nfsdiropokres dr_drok_u; /* was diropres */ 279 } dr_u; /* was diropres_u */ 280 }; 281 282 struct readlinkres { 283 nfsstat rlr_status; 284 union { 285 nfspath rlr_data_u; 286 } rlr_u; 287 }; 288 289 struct readargs { 290 nfs_fh ra_fhandle; 291 u_int ra_offset; 292 u_int ra_count; 293 u_int ra_totalcount; 294 }; 295 296 struct readokres { 297 nfsfattr raok_attributes; 298 struct { 299 u_int raok_len_u; 300 char *raok_val_u; 301 } raok_u; 302 }; 303 304 struct readres { 305 nfsstat rr_status; 306 union { 307 nfsreadokres rr_reply_u; 308 } rr_u; 309 }; 310 311 struct writeargs { 312 nfs_fh wra_fhandle; 313 u_int wra_beginoffset; 314 u_int wra_offset; 315 u_int wra_totalcount; 316 struct { 317 u_int wra_len_u; 318 char *wra_val_u; 319 } wra_u; 320 }; 321 322 struct createargs { 323 nfsdiropargs ca_where; 324 nfssattr ca_attributes; 325 }; 326 327 struct renameargs { 328 nfsdiropargs rna_from; 329 nfsdiropargs rna_to; 330 }; 331 332 struct linkargs { 333 nfs_fh la_fhandle; 334 nfsdiropargs la_to; 335 }; 336 337 struct symlinkargs { 338 nfsdiropargs sla_from; 339 nfspath sla_to; 340 nfssattr sla_attributes; 341 }; 342 343 struct readdirargs { 344 nfs_fh rda_fhandle; 345 nfscookie rda_cookie; 346 u_int rda_count; 347 }; 348 349 struct entry { 350 u_int ne_fileid; 351 filename ne_name; 352 nfscookie ne_cookie; 353 nfsentry *ne_nextentry; 354 }; 355 356 struct dirlist { 357 nfsentry *dl_entries; 358 bool_t dl_eof; 359 }; 360 361 struct readdirres { 362 nfsstat rdr_status; 363 union { 364 nfsdirlist rdr_reply_u; 365 } rdr_u; 366 }; 367 368 struct statfsokres { 369 u_int sfrok_tsize; 370 u_int sfrok_bsize; 371 u_int sfrok_blocks; 372 u_int sfrok_bfree; 373 u_int sfrok_bavail; 374 }; 375 376 struct statfsres { 377 nfsstat sfr_status; 378 union { 379 nfsstatfsokres sfr_reply_u; 380 } sfr_u; 381 }; 382 383 #endif /* not _AMU_NFS_PROT_H */ 384