2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* fs/nfs/nfs_proto.h
|
|
|
|
*
|
2018-08-26 21:11:24 +02:00
|
|
|
* Copyright (C) 2012, 2018 Gregory Nutt. All rights reserved.
|
2012-03-22 01:51:01 +01:00
|
|
|
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
|
|
|
|
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
|
2012-06-11 01:17:10 +02:00
|
|
|
* Gregory Nutt <gnutt@nuttx.org>
|
2012-03-22 01:51:01 +01:00
|
|
|
*
|
|
|
|
* Leveraged from OpenBSD:
|
|
|
|
*
|
|
|
|
* Copyright (c) 1989, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
2012-03-17 01:25:34 +01:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Rick Macklem at The University of Guelph.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2012-03-22 01:51:01 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __FS_NFS_NFS_PROTO_H
|
|
|
|
#define __FS_NFS_NFS_PROTO_H
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Constants as defined in the Sun NFS Version 2 and 3 specs.
|
2012-03-17 01:25:34 +01:00
|
|
|
* "NFS: Network File System Protocol Specification" RFC1094
|
|
|
|
* and in the "NFS: Network File System Version 3 Protocol
|
|
|
|
* Specification"
|
|
|
|
*/
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFS_PORT 2049
|
|
|
|
#define NFS_PROG 100003
|
|
|
|
#define NFS_VER2 2
|
|
|
|
#define NFS_VER3 3
|
|
|
|
#define NFS_VER4 4
|
|
|
|
#define NFS_MAXDGRAMDATA 32768
|
|
|
|
#define MAXBSIZE 64000
|
|
|
|
#define NFS_MAXDATA MAXBSIZE
|
|
|
|
#define NFS_MAXPATHLEN 1024
|
|
|
|
#define NFS_MAXNAMLEN 255
|
|
|
|
#define NFS_MAXPKTHDR 404
|
|
|
|
#define NFS_MAXPACKET (NFS_MAXPKTHDR + NFS_MAXDATA)
|
|
|
|
#define NFS_MINPACKET 20
|
|
|
|
#define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
|
|
|
/* Stat numbers for rpc returns (version 2 and 3) */
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFS_OK 0
|
|
|
|
#define NFSERR_PERM 1
|
|
|
|
#define NFSERR_NOENT 2
|
|
|
|
#define NFSERR_IO 5
|
|
|
|
#define NFSERR_NXIO 6
|
|
|
|
#define NFSERR_ACCES 13
|
|
|
|
#define NFSERR_EXIST 17
|
|
|
|
#define NFSERR_XDEV 18 /* Version 3 only */
|
|
|
|
#define NFSERR_NODEV 19
|
|
|
|
#define NFSERR_NOTDIR 20
|
|
|
|
#define NFSERR_ISDIR 21
|
|
|
|
#define NFSERR_INVAL 22 /* Version 3 only */
|
|
|
|
#define NFSERR_FBIG 27
|
|
|
|
#define NFSERR_NOSPC 28
|
|
|
|
#define NFSERR_ROFS 30
|
|
|
|
#define NFSERR_MLINK 31 /* Version 3 only */
|
|
|
|
#define NFSERR_NAMETOL 63
|
|
|
|
#define NFSERR_NOTEMPTY 66
|
|
|
|
#define NFSERR_DQUOT 69
|
|
|
|
#define NFSERR_STALE 70
|
|
|
|
#define NFSERR_REMOTE 71 /* Version 3 only */
|
|
|
|
#define NFSERR_WFLUSH 99 /* Version 2 only */
|
|
|
|
#define NFSERR_BADHANDLE 10001 /* The rest Version 3 only */
|
|
|
|
#define NFSERR_NOT_SYNC 10002
|
|
|
|
#define NFSERR_BAD_COOKIE 10003
|
|
|
|
#define NFSERR_NOTSUPP 10004
|
|
|
|
#define NFSERR_TOOSMALL 10005
|
|
|
|
#define NFSERR_SERVERFAULT 10006
|
|
|
|
#define NFSERR_BADTYPE 10007
|
|
|
|
#define NFSERR_JUKEBOX 10008
|
|
|
|
#define NFSERR_TRYLATER NFSERR_JUKEBOX
|
|
|
|
#define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */
|
|
|
|
|
|
|
|
#define NFSERR_RETVOID 0x20000000 /* Return void, not error */
|
|
|
|
#define NFSERR_AUTHERR 0x40000000 /* Mark an authentication error */
|
|
|
|
#define NFSERR_RETERR 0x80000000 /* Mark an error return for V3 */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2018-08-26 21:11:24 +02:00
|
|
|
/* Sizes in bytes of various NFS RPC components */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSX_UNSIGNED 4
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-06-09 02:08:18 +02:00
|
|
|
/* Specific to NFS Version 3 */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSX_V3FH (sizeof(struct fhandle)) /* size this server uses */
|
|
|
|
#define NFSX_V3FHMAX 64 /* max. allowed by protocol */
|
|
|
|
#define NFSX_V3FATTR 84
|
|
|
|
#define NFSX_V3SATTR 60 /* max. all fields filled in */
|
|
|
|
#define NFSX_V3SRVSATTR (sizeof (struct nfsv3_sattr))
|
|
|
|
#define NFSX_V3POSTOPATTR (NFSX_V3FATTR + NFSX_UNSIGNED)
|
|
|
|
#define NFSX_V3WCCDATA (NFSX_V3POSTOPATTR + 7 * NFSX_UNSIGNED)
|
|
|
|
#define NFSX_V3COOKIEVERF 8
|
|
|
|
#define NFSX_V3WRITEVERF 8
|
|
|
|
#define NFSX_V3CREATEVERF 8
|
|
|
|
#define NFSX_V3STATFS 52
|
|
|
|
#define NFSX_V3FSINFO 48
|
|
|
|
#define NFSX_V3PATHCONF 24
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/* NFS RPC procedure numbers (before version mapping) */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSPROC_NULL 0
|
|
|
|
#define NFSPROC_GETATTR 1
|
|
|
|
#define NFSPROC_SETATTR 2
|
|
|
|
#define NFSPROC_LOOKUP 3
|
|
|
|
#define NFSPROC_ACCESS 4
|
|
|
|
#define NFSPROC_READLINK 5
|
|
|
|
#define NFSPROC_READ 6
|
|
|
|
#define NFSPROC_WRITE 7
|
|
|
|
#define NFSPROC_CREATE 8
|
|
|
|
#define NFSPROC_MKDIR 9
|
|
|
|
#define NFSPROC_SYMLINK 10
|
|
|
|
#define NFSPROC_MKNOD 11
|
|
|
|
#define NFSPROC_REMOVE 12
|
|
|
|
#define NFSPROC_RMDIR 13
|
|
|
|
#define NFSPROC_RENAME 14
|
|
|
|
#define NFSPROC_LINK 15
|
|
|
|
#define NFSPROC_READDIR 16
|
|
|
|
#define NFSPROC_READDIRPLUS 17
|
|
|
|
#define NFSPROC_FSSTAT 18
|
|
|
|
#define NFSPROC_FSINFO 19
|
|
|
|
#define NFSPROC_PATHCONF 20
|
|
|
|
#define NFSPROC_COMMIT 21
|
|
|
|
#define NFSPROC_NOOP 22
|
|
|
|
#define NFS_NPROCS 23
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/* Constants used by the Version 3 protocol for various RPCs */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-05-29 01:40:20 +02:00
|
|
|
#define NFSV3SATTRTIME_DONTCHANGE 0
|
|
|
|
#define NFSV3SATTRTIME_TOSERVER 1
|
|
|
|
#define NFSV3SATTRTIME_TOCLIENT 2
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSV3ACCESS_READ 0x01
|
|
|
|
#define NFSV3ACCESS_LOOKUP 0x02
|
|
|
|
#define NFSV3ACCESS_MODIFY 0x04
|
|
|
|
#define NFSV3ACCESS_EXTEND 0x08
|
|
|
|
#define NFSV3ACCESS_DELETE 0x10
|
|
|
|
#define NFSV3ACCESS_EXECUTE 0x20
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSV3WRITE_UNSTABLE 0
|
|
|
|
#define NFSV3WRITE_DATASYNC 1
|
|
|
|
#define NFSV3WRITE_FILESYNC 2
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSV3CREATE_UNCHECKED 0
|
|
|
|
#define NFSV3CREATE_GUARDED 1
|
|
|
|
#define NFSV3CREATE_EXCLUSIVE 2
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSV3FSINFO_LINK 0x01
|
|
|
|
#define NFSV3FSINFO_SYMLINK 0x02
|
|
|
|
#define NFSV3FSINFO_HOMOGENEOUS 0x08
|
|
|
|
#define NFSV3FSINFO_CANSETTIME 0x10
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2012-06-09 02:08:18 +02:00
|
|
|
/* Mode bit values */
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define NFSMODE_IXOTH (1 << 0) /* Execute permission for others on a file */
|
|
|
|
#define NFSMODE_IWOTH (1 << 1) /* Write permission for others */
|
|
|
|
#define NFSMODE_IROTH (1 << 2) /* Read permission for others */
|
|
|
|
#define NFSMODE_IXGRP (1 << 3) /* Execute permission for group on a file */
|
|
|
|
#define NFSMODE_IWGRP (1 << 4) /* Write permission for group */
|
|
|
|
#define NFSMODE_IRGRP (1 << 5) /* Read permission for group */
|
|
|
|
#define NFSMODE_IXUSR (1 << 6) /* Execute permission for owner on a file */
|
|
|
|
#define NFSMODE_IWUSR (1 << 7) /* Write permission for owner */
|
|
|
|
#define NFSMODE_IRUSR (1 << 8) /* Read permission for owner */
|
|
|
|
#define NFSMODE_SAVETEXT (1 << 9) /* Save swapped text */
|
|
|
|
#define NFSMODE_ISGID (1 << 10) /* Set group ID on execution */
|
|
|
|
#define NFSMODE_ISUID (1 << 11) /* Set user ID on execution */
|
2012-06-09 02:08:18 +02:00
|
|
|
|
2012-03-28 02:10:43 +02:00
|
|
|
/* File identifier */
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define MAXFIDSZ 16
|
2012-03-28 02:10:43 +02:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-03-17 01:25:34 +01:00
|
|
|
/* File types */
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2012-06-09 02:08:18 +02:00
|
|
|
NFNON = 0, /* Unknown type */
|
|
|
|
NFREG = 1, /* Regular file */
|
|
|
|
NFDIR = 2, /* Directory */
|
|
|
|
NFBLK = 3, /* Block special device file */
|
2012-06-10 02:13:59 +02:00
|
|
|
NFCHR = 4, /* Character special device file */
|
2012-06-09 02:08:18 +02:00
|
|
|
NFLNK = 5, /* Symbolic link */
|
|
|
|
NFSOCK = 6, /* Socket */
|
2012-06-10 02:13:59 +02:00
|
|
|
NFFIFO = 7 /* Named FIFO */
|
2012-03-17 01:25:34 +01:00
|
|
|
} nfstype;
|
|
|
|
|
2014-04-14 00:22:22 +02:00
|
|
|
/* File Handle variable is up to 64 bytes for version 3. This structures a
|
2020-03-01 21:53:45 +01:00
|
|
|
* variable sized and are provided only for setting aside maximum memory
|
2012-06-13 02:46:44 +02:00
|
|
|
* allocations for a file handle.
|
2012-06-10 20:16:01 +02:00
|
|
|
*/
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2012-06-10 20:16:01 +02:00
|
|
|
struct nfsfh
|
2012-03-17 01:25:34 +01:00
|
|
|
{
|
2012-06-11 19:14:46 +02:00
|
|
|
uint8_t fh_bytes[NFSX_V3FHMAX];
|
2012-03-17 01:25:34 +01:00
|
|
|
};
|
2012-06-10 20:16:01 +02:00
|
|
|
typedef struct nfsfh nfsfh_t;
|
|
|
|
#define SIZEOF_nfsfh_t(n) (n)
|
2012-05-29 01:40:20 +02:00
|
|
|
|
2012-03-17 01:25:34 +01:00
|
|
|
struct nfsv3_time
|
|
|
|
{
|
|
|
|
uint32_t nfsv3_sec;
|
|
|
|
uint32_t nfsv3_nsec;
|
|
|
|
};
|
|
|
|
typedef struct nfsv3_time nfstime3;
|
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/* Quads are defined as arrays of 2 longs to ensure dense packing for the
|
2012-03-17 01:25:34 +01:00
|
|
|
* protocol and to facilitate xdr conversion.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct nfs_uquad
|
|
|
|
{
|
|
|
|
uint32_t nfsuquad[2];
|
|
|
|
};
|
|
|
|
typedef struct nfs_uquad nfsuint64;
|
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/* NFS Version 3 special file number. */
|
2012-03-17 01:25:34 +01:00
|
|
|
|
|
|
|
struct nfsv3_spec
|
|
|
|
{
|
|
|
|
uint32_t specdata1;
|
|
|
|
uint32_t specdata2;
|
|
|
|
};
|
|
|
|
typedef struct nfsv3_spec nfsv3spec;
|
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/* File attributes and setable attributes. These structures cover both
|
2012-03-17 01:25:34 +01:00
|
|
|
* NFS version 2 and the version 3 protocol. Note that the union is only
|
|
|
|
* used so that one pointer can refer to both variants. These structures
|
|
|
|
* go out on the wire and must be densely packed, so no quad data types
|
|
|
|
* are used. (all fields are longs or u_longs or structures of same)
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct nfs_fattr
|
|
|
|
{
|
2012-06-11 20:55:58 +02:00
|
|
|
uint32_t fa_type;
|
|
|
|
uint32_t fa_mode;
|
|
|
|
uint32_t fa_nlink;
|
|
|
|
uint32_t fa_uid;
|
|
|
|
uint32_t fa_gid;
|
|
|
|
nfsuint64 fa_size;
|
|
|
|
nfsuint64 fa_used;
|
|
|
|
nfsv3spec fa_rdev;
|
|
|
|
nfsuint64 fa_fsid;
|
|
|
|
nfsuint64 fa_fileid;
|
|
|
|
nfstime3 fa_atime;
|
|
|
|
nfstime3 fa_mtime;
|
|
|
|
nfstime3 fa_ctime;
|
2012-06-11 19:14:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* NFS Version 3 sattr structure for the new node creation case. This is the
|
|
|
|
* maximum size of the attributes; the actual size may vary if values are not
|
|
|
|
* include.
|
|
|
|
*/
|
2012-03-17 01:25:34 +01:00
|
|
|
|
|
|
|
struct nfsv3_sattr
|
|
|
|
{
|
2012-06-11 20:55:58 +02:00
|
|
|
uint32_t sa_modefollows; /* TRUE: Mode value follows */
|
|
|
|
uint32_t sa_mode; /* Mode value */
|
|
|
|
uint32_t sa_uidfollows; /* TRUE: Uid value follows */
|
|
|
|
uint32_t sa_uid; /* Uid value */
|
|
|
|
uint32_t sa_gidfollows; /* TRUE: Mode value follows */
|
|
|
|
uint32_t sa_gid; /* Mode value */
|
|
|
|
uint32_t sa_sizefollows; /* TRUE: Size value follows */
|
2020-03-01 21:53:45 +01:00
|
|
|
nfsuint64 sa_size; /* Size value */
|
2012-06-11 20:55:58 +02:00
|
|
|
uint32_t sa_atimetype; /* Don't change, use server timer, or use client time */
|
|
|
|
nfstime3 sa_atime; /* Client time */
|
|
|
|
uint32_t sa_mtimetype; /* Don't change, use server timer, or use client time */
|
|
|
|
nfstime3 sa_mtime; /* Client time */
|
2012-03-17 01:25:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nfs_statfs
|
|
|
|
{
|
2020-03-01 21:53:45 +01:00
|
|
|
uint32_t obj_attributes_follow;
|
2012-06-11 20:55:58 +02:00
|
|
|
struct nfs_fattr obj_attributes;
|
|
|
|
nfsuint64 sf_tbytes;
|
|
|
|
nfsuint64 sf_fbytes;
|
|
|
|
nfsuint64 sf_abytes;
|
|
|
|
nfsuint64 sf_tfiles;
|
|
|
|
nfsuint64 sf_ffiles;
|
|
|
|
nfsuint64 sf_afiles;
|
|
|
|
uint32_t sf_invarsec;
|
2012-06-11 19:14:46 +02:00
|
|
|
};
|
2014-04-14 00:22:22 +02:00
|
|
|
|
2012-03-17 01:25:34 +01:00
|
|
|
struct nfsv3_fsinfo
|
|
|
|
{
|
2020-03-01 21:53:45 +01:00
|
|
|
uint32_t obj_attributes_follow;
|
|
|
|
struct nfs_fattr obj_attributes;
|
2012-06-06 23:51:03 +02:00
|
|
|
uint32_t fs_rtmax;
|
|
|
|
uint32_t fs_rtpref;
|
|
|
|
uint32_t fs_rtmult;
|
|
|
|
uint32_t fs_wtmax;
|
|
|
|
uint32_t fs_wtpref;
|
|
|
|
uint32_t fs_wtmult;
|
|
|
|
uint32_t fs_dtpref;
|
|
|
|
nfsuint64 fs_maxfilesize;
|
|
|
|
nfstime3 fs_timedelta;
|
|
|
|
uint32_t fs_properties;
|
2012-03-17 01:25:34 +01:00
|
|
|
};
|
|
|
|
|
2012-04-17 01:01:21 +02:00
|
|
|
/* NFS procedures args */
|
|
|
|
|
|
|
|
struct wcc_attr
|
|
|
|
{
|
2012-05-29 01:40:20 +02:00
|
|
|
nfsuint64 size;
|
|
|
|
nfstime3 mtime;
|
|
|
|
nfstime3 ctime;
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wcc_data
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
uint32_t wcc_attr_follows; /* True if data follows */
|
2012-05-29 01:40:20 +02:00
|
|
|
struct wcc_attr before;
|
2020-05-28 19:03:43 +02:00
|
|
|
uint32_t nfs_attr_follow; /* True if attributes present */
|
2012-05-29 01:40:20 +02:00
|
|
|
struct nfs_fattr after;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct file_handle
|
|
|
|
{
|
|
|
|
uint32_t length;
|
|
|
|
nfsfh_t handle;
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
2012-06-10 20:16:01 +02:00
|
|
|
#define SIZEOF_file_handle(n) (sizeof(uint32_t) + SIZEOF_nfsfh_t(n))
|
2012-04-17 01:01:21 +02:00
|
|
|
|
|
|
|
struct diropargs3
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
struct file_handle fhandle; /* Variable length */
|
|
|
|
uint32_t length; /* Size of name[] */
|
|
|
|
uint32_t name[(NAME_MAX + 3) >> 2]; /* Variable length */
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CREATE3args
|
|
|
|
{
|
|
|
|
struct diropargs3 where;
|
2012-05-30 01:23:22 +02:00
|
|
|
uint32_t create_mode;
|
2012-04-17 01:01:21 +02:00
|
|
|
struct nfsv3_sattr how;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CREATE3resok
|
|
|
|
{
|
2012-06-11 19:14:46 +02:00
|
|
|
uint32_t handle_follows; /* True, handle follows */
|
|
|
|
struct file_handle fhandle; /* Variable length */
|
|
|
|
uint32_t attributes_follows; /* True, attributes follows */
|
|
|
|
struct nfs_fattr attributes; /* File attributes */
|
2012-04-17 01:01:21 +02:00
|
|
|
struct wcc_data dir_wcc;
|
|
|
|
};
|
|
|
|
|
2020-03-01 21:53:45 +01:00
|
|
|
struct SETATTR3args
|
|
|
|
{
|
|
|
|
struct file_handle fhandle; /* Variable length */
|
|
|
|
struct nfsv3_sattr new_attributes; /* Variable length */
|
|
|
|
uint32_t guard; /* Guard value */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SETATTR3resok
|
|
|
|
{
|
|
|
|
struct wcc_data wcc_data;
|
|
|
|
};
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
/* The actual size of the lookup argument is variable.
|
|
|
|
* These structures are, therefore, only useful in setting
|
|
|
|
* aside maximum memory usage for the LOOKUP arguments.
|
2012-06-10 20:16:01 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct LOOKUP3filename
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
uint32_t namelen; /* Size of name[] */
|
|
|
|
uint32_t name[(NAME_MAX + 3) >> 2]; /* Variable length */
|
2012-06-10 20:16:01 +02:00
|
|
|
};
|
|
|
|
|
2012-06-09 21:29:49 +02:00
|
|
|
struct LOOKUP3args
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
struct file_handle dirhandle; /* Variable length */
|
|
|
|
struct LOOKUP3filename name; /* Variable length */
|
2012-06-09 21:29:49 +02:00
|
|
|
};
|
2012-06-10 02:13:59 +02:00
|
|
|
|
|
|
|
/* Actual size of LOOKUP3args */
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
#define SIZEOF_LOOKUP3filename(b) (sizeof(uint32_t) + (((b) + 3) & ~3))
|
2012-06-10 20:16:01 +02:00
|
|
|
#define SIZEOF_LOOKUP3args(a,b) (SIZEOF_file_handle(a) + SIZEOF_LOOKUP3filename(b))
|
2012-06-09 21:29:49 +02:00
|
|
|
|
|
|
|
struct LOOKUP3resok
|
|
|
|
{
|
2012-06-11 19:14:46 +02:00
|
|
|
struct file_handle fhandle;
|
2012-06-09 21:29:49 +02:00
|
|
|
uint32_t obj_attributes_follow;
|
|
|
|
struct nfs_fattr obj_attributes;
|
|
|
|
uint32_t dir_attributes_follow;
|
|
|
|
struct nfs_fattr dir_attributes;
|
|
|
|
};
|
|
|
|
|
2012-04-17 01:01:21 +02:00
|
|
|
struct READ3args
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
struct file_handle fhandle; /* Variable length */
|
2020-05-27 23:56:53 +02:00
|
|
|
nfsuint64 offset;
|
2012-04-17 01:01:21 +02:00
|
|
|
uint32_t count;
|
|
|
|
};
|
|
|
|
|
2012-06-11 01:17:10 +02:00
|
|
|
struct nfs_rdhdr_s
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
2012-06-11 01:17:10 +02:00
|
|
|
uint32_t attributes_follow;
|
2020-05-28 19:03:43 +02:00
|
|
|
struct nfs_fattr attributes; /* Will not be present if attributes_follow == 0 */
|
|
|
|
uint32_t count; /* Number of bytes read */
|
|
|
|
uint32_t eof; /* Non-zero if at the end of file */
|
|
|
|
uint32_t length; /* Length of data (same as count?) */
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
2012-06-11 01:17:10 +02:00
|
|
|
struct READ3resok
|
|
|
|
{
|
|
|
|
struct nfs_rdhdr_s hdr;
|
2020-05-28 19:03:43 +02:00
|
|
|
uint8_t data[1]; /* Actual data size depends on count */
|
2012-06-11 01:17:10 +02:00
|
|
|
};
|
|
|
|
#define SIZEOF_READ3resok(n) (sizeof(struct nfs_rdhdr_s) + (n))
|
2012-04-17 01:01:21 +02:00
|
|
|
|
2012-06-11 01:17:10 +02:00
|
|
|
struct nfs_wrhdr_s
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
struct file_handle fhandle; /* Variable length */
|
2020-05-27 23:56:53 +02:00
|
|
|
nfsuint64 offset;
|
2012-04-17 01:01:21 +02:00
|
|
|
uint32_t count;
|
2012-06-08 02:14:54 +02:00
|
|
|
uint32_t stable;
|
2020-03-01 21:53:45 +01:00
|
|
|
uint32_t length;
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
2012-06-11 01:17:10 +02:00
|
|
|
struct WRITE3args
|
|
|
|
{
|
|
|
|
struct nfs_wrhdr_s hdr;
|
2020-05-28 19:03:43 +02:00
|
|
|
uint8_t data[1]; /* Actual data size depends on count */
|
2012-06-11 01:17:10 +02:00
|
|
|
};
|
|
|
|
#define SIZEOF_WRITE3args(n) (sizeof(struct nfs_wrhdr_s) + (n))
|
|
|
|
|
2012-04-17 01:01:21 +02:00
|
|
|
struct WRITE3resok
|
|
|
|
{
|
|
|
|
struct wcc_data file_wcc;
|
|
|
|
uint32_t count;
|
2012-06-08 02:14:54 +02:00
|
|
|
uint32_t committed;
|
2012-06-08 17:45:40 +02:00
|
|
|
uint8_t verf[NFSX_V3WRITEVERF];
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct REMOVE3args
|
|
|
|
{
|
|
|
|
struct diropargs3 object;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct REMOVE3resok
|
|
|
|
{
|
|
|
|
struct wcc_data dir_wcc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RENAME3args
|
|
|
|
{
|
|
|
|
struct diropargs3 from;
|
|
|
|
struct diropargs3 to;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RENAME3resok
|
|
|
|
{
|
|
|
|
struct wcc_data fromdir_wcc;
|
|
|
|
struct wcc_data todir_wcc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MKDIR3args
|
|
|
|
{
|
|
|
|
struct diropargs3 where;
|
2012-06-11 23:16:35 +02:00
|
|
|
struct nfsv3_sattr how;
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MKDIR3resok
|
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
uint32_t handle_follows; /* True, handle follows */
|
|
|
|
struct file_handle fhandle; /* Variable length */
|
|
|
|
uint32_t attributes_follows; /* True, attributes follows */
|
|
|
|
struct nfs_fattr attributes; /* Directory attributes */
|
2012-04-17 01:01:21 +02:00
|
|
|
struct wcc_data dir_wcc;
|
|
|
|
};
|
|
|
|
|
2014-04-14 00:22:22 +02:00
|
|
|
struct RMDIR3args
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
|
|
|
struct diropargs3 object;
|
|
|
|
};
|
|
|
|
|
2014-04-14 00:22:22 +02:00
|
|
|
struct RMDIR3resok
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
|
|
|
struct wcc_data dir_wcc;
|
|
|
|
};
|
|
|
|
|
2014-04-14 00:22:22 +02:00
|
|
|
struct READDIR3args
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
2020-05-28 19:03:43 +02:00
|
|
|
struct file_handle dir; /* Variable length */
|
2012-04-17 01:01:21 +02:00
|
|
|
nfsuint64 cookie;
|
2012-06-08 17:45:40 +02:00
|
|
|
uint8_t cookieverf[NFSX_V3COOKIEVERF];
|
2012-04-17 01:01:21 +02:00
|
|
|
uint32_t count;
|
|
|
|
};
|
|
|
|
|
2020-05-28 19:03:43 +02:00
|
|
|
/* The READDIR reply is variable length and consists of multiple entries,
|
|
|
|
* each of form:
|
2012-06-08 17:45:40 +02:00
|
|
|
*
|
|
|
|
* EOF - OR -
|
|
|
|
*
|
|
|
|
* File ID (8 bytes)
|
|
|
|
* Name length (4 bytes)
|
2020-02-23 09:50:23 +01:00
|
|
|
* Name string (variable size but in multiples of 4 bytes)
|
2012-06-08 17:45:40 +02:00
|
|
|
* Cookie (8 bytes)
|
|
|
|
* next entry (4 bytes)
|
|
|
|
*/
|
2014-04-14 00:22:22 +02:00
|
|
|
|
|
|
|
struct READDIR3resok
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
2012-06-09 02:08:18 +02:00
|
|
|
uint32_t attributes_follow;
|
2012-04-17 01:01:21 +02:00
|
|
|
struct nfs_fattr dir_attributes;
|
2012-06-08 17:45:40 +02:00
|
|
|
uint8_t cookieverf[NFSX_V3COOKIEVERF];
|
2012-06-09 02:08:18 +02:00
|
|
|
uint32_t value_follows;
|
2020-05-28 19:03:43 +02:00
|
|
|
uint32_t reply[1]; /* Variable length reply begins here */
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
|
|
|
|
2018-08-26 21:11:24 +02:00
|
|
|
#define SIZEOF_READDIR3resok(n) \
|
|
|
|
(sizeof(uint32_t) + sizeof(struct nfs_fattr) + \
|
|
|
|
NFSX_V3COOKIEVERF + sizeof(uint32_t) + (n))
|
|
|
|
|
2012-05-18 03:11:57 +02:00
|
|
|
struct FS3args
|
2012-04-17 01:01:21 +02:00
|
|
|
{
|
2012-05-29 01:40:20 +02:00
|
|
|
struct file_handle fsroot;
|
2012-04-17 01:01:21 +02:00
|
|
|
};
|
2012-06-06 23:51:03 +02:00
|
|
|
|
2012-06-08 02:14:54 +02:00
|
|
|
#endif /* __FS_NFS_NFS_PROTO_H */
|