1/* 2 * Copyright (c) 2010-2013 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* 25 * nfs_sys_prot.x 26 */ 27 28/* 29 * Basic typedefs for RFC 1832 data type definitions 30 */ 31typedef int int32_t; 32typedef unsigned int uint32_t; 33 34/* 35 * Basic data types 36 */ 37typedef uint32_t bitmap<>; 38typedef opaque utf8string<>; 39typedef utf8string utf8str_cis; 40typedef utf8string utf8str_cs; 41typedef utf8str_cs component; 42typedef component pathname<>; 43typedef opaque attrlist<>; 44 45/* timespec */ 46struct nfstime32 { 47 int32_t seconds; 48 uint32_t nseconds; 49}; 50 51/* a set of flags: which ones are set and what they are set to */ 52struct nfs_flag_set { 53 bitmap mask; /* which flags are valid */ 54 bitmap value; /* what each flag is set to */ 55}; 56 57/* values for MATTR_LOCK_MODE */ 58enum nfs_lock_mode { 59 NFS_LOCK_MODE_ENABLED = 0, 60 NFS_LOCK_MODE_DISABLED = 1, 61 NFS_LOCK_MODE_LOCAL = 2 62}; 63 64/* 65 * Filesystem locations attributes. 66 * 67 * This structure closely resembles the fs_locations and 68 * fs_locations_info structures in NFSv4. 69 * 70 * An NFS file system can have multiple locations. 71 * Each location consists of one or more servers that have 72 * the file system available at a given server-side pathname. 73 * Each server has a name and a list of addresses. 74 * 75 * The *_info elements are optional. If they are included the 76 * length of the element will be non-zero and the contents will 77 * be described by the corresponding _info structure. 78 */ 79struct nfs_fs_server_info { 80 int32_t nfssi_currency; 81 opaque nfssi_info<>; 82}; 83struct nfs_fs_server { 84 utf8str_cis nfss_name; 85 utf8str_cis nfss_address<>; /* universal addresses */ 86 opaque nfss_server_info<>; /* optional, contents described by nfs_fs_server_info */ 87}; 88struct nfs_fs_location { 89 nfs_fs_server nfsl_server<>; 90 pathname nfsl_rootpath; 91}; 92struct nfs_fs_locations_info { 93 uint32_t nfsli_flags; 94 int32_t nfsli_valid_for; 95 pathname nfsli_root; 96}; 97struct nfs_fs_locations { 98 nfs_fs_location nfsl_location<>; 99 opaque nfsl_locations_info<>; /* optional, contents described by nfs_fs_locations_info */ 100}; 101 102/* NFS mount attribute container */ 103struct nfs_mattr { 104 bitmap attrmask; 105 attrlist attr_vals; 106}; 107 108/* miscellaneous constants */ 109const NFS_XDRARGS_VERSION_0 = 0; /* nfs_mount_args version */ 110const NFS_MATTR_BITMAP_LEN = 1; /* # XDR words in mount attributes bitmap */ 111const NFS_MFLAG_BITMAP_LEN = 1; /* # XDR words in mount flags bitmap */ 112 113/* 114 * Mount attributes 115 * 116 * Additional mount attribute notes: 117 * 118 * Time value attributes are specified in second.nanosecond format but 119 * mount arguments may be rounded to a more appropriate unit/increment. 120 * 121 * The supported string values for NFS_MATTR_SOCKET_TYPE: 122 * tcp - use TCP over IPv4 or IPv6 123 * udp - use UDP over IPv4 or IPv6 124 * tcp6 - use TCP over IPv6 only 125 * udp6 - use UDP over IPv6 only 126 * tcp4 - use TCP over IPv4 only 127 * udp4 - use UDP over IPv4 only 128 * inet - use TCP or UDP over IPv4 or IPv6 129 * inet4 - use TCP or UDP over IPv4 only 130 * inet6 - use TCP or UDP over IPv6 only 131 */ 132 133/* mount attribute types */ 134typedef nfs_flag_set nfs_mattr_flags; 135typedef uint32_t nfs_mattr_nfs_version; 136typedef uint32_t nfs_mattr_nfs_minor_version; 137typedef uint32_t nfs_mattr_rsize; 138typedef uint32_t nfs_mattr_wsize; 139typedef uint32_t nfs_mattr_readdirsize; 140typedef uint32_t nfs_mattr_readahead; 141typedef nfstime32 nfs_mattr_acregmin; 142typedef nfstime32 nfs_mattr_acregmax; 143typedef nfstime32 nfs_mattr_acdirmin; 144typedef nfstime32 nfs_mattr_acdirmax; 145typedef nfs_lock_mode nfs_mattr_lock_mode; 146typedef uint32_t nfs_mattr_security<>; 147typedef uint32_t nfs_mattr_maxgrouplist; 148typedef string nfs_mattr_socket_type<>; 149typedef uint32_t nfs_mattr_nfs_port; 150typedef uint32_t nfs_mattr_mount_port; 151typedef nfstime32 nfs_mattr_request_timeout; 152typedef uint32_t nfs_mattr_soft_retry_count; 153typedef nfstime32 nfs_mattr_dead_timeout; 154typedef opaque nfs_mattr_fh<NFS4_FHSIZE>; 155typedef nfs_fs_locations nfs_mattr_fs_locations; 156typedef uint32_t nfs_mattr_mntflags; 157typedef string nfs_mattr_mntfrom<MAXPATHLEN-1>; 158typedef string nfs_mattr_realm<MAXPATHLEN-1>; 159typedef string nfs_mattr_principal<MAXPATHLEN-1>; 160typedef string nfs_mattr_svcpinc<MAXPATHLEN-1>; 161 162/* mount attribute bitmap indices */ 163const NFS_MATTR_FLAGS = 0; /* mount flags bitmap (MFLAG_*) */ 164const NFS_MATTR_NFS_VERSION = 1; /* NFS protocol version */ 165const NFS_MATTR_NFS_MINOR_VERSION = 2; /* NFS protocol minor version */ 166const NFS_MATTR_READ_SIZE = 3; /* READ RPC size */ 167const NFS_MATTR_WRITE_SIZE = 4; /* WRITE RPC size */ 168const NFS_MATTR_READDIR_SIZE = 5; /* READDIR RPC size */ 169const NFS_MATTR_READAHEAD = 6; /* block readahead count */ 170const NFS_MATTR_ATTRCACHE_REG_MIN = 7; /* minimum attribute cache time */ 171const NFS_MATTR_ATTRCACHE_REG_MAX = 8; /* maximum attribute cache time */ 172const NFS_MATTR_ATTRCACHE_DIR_MIN = 9; /* minimum attribute cache time for directories */ 173const NFS_MATTR_ATTRCACHE_DIR_MAX = 10; /* maximum attribute cache time for directories */ 174const NFS_MATTR_LOCK_MODE = 11; /* advisory file locking mode (nfs_lock_mode) */ 175const NFS_MATTR_SECURITY = 12; /* RPC security flavors to use */ 176const NFS_MATTR_MAX_GROUP_LIST = 13; /* max # of RPC AUTH_SYS groups */ 177const NFS_MATTR_SOCKET_TYPE = 14; /* socket transport type as a netid-like string */ 178const NFS_MATTR_NFS_PORT = 15; /* port # to use for NFS protocol */ 179const NFS_MATTR_MOUNT_PORT = 16; /* port # to use for MOUNT protocol */ 180const NFS_MATTR_REQUEST_TIMEOUT = 17; /* initial RPC request timeout value */ 181const NFS_MATTR_SOFT_RETRY_COUNT = 18; /* max RPC retransmissions for soft mounts */ 182const NFS_MATTR_DEAD_TIMEOUT = 19; /* how long until unresponsive mount is considered dead */ 183const NFS_MATTR_FH = 20; /* file handle for mount directory */ 184const NFS_MATTR_FS_LOCATIONS = 21; /* list of locations for the file system */ 185const NFS_MATTR_MNTFLAGS = 22; /* VFS mount flags (MNT_*) */ 186const NFS_MATTR_MNTFROM = 23; /* fixed string to use for "f_mntfromname" */ 187const NFS_MATTR_REALM = 24; /* Kerberos realm to use for authentication */ 188const NFS_MATTR_PRINCIPAL = 25; /* Principal to use for the mount */ 189const NFS_MATTR_SVCPRINCIPAL = 26; /* Kerberos principal of the server */ 190 191/* 192 * Mount flags 193 */ 194const NFS_MFLAG_SOFT = 0; /* soft mount (requests fail if unresponsive) */ 195const NFS_MFLAG_INTR = 1; /* allow operations to be interrupted */ 196const NFS_MFLAG_RESVPORT = 2; /* use a reserved port */ 197const NFS_MFLAG_NOCONNECT = 3; /* don't connect the socket (UDP) */ 198const NFS_MFLAG_DUMBTIMER = 4; /* don't estimate RTT dynamically */ 199const NFS_MFLAG_CALLUMNT = 5; /* call MOUNTPROC_UMNT on unmount */ 200const NFS_MFLAG_RDIRPLUS = 6; /* request additional info when reading directories */ 201const NFS_MFLAG_NONEGNAMECACHE = 7; /* don't do negative name caching */ 202const NFS_MFLAG_MUTEJUKEBOX = 8; /* don't treat jukebox errors as unresponsive */ 203const NFS_MFLAG_EPHEMERAL = 9; /* ephemeral (mirror) mount */ 204const NFS_MFLAG_NOCALLBACK = 10; /* don't provide callback RPC service */ 205const NFS_MFLAG_NONAMEDATTR = 11; /* don't use named attributes */ 206const NFS_MFLAG_NOACL = 12; /* don't support ACLs */ 207const NFS_MFLAG_ACLONLY = 13; /* only support ACLs - not mode */ 208const NFS_MFLAG_NFC = 14; /* send NFC strings */ 209const NFS_MFLAG_NOQUOTA = 15; /* don't support QUOTA requests */ 210const NFS_MFLAG_MNTUDP = 16; /* MOUNT protocol should use UDP */ 211const NFS_MFLAG_MNTQUICK = 17; /* use short timeouts while mounting */ 212 213 214/* 215 * Arguments to mount an NFS file system 216 * 217 * Format of the buffer passed to NFS in the mount(2) system call. 218 */ 219struct nfs_mount_args { 220 uint32_t args_version; /* NFS_ARGSVERSION_XDR = 88 */ 221 uint32_t args_length; /* length of the entire nfs_mount_args structure */ 222 uint32_t xdr_args_version; /* version of nfs_mount_args structure */ 223 nfs_mattr nfs_mount_attrs; /* mount information */ 224}; 225 226 227 228/* 229 * Mount Info attributes 230 */ 231 232/* mount info attribute types */ 233typedef nfs_flag_set nfs_miattr_flags; 234typedef uint32_t nfs_miattr_cur_loc_index[4]; 235 236/* mount info attribute bitmap indices */ 237const NFS_MIATTR_FLAGS = 0; /* mount info flags bitmap (MIFLAG_*) */ 238const NFS_MIATTR_ORIG_ARGS = 1; /* original mount args passed into mount call */ 239const NFS_MIATTR_CUR_ARGS = 2; /* current mount args values */ 240const NFS_MIATTR_CUR_LOC_INDEX = 3; /* current fs location index */ 241 242/* 243 * Mount Info flags 244 */ 245const NFS_MIFLAG_DEAD = 0; /* mount is dead */ 246const NFS_MIFLAG_NOTRESP = 1; /* server is unresponsive */ 247const NFS_MIFLAG_RECOVERY = 2; /* mount in recovery */ 248 249/* NFS mount info attribute container */ 250struct nfs_miattr { 251 bitmap attrmask; 252 attrlist attr_vals; 253}; 254 255/* miscellaneous constants */ 256const NFS_MOUNT_INFO_VERSION = 0; /* nfs_mount_info version */ 257const NFS_MIATTR_BITMAP_LEN = 1; /* # XDR words in mount info attributes bitmap */ 258const NFS_MIFLAG_BITMAP_LEN = 1; /* # XDR words in mount info flags bitmap */ 259 260/* 261 * NFS mount information as returned by NFS_MOUNTINFO sysctl. 262 */ 263struct nfs_mount_info { 264 uint32_t info_version; /* NFS_MOUNT_INFO_VERSION = 0 */ 265 uint32_t info_length; /* length of the entire nfs_mount_info structure */ 266 nfs_miattr nfs_mountinfo_attrs; /* mount information attributes */ 267}; 268 269