10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*11291SRobert.Thurlow@Sun.COM * Common Development and Distribution License (the "License"). 6*11291SRobert.Thurlow@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 220Sstevel@tonic-gate * Copyright (C) The Internet Society (1998-2003). 230Sstevel@tonic-gate * All Rights Reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* 270Sstevel@tonic-gate * nfs4_prot.x 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate /* 310Sstevel@tonic-gate * Basic typedefs for RFC 1832 data type definitions 320Sstevel@tonic-gate */ 330Sstevel@tonic-gate 340Sstevel@tonic-gate /* 350Sstevel@tonic-gate * typedef int int32_t; 360Sstevel@tonic-gate * typedef unsigned int uint32_t; 370Sstevel@tonic-gate * typedef hyper int64_t; 380Sstevel@tonic-gate * typedef unsigned hyper uint64_t; 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * Sizes 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate const NFS4_FHSIZE = 128; 450Sstevel@tonic-gate const NFS4_VERIFIER_SIZE = 8; 460Sstevel@tonic-gate const NFS4_OPAQUE_LIMIT = 1024; 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * File types 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate enum nfs_ftype4 { 520Sstevel@tonic-gate NF4REG = 1, /* Regular File */ 530Sstevel@tonic-gate NF4DIR = 2, /* Directory */ 540Sstevel@tonic-gate NF4BLK = 3, /* Special File - block device */ 550Sstevel@tonic-gate NF4CHR = 4, /* Special File - character device */ 560Sstevel@tonic-gate NF4LNK = 5, /* Symbolic Link */ 570Sstevel@tonic-gate NF4SOCK = 6, /* Special File - socket */ 580Sstevel@tonic-gate NF4FIFO = 7, /* Special File - fifo */ 590Sstevel@tonic-gate NF4ATTRDIR = 8, /* Attribute Directory */ 600Sstevel@tonic-gate NF4NAMEDATTR = 9 /* Named Attribute */ 610Sstevel@tonic-gate }; 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* 640Sstevel@tonic-gate * Error status 650Sstevel@tonic-gate */ 660Sstevel@tonic-gate enum nfsstat4 { 670Sstevel@tonic-gate NFS4_OK = 0, /* everything is okay */ 680Sstevel@tonic-gate NFS4ERR_PERM = 1, /* caller not privileged */ 690Sstevel@tonic-gate NFS4ERR_NOENT = 2, /* no such file/directory */ 700Sstevel@tonic-gate NFS4ERR_IO = 5, /* hard I/O error */ 710Sstevel@tonic-gate NFS4ERR_NXIO = 6, /* no such device */ 720Sstevel@tonic-gate NFS4ERR_ACCESS = 13, /* access denied */ 730Sstevel@tonic-gate NFS4ERR_EXIST = 17, /* file already exists */ 740Sstevel@tonic-gate NFS4ERR_XDEV = 18, /* different filesystems */ 750Sstevel@tonic-gate /* Unused/reserved 19 */ 760Sstevel@tonic-gate NFS4ERR_NOTDIR = 20, /* should be a directory */ 770Sstevel@tonic-gate NFS4ERR_ISDIR = 21, /* should not be directory */ 780Sstevel@tonic-gate NFS4ERR_INVAL = 22, /* invalid argument */ 790Sstevel@tonic-gate NFS4ERR_FBIG = 27, /* file exceeds server max */ 800Sstevel@tonic-gate NFS4ERR_NOSPC = 28, /* no space on filesystem */ 810Sstevel@tonic-gate NFS4ERR_ROFS = 30, /* read-only filesystem */ 820Sstevel@tonic-gate NFS4ERR_MLINK = 31, /* too many hard links */ 830Sstevel@tonic-gate NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */ 840Sstevel@tonic-gate NFS4ERR_NOTEMPTY = 66, /* directory not empty */ 850Sstevel@tonic-gate NFS4ERR_DQUOT = 69, /* hard quota limit reached*/ 860Sstevel@tonic-gate NFS4ERR_STALE = 70, /* file no longer exists */ 870Sstevel@tonic-gate NFS4ERR_BADHANDLE = 10001,/* Illegal filehandle */ 880Sstevel@tonic-gate NFS4ERR_BAD_COOKIE = 10003,/* READDIR cookie is stale */ 890Sstevel@tonic-gate NFS4ERR_NOTSUPP = 10004,/* operation not supported */ 900Sstevel@tonic-gate NFS4ERR_TOOSMALL = 10005,/* response limit exceeded */ 910Sstevel@tonic-gate NFS4ERR_SERVERFAULT = 10006,/* undefined server error */ 920Sstevel@tonic-gate NFS4ERR_BADTYPE = 10007,/* type invalid for CREATE */ 930Sstevel@tonic-gate NFS4ERR_DELAY = 10008,/* file "busy" - retry */ 940Sstevel@tonic-gate NFS4ERR_SAME = 10009,/* nverify says attrs same */ 950Sstevel@tonic-gate NFS4ERR_DENIED = 10010,/* lock unavailable */ 960Sstevel@tonic-gate NFS4ERR_EXPIRED = 10011,/* lock lease expired */ 970Sstevel@tonic-gate NFS4ERR_LOCKED = 10012,/* I/O failed due to lock */ 980Sstevel@tonic-gate NFS4ERR_GRACE = 10013,/* in grace period */ 990Sstevel@tonic-gate NFS4ERR_FHEXPIRED = 10014,/* filehandle expired */ 1000Sstevel@tonic-gate NFS4ERR_SHARE_DENIED = 10015,/* share reserve denied */ 1010Sstevel@tonic-gate NFS4ERR_WRONGSEC = 10016,/* wrong security flavor */ 1020Sstevel@tonic-gate NFS4ERR_CLID_INUSE = 10017,/* clientid in use */ 1030Sstevel@tonic-gate NFS4ERR_RESOURCE = 10018,/* resource exhaustion */ 1040Sstevel@tonic-gate NFS4ERR_MOVED = 10019,/* filesystem relocated */ 1050Sstevel@tonic-gate NFS4ERR_NOFILEHANDLE = 10020,/* current FH is not set */ 1060Sstevel@tonic-gate NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */ 1070Sstevel@tonic-gate NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted */ 1080Sstevel@tonic-gate NFS4ERR_STALE_STATEID = 10023,/* server has rebooted */ 1090Sstevel@tonic-gate NFS4ERR_OLD_STATEID = 10024,/* state is out of sync */ 1100Sstevel@tonic-gate NFS4ERR_BAD_STATEID = 10025,/* incorrect stateid */ 1110Sstevel@tonic-gate NFS4ERR_BAD_SEQID = 10026,/* request is out of seq. */ 1120Sstevel@tonic-gate NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */ 1130Sstevel@tonic-gate NFS4ERR_LOCK_RANGE = 10028,/* lock range not supported*/ 1140Sstevel@tonic-gate NFS4ERR_SYMLINK = 10029,/* should be file/directory*/ 1150Sstevel@tonic-gate NFS4ERR_RESTOREFH = 10030,/* no saved filehandle */ 1160Sstevel@tonic-gate NFS4ERR_LEASE_MOVED = 10031,/* some filesystem moved */ 1170Sstevel@tonic-gate NFS4ERR_ATTRNOTSUPP = 10032,/* recommended attr not sup*/ 1180Sstevel@tonic-gate NFS4ERR_NO_GRACE = 10033,/* reclaim outside of grace*/ 1190Sstevel@tonic-gate NFS4ERR_RECLAIM_BAD = 10034,/* reclaim error at server */ 1200Sstevel@tonic-gate NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim */ 1210Sstevel@tonic-gate NFS4ERR_BADXDR = 10036,/* XDR decode failed */ 1220Sstevel@tonic-gate NFS4ERR_LOCKS_HELD = 10037,/* file locks held at CLOSE*/ 1230Sstevel@tonic-gate NFS4ERR_OPENMODE = 10038,/* conflict in OPEN and I/O*/ 1240Sstevel@tonic-gate NFS4ERR_BADOWNER = 10039,/* owner translation bad */ 1250Sstevel@tonic-gate NFS4ERR_BADCHAR = 10040,/* utf-8 char not supported*/ 1260Sstevel@tonic-gate NFS4ERR_BADNAME = 10041,/* name not supported */ 1270Sstevel@tonic-gate NFS4ERR_BAD_RANGE = 10042,/* lock range not supported*/ 1280Sstevel@tonic-gate NFS4ERR_LOCK_NOTSUPP = 10043,/* no atomic up/downgrade */ 1290Sstevel@tonic-gate NFS4ERR_OP_ILLEGAL = 10044,/* undefined operation */ 1300Sstevel@tonic-gate NFS4ERR_DEADLOCK = 10045,/* file locking deadlock */ 1310Sstevel@tonic-gate NFS4ERR_FILE_OPEN = 10046,/* open file blocks op. */ 1320Sstevel@tonic-gate NFS4ERR_ADMIN_REVOKED = 10047,/* lockowner state revoked */ 1330Sstevel@tonic-gate NFS4ERR_CB_PATH_DOWN = 10048 /* callback path down */ 1340Sstevel@tonic-gate }; 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* 1370Sstevel@tonic-gate * Basic data types 1380Sstevel@tonic-gate */ 1390Sstevel@tonic-gate typedef uint32_t bitmap4<>; 1400Sstevel@tonic-gate typedef uint64_t offset4; 1410Sstevel@tonic-gate typedef uint32_t count4; 1420Sstevel@tonic-gate typedef uint64_t length4; 1430Sstevel@tonic-gate typedef uint64_t clientid4; 1440Sstevel@tonic-gate typedef uint32_t seqid4; 1450Sstevel@tonic-gate typedef opaque utf8string<>; 1460Sstevel@tonic-gate typedef utf8string utf8str_cis; 1470Sstevel@tonic-gate typedef utf8string utf8str_cs; 1480Sstevel@tonic-gate typedef utf8string utf8str_mixed; 1490Sstevel@tonic-gate typedef utf8str_cs component4; 1500Sstevel@tonic-gate typedef component4 pathname4<>; 1510Sstevel@tonic-gate typedef uint64_t nfs_lockid4; 1520Sstevel@tonic-gate typedef uint64_t nfs_cookie4; 1530Sstevel@tonic-gate typedef utf8str_cs linktext4; 1540Sstevel@tonic-gate typedef opaque sec_oid4<>; 1550Sstevel@tonic-gate typedef uint32_t qop4; 1560Sstevel@tonic-gate typedef uint32_t mode4; 1570Sstevel@tonic-gate typedef uint64_t changeid4; 1580Sstevel@tonic-gate typedef opaque verifier4[NFS4_VERIFIER_SIZE]; 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate /* 1610Sstevel@tonic-gate * Timeval 1620Sstevel@tonic-gate */ 1630Sstevel@tonic-gate struct nfstime4 { 1640Sstevel@tonic-gate int64_t seconds; 1650Sstevel@tonic-gate uint32_t nseconds; 1660Sstevel@tonic-gate }; 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate enum time_how4 { 1690Sstevel@tonic-gate SET_TO_SERVER_TIME4 = 0, 1700Sstevel@tonic-gate SET_TO_CLIENT_TIME4 = 1 1710Sstevel@tonic-gate }; 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate union settime4 switch (time_how4 set_it) { 1740Sstevel@tonic-gate case SET_TO_CLIENT_TIME4: 1750Sstevel@tonic-gate nfstime4 time; 1760Sstevel@tonic-gate default: 1770Sstevel@tonic-gate void; 1780Sstevel@tonic-gate }; 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate /* 1810Sstevel@tonic-gate * File access handle 1820Sstevel@tonic-gate */ 1830Sstevel@tonic-gate typedef opaque nfs_fh4<NFS4_FHSIZE>; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate 1860Sstevel@tonic-gate /* 1870Sstevel@tonic-gate * File attribute definitions 1880Sstevel@tonic-gate */ 1890Sstevel@tonic-gate 1900Sstevel@tonic-gate /* 1910Sstevel@tonic-gate * FSID structure for major/minor 1920Sstevel@tonic-gate */ 1930Sstevel@tonic-gate struct fsid4 { 1940Sstevel@tonic-gate uint64_t major; 1950Sstevel@tonic-gate uint64_t minor; 1960Sstevel@tonic-gate }; 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate /* 1990Sstevel@tonic-gate * Filesystem locations attribute for relocation/migration 2000Sstevel@tonic-gate */ 2010Sstevel@tonic-gate struct fs_location4 { 2020Sstevel@tonic-gate utf8str_cis server<>; 2030Sstevel@tonic-gate pathname4 rootpath; 2040Sstevel@tonic-gate }; 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate struct fs_locations4 { 2070Sstevel@tonic-gate pathname4 fs_root; 2080Sstevel@tonic-gate fs_location4 locations<>; 2090Sstevel@tonic-gate }; 2100Sstevel@tonic-gate 211*11291SRobert.Thurlow@Sun.COM struct nfs_fsl_info { 212*11291SRobert.Thurlow@Sun.COM uint_t netbuf_len; 213*11291SRobert.Thurlow@Sun.COM uint_t netnm_len; 214*11291SRobert.Thurlow@Sun.COM uint_t knconf_len; 215*11291SRobert.Thurlow@Sun.COM string netname<MAXNETNAMELEN>; 216*11291SRobert.Thurlow@Sun.COM struct netbuf *addr; 217*11291SRobert.Thurlow@Sun.COM struct knetconfig *knconf; 218*11291SRobert.Thurlow@Sun.COM }; 219*11291SRobert.Thurlow@Sun.COM 220*11291SRobert.Thurlow@Sun.COM 2210Sstevel@tonic-gate /* 2220Sstevel@tonic-gate * Various Access Control Entry definitions 2230Sstevel@tonic-gate */ 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate /* 2260Sstevel@tonic-gate * Mask that indicates which Access Control Entries are supported. 2270Sstevel@tonic-gate * Values for the fattr4_aclsupport attribute. 2280Sstevel@tonic-gate */ 2290Sstevel@tonic-gate const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; 2300Sstevel@tonic-gate const ACL4_SUPPORT_DENY_ACL = 0x00000002; 2310Sstevel@tonic-gate const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; 2320Sstevel@tonic-gate const ACL4_SUPPORT_ALARM_ACL = 0x00000008; 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate typedef uint32_t acetype4; 2360Sstevel@tonic-gate 2370Sstevel@tonic-gate /* 2380Sstevel@tonic-gate * acetype4 values, others can be added as needed. 2390Sstevel@tonic-gate */ 2400Sstevel@tonic-gate const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; 2410Sstevel@tonic-gate const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; 2420Sstevel@tonic-gate const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; 2430Sstevel@tonic-gate const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate /* 2470Sstevel@tonic-gate * ACE flag 2480Sstevel@tonic-gate */ 2490Sstevel@tonic-gate typedef uint32_t aceflag4; 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate /* 2520Sstevel@tonic-gate * ACE flag values 2530Sstevel@tonic-gate */ 2540Sstevel@tonic-gate const ACE4_FILE_INHERIT_ACE = 0x00000001; 2550Sstevel@tonic-gate const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; 2560Sstevel@tonic-gate const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; 2570Sstevel@tonic-gate const ACE4_INHERIT_ONLY_ACE = 0x00000008; 2580Sstevel@tonic-gate const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; 2590Sstevel@tonic-gate const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; 2600Sstevel@tonic-gate const ACE4_IDENTIFIER_GROUP = 0x00000040; 2610Sstevel@tonic-gate 2620Sstevel@tonic-gate 2630Sstevel@tonic-gate /* 2640Sstevel@tonic-gate * ACE mask 2650Sstevel@tonic-gate */ 2660Sstevel@tonic-gate typedef uint32_t acemask4; 2670Sstevel@tonic-gate 2680Sstevel@tonic-gate /* 2690Sstevel@tonic-gate * ACE mask values 2700Sstevel@tonic-gate */ 2710Sstevel@tonic-gate const ACE4_READ_DATA = 0x00000001; 2720Sstevel@tonic-gate const ACE4_LIST_DIRECTORY = 0x00000001; 2730Sstevel@tonic-gate const ACE4_WRITE_DATA = 0x00000002; 2740Sstevel@tonic-gate const ACE4_ADD_FILE = 0x00000002; 2750Sstevel@tonic-gate const ACE4_APPEND_DATA = 0x00000004; 2760Sstevel@tonic-gate const ACE4_ADD_SUBDIRECTORY = 0x00000004; 2770Sstevel@tonic-gate const ACE4_READ_NAMED_ATTRS = 0x00000008; 2780Sstevel@tonic-gate const ACE4_WRITE_NAMED_ATTRS = 0x00000010; 2790Sstevel@tonic-gate const ACE4_EXECUTE = 0x00000020; 2800Sstevel@tonic-gate const ACE4_DELETE_CHILD = 0x00000040; 2810Sstevel@tonic-gate const ACE4_READ_ATTRIBUTES = 0x00000080; 2820Sstevel@tonic-gate const ACE4_WRITE_ATTRIBUTES = 0x00000100; 2830Sstevel@tonic-gate 2840Sstevel@tonic-gate const ACE4_DELETE = 0x00010000; 2850Sstevel@tonic-gate const ACE4_READ_ACL = 0x00020000; 2860Sstevel@tonic-gate const ACE4_WRITE_ACL = 0x00040000; 2870Sstevel@tonic-gate const ACE4_WRITE_OWNER = 0x00080000; 2880Sstevel@tonic-gate const ACE4_SYNCHRONIZE = 0x00100000; 2890Sstevel@tonic-gate 2900Sstevel@tonic-gate /* 2910Sstevel@tonic-gate * ACE4_GENERIC_READ -- defined as combination of 2920Sstevel@tonic-gate * ACE4_READ_ACL | 2930Sstevel@tonic-gate * ACE4_READ_DATA | 2940Sstevel@tonic-gate * ACE4_READ_ATTRIBUTES | 2950Sstevel@tonic-gate * ACE4_SYNCHRONIZE 2960Sstevel@tonic-gate */ 2970Sstevel@tonic-gate 2980Sstevel@tonic-gate const ACE4_GENERIC_READ = 0x00120081; 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate /* 3010Sstevel@tonic-gate * ACE4_GENERIC_WRITE -- defined as combination of 3020Sstevel@tonic-gate * ACE4_READ_ACL | 3030Sstevel@tonic-gate * ACE4_WRITE_DATA | 3040Sstevel@tonic-gate * ACE4_WRITE_ATTRIBUTES | 3050Sstevel@tonic-gate * ACE4_WRITE_ACL | 3060Sstevel@tonic-gate * ACE4_APPEND_DATA | 3070Sstevel@tonic-gate * ACE4_SYNCHRONIZE 3080Sstevel@tonic-gate */ 3090Sstevel@tonic-gate const ACE4_GENERIC_WRITE = 0x00160106; 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate 3120Sstevel@tonic-gate /* 3130Sstevel@tonic-gate * ACE4_GENERIC_EXECUTE -- defined as combination of 3140Sstevel@tonic-gate * ACE4_READ_ACL 3150Sstevel@tonic-gate * ACE4_READ_ATTRIBUTES 3160Sstevel@tonic-gate * ACE4_EXECUTE 3170Sstevel@tonic-gate * ACE4_SYNCHRONIZE 3180Sstevel@tonic-gate */ 3190Sstevel@tonic-gate const ACE4_GENERIC_EXECUTE = 0x001200A0; 3200Sstevel@tonic-gate 3210Sstevel@tonic-gate 3220Sstevel@tonic-gate /* 3230Sstevel@tonic-gate * Access Control Entry definition 3240Sstevel@tonic-gate */ 3250Sstevel@tonic-gate struct nfsace4 { 3260Sstevel@tonic-gate acetype4 type; 3270Sstevel@tonic-gate aceflag4 flag; 3280Sstevel@tonic-gate acemask4 access_mask; 3290Sstevel@tonic-gate utf8str_mixed who; 3300Sstevel@tonic-gate }; 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate /* 3330Sstevel@tonic-gate * Field definitions for the fattr4_mode attribute 3340Sstevel@tonic-gate */ 3350Sstevel@tonic-gate const MODE4_SUID = 0x800; /* set user id on execution */ 3360Sstevel@tonic-gate const MODE4_SGID = 0x400; /* set group id on execution */ 3370Sstevel@tonic-gate const MODE4_SVTX = 0x200; /* save text even after use */ 3380Sstevel@tonic-gate const MODE4_RUSR = 0x100; /* read permission: owner */ 3390Sstevel@tonic-gate const MODE4_WUSR = 0x080; /* write permission: owner */ 3400Sstevel@tonic-gate const MODE4_XUSR = 0x040; /* execute permission: owner */ 3410Sstevel@tonic-gate const MODE4_RGRP = 0x020; /* read permission: group */ 3420Sstevel@tonic-gate const MODE4_WGRP = 0x010; /* write permission: group */ 3430Sstevel@tonic-gate const MODE4_XGRP = 0x008; /* execute permission: group */ 3440Sstevel@tonic-gate const MODE4_ROTH = 0x004; /* read permission: other */ 3450Sstevel@tonic-gate const MODE4_WOTH = 0x002; /* write permission: other */ 3460Sstevel@tonic-gate const MODE4_XOTH = 0x001; /* execute permission: other */ 3470Sstevel@tonic-gate 3480Sstevel@tonic-gate /* 3490Sstevel@tonic-gate * Special data/attribute associated with 3500Sstevel@tonic-gate * file types NF4BLK and NF4CHR. 3510Sstevel@tonic-gate */ 3520Sstevel@tonic-gate struct specdata4 { 3530Sstevel@tonic-gate uint32_t specdata1; /* major device number */ 3540Sstevel@tonic-gate uint32_t specdata2; /* minor device number */ 3550Sstevel@tonic-gate }; 3560Sstevel@tonic-gate 3570Sstevel@tonic-gate /* 3580Sstevel@tonic-gate * Values for fattr4_fh_expire_type 3590Sstevel@tonic-gate */ 3600Sstevel@tonic-gate const FH4_PERSISTENT = 0x00000000; 3610Sstevel@tonic-gate const FH4_NOEXPIRE_WITH_OPEN = 0x00000001; 3620Sstevel@tonic-gate const FH4_VOLATILE_ANY = 0x00000002; 3630Sstevel@tonic-gate const FH4_VOL_MIGRATION = 0x00000004; 3640Sstevel@tonic-gate const FH4_VOL_RENAME = 0x00000008; 3650Sstevel@tonic-gate 3660Sstevel@tonic-gate 3670Sstevel@tonic-gate typedef bitmap4 fattr4_supported_attrs; 3680Sstevel@tonic-gate typedef nfs_ftype4 fattr4_type; 3690Sstevel@tonic-gate typedef uint32_t fattr4_fh_expire_type; 3700Sstevel@tonic-gate typedef changeid4 fattr4_change; 3710Sstevel@tonic-gate typedef uint64_t fattr4_size; 3720Sstevel@tonic-gate typedef bool fattr4_link_support; 3730Sstevel@tonic-gate typedef bool fattr4_symlink_support; 3740Sstevel@tonic-gate typedef bool fattr4_named_attr; 3750Sstevel@tonic-gate typedef fsid4 fattr4_fsid; 3760Sstevel@tonic-gate typedef bool fattr4_unique_handles; 3770Sstevel@tonic-gate typedef uint32_t fattr4_lease_time; 3780Sstevel@tonic-gate typedef nfsstat4 fattr4_rdattr_error; 3790Sstevel@tonic-gate 3800Sstevel@tonic-gate typedef nfsace4 fattr4_acl<>; 3810Sstevel@tonic-gate typedef uint32_t fattr4_aclsupport; 3820Sstevel@tonic-gate typedef bool fattr4_archive; 3830Sstevel@tonic-gate typedef bool fattr4_cansettime; 3840Sstevel@tonic-gate typedef bool fattr4_case_insensitive; 3850Sstevel@tonic-gate typedef bool fattr4_case_preserving; 3860Sstevel@tonic-gate typedef bool fattr4_chown_restricted; 3870Sstevel@tonic-gate typedef uint64_t fattr4_fileid; 3880Sstevel@tonic-gate typedef uint64_t fattr4_files_avail; 3890Sstevel@tonic-gate typedef nfs_fh4 fattr4_filehandle; 3900Sstevel@tonic-gate typedef uint64_t fattr4_files_free; 3910Sstevel@tonic-gate typedef uint64_t fattr4_files_total; 3920Sstevel@tonic-gate typedef fs_locations4 fattr4_fs_locations; 3930Sstevel@tonic-gate typedef bool fattr4_hidden; 3940Sstevel@tonic-gate typedef bool fattr4_homogeneous; 3950Sstevel@tonic-gate typedef uint64_t fattr4_maxfilesize; 3960Sstevel@tonic-gate typedef uint32_t fattr4_maxlink; 3970Sstevel@tonic-gate typedef uint32_t fattr4_maxname; 3980Sstevel@tonic-gate typedef uint64_t fattr4_maxread; 3990Sstevel@tonic-gate typedef uint64_t fattr4_maxwrite; 4000Sstevel@tonic-gate typedef utf8str_cs fattr4_mimetype; 4010Sstevel@tonic-gate typedef mode4 fattr4_mode; 4020Sstevel@tonic-gate typedef uint64_t fattr4_mounted_on_fileid; 4030Sstevel@tonic-gate typedef bool fattr4_no_trunc; 4040Sstevel@tonic-gate typedef uint32_t fattr4_numlinks; 4050Sstevel@tonic-gate typedef utf8str_mixed fattr4_owner; 4060Sstevel@tonic-gate typedef utf8str_mixed fattr4_owner_group; 4070Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_hard; 4080Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_soft; 4090Sstevel@tonic-gate typedef uint64_t fattr4_quota_used; 4100Sstevel@tonic-gate typedef specdata4 fattr4_rawdev; 4110Sstevel@tonic-gate typedef uint64_t fattr4_space_avail; 4120Sstevel@tonic-gate typedef uint64_t fattr4_space_free; 4130Sstevel@tonic-gate typedef uint64_t fattr4_space_total; 4140Sstevel@tonic-gate typedef uint64_t fattr4_space_used; 4150Sstevel@tonic-gate typedef bool fattr4_system; 4160Sstevel@tonic-gate typedef nfstime4 fattr4_time_access; 4170Sstevel@tonic-gate typedef settime4 fattr4_time_access_set; 4180Sstevel@tonic-gate typedef nfstime4 fattr4_time_backup; 4190Sstevel@tonic-gate typedef nfstime4 fattr4_time_create; 4200Sstevel@tonic-gate typedef nfstime4 fattr4_time_delta; 4210Sstevel@tonic-gate typedef nfstime4 fattr4_time_metadata; 4220Sstevel@tonic-gate typedef nfstime4 fattr4_time_modify; 4230Sstevel@tonic-gate typedef settime4 fattr4_time_modify_set; 4240Sstevel@tonic-gate 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate /* 4270Sstevel@tonic-gate * Mandatory Attributes 4280Sstevel@tonic-gate */ 4290Sstevel@tonic-gate const FATTR4_SUPPORTED_ATTRS = 0; 4300Sstevel@tonic-gate const FATTR4_TYPE = 1; 4310Sstevel@tonic-gate const FATTR4_FH_EXPIRE_TYPE = 2; 4320Sstevel@tonic-gate const FATTR4_CHANGE = 3; 4330Sstevel@tonic-gate const FATTR4_SIZE = 4; 4340Sstevel@tonic-gate const FATTR4_LINK_SUPPORT = 5; 4350Sstevel@tonic-gate const FATTR4_SYMLINK_SUPPORT = 6; 4360Sstevel@tonic-gate const FATTR4_NAMED_ATTR = 7; 4370Sstevel@tonic-gate const FATTR4_FSID = 8; 4380Sstevel@tonic-gate const FATTR4_UNIQUE_HANDLES = 9; 4390Sstevel@tonic-gate const FATTR4_LEASE_TIME = 10; 4400Sstevel@tonic-gate const FATTR4_RDATTR_ERROR = 11; 4410Sstevel@tonic-gate const FATTR4_FILEHANDLE = 19; 4420Sstevel@tonic-gate 4430Sstevel@tonic-gate /* 4440Sstevel@tonic-gate * Recommended Attributes 4450Sstevel@tonic-gate */ 4460Sstevel@tonic-gate const FATTR4_ACL = 12; 4470Sstevel@tonic-gate const FATTR4_ACLSUPPORT = 13; 4480Sstevel@tonic-gate const FATTR4_ARCHIVE = 14; 4490Sstevel@tonic-gate const FATTR4_CANSETTIME = 15; 4500Sstevel@tonic-gate const FATTR4_CASE_INSENSITIVE = 16; 4510Sstevel@tonic-gate const FATTR4_CASE_PRESERVING = 17; 4520Sstevel@tonic-gate const FATTR4_CHOWN_RESTRICTED = 18; 4530Sstevel@tonic-gate const FATTR4_FILEID = 20; 4540Sstevel@tonic-gate const FATTR4_FILES_AVAIL = 21; 4550Sstevel@tonic-gate const FATTR4_FILES_FREE = 22; 4560Sstevel@tonic-gate const FATTR4_FILES_TOTAL = 23; 4570Sstevel@tonic-gate const FATTR4_FS_LOCATIONS = 24; 4580Sstevel@tonic-gate const FATTR4_HIDDEN = 25; 4590Sstevel@tonic-gate const FATTR4_HOMOGENEOUS = 26; 4600Sstevel@tonic-gate const FATTR4_MAXFILESIZE = 27; 4610Sstevel@tonic-gate const FATTR4_MAXLINK = 28; 4620Sstevel@tonic-gate const FATTR4_MAXNAME = 29; 4630Sstevel@tonic-gate const FATTR4_MAXREAD = 30; 4640Sstevel@tonic-gate const FATTR4_MAXWRITE = 31; 4650Sstevel@tonic-gate const FATTR4_MIMETYPE = 32; 4660Sstevel@tonic-gate const FATTR4_MODE = 33; 4670Sstevel@tonic-gate const FATTR4_NO_TRUNC = 34; 4680Sstevel@tonic-gate const FATTR4_NUMLINKS = 35; 4690Sstevel@tonic-gate const FATTR4_OWNER = 36; 4700Sstevel@tonic-gate const FATTR4_OWNER_GROUP = 37; 4710Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_HARD = 38; 4720Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_SOFT = 39; 4730Sstevel@tonic-gate const FATTR4_QUOTA_USED = 40; 4740Sstevel@tonic-gate const FATTR4_RAWDEV = 41; 4750Sstevel@tonic-gate const FATTR4_SPACE_AVAIL = 42; 4760Sstevel@tonic-gate const FATTR4_SPACE_FREE = 43; 4770Sstevel@tonic-gate const FATTR4_SPACE_TOTAL = 44; 4780Sstevel@tonic-gate const FATTR4_SPACE_USED = 45; 4790Sstevel@tonic-gate const FATTR4_SYSTEM = 46; 4800Sstevel@tonic-gate const FATTR4_TIME_ACCESS = 47; 4810Sstevel@tonic-gate const FATTR4_TIME_ACCESS_SET = 48; 4820Sstevel@tonic-gate const FATTR4_TIME_BACKUP = 49; 4830Sstevel@tonic-gate const FATTR4_TIME_CREATE = 50; 4840Sstevel@tonic-gate const FATTR4_TIME_DELTA = 51; 4850Sstevel@tonic-gate const FATTR4_TIME_METADATA = 52; 4860Sstevel@tonic-gate const FATTR4_TIME_MODIFY = 53; 4870Sstevel@tonic-gate const FATTR4_TIME_MODIFY_SET = 54; 4880Sstevel@tonic-gate const FATTR4_MOUNTED_ON_FILEID = 55; 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate typedef opaque attrlist4<>; 4910Sstevel@tonic-gate 4920Sstevel@tonic-gate /* 4930Sstevel@tonic-gate * File attribute container 4940Sstevel@tonic-gate */ 4950Sstevel@tonic-gate struct fattr4 { 4960Sstevel@tonic-gate bitmap4 attrmask; 4970Sstevel@tonic-gate attrlist4 attr_vals; 4980Sstevel@tonic-gate }; 4990Sstevel@tonic-gate 5000Sstevel@tonic-gate /* 5010Sstevel@tonic-gate * Change info for the client 5020Sstevel@tonic-gate */ 5030Sstevel@tonic-gate struct change_info4 { 5040Sstevel@tonic-gate bool atomic; 5050Sstevel@tonic-gate changeid4 before; 5060Sstevel@tonic-gate changeid4 after; 5070Sstevel@tonic-gate }; 5080Sstevel@tonic-gate 5090Sstevel@tonic-gate struct clientaddr4 { 5100Sstevel@tonic-gate /* see struct rpcb in RFC 1833 */ 5110Sstevel@tonic-gate string r_netid<>; /* network id */ 5120Sstevel@tonic-gate string r_addr<>; /* universal address */ 5130Sstevel@tonic-gate }; 5140Sstevel@tonic-gate 5150Sstevel@tonic-gate /* 5160Sstevel@tonic-gate * Callback program info as provided by the client 5170Sstevel@tonic-gate */ 5180Sstevel@tonic-gate struct cb_client4 { 5190Sstevel@tonic-gate uint32_t cb_program; 5200Sstevel@tonic-gate clientaddr4 cb_location; 5210Sstevel@tonic-gate }; 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate /* 5240Sstevel@tonic-gate * Stateid 5250Sstevel@tonic-gate */ 5260Sstevel@tonic-gate struct stateid4 { 5270Sstevel@tonic-gate uint32_t seqid; 5280Sstevel@tonic-gate opaque other[12]; 5290Sstevel@tonic-gate }; 5300Sstevel@tonic-gate 5310Sstevel@tonic-gate /* 5320Sstevel@tonic-gate * Client ID 5330Sstevel@tonic-gate */ 5340Sstevel@tonic-gate struct nfs_client_id4 { 5350Sstevel@tonic-gate verifier4 verifier; 5360Sstevel@tonic-gate opaque id<NFS4_OPAQUE_LIMIT>; 5370Sstevel@tonic-gate }; 5380Sstevel@tonic-gate 5390Sstevel@tonic-gate struct open_owner4 { 5400Sstevel@tonic-gate clientid4 clientid; 5410Sstevel@tonic-gate opaque owner<NFS4_OPAQUE_LIMIT>; 5420Sstevel@tonic-gate }; 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate struct lock_owner4 { 5450Sstevel@tonic-gate clientid4 clientid; 5460Sstevel@tonic-gate opaque owner<NFS4_OPAQUE_LIMIT>; 5470Sstevel@tonic-gate }; 5480Sstevel@tonic-gate 5490Sstevel@tonic-gate enum nfs_lock_type4 { 5500Sstevel@tonic-gate READ_LT = 1, 5510Sstevel@tonic-gate WRITE_LT = 2, 5520Sstevel@tonic-gate READW_LT = 3, /* blocking read */ 5530Sstevel@tonic-gate WRITEW_LT = 4 /* blocking write */ 5540Sstevel@tonic-gate }; 5550Sstevel@tonic-gate 5560Sstevel@tonic-gate /* 5570Sstevel@tonic-gate * ACCESS: Check access permission 5580Sstevel@tonic-gate */ 5590Sstevel@tonic-gate const ACCESS4_READ = 0x00000001; 5600Sstevel@tonic-gate const ACCESS4_LOOKUP = 0x00000002; 5610Sstevel@tonic-gate const ACCESS4_MODIFY = 0x00000004; 5620Sstevel@tonic-gate const ACCESS4_EXTEND = 0x00000008; 5630Sstevel@tonic-gate const ACCESS4_DELETE = 0x00000010; 5640Sstevel@tonic-gate const ACCESS4_EXECUTE = 0x00000020; 5650Sstevel@tonic-gate 5660Sstevel@tonic-gate struct ACCESS4args { 5670Sstevel@tonic-gate /* CURRENT_FH: object */ 5680Sstevel@tonic-gate uint32_t access; 5690Sstevel@tonic-gate }; 5700Sstevel@tonic-gate 5710Sstevel@tonic-gate struct ACCESS4resok { 5720Sstevel@tonic-gate uint32_t supported; 5730Sstevel@tonic-gate uint32_t access; 5740Sstevel@tonic-gate }; 5750Sstevel@tonic-gate 5760Sstevel@tonic-gate union ACCESS4res switch (nfsstat4 status) { 5770Sstevel@tonic-gate case NFS4_OK: 5780Sstevel@tonic-gate ACCESS4resok resok4; 5790Sstevel@tonic-gate default: 5800Sstevel@tonic-gate void; 5810Sstevel@tonic-gate }; 5820Sstevel@tonic-gate 5830Sstevel@tonic-gate /* 5840Sstevel@tonic-gate * CLOSE: Close a file and release share reservations 5850Sstevel@tonic-gate */ 5860Sstevel@tonic-gate struct CLOSE4args { 5870Sstevel@tonic-gate /* CURRENT_FH: object */ 5880Sstevel@tonic-gate seqid4 seqid; 5890Sstevel@tonic-gate stateid4 open_stateid; 5900Sstevel@tonic-gate }; 5910Sstevel@tonic-gate 5920Sstevel@tonic-gate union CLOSE4res switch (nfsstat4 status) { 5930Sstevel@tonic-gate case NFS4_OK: 5940Sstevel@tonic-gate stateid4 open_stateid; 5950Sstevel@tonic-gate default: 5960Sstevel@tonic-gate void; 5970Sstevel@tonic-gate }; 5980Sstevel@tonic-gate 5990Sstevel@tonic-gate /* 6000Sstevel@tonic-gate * COMMIT: Commit cached data on server to stable storage 6010Sstevel@tonic-gate */ 6020Sstevel@tonic-gate struct COMMIT4args { 6030Sstevel@tonic-gate /* CURRENT_FH: file */ 6040Sstevel@tonic-gate offset4 offset; 6050Sstevel@tonic-gate count4 count; 6060Sstevel@tonic-gate }; 6070Sstevel@tonic-gate 6080Sstevel@tonic-gate struct COMMIT4resok { 6090Sstevel@tonic-gate verifier4 writeverf; 6100Sstevel@tonic-gate }; 6110Sstevel@tonic-gate 6120Sstevel@tonic-gate 6130Sstevel@tonic-gate union COMMIT4res switch (nfsstat4 status) { 6140Sstevel@tonic-gate case NFS4_OK: 6150Sstevel@tonic-gate COMMIT4resok resok4; 6160Sstevel@tonic-gate default: 6170Sstevel@tonic-gate void; 6180Sstevel@tonic-gate }; 6190Sstevel@tonic-gate 6200Sstevel@tonic-gate /* 6210Sstevel@tonic-gate * CREATE: Create a non-regular file 6220Sstevel@tonic-gate */ 6230Sstevel@tonic-gate union createtype4 switch (nfs_ftype4 type) { 6240Sstevel@tonic-gate case NF4LNK: 6250Sstevel@tonic-gate linktext4 linkdata; 6260Sstevel@tonic-gate case NF4BLK: 6270Sstevel@tonic-gate case NF4CHR: 6280Sstevel@tonic-gate specdata4 devdata; 6290Sstevel@tonic-gate case NF4SOCK: 6300Sstevel@tonic-gate case NF4FIFO: 6310Sstevel@tonic-gate case NF4DIR: 6320Sstevel@tonic-gate void; 6330Sstevel@tonic-gate default: 6340Sstevel@tonic-gate void; /* server should return NFS4ERR_BADTYPE */ 6350Sstevel@tonic-gate }; 6360Sstevel@tonic-gate 6370Sstevel@tonic-gate struct CREATE4args { 6380Sstevel@tonic-gate /* CURRENT_FH: directory for creation */ 6390Sstevel@tonic-gate createtype4 objtype; 6400Sstevel@tonic-gate component4 objname; 6410Sstevel@tonic-gate fattr4 createattrs; 6420Sstevel@tonic-gate }; 6430Sstevel@tonic-gate 6440Sstevel@tonic-gate struct CREATE4resok { 6450Sstevel@tonic-gate change_info4 cinfo; 6460Sstevel@tonic-gate bitmap4 attrset; /* attributes set */ 6470Sstevel@tonic-gate }; 6480Sstevel@tonic-gate 6490Sstevel@tonic-gate union CREATE4res switch (nfsstat4 status) { 6500Sstevel@tonic-gate case NFS4_OK: 6510Sstevel@tonic-gate CREATE4resok resok4; 6520Sstevel@tonic-gate default: 6530Sstevel@tonic-gate void; 6540Sstevel@tonic-gate }; 6550Sstevel@tonic-gate 6560Sstevel@tonic-gate /* 6570Sstevel@tonic-gate * DELEGPURGE: Purge Delegations Awaiting Recovery 6580Sstevel@tonic-gate */ 6590Sstevel@tonic-gate struct DELEGPURGE4args { 6600Sstevel@tonic-gate clientid4 clientid; 6610Sstevel@tonic-gate }; 6620Sstevel@tonic-gate 6630Sstevel@tonic-gate struct DELEGPURGE4res { 6640Sstevel@tonic-gate nfsstat4 status; 6650Sstevel@tonic-gate }; 6660Sstevel@tonic-gate 6670Sstevel@tonic-gate /* 6680Sstevel@tonic-gate * DELEGRETURN: Return a delegation 6690Sstevel@tonic-gate */ 6700Sstevel@tonic-gate struct DELEGRETURN4args { 6710Sstevel@tonic-gate /* CURRENT_FH: delegated file */ 6720Sstevel@tonic-gate stateid4 deleg_stateid; 6730Sstevel@tonic-gate }; 6740Sstevel@tonic-gate 6750Sstevel@tonic-gate struct DELEGRETURN4res { 6760Sstevel@tonic-gate nfsstat4 status; 6770Sstevel@tonic-gate }; 6780Sstevel@tonic-gate 6790Sstevel@tonic-gate /* 6800Sstevel@tonic-gate * GETATTR: Get file attributes 6810Sstevel@tonic-gate */ 6820Sstevel@tonic-gate struct GETATTR4args { 6830Sstevel@tonic-gate /* CURRENT_FH: directory or file */ 6840Sstevel@tonic-gate bitmap4 attr_request; 6850Sstevel@tonic-gate }; 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate struct GETATTR4resok { 6880Sstevel@tonic-gate fattr4 obj_attributes; 6890Sstevel@tonic-gate }; 6900Sstevel@tonic-gate 6910Sstevel@tonic-gate union GETATTR4res switch (nfsstat4 status) { 6920Sstevel@tonic-gate case NFS4_OK: 6930Sstevel@tonic-gate GETATTR4resok resok4; 6940Sstevel@tonic-gate default: 6950Sstevel@tonic-gate void; 6960Sstevel@tonic-gate }; 6970Sstevel@tonic-gate 6980Sstevel@tonic-gate /* 6990Sstevel@tonic-gate * GETFH: Get current filehandle 7000Sstevel@tonic-gate */ 7010Sstevel@tonic-gate struct GETFH4resok { 7020Sstevel@tonic-gate nfs_fh4 object; 7030Sstevel@tonic-gate }; 7040Sstevel@tonic-gate 7050Sstevel@tonic-gate union GETFH4res switch (nfsstat4 status) { 7060Sstevel@tonic-gate case NFS4_OK: 7070Sstevel@tonic-gate GETFH4resok resok4; 7080Sstevel@tonic-gate default: 7090Sstevel@tonic-gate void; 7100Sstevel@tonic-gate }; 7110Sstevel@tonic-gate 7120Sstevel@tonic-gate /* 7130Sstevel@tonic-gate * LINK: Create link to an object 7140Sstevel@tonic-gate */ 7150Sstevel@tonic-gate struct LINK4args { 7160Sstevel@tonic-gate /* SAVED_FH: source object */ 7170Sstevel@tonic-gate /* CURRENT_FH: target directory */ 7180Sstevel@tonic-gate component4 newname; 7190Sstevel@tonic-gate }; 7200Sstevel@tonic-gate 7210Sstevel@tonic-gate struct LINK4resok { 7220Sstevel@tonic-gate change_info4 cinfo; 7230Sstevel@tonic-gate }; 7240Sstevel@tonic-gate 7250Sstevel@tonic-gate union LINK4res switch (nfsstat4 status) { 7260Sstevel@tonic-gate case NFS4_OK: 7270Sstevel@tonic-gate LINK4resok resok4; 7280Sstevel@tonic-gate default: 7290Sstevel@tonic-gate void; 7300Sstevel@tonic-gate }; 7310Sstevel@tonic-gate 7320Sstevel@tonic-gate /* 7330Sstevel@tonic-gate * For LOCK, transition from open_owner to new lock_owner 7340Sstevel@tonic-gate */ 7350Sstevel@tonic-gate struct open_to_lock_owner4 { 7360Sstevel@tonic-gate seqid4 open_seqid; 7370Sstevel@tonic-gate stateid4 open_stateid; 7380Sstevel@tonic-gate seqid4 lock_seqid; 7390Sstevel@tonic-gate lock_owner4 lock_owner; 7400Sstevel@tonic-gate }; 7410Sstevel@tonic-gate 7420Sstevel@tonic-gate /* 7430Sstevel@tonic-gate * For LOCK, existing lock_owner continues to request file locks 7440Sstevel@tonic-gate */ 7450Sstevel@tonic-gate struct exist_lock_owner4 { 7460Sstevel@tonic-gate stateid4 lock_stateid; 7470Sstevel@tonic-gate seqid4 lock_seqid; 7480Sstevel@tonic-gate }; 7490Sstevel@tonic-gate 7500Sstevel@tonic-gate union locker4 switch (bool new_lock_owner) { 7510Sstevel@tonic-gate case TRUE: 7520Sstevel@tonic-gate open_to_lock_owner4 open_owner; 7530Sstevel@tonic-gate case FALSE: 7540Sstevel@tonic-gate exist_lock_owner4 lock_owner; 7550Sstevel@tonic-gate }; 7560Sstevel@tonic-gate 7570Sstevel@tonic-gate /* 7580Sstevel@tonic-gate * LOCK/LOCKT/LOCKU: Record lock management 7590Sstevel@tonic-gate */ 7600Sstevel@tonic-gate struct LOCK4args { 7610Sstevel@tonic-gate /* CURRENT_FH: file */ 7620Sstevel@tonic-gate nfs_lock_type4 locktype; 7630Sstevel@tonic-gate bool reclaim; 7640Sstevel@tonic-gate offset4 offset; 7650Sstevel@tonic-gate length4 length; 7660Sstevel@tonic-gate locker4 locker; 7670Sstevel@tonic-gate }; 7680Sstevel@tonic-gate 7690Sstevel@tonic-gate struct LOCK4denied { 7700Sstevel@tonic-gate offset4 offset; 7710Sstevel@tonic-gate length4 length; 7720Sstevel@tonic-gate nfs_lock_type4 locktype; 7730Sstevel@tonic-gate lock_owner4 owner; 7740Sstevel@tonic-gate }; 7750Sstevel@tonic-gate 7760Sstevel@tonic-gate struct LOCK4resok { 7770Sstevel@tonic-gate stateid4 lock_stateid; 7780Sstevel@tonic-gate }; 7790Sstevel@tonic-gate 7800Sstevel@tonic-gate union LOCK4res switch (nfsstat4 status) { 7810Sstevel@tonic-gate case NFS4_OK: 7820Sstevel@tonic-gate LOCK4resok resok4; 7830Sstevel@tonic-gate case NFS4ERR_DENIED: 7840Sstevel@tonic-gate LOCK4denied denied; 7850Sstevel@tonic-gate default: 7860Sstevel@tonic-gate void; 7870Sstevel@tonic-gate }; 7880Sstevel@tonic-gate 7890Sstevel@tonic-gate struct LOCKT4args { 7900Sstevel@tonic-gate /* CURRENT_FH: file */ 7910Sstevel@tonic-gate nfs_lock_type4 locktype; 7920Sstevel@tonic-gate offset4 offset; 7930Sstevel@tonic-gate length4 length; 7940Sstevel@tonic-gate lock_owner4 owner; 7950Sstevel@tonic-gate }; 7960Sstevel@tonic-gate 7970Sstevel@tonic-gate union LOCKT4res switch (nfsstat4 status) { 7980Sstevel@tonic-gate case NFS4ERR_DENIED: 7990Sstevel@tonic-gate LOCK4denied denied; 8000Sstevel@tonic-gate case NFS4_OK: 8010Sstevel@tonic-gate void; 8020Sstevel@tonic-gate default: 8030Sstevel@tonic-gate void; 8040Sstevel@tonic-gate }; 8050Sstevel@tonic-gate 8060Sstevel@tonic-gate struct LOCKU4args { 8070Sstevel@tonic-gate /* CURRENT_FH: file */ 8080Sstevel@tonic-gate nfs_lock_type4 locktype; 8090Sstevel@tonic-gate seqid4 seqid; 8100Sstevel@tonic-gate stateid4 lock_stateid; 8110Sstevel@tonic-gate offset4 offset; 8120Sstevel@tonic-gate length4 length; 8130Sstevel@tonic-gate }; 8140Sstevel@tonic-gate 8150Sstevel@tonic-gate union LOCKU4res switch (nfsstat4 status) { 8160Sstevel@tonic-gate case NFS4_OK: 8170Sstevel@tonic-gate stateid4 lock_stateid; 8180Sstevel@tonic-gate default: 8190Sstevel@tonic-gate void; 8200Sstevel@tonic-gate }; 8210Sstevel@tonic-gate 8220Sstevel@tonic-gate /* 8230Sstevel@tonic-gate * LOOKUP: Lookup filename 8240Sstevel@tonic-gate */ 8250Sstevel@tonic-gate struct LOOKUP4args { 8260Sstevel@tonic-gate /* CURRENT_FH: directory */ 8270Sstevel@tonic-gate component4 objname; 8280Sstevel@tonic-gate }; 8290Sstevel@tonic-gate 8300Sstevel@tonic-gate struct LOOKUP4res { 8310Sstevel@tonic-gate /* CURRENT_FH: object */ 8320Sstevel@tonic-gate nfsstat4 status; 8330Sstevel@tonic-gate }; 8340Sstevel@tonic-gate 8350Sstevel@tonic-gate /* 8360Sstevel@tonic-gate * LOOKUPP: Lookup parent directory 8370Sstevel@tonic-gate */ 8380Sstevel@tonic-gate struct LOOKUPP4res { 8390Sstevel@tonic-gate /* CURRENT_FH: directory */ 8400Sstevel@tonic-gate nfsstat4 status; 8410Sstevel@tonic-gate }; 8420Sstevel@tonic-gate 8430Sstevel@tonic-gate /* 8440Sstevel@tonic-gate * NVERIFY: Verify attributes different 8450Sstevel@tonic-gate */ 8460Sstevel@tonic-gate struct NVERIFY4args { 8470Sstevel@tonic-gate /* CURRENT_FH: object */ 8480Sstevel@tonic-gate fattr4 obj_attributes; 8490Sstevel@tonic-gate }; 8500Sstevel@tonic-gate 8510Sstevel@tonic-gate struct NVERIFY4res { 8520Sstevel@tonic-gate nfsstat4 status; 8530Sstevel@tonic-gate }; 8540Sstevel@tonic-gate 8550Sstevel@tonic-gate /* 8560Sstevel@tonic-gate * Various definitions for OPEN 8570Sstevel@tonic-gate */ 8580Sstevel@tonic-gate enum createmode4 { 8590Sstevel@tonic-gate UNCHECKED4 = 0, 8600Sstevel@tonic-gate GUARDED4 = 1, 8610Sstevel@tonic-gate EXCLUSIVE4 = 2 8620Sstevel@tonic-gate }; 8630Sstevel@tonic-gate 8640Sstevel@tonic-gate union createhow4 switch (createmode4 mode) { 8650Sstevel@tonic-gate case UNCHECKED4: 8660Sstevel@tonic-gate case GUARDED4: 8670Sstevel@tonic-gate fattr4 createattrs; 8680Sstevel@tonic-gate case EXCLUSIVE4: 8690Sstevel@tonic-gate verifier4 createverf; 8700Sstevel@tonic-gate }; 8710Sstevel@tonic-gate 8720Sstevel@tonic-gate enum opentype4 { 8730Sstevel@tonic-gate OPEN4_NOCREATE = 0, 8740Sstevel@tonic-gate OPEN4_CREATE = 1 8750Sstevel@tonic-gate }; 8760Sstevel@tonic-gate 8770Sstevel@tonic-gate union openflag4 switch (opentype4 opentype) { 8780Sstevel@tonic-gate case OPEN4_CREATE: 8790Sstevel@tonic-gate createhow4 how; 8800Sstevel@tonic-gate default: 8810Sstevel@tonic-gate void; 8820Sstevel@tonic-gate }; 8830Sstevel@tonic-gate 8840Sstevel@tonic-gate /* Next definitions used for OPEN delegation */ 8850Sstevel@tonic-gate enum limit_by4 { 8860Sstevel@tonic-gate NFS_LIMIT_SIZE = 1, 8870Sstevel@tonic-gate NFS_LIMIT_BLOCKS = 2 8880Sstevel@tonic-gate /* others as needed */ 8890Sstevel@tonic-gate }; 8900Sstevel@tonic-gate 8910Sstevel@tonic-gate struct nfs_modified_limit4 { 8920Sstevel@tonic-gate uint32_t num_blocks; 8930Sstevel@tonic-gate uint32_t bytes_per_block; 8940Sstevel@tonic-gate }; 8950Sstevel@tonic-gate 8960Sstevel@tonic-gate union nfs_space_limit4 switch (limit_by4 limitby) { 8970Sstevel@tonic-gate /* limit specified as file size */ 8980Sstevel@tonic-gate case NFS_LIMIT_SIZE: 8990Sstevel@tonic-gate uint64_t filesize; 9000Sstevel@tonic-gate /* limit specified by number of blocks */ 9010Sstevel@tonic-gate case NFS_LIMIT_BLOCKS: 9020Sstevel@tonic-gate nfs_modified_limit4 mod_blocks; 9030Sstevel@tonic-gate } ; 9040Sstevel@tonic-gate 9050Sstevel@tonic-gate /* 9060Sstevel@tonic-gate * Share Access and Deny constants for open argument 9070Sstevel@tonic-gate */ 9080Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_READ = 0x00000001; 9090Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; 9100Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; 9110Sstevel@tonic-gate 9120Sstevel@tonic-gate const OPEN4_SHARE_DENY_NONE = 0x00000000; 9130Sstevel@tonic-gate const OPEN4_SHARE_DENY_READ = 0x00000001; 9140Sstevel@tonic-gate const OPEN4_SHARE_DENY_WRITE = 0x00000002; 9150Sstevel@tonic-gate const OPEN4_SHARE_DENY_BOTH = 0x00000003; 9160Sstevel@tonic-gate 9170Sstevel@tonic-gate enum open_delegation_type4 { 9180Sstevel@tonic-gate OPEN_DELEGATE_NONE = 0, 9190Sstevel@tonic-gate OPEN_DELEGATE_READ = 1, 9200Sstevel@tonic-gate OPEN_DELEGATE_WRITE = 2 9210Sstevel@tonic-gate }; 9220Sstevel@tonic-gate 9230Sstevel@tonic-gate enum open_claim_type4 { 9240Sstevel@tonic-gate CLAIM_NULL = 0, 9250Sstevel@tonic-gate CLAIM_PREVIOUS = 1, 9260Sstevel@tonic-gate CLAIM_DELEGATE_CUR = 2, 9270Sstevel@tonic-gate CLAIM_DELEGATE_PREV = 3 9280Sstevel@tonic-gate }; 9290Sstevel@tonic-gate 9300Sstevel@tonic-gate struct open_claim_delegate_cur4 { 9310Sstevel@tonic-gate stateid4 delegate_stateid; 9320Sstevel@tonic-gate component4 file; 9330Sstevel@tonic-gate }; 9340Sstevel@tonic-gate 9350Sstevel@tonic-gate union open_claim4 switch (open_claim_type4 claim) { 9360Sstevel@tonic-gate /* 9370Sstevel@tonic-gate * No special rights to file. Ordinary OPEN of the specified file. 9380Sstevel@tonic-gate */ 9390Sstevel@tonic-gate case CLAIM_NULL: 9400Sstevel@tonic-gate /* CURRENT_FH: directory */ 9410Sstevel@tonic-gate component4 file; 9420Sstevel@tonic-gate 9430Sstevel@tonic-gate /* 9440Sstevel@tonic-gate * Right to the file established by an open previous to server 9450Sstevel@tonic-gate * reboot. File identified by filehandle obtained at that time 9460Sstevel@tonic-gate * rather than by name. 9470Sstevel@tonic-gate */ 9480Sstevel@tonic-gate case CLAIM_PREVIOUS: 9490Sstevel@tonic-gate /* CURRENT_FH: file being reclaimed */ 9500Sstevel@tonic-gate open_delegation_type4 delegate_type; 9510Sstevel@tonic-gate 9520Sstevel@tonic-gate /* 9530Sstevel@tonic-gate * Right to file based on a delegation granted by the server. 9540Sstevel@tonic-gate * File is specified by name. 9550Sstevel@tonic-gate */ 9560Sstevel@tonic-gate case CLAIM_DELEGATE_CUR: 9570Sstevel@tonic-gate /* CURRENT_FH: directory */ 9580Sstevel@tonic-gate open_claim_delegate_cur4 delegate_cur_info; 9590Sstevel@tonic-gate 9600Sstevel@tonic-gate /* Right to file based on a delegation granted to a previous boot 9610Sstevel@tonic-gate * instance of the client. File is specified by name. 9620Sstevel@tonic-gate */ 9630Sstevel@tonic-gate case CLAIM_DELEGATE_PREV: 9640Sstevel@tonic-gate /* CURRENT_FH: directory */ 9650Sstevel@tonic-gate component4 file_delegate_prev; 9660Sstevel@tonic-gate }; 9670Sstevel@tonic-gate 9680Sstevel@tonic-gate /* 9690Sstevel@tonic-gate * OPEN: Open a file, potentially receiving an open delegation 9700Sstevel@tonic-gate */ 9710Sstevel@tonic-gate struct OPEN4args { 9720Sstevel@tonic-gate seqid4 seqid; 9730Sstevel@tonic-gate uint32_t share_access; 9740Sstevel@tonic-gate uint32_t share_deny; 9750Sstevel@tonic-gate open_owner4 owner; 9760Sstevel@tonic-gate openflag4 openhow; 9770Sstevel@tonic-gate open_claim4 claim; 9780Sstevel@tonic-gate }; 9790Sstevel@tonic-gate 9800Sstevel@tonic-gate struct open_read_delegation4 { 9810Sstevel@tonic-gate stateid4 stateid; /* Stateid for delegation*/ 9820Sstevel@tonic-gate bool recall; /* Pre-recalled flag for 9830Sstevel@tonic-gate delegations obtained 9840Sstevel@tonic-gate by reclaim 9850Sstevel@tonic-gate (CLAIM_PREVIOUS) */ 9860Sstevel@tonic-gate nfsace4 permissions; /* Defines users who don't 9870Sstevel@tonic-gate need an ACCESS call to 9880Sstevel@tonic-gate open for read */ 9890Sstevel@tonic-gate }; 9900Sstevel@tonic-gate 9910Sstevel@tonic-gate struct open_write_delegation4 { 9920Sstevel@tonic-gate stateid4 stateid; /* Stateid for delegation */ 9930Sstevel@tonic-gate bool recall; /* Pre-recalled flag for 9940Sstevel@tonic-gate delegations obtained 9950Sstevel@tonic-gate by reclaim 9960Sstevel@tonic-gate (CLAIM_PREVIOUS) */ 9970Sstevel@tonic-gate nfs_space_limit4 space_limit; /* Defines condition that 9980Sstevel@tonic-gate the client must check to 9990Sstevel@tonic-gate determine whether the 10000Sstevel@tonic-gate file needs to be flushed 10010Sstevel@tonic-gate to the server on close. 10020Sstevel@tonic-gate */ 10030Sstevel@tonic-gate nfsace4 permissions; /* Defines users who don't 10040Sstevel@tonic-gate need an ACCESS call as 10050Sstevel@tonic-gate part of a delegated 10060Sstevel@tonic-gate open. */ 10070Sstevel@tonic-gate }; 10080Sstevel@tonic-gate 10090Sstevel@tonic-gate union open_delegation4 10100Sstevel@tonic-gate switch (open_delegation_type4 delegation_type) { 10110Sstevel@tonic-gate case OPEN_DELEGATE_NONE: 10120Sstevel@tonic-gate void; 10130Sstevel@tonic-gate case OPEN_DELEGATE_READ: 10140Sstevel@tonic-gate open_read_delegation4 read; 10150Sstevel@tonic-gate case OPEN_DELEGATE_WRITE: 10160Sstevel@tonic-gate open_write_delegation4 write; 10170Sstevel@tonic-gate }; 10180Sstevel@tonic-gate 10190Sstevel@tonic-gate /* 10200Sstevel@tonic-gate * Result flags 10210Sstevel@tonic-gate */ 10220Sstevel@tonic-gate /* Client must confirm open */ 10230Sstevel@tonic-gate const OPEN4_RESULT_CONFIRM = 0x00000002; 10240Sstevel@tonic-gate /* Type of file locking behavior at the server */ 10250Sstevel@tonic-gate const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; 10260Sstevel@tonic-gate 10270Sstevel@tonic-gate struct OPEN4resok { 10280Sstevel@tonic-gate stateid4 stateid; /* Stateid for open */ 10290Sstevel@tonic-gate change_info4 cinfo; /* Directory Change Info */ 10300Sstevel@tonic-gate uint32_t rflags; /* Result flags */ 10310Sstevel@tonic-gate bitmap4 attrset; /* attribute set for create*/ 10320Sstevel@tonic-gate open_delegation4 delegation; /* Info on any open 10330Sstevel@tonic-gate delegation */ 10340Sstevel@tonic-gate }; 10350Sstevel@tonic-gate 10360Sstevel@tonic-gate union OPEN4res switch (nfsstat4 status) { 10370Sstevel@tonic-gate case NFS4_OK: 10380Sstevel@tonic-gate /* CURRENT_FH: opened file */ 10390Sstevel@tonic-gate OPEN4resok resok4; 10400Sstevel@tonic-gate default: 10410Sstevel@tonic-gate void; 10420Sstevel@tonic-gate }; 10430Sstevel@tonic-gate 10440Sstevel@tonic-gate /* 10450Sstevel@tonic-gate * OPENATTR: open named attributes directory 10460Sstevel@tonic-gate */ 10470Sstevel@tonic-gate struct OPENATTR4args { 10480Sstevel@tonic-gate /* CURRENT_FH: object */ 10490Sstevel@tonic-gate bool createdir; 10500Sstevel@tonic-gate }; 10510Sstevel@tonic-gate 10520Sstevel@tonic-gate struct OPENATTR4res { 10530Sstevel@tonic-gate /* CURRENT_FH: named attr directory */ 10540Sstevel@tonic-gate nfsstat4 status; 10550Sstevel@tonic-gate }; 10560Sstevel@tonic-gate 10570Sstevel@tonic-gate /* 10580Sstevel@tonic-gate * OPEN_CONFIRM: confirm the open 10590Sstevel@tonic-gate */ 10600Sstevel@tonic-gate struct OPEN_CONFIRM4args { 10610Sstevel@tonic-gate /* CURRENT_FH: opened file */ 10620Sstevel@tonic-gate stateid4 open_stateid; 10630Sstevel@tonic-gate seqid4 seqid; 10640Sstevel@tonic-gate }; 10650Sstevel@tonic-gate 10660Sstevel@tonic-gate struct OPEN_CONFIRM4resok { 10670Sstevel@tonic-gate stateid4 open_stateid; 10680Sstevel@tonic-gate }; 10690Sstevel@tonic-gate 10700Sstevel@tonic-gate union OPEN_CONFIRM4res switch (nfsstat4 status) { 10710Sstevel@tonic-gate case NFS4_OK: 10720Sstevel@tonic-gate OPEN_CONFIRM4resok resok4; 10730Sstevel@tonic-gate default: 10740Sstevel@tonic-gate void; 10750Sstevel@tonic-gate }; 10760Sstevel@tonic-gate 10770Sstevel@tonic-gate /* 10780Sstevel@tonic-gate * OPEN_DOWNGRADE: downgrade the access/deny for a file 10790Sstevel@tonic-gate */ 10800Sstevel@tonic-gate struct OPEN_DOWNGRADE4args { 10810Sstevel@tonic-gate /* CURRENT_FH: opened file */ 10820Sstevel@tonic-gate stateid4 open_stateid; 10830Sstevel@tonic-gate seqid4 seqid; 10840Sstevel@tonic-gate uint32_t share_access; 10850Sstevel@tonic-gate uint32_t share_deny; 10860Sstevel@tonic-gate }; 10870Sstevel@tonic-gate 10880Sstevel@tonic-gate struct OPEN_DOWNGRADE4resok { 10890Sstevel@tonic-gate stateid4 open_stateid; 10900Sstevel@tonic-gate }; 10910Sstevel@tonic-gate 10920Sstevel@tonic-gate union OPEN_DOWNGRADE4res switch(nfsstat4 status) { 10930Sstevel@tonic-gate case NFS4_OK: 10940Sstevel@tonic-gate OPEN_DOWNGRADE4resok resok4; 10950Sstevel@tonic-gate default: 10960Sstevel@tonic-gate void; 10970Sstevel@tonic-gate }; 10980Sstevel@tonic-gate 10990Sstevel@tonic-gate /* 11000Sstevel@tonic-gate * PUTFH: Set current filehandle 11010Sstevel@tonic-gate */ 11020Sstevel@tonic-gate struct PUTFH4args { 11030Sstevel@tonic-gate nfs_fh4 object; 11040Sstevel@tonic-gate }; 11050Sstevel@tonic-gate 11060Sstevel@tonic-gate struct PUTFH4res { 11070Sstevel@tonic-gate /* CURRENT_FH: */ 11080Sstevel@tonic-gate nfsstat4 status; 11090Sstevel@tonic-gate }; 11100Sstevel@tonic-gate 11110Sstevel@tonic-gate /* 11120Sstevel@tonic-gate * PUTPUBFH: Set public filehandle 11130Sstevel@tonic-gate */ 11140Sstevel@tonic-gate struct PUTPUBFH4res { 11150Sstevel@tonic-gate /* CURRENT_FH: public fh */ 11160Sstevel@tonic-gate nfsstat4 status; 11170Sstevel@tonic-gate }; 11180Sstevel@tonic-gate 11190Sstevel@tonic-gate /* 11200Sstevel@tonic-gate * PUTROOTFH: Set root filehandle 11210Sstevel@tonic-gate */ 11220Sstevel@tonic-gate struct PUTROOTFH4res { 11230Sstevel@tonic-gate /* CURRENT_FH: root fh */ 11240Sstevel@tonic-gate nfsstat4 status; 11250Sstevel@tonic-gate }; 11260Sstevel@tonic-gate 11270Sstevel@tonic-gate /* 11280Sstevel@tonic-gate * READ: Read from file 11290Sstevel@tonic-gate */ 11300Sstevel@tonic-gate struct READ4args { 11310Sstevel@tonic-gate /* CURRENT_FH: file */ 11320Sstevel@tonic-gate stateid4 stateid; 11330Sstevel@tonic-gate offset4 offset; 11340Sstevel@tonic-gate count4 count; 11350Sstevel@tonic-gate }; 11360Sstevel@tonic-gate 11370Sstevel@tonic-gate struct READ4resok { 11380Sstevel@tonic-gate bool eof; 11390Sstevel@tonic-gate opaque data<>; 11400Sstevel@tonic-gate }; 11410Sstevel@tonic-gate 11420Sstevel@tonic-gate union READ4res switch (nfsstat4 status) { 11430Sstevel@tonic-gate case NFS4_OK: 11440Sstevel@tonic-gate READ4resok resok4; 11450Sstevel@tonic-gate default: 11460Sstevel@tonic-gate void; 11470Sstevel@tonic-gate }; 11480Sstevel@tonic-gate 11490Sstevel@tonic-gate /* 11500Sstevel@tonic-gate * READDIR: Read directory 11510Sstevel@tonic-gate */ 11520Sstevel@tonic-gate struct READDIR4args { 11530Sstevel@tonic-gate /* CURRENT_FH: directory */ 11540Sstevel@tonic-gate nfs_cookie4 cookie; 11550Sstevel@tonic-gate verifier4 cookieverf; 11560Sstevel@tonic-gate count4 dircount; 11570Sstevel@tonic-gate count4 maxcount; 11580Sstevel@tonic-gate bitmap4 attr_request; 11590Sstevel@tonic-gate }; 11600Sstevel@tonic-gate 11610Sstevel@tonic-gate struct entry4 { 11620Sstevel@tonic-gate nfs_cookie4 cookie; 11630Sstevel@tonic-gate component4 name; 11640Sstevel@tonic-gate fattr4 attrs; 11650Sstevel@tonic-gate entry4 *nextentry; 11660Sstevel@tonic-gate }; 11670Sstevel@tonic-gate 11680Sstevel@tonic-gate struct dirlist4 { 11690Sstevel@tonic-gate entry4 *entries; 11700Sstevel@tonic-gate bool eof; 11710Sstevel@tonic-gate }; 11720Sstevel@tonic-gate 11730Sstevel@tonic-gate struct READDIR4resok { 11740Sstevel@tonic-gate verifier4 cookieverf; 11750Sstevel@tonic-gate dirlist4 reply; 11760Sstevel@tonic-gate }; 11770Sstevel@tonic-gate 11780Sstevel@tonic-gate 11790Sstevel@tonic-gate union READDIR4res switch (nfsstat4 status) { 11800Sstevel@tonic-gate case NFS4_OK: 11810Sstevel@tonic-gate READDIR4resok resok4; 11820Sstevel@tonic-gate default: 11830Sstevel@tonic-gate void; 11840Sstevel@tonic-gate }; 11850Sstevel@tonic-gate 11860Sstevel@tonic-gate 11870Sstevel@tonic-gate /* 11880Sstevel@tonic-gate * READLINK: Read symbolic link 11890Sstevel@tonic-gate */ 11900Sstevel@tonic-gate struct READLINK4resok { 11910Sstevel@tonic-gate linktext4 link; 11920Sstevel@tonic-gate }; 11930Sstevel@tonic-gate 11940Sstevel@tonic-gate union READLINK4res switch (nfsstat4 status) { 11950Sstevel@tonic-gate case NFS4_OK: 11960Sstevel@tonic-gate READLINK4resok resok4; 11970Sstevel@tonic-gate default: 11980Sstevel@tonic-gate void; 11990Sstevel@tonic-gate }; 12000Sstevel@tonic-gate 12010Sstevel@tonic-gate /* 12020Sstevel@tonic-gate * REMOVE: Remove filesystem object 12030Sstevel@tonic-gate */ 12040Sstevel@tonic-gate struct REMOVE4args { 12050Sstevel@tonic-gate /* CURRENT_FH: directory */ 12060Sstevel@tonic-gate component4 target; 12070Sstevel@tonic-gate }; 12080Sstevel@tonic-gate 12090Sstevel@tonic-gate struct REMOVE4resok { 12100Sstevel@tonic-gate change_info4 cinfo; 12110Sstevel@tonic-gate }; 12120Sstevel@tonic-gate 12130Sstevel@tonic-gate union REMOVE4res switch (nfsstat4 status) { 12140Sstevel@tonic-gate case NFS4_OK: 12150Sstevel@tonic-gate REMOVE4resok resok4; 12160Sstevel@tonic-gate default: 12170Sstevel@tonic-gate void; 12180Sstevel@tonic-gate }; 12190Sstevel@tonic-gate 12200Sstevel@tonic-gate /* 12210Sstevel@tonic-gate * RENAME: Rename directory entry 12220Sstevel@tonic-gate */ 12230Sstevel@tonic-gate struct RENAME4args { 12240Sstevel@tonic-gate /* SAVED_FH: source directory */ 12250Sstevel@tonic-gate component4 oldname; 12260Sstevel@tonic-gate /* CURRENT_FH: target directory */ 12270Sstevel@tonic-gate component4 newname; 12280Sstevel@tonic-gate }; 12290Sstevel@tonic-gate 12300Sstevel@tonic-gate struct RENAME4resok { 12310Sstevel@tonic-gate change_info4 source_cinfo; 12320Sstevel@tonic-gate change_info4 target_cinfo; 12330Sstevel@tonic-gate }; 12340Sstevel@tonic-gate 12350Sstevel@tonic-gate union RENAME4res switch (nfsstat4 status) { 12360Sstevel@tonic-gate case NFS4_OK: 12370Sstevel@tonic-gate RENAME4resok resok4; 12380Sstevel@tonic-gate default: 12390Sstevel@tonic-gate void; 12400Sstevel@tonic-gate }; 12410Sstevel@tonic-gate 12420Sstevel@tonic-gate /* 12430Sstevel@tonic-gate * RENEW: Renew a Lease 12440Sstevel@tonic-gate */ 12450Sstevel@tonic-gate struct RENEW4args { 12460Sstevel@tonic-gate clientid4 clientid; 12470Sstevel@tonic-gate }; 12480Sstevel@tonic-gate 12490Sstevel@tonic-gate struct RENEW4res { 12500Sstevel@tonic-gate nfsstat4 status; 12510Sstevel@tonic-gate }; 12520Sstevel@tonic-gate 12530Sstevel@tonic-gate /* 12540Sstevel@tonic-gate * RESTOREFH: Restore saved filehandle 12550Sstevel@tonic-gate */ 12560Sstevel@tonic-gate 12570Sstevel@tonic-gate struct RESTOREFH4res { 12580Sstevel@tonic-gate /* CURRENT_FH: value of saved fh */ 12590Sstevel@tonic-gate nfsstat4 status; 12600Sstevel@tonic-gate }; 12610Sstevel@tonic-gate 12620Sstevel@tonic-gate /* 12630Sstevel@tonic-gate * SAVEFH: Save current filehandle 12640Sstevel@tonic-gate */ 12650Sstevel@tonic-gate struct SAVEFH4res { 12660Sstevel@tonic-gate /* SAVED_FH: value of current fh */ 12670Sstevel@tonic-gate nfsstat4 status; 12680Sstevel@tonic-gate }; 12690Sstevel@tonic-gate 12700Sstevel@tonic-gate /* 12710Sstevel@tonic-gate * SECINFO: Obtain Available Security Mechanisms 12720Sstevel@tonic-gate */ 12730Sstevel@tonic-gate struct SECINFO4args { 12740Sstevel@tonic-gate /* CURRENT_FH: directory */ 12750Sstevel@tonic-gate component4 name; 12760Sstevel@tonic-gate }; 12770Sstevel@tonic-gate 12780Sstevel@tonic-gate /* 12790Sstevel@tonic-gate * From RFC 2203 12800Sstevel@tonic-gate */ 12810Sstevel@tonic-gate enum rpc_gss_svc_t { 12820Sstevel@tonic-gate RPC_GSS_SVC_NONE = 1, 12830Sstevel@tonic-gate RPC_GSS_SVC_INTEGRITY = 2, 12840Sstevel@tonic-gate RPC_GSS_SVC_PRIVACY = 3 12850Sstevel@tonic-gate }; 12860Sstevel@tonic-gate 12870Sstevel@tonic-gate struct rpcsec_gss_info { 12880Sstevel@tonic-gate sec_oid4 oid; 12890Sstevel@tonic-gate qop4 qop; 12900Sstevel@tonic-gate rpc_gss_svc_t service; 12910Sstevel@tonic-gate }; 12920Sstevel@tonic-gate 12930Sstevel@tonic-gate /* RPCSEC_GSS has a value of '6' - See RFC 2203 */ 12940Sstevel@tonic-gate union secinfo4 switch (uint32_t flavor) { 12950Sstevel@tonic-gate case RPCSEC_GSS: 12960Sstevel@tonic-gate rpcsec_gss_info flavor_info; 12970Sstevel@tonic-gate default: 12980Sstevel@tonic-gate void; 12990Sstevel@tonic-gate }; 13000Sstevel@tonic-gate 13010Sstevel@tonic-gate typedef secinfo4 SECINFO4resok<>; 13020Sstevel@tonic-gate 13030Sstevel@tonic-gate union SECINFO4res switch (nfsstat4 status) { 13040Sstevel@tonic-gate case NFS4_OK: 13050Sstevel@tonic-gate SECINFO4resok resok4; 13060Sstevel@tonic-gate default: 13070Sstevel@tonic-gate void; 13080Sstevel@tonic-gate }; 13090Sstevel@tonic-gate 13100Sstevel@tonic-gate /* 13110Sstevel@tonic-gate * SETATTR: Set attributes 13120Sstevel@tonic-gate */ 13130Sstevel@tonic-gate struct SETATTR4args { 13140Sstevel@tonic-gate /* CURRENT_FH: target object */ 13150Sstevel@tonic-gate stateid4 stateid; 13160Sstevel@tonic-gate fattr4 obj_attributes; 13170Sstevel@tonic-gate }; 13180Sstevel@tonic-gate 13190Sstevel@tonic-gate struct SETATTR4res { 13200Sstevel@tonic-gate nfsstat4 status; 13210Sstevel@tonic-gate bitmap4 attrsset; 13220Sstevel@tonic-gate }; 13230Sstevel@tonic-gate 13240Sstevel@tonic-gate /* 13250Sstevel@tonic-gate * SETCLIENTID 13260Sstevel@tonic-gate */ 13270Sstevel@tonic-gate struct SETCLIENTID4args { 13280Sstevel@tonic-gate nfs_client_id4 client; 13290Sstevel@tonic-gate cb_client4 callback; 13300Sstevel@tonic-gate uint32_t callback_ident; 13310Sstevel@tonic-gate }; 13320Sstevel@tonic-gate 13330Sstevel@tonic-gate struct SETCLIENTID4resok { 13340Sstevel@tonic-gate clientid4 clientid; 13350Sstevel@tonic-gate verifier4 setclientid_confirm; 13360Sstevel@tonic-gate }; 13370Sstevel@tonic-gate 13380Sstevel@tonic-gate union SETCLIENTID4res switch (nfsstat4 status) { 13390Sstevel@tonic-gate case NFS4_OK: 13400Sstevel@tonic-gate SETCLIENTID4resok resok4; 13410Sstevel@tonic-gate case NFS4ERR_CLID_INUSE: 13420Sstevel@tonic-gate clientaddr4 client_using; 13430Sstevel@tonic-gate default: 13440Sstevel@tonic-gate void; 13450Sstevel@tonic-gate }; 13460Sstevel@tonic-gate 13470Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4args { 13480Sstevel@tonic-gate clientid4 clientid; 13490Sstevel@tonic-gate verifier4 setclientid_confirm; 13500Sstevel@tonic-gate }; 13510Sstevel@tonic-gate 13520Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4res { 13530Sstevel@tonic-gate nfsstat4 status; 13540Sstevel@tonic-gate }; 13550Sstevel@tonic-gate 13560Sstevel@tonic-gate /* 13570Sstevel@tonic-gate * VERIFY: Verify attributes same 13580Sstevel@tonic-gate */ 13590Sstevel@tonic-gate struct VERIFY4args { 13600Sstevel@tonic-gate /* CURRENT_FH: object */ 13610Sstevel@tonic-gate fattr4 obj_attributes; 13620Sstevel@tonic-gate }; 13630Sstevel@tonic-gate 13640Sstevel@tonic-gate struct VERIFY4res { 13650Sstevel@tonic-gate nfsstat4 status; 13660Sstevel@tonic-gate }; 13670Sstevel@tonic-gate 13680Sstevel@tonic-gate /* 13690Sstevel@tonic-gate * WRITE: Write to file 13700Sstevel@tonic-gate */ 13710Sstevel@tonic-gate enum stable_how4 { 13720Sstevel@tonic-gate UNSTABLE4 = 0, 13730Sstevel@tonic-gate DATA_SYNC4 = 1, 13740Sstevel@tonic-gate FILE_SYNC4 = 2 13750Sstevel@tonic-gate }; 13760Sstevel@tonic-gate 13770Sstevel@tonic-gate struct WRITE4args { 13780Sstevel@tonic-gate /* CURRENT_FH: file */ 13790Sstevel@tonic-gate stateid4 stateid; 13800Sstevel@tonic-gate offset4 offset; 13810Sstevel@tonic-gate stable_how4 stable; 13820Sstevel@tonic-gate opaque data<>; 13830Sstevel@tonic-gate }; 13840Sstevel@tonic-gate 13850Sstevel@tonic-gate struct WRITE4resok { 13860Sstevel@tonic-gate count4 count; 13870Sstevel@tonic-gate stable_how4 committed; 13880Sstevel@tonic-gate verifier4 writeverf; 13890Sstevel@tonic-gate }; 13900Sstevel@tonic-gate 13910Sstevel@tonic-gate union WRITE4res switch (nfsstat4 status) { 13920Sstevel@tonic-gate case NFS4_OK: 13930Sstevel@tonic-gate WRITE4resok resok4; 13940Sstevel@tonic-gate default: 13950Sstevel@tonic-gate void; 13960Sstevel@tonic-gate }; 13970Sstevel@tonic-gate 13980Sstevel@tonic-gate /* 13990Sstevel@tonic-gate * RELEASE_LOCKOWNER: Notify server to release lockowner 14000Sstevel@tonic-gate */ 14010Sstevel@tonic-gate struct RELEASE_LOCKOWNER4args { 14020Sstevel@tonic-gate lock_owner4 lock_owner; 14030Sstevel@tonic-gate }; 14040Sstevel@tonic-gate 14050Sstevel@tonic-gate struct RELEASE_LOCKOWNER4res { 14060Sstevel@tonic-gate nfsstat4 status; 14070Sstevel@tonic-gate }; 14080Sstevel@tonic-gate 14090Sstevel@tonic-gate /* 14100Sstevel@tonic-gate * ILLEGAL: Response for illegal operation numbers 14110Sstevel@tonic-gate */ 14120Sstevel@tonic-gate struct ILLEGAL4res { 14130Sstevel@tonic-gate nfsstat4 status; 14140Sstevel@tonic-gate }; 14150Sstevel@tonic-gate 14160Sstevel@tonic-gate /* 14170Sstevel@tonic-gate * Operation arrays 14180Sstevel@tonic-gate */ 14190Sstevel@tonic-gate 14200Sstevel@tonic-gate enum nfs_opnum4 { 14210Sstevel@tonic-gate OP_ACCESS = 3, 14220Sstevel@tonic-gate OP_CLOSE = 4, 14230Sstevel@tonic-gate OP_COMMIT = 5, 14240Sstevel@tonic-gate OP_CREATE = 6, 14250Sstevel@tonic-gate OP_DELEGPURGE = 7, 14260Sstevel@tonic-gate OP_DELEGRETURN = 8, 14270Sstevel@tonic-gate OP_GETATTR = 9, 14280Sstevel@tonic-gate OP_GETFH = 10, 14290Sstevel@tonic-gate OP_LINK = 11, 14300Sstevel@tonic-gate OP_LOCK = 12, 14310Sstevel@tonic-gate OP_LOCKT = 13, 14320Sstevel@tonic-gate OP_LOCKU = 14, 14330Sstevel@tonic-gate OP_LOOKUP = 15, 14340Sstevel@tonic-gate OP_LOOKUPP = 16, 14350Sstevel@tonic-gate OP_NVERIFY = 17, 14360Sstevel@tonic-gate OP_OPEN = 18, 14370Sstevel@tonic-gate OP_OPENATTR = 19, 14380Sstevel@tonic-gate OP_OPEN_CONFIRM = 20, 14390Sstevel@tonic-gate OP_OPEN_DOWNGRADE = 21, 14400Sstevel@tonic-gate OP_PUTFH = 22, 14410Sstevel@tonic-gate OP_PUTPUBFH = 23, 14420Sstevel@tonic-gate OP_PUTROOTFH = 24, 14430Sstevel@tonic-gate OP_READ = 25, 14440Sstevel@tonic-gate OP_READDIR = 26, 14450Sstevel@tonic-gate OP_READLINK = 27, 14460Sstevel@tonic-gate OP_REMOVE = 28, 14470Sstevel@tonic-gate OP_RENAME = 29, 14480Sstevel@tonic-gate OP_RENEW = 30, 14490Sstevel@tonic-gate OP_RESTOREFH = 31, 14500Sstevel@tonic-gate OP_SAVEFH = 32, 14510Sstevel@tonic-gate OP_SECINFO = 33, 14520Sstevel@tonic-gate OP_SETATTR = 34, 14530Sstevel@tonic-gate OP_SETCLIENTID = 35, 14540Sstevel@tonic-gate OP_SETCLIENTID_CONFIRM = 36, 14550Sstevel@tonic-gate OP_VERIFY = 37, 14560Sstevel@tonic-gate OP_WRITE = 38, 14570Sstevel@tonic-gate OP_RELEASE_LOCKOWNER = 39, 14580Sstevel@tonic-gate OP_ILLEGAL = 10044 14590Sstevel@tonic-gate }; 14600Sstevel@tonic-gate 14610Sstevel@tonic-gate union nfs_argop4 switch (nfs_opnum4 argop) { 14620Sstevel@tonic-gate case OP_ACCESS: ACCESS4args opaccess; 14630Sstevel@tonic-gate case OP_CLOSE: CLOSE4args opclose; 14640Sstevel@tonic-gate case OP_COMMIT: COMMIT4args opcommit; 14650Sstevel@tonic-gate case OP_CREATE: CREATE4args opcreate; 14660Sstevel@tonic-gate case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge; 14670Sstevel@tonic-gate case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn; 14680Sstevel@tonic-gate case OP_GETATTR: GETATTR4args opgetattr; 14690Sstevel@tonic-gate case OP_GETFH: void; 14700Sstevel@tonic-gate case OP_LINK: LINK4args oplink; 14710Sstevel@tonic-gate case OP_LOCK: LOCK4args oplock; 14720Sstevel@tonic-gate case OP_LOCKT: LOCKT4args oplockt; 14730Sstevel@tonic-gate case OP_LOCKU: LOCKU4args oplocku; 14740Sstevel@tonic-gate case OP_LOOKUP: LOOKUP4args oplookup; 14750Sstevel@tonic-gate case OP_LOOKUPP: void; 14760Sstevel@tonic-gate case OP_NVERIFY: NVERIFY4args opnverify; 14770Sstevel@tonic-gate case OP_OPEN: OPEN4args opopen; 14780Sstevel@tonic-gate case OP_OPENATTR: OPENATTR4args opopenattr; 14790Sstevel@tonic-gate case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm; 14800Sstevel@tonic-gate case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4args opopen_downgrade; 14810Sstevel@tonic-gate case OP_PUTFH: PUTFH4args opputfh; 14820Sstevel@tonic-gate case OP_PUTPUBFH: void; 14830Sstevel@tonic-gate case OP_PUTROOTFH: void; 14840Sstevel@tonic-gate case OP_READ: READ4args opread; 14850Sstevel@tonic-gate case OP_READDIR: READDIR4args opreaddir; 14860Sstevel@tonic-gate case OP_READLINK: void; 14870Sstevel@tonic-gate case OP_REMOVE: REMOVE4args opremove; 14880Sstevel@tonic-gate case OP_RENAME: RENAME4args oprename; 14890Sstevel@tonic-gate case OP_RENEW: RENEW4args oprenew; 14900Sstevel@tonic-gate case OP_RESTOREFH: void; 14910Sstevel@tonic-gate case OP_SAVEFH: void; 14920Sstevel@tonic-gate case OP_SECINFO: SECINFO4args opsecinfo; 14930Sstevel@tonic-gate case OP_SETATTR: SETATTR4args opsetattr; 14940Sstevel@tonic-gate case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; 14950Sstevel@tonic-gate case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args 14960Sstevel@tonic-gate opsetclientid_confirm; 14970Sstevel@tonic-gate case OP_VERIFY: VERIFY4args opverify; 14980Sstevel@tonic-gate case OP_WRITE: WRITE4args opwrite; 14990Sstevel@tonic-gate case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4args 15000Sstevel@tonic-gate oprelease_lockowner; 15010Sstevel@tonic-gate case OP_ILLEGAL: void; 15020Sstevel@tonic-gate }; 15030Sstevel@tonic-gate 15040Sstevel@tonic-gate union nfs_resop4 switch (nfs_opnum4 resop){ 15050Sstevel@tonic-gate case OP_ACCESS: ACCESS4res opaccess; 15060Sstevel@tonic-gate case OP_CLOSE: CLOSE4res opclose; 15070Sstevel@tonic-gate case OP_COMMIT: COMMIT4res opcommit; 15080Sstevel@tonic-gate case OP_CREATE: CREATE4res opcreate; 15090Sstevel@tonic-gate case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge; 15100Sstevel@tonic-gate case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn; 15110Sstevel@tonic-gate case OP_GETATTR: GETATTR4res opgetattr; 15120Sstevel@tonic-gate case OP_GETFH: GETFH4res opgetfh; 15130Sstevel@tonic-gate case OP_LINK: LINK4res oplink; 15140Sstevel@tonic-gate case OP_LOCK: LOCK4res oplock; 15150Sstevel@tonic-gate case OP_LOCKT: LOCKT4res oplockt; 15160Sstevel@tonic-gate case OP_LOCKU: LOCKU4res oplocku; 15170Sstevel@tonic-gate case OP_LOOKUP: LOOKUP4res oplookup; 15180Sstevel@tonic-gate case OP_LOOKUPP: LOOKUPP4res oplookupp; 15190Sstevel@tonic-gate case OP_NVERIFY: NVERIFY4res opnverify; 15200Sstevel@tonic-gate case OP_OPEN: OPEN4res opopen; 15210Sstevel@tonic-gate case OP_OPENATTR: OPENATTR4res opopenattr; 15220Sstevel@tonic-gate case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm; 15230Sstevel@tonic-gate case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4res opopen_downgrade; 15240Sstevel@tonic-gate case OP_PUTFH: PUTFH4res opputfh; 15250Sstevel@tonic-gate case OP_PUTPUBFH: PUTPUBFH4res opputpubfh; 15260Sstevel@tonic-gate case OP_PUTROOTFH: PUTROOTFH4res opputrootfh; 15270Sstevel@tonic-gate case OP_READ: READ4res opread; 15280Sstevel@tonic-gate case OP_READDIR: READDIR4res opreaddir; 15290Sstevel@tonic-gate case OP_READLINK: READLINK4res opreadlink; 15300Sstevel@tonic-gate case OP_REMOVE: REMOVE4res opremove; 15310Sstevel@tonic-gate case OP_RENAME: RENAME4res oprename; 15320Sstevel@tonic-gate case OP_RENEW: RENEW4res oprenew; 15330Sstevel@tonic-gate case OP_RESTOREFH: RESTOREFH4res oprestorefh; 15340Sstevel@tonic-gate case OP_SAVEFH: SAVEFH4res opsavefh; 15350Sstevel@tonic-gate case OP_SECINFO: SECINFO4res opsecinfo; 15360Sstevel@tonic-gate case OP_SETATTR: SETATTR4res opsetattr; 15370Sstevel@tonic-gate case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; 15380Sstevel@tonic-gate case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4res 15390Sstevel@tonic-gate opsetclientid_confirm; 15400Sstevel@tonic-gate case OP_VERIFY: VERIFY4res opverify; 15410Sstevel@tonic-gate case OP_WRITE: WRITE4res opwrite; 15420Sstevel@tonic-gate case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4res 15430Sstevel@tonic-gate oprelease_lockowner; 15440Sstevel@tonic-gate case OP_ILLEGAL: ILLEGAL4res opillegal; 15450Sstevel@tonic-gate }; 15460Sstevel@tonic-gate 15470Sstevel@tonic-gate struct COMPOUND4args { 15480Sstevel@tonic-gate utf8str_cs tag; 15490Sstevel@tonic-gate uint32_t minorversion; 15500Sstevel@tonic-gate nfs_argop4 argarray<>; 15510Sstevel@tonic-gate }; 15520Sstevel@tonic-gate 15530Sstevel@tonic-gate struct COMPOUND4res { 15540Sstevel@tonic-gate nfsstat4 status; 15550Sstevel@tonic-gate utf8str_cs tag; 15560Sstevel@tonic-gate nfs_resop4 resarray<>; 15570Sstevel@tonic-gate }; 15580Sstevel@tonic-gate 15590Sstevel@tonic-gate /* 15600Sstevel@tonic-gate * Remote file service routines 15610Sstevel@tonic-gate */ 15620Sstevel@tonic-gate program NFS4_PROGRAM { 15630Sstevel@tonic-gate version NFS_V4 { 15640Sstevel@tonic-gate void 15650Sstevel@tonic-gate NFSPROC4_NULL(void) = 0; 15660Sstevel@tonic-gate 15670Sstevel@tonic-gate COMPOUND4res 15680Sstevel@tonic-gate NFSPROC4_COMPOUND(COMPOUND4args) = 1; 15690Sstevel@tonic-gate 15700Sstevel@tonic-gate } = 4; 15710Sstevel@tonic-gate } = 100003; 15720Sstevel@tonic-gate 15730Sstevel@tonic-gate 15740Sstevel@tonic-gate 15750Sstevel@tonic-gate /* 15760Sstevel@tonic-gate * NFS4 Callback Procedure Definitions and Program 15770Sstevel@tonic-gate */ 15780Sstevel@tonic-gate 15790Sstevel@tonic-gate /* 15800Sstevel@tonic-gate * CB_GETATTR: Get Current Attributes 15810Sstevel@tonic-gate */ 15820Sstevel@tonic-gate struct CB_GETATTR4args { 15830Sstevel@tonic-gate nfs_fh4 fh; 15840Sstevel@tonic-gate bitmap4 attr_request; 15850Sstevel@tonic-gate }; 15860Sstevel@tonic-gate 15870Sstevel@tonic-gate struct CB_GETATTR4resok { 15880Sstevel@tonic-gate fattr4 obj_attributes; 15890Sstevel@tonic-gate }; 15900Sstevel@tonic-gate 15910Sstevel@tonic-gate union CB_GETATTR4res switch (nfsstat4 status) { 15920Sstevel@tonic-gate case NFS4_OK: 15930Sstevel@tonic-gate CB_GETATTR4resok resok4; 15940Sstevel@tonic-gate default: 15950Sstevel@tonic-gate void; 15960Sstevel@tonic-gate }; 15970Sstevel@tonic-gate 15980Sstevel@tonic-gate /* 15990Sstevel@tonic-gate * CB_RECALL: Recall an Open Delegation 16000Sstevel@tonic-gate */ 16010Sstevel@tonic-gate struct CB_RECALL4args { 16020Sstevel@tonic-gate stateid4 stateid; 16030Sstevel@tonic-gate bool truncate; 16040Sstevel@tonic-gate nfs_fh4 fh; 16050Sstevel@tonic-gate }; 16060Sstevel@tonic-gate 16070Sstevel@tonic-gate struct CB_RECALL4res { 16080Sstevel@tonic-gate nfsstat4 status; 16090Sstevel@tonic-gate }; 16100Sstevel@tonic-gate 16110Sstevel@tonic-gate /* 16120Sstevel@tonic-gate * CB_ILLEGAL: Response for illegal operation numbers 16130Sstevel@tonic-gate */ 16140Sstevel@tonic-gate struct CB_ILLEGAL4res { 16150Sstevel@tonic-gate nfsstat4 status; 16160Sstevel@tonic-gate }; 16170Sstevel@tonic-gate 16180Sstevel@tonic-gate /* 16190Sstevel@tonic-gate * Various definitions for CB_COMPOUND 16200Sstevel@tonic-gate */ 16210Sstevel@tonic-gate enum nfs_cb_opnum4 { 16220Sstevel@tonic-gate OP_CB_GETATTR = 3, 16230Sstevel@tonic-gate OP_CB_RECALL = 4, 16240Sstevel@tonic-gate OP_CB_ILLEGAL = 10044 16250Sstevel@tonic-gate }; 16260Sstevel@tonic-gate 16270Sstevel@tonic-gate union nfs_cb_argop4 switch (unsigned argop) { 16280Sstevel@tonic-gate case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; 16290Sstevel@tonic-gate case OP_CB_RECALL: CB_RECALL4args opcbrecall; 16300Sstevel@tonic-gate case OP_CB_ILLEGAL: void; 16310Sstevel@tonic-gate }; 16320Sstevel@tonic-gate 16330Sstevel@tonic-gate union nfs_cb_resop4 switch (unsigned resop){ 16340Sstevel@tonic-gate case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; 16350Sstevel@tonic-gate case OP_CB_RECALL: CB_RECALL4res opcbrecall; 16360Sstevel@tonic-gate case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal; 16370Sstevel@tonic-gate }; 16380Sstevel@tonic-gate 16390Sstevel@tonic-gate struct CB_COMPOUND4args { 16400Sstevel@tonic-gate utf8str_cs tag; 16410Sstevel@tonic-gate uint32_t minorversion; 16420Sstevel@tonic-gate uint32_t callback_ident; 16430Sstevel@tonic-gate nfs_cb_argop4 argarray<>; 16440Sstevel@tonic-gate }; 16450Sstevel@tonic-gate 16460Sstevel@tonic-gate struct CB_COMPOUND4res { 16470Sstevel@tonic-gate nfsstat4 status; 16480Sstevel@tonic-gate utf8str_cs tag; 16490Sstevel@tonic-gate nfs_cb_resop4 resarray<>; 16500Sstevel@tonic-gate }; 16510Sstevel@tonic-gate 16520Sstevel@tonic-gate 16530Sstevel@tonic-gate /* 16540Sstevel@tonic-gate * Program number is in the transient range since the client 16550Sstevel@tonic-gate * will assign the exact transient program number and provide 16560Sstevel@tonic-gate * that to the server via the SETCLIENTID operation. 16570Sstevel@tonic-gate */ 16580Sstevel@tonic-gate program NFS4_CALLBACK { 16590Sstevel@tonic-gate version NFS_CB { 16600Sstevel@tonic-gate void 16610Sstevel@tonic-gate CB_NULL(void) = 0; 16620Sstevel@tonic-gate CB_COMPOUND4res 16630Sstevel@tonic-gate CB_COMPOUND(CB_COMPOUND4args) = 1; 16640Sstevel@tonic-gate } = 1; 16650Sstevel@tonic-gate } = 0x40000000; 1666