Home | History | Annotate | Line # | Download | only in libsa
      1 /*	$NetBSD: nfsv3.h,v 1.1 2023/12/12 09:12:55 mlelstv Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2023 Michael van Elst
      5  *
      6  * This code is derived from software contributed to Berkeley by
      7  * Rick Macklem at The University of Guelph.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28  * SUCH DAMAGE.
     29  */
     30 
     31 /*
     32  * nfs definitions as per the version 3 specs
     33  */
     34 
     35 #define NFS_VER3	3
     36 #define	NFS_V3FHSIZE	64
     37 
     38 /* Sizes in bytes of various nfs rpc components */
     39 #define	NFSX_V3FH	64
     40 #define	NFSX_V3FATTR	84
     41 
     42 /* Different V3 procedure numbers that we need */
     43 #define NFSV3PROC_LOOKUP          3
     44 
     45 /* Structs for common parts of the rpc's */
     46 struct nfsv3_time {
     47 	n_long	nfs_sec;
     48 	n_long	nfs_nsec;
     49 };
     50 
     51 struct nfsv3_spec {
     52         n_long specdata1;
     53         n_long specdata2;
     54 };
     55 
     56 /*
     57  * File attributes and setable attributes.
     58  */
     59 struct nfsv3_fattr {
     60 	n_long	fa_type;
     61 	n_long	fa_mode;
     62 	n_long	fa_nlink;
     63 	n_long	fa_uid;
     64 	n_long	fa_gid;
     65 	n_long	fa_size[2]; /* nfsuint64 */
     66 	n_long	fa_used[2]; /* nfsuint64 */
     67 	struct nfsv3_spec fa_rdev;
     68 	n_long	fa_fsid[2]; /* nfsuint64 */
     69 	n_long	fa_fileid[2]; /* nfsuint64 */
     70 	struct nfsv3_time fa_atime;
     71 	struct nfsv3_time fa_mtime;
     72 	struct nfsv3_time fa_ctime;
     73 };
     74