diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2015-04-23 11:41:11 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2015-04-23 11:41:11 +0000 |
commit | f3a5bc7edf906f2c7e861c9ae3e073a91e04f079 (patch) | |
tree | 597cbcdce520edf2f33a43db04c3703dba628264 | |
parent | 5f2993abca7d7446d6e6b50d659388bff9879d78 (diff) | |
parent | bbe876c07ed632b8f85e195d41e7948382064a95 (diff) | |
download | illumos-joyent-f3a5bc7edf906f2c7e861c9ae3e073a91e04f079.tar.gz |
[illumos-gate merge]
commit bbe876c07ed632b8f85e195d41e7948382064a95
5761 nfs4_prot.x should be updated for RFC 7531
commit 85aac7c12e738f35fbcd61cdc0503288fb66b382
5831 "beadm umount <dir>" core dump
-rw-r--r-- | exception_lists/copyright | 5 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/snoop/nfs4_xdr.c | 140 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/autofs/autod_nfs.c | 3 | ||||
-rw-r--r-- | usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot | 36 | ||||
-rw-r--r-- | usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot.descrip | 1 | ||||
-rw-r--r-- | usr/src/head/rpcsvc/nfs4_prot.x | 1890 | ||||
-rw-r--r-- | usr/src/lib/libbe/common/be_mount.c | 2 | ||||
-rw-r--r-- | usr/src/stand/lib/fs/nfs/nfs4_xdr.c | 80 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_srv.c | 7 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_vfsops.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_vnops.c | 10 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_xdr.c | 72 | ||||
-rw-r--r-- | usr/src/uts/common/nfs/nfs4.h | 20 | ||||
-rw-r--r-- | usr/src/uts/common/nfs/nfs4_kprot.h | 35 |
15 files changed, 1181 insertions, 1133 deletions
diff --git a/exception_lists/copyright b/exception_lists/copyright index 4f3c232f39..6a5dce89e2 100644 --- a/exception_lists/copyright +++ b/exception_lists/copyright @@ -18,8 +18,10 @@ # # CDDL HEADER END # + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. # Copyright (c) 2011 by Delphix. All rights reserved. # @@ -73,6 +75,7 @@ usr/src/grub/grub-0.97/stage2/disk_io.c usr/src/grub/grub-0.97/stage2/pc_slice.h usr/src/grub/grub-0.97/stage2/gpt.h usr/src/grub/grub-0.97/stage2/shared.h +usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot.descrip usr/src/lib/gss_mechs/mech_krb5/crypto/cksumtype_to_string.c usr/src/lib/gss_mechs/mech_krb5/crypto/coll_proof_cksum.c usr/src/lib/gss_mechs/mech_krb5/crypto/enctype_compare.c diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/nfs4_xdr.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/nfs4_xdr.c index 0ee7a6c4e7..88e2ff0d9f 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/nfs4_xdr.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/nfs4_xdr.c @@ -19,13 +19,16 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file was initially generated using rpcgen. The rpcgen-erated * code used tail recursion to implement linked lists which resulted @@ -73,8 +76,8 @@ xdr_bitmap4(register XDR *xdrs, bitmap4 *objp) { if (!xdr_array(xdrs, (char **)&objp->bitmap4_val, - (uint_t *)&objp->bitmap4_len, ~0, - sizeof (uint32_t), (xdrproc_t)xdr_uint32_t)) + (uint_t *)&objp->bitmap4_len, ~0, + sizeof (uint32_t), (xdrproc_t)xdr_uint32_t)) return (FALSE); return (TRUE); } @@ -129,7 +132,7 @@ xdr_utf8string(register XDR *xdrs, utf8string *objp) { if (!xdr_bytes(xdrs, (char **)&objp->utf8string_val, - (uint_t *)&objp->utf8string_len, NFS4_MAX_UTF8STRING)) + (uint_t *)&objp->utf8string_len, NFS4_MAX_UTF8STRING)) return (FALSE); return (TRUE); } @@ -148,8 +151,8 @@ xdr_pathname4(register XDR *xdrs, pathname4 *objp) { if (!xdr_array(xdrs, (char **)&objp->pathname4_val, - (uint_t *)&objp->pathname4_len, NFS4_MAX_PATHNAME4, - sizeof (component4), (xdrproc_t)xdr_component4)) + (uint_t *)&objp->pathname4_len, NFS4_MAX_PATHNAME4, + sizeof (component4), (xdrproc_t)xdr_component4)) return (FALSE); return (TRUE); } @@ -176,6 +179,16 @@ bool_t xdr_linktext4(register XDR *xdrs, linktext4 *objp) { + if (!xdr_bytes(xdrs, (char **)&objp->linktext4_val, + (uint_t *)&objp->linktext4_len, NFS4_MAX_LINKTEXT4)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr_ascii_REQUIRED4(register XDR *xdrs, ascii_REQUIRED4 *objp) +{ + if (!xdr_utf8string(xdrs, objp)) return (FALSE); return (TRUE); @@ -186,7 +199,7 @@ xdr_sec_oid4(register XDR *xdrs, sec_oid4 *objp) { if (!xdr_bytes(xdrs, (char **)&objp->sec_oid4_val, - (uint_t *)&objp->sec_oid4_len, NFS4_MAX_SECOID4)) + (uint_t *)&objp->sec_oid4_len, NFS4_MAX_SECOID4)) return (FALSE); return (TRUE); } @@ -267,7 +280,7 @@ xdr_nfs_fh4(register XDR *xdrs, nfs_fh4 *objp) { if (!xdr_bytes(xdrs, (char **)&objp->nfs_fh4_val, - (uint_t *)&objp->nfs_fh4_len, NFS4_FHSIZE)) + (uint_t *)&objp->nfs_fh4_len, NFS4_FHSIZE)) return (FALSE); return (TRUE); } @@ -288,8 +301,8 @@ xdr_fs_location4(register XDR *xdrs, fs_location4 *objp) { if (!xdr_array(xdrs, (char **)&objp->server.server_val, - (uint_t *)&objp->server.server_len, ~0, - sizeof (utf8string), (xdrproc_t)xdr_utf8string)) + (uint_t *)&objp->server.server_len, ~0, + sizeof (utf8string), (xdrproc_t)xdr_utf8string)) return (FALSE); if (!xdr_pathname4(xdrs, &objp->rootpath)) return (FALSE); @@ -303,8 +316,8 @@ xdr_fs_locations4(register XDR *xdrs, fs_locations4 *objp) if (!xdr_pathname4(xdrs, &objp->fs_root)) return (FALSE); if (!xdr_array(xdrs, (char **)&objp->locations.locations_val, - (uint_t *)&objp->locations.locations_len, ~0, - sizeof (fs_location4), (xdrproc_t)xdr_fs_location4)) + (uint_t *)&objp->locations.locations_len, ~0, + sizeof (fs_location4), (xdrproc_t)xdr_fs_location4)) return (FALSE); return (TRUE); } @@ -478,8 +491,8 @@ xdr_fattr4_acl(register XDR *xdrs, fattr4_acl *objp) { if (!xdr_array(xdrs, (char **)&objp->fattr4_acl_val, - (uint_t *)&objp->fattr4_acl_len, ~0, - sizeof (nfsace4), (xdrproc_t)xdr_nfsace4)) + (uint_t *)&objp->fattr4_acl_len, ~0, + sizeof (nfsace4), (xdrproc_t)xdr_nfsace4)) return (FALSE); return (TRUE); } @@ -659,7 +672,7 @@ bool_t xdr_fattr4_mimetype(register XDR *xdrs, fattr4_mimetype *objp) { - if (!xdr_utf8string(xdrs, objp)) + if (!xdr_ascii_REQUIRED4(xdrs, objp)) return (FALSE); return (TRUE); } @@ -876,7 +889,7 @@ xdr_attrlist4(register XDR *xdrs, attrlist4 *objp) { if (!xdr_bytes(xdrs, (char **)&objp->attrlist4_val, - (uint_t *)&objp->attrlist4_len, ~0)) + (uint_t *)&objp->attrlist4_len, ~0)) return (FALSE); return (TRUE); } @@ -920,7 +933,7 @@ bool_t xdr_cb_client4(register XDR *xdrs, cb_client4 *objp) { - if (!xdr_uint32_t(xdrs, &objp->cb_program)) + if (!xdr_u_int(xdrs, &objp->cb_program)) return (FALSE); if (!xdr_clientaddr4(xdrs, &objp->cb_location)) return (FALSE); @@ -945,7 +958,7 @@ xdr_nfs_client_id4(register XDR *xdrs, nfs_client_id4 *objp) if (!xdr_verifier4(xdrs, objp->verifier)) return (FALSE); if (!xdr_bytes(xdrs, (char **)&objp->id.id_val, - (uint_t *)&objp->id.id_len, NFS4_OPAQUE_LIMIT)) + (uint_t *)&objp->id.id_len, NFS4_OPAQUE_LIMIT)) return (FALSE); return (TRUE); } @@ -957,7 +970,7 @@ xdr_open_owner4(register XDR *xdrs, open_owner4 *objp) if (!xdr_clientid4(xdrs, &objp->clientid)) return (FALSE); if (!xdr_bytes(xdrs, (char **)&objp->owner.owner_val, - (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT)) + (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT)) return (FALSE); return (TRUE); } @@ -969,7 +982,7 @@ xdr_lock_owner4(register XDR *xdrs, lock_owner4 *objp) if (!xdr_clientid4(xdrs, &objp->clientid)) return (FALSE); if (!xdr_bytes(xdrs, (char **)&objp->owner.owner_val, - (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT)) + (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT)) return (FALSE); return (TRUE); } @@ -1572,7 +1585,7 @@ xdr_nfs_space_limit4(register XDR *xdrs, nfs_space_limit4 *objp) break; case NFS_LIMIT_BLOCKS: if (!xdr_nfs_modified_limit4(xdrs, &objp->nfs_space_limit4_u. - mod_blocks)) + mod_blocks)) return (FALSE); break; default: @@ -1623,17 +1636,17 @@ xdr_open_claim4(register XDR *xdrs, open_claim4 *objp) break; case CLAIM_PREVIOUS: if (!xdr_open_delegation_type4(xdrs, &objp->open_claim4_u. - delegate_type)) + delegate_type)) return (FALSE); break; case CLAIM_DELEGATE_CUR: if (!xdr_open_claim_delegate_cur4(xdrs, &objp->open_claim4_u. - delegate_cur_info)) + delegate_cur_info)) return (FALSE); break; case CLAIM_DELEGATE_PREV: if (!xdr_component4(xdrs, &objp->open_claim4_u. - file_delegate_prev)) + file_delegate_prev)) return (FALSE); break; default: @@ -1700,12 +1713,12 @@ xdr_open_delegation4(register XDR *xdrs, open_delegation4 *objp) break; case OPEN_DELEGATE_READ: if (!xdr_open_read_delegation4(xdrs, &objp->open_delegation4_u. - read)) + read)) return (FALSE); break; case OPEN_DELEGATE_WRITE: if (!xdr_open_write_delegation4(xdrs, &objp->open_delegation4_u. - write)) + write)) return (FALSE); break; default: @@ -1793,7 +1806,7 @@ xdr_OPEN_CONFIRM4res(register XDR *xdrs, OPEN_CONFIRM4res *objp) switch (objp->status) { case NFS4_OK: if (!xdr_OPEN_CONFIRM4resok(xdrs, &objp->OPEN_CONFIRM4res_u. - resok4)) + resok4)) return (FALSE); break; } @@ -1833,7 +1846,7 @@ xdr_OPEN_DOWNGRADE4res(register XDR *xdrs, OPEN_DOWNGRADE4res *objp) switch (objp->status) { case NFS4_OK: if (!xdr_OPEN_DOWNGRADE4resok(xdrs, &objp->OPEN_DOWNGRADE4res_u. - resok4)) + resok4)) return (FALSE); break; } @@ -1909,7 +1922,7 @@ xdr_READ4resok(register XDR *xdrs, READ4resok *objp) nfs4_skip_bytes = objp->data.data_len; #else if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, - (uint_t *)&objp->data.data_len, ~0)) + (uint_t *)&objp->data.data_len, ~0)) return (FALSE); #endif return (TRUE); @@ -1976,8 +1989,7 @@ xdr_entry4(register XDR *xdrs, entry4 *objp) break; } - objp->nextentry = (entry4 *) - mem_alloc(sizeof (entry4)); + objp->nextentry = (entry4 *)mem_alloc(sizeof (entry4)); if (objp->nextentry == NULL) return (NULL); bzero(objp->nextentry, sizeof (entry4)); @@ -2011,7 +2023,7 @@ xdr_dirlist4(register XDR *xdrs, dirlist4 *objp) { if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entry4), - (xdrproc_t)xdr_entry4)) + (xdrproc_t)xdr_entry4)) return (FALSE); if (!xdr_bool(xdrs, &objp->eof)) return (FALSE); @@ -2225,8 +2237,8 @@ xdr_SECINFO4resok(register XDR *xdrs, SECINFO4resok *objp) { if (!xdr_array(xdrs, (char **)&objp->SECINFO4resok_val, - (uint_t *)&objp->SECINFO4resok_len, ~0, - sizeof (secinfo4), (xdrproc_t)xdr_secinfo4)) + (uint_t *)&objp->SECINFO4resok_len, ~0, + sizeof (secinfo4), (xdrproc_t)xdr_secinfo4)) return (FALSE); return (TRUE); } @@ -2301,12 +2313,12 @@ xdr_SETCLIENTID4res(register XDR *xdrs, SETCLIENTID4res *objp) switch (objp->status) { case NFS4_OK: if (!xdr_SETCLIENTID4resok(xdrs, &objp->SETCLIENTID4res_u. - resok4)) + resok4)) return (FALSE); break; case NFS4ERR_CLID_INUSE: if (!xdr_clientaddr4(xdrs, &objp->SETCLIENTID4res_u. - client_using)) + client_using)) return (FALSE); break; } @@ -2384,7 +2396,7 @@ xdr_WRITE4args(register XDR *xdrs, WRITE4args *objp) nfs4_skip_bytes = objp->data.data_len; #else if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, - (uint_t *)&objp->data.data_len, ~0)) + (uint_t *)&objp->data.data_len, ~0)) return (FALSE); #endif return (TRUE); @@ -2479,17 +2491,17 @@ xdr_nfs_argop4(register XDR *xdrs, nfs_argop4 *objp) break; case OP_DELEGPURGE: if (!xdr_DELEGPURGE4args(xdrs, &objp->nfs_argop4_u. - opdelegpurge)) + opdelegpurge)) return (FALSE); break; case OP_DELEGRETURN: if (!xdr_DELEGRETURN4args(xdrs, &objp->nfs_argop4_u. - opdelegreturn)) + opdelegreturn)) return (FALSE); break; case OP_GETATTR: if (!xdr_GETATTR4args(xdrs, &objp->nfs_argop4_u. - opgetattr)) + opgetattr)) return (FALSE); break; case OP_GETFH: @@ -2530,12 +2542,12 @@ xdr_nfs_argop4(register XDR *xdrs, nfs_argop4 *objp) break; case OP_OPEN_CONFIRM: if (!xdr_OPEN_CONFIRM4args(xdrs, &objp->nfs_argop4_u. - opopen_confirm)) + opopen_confirm)) return (FALSE); break; case OP_OPEN_DOWNGRADE: if (!xdr_OPEN_DOWNGRADE4args(xdrs, &objp->nfs_argop4_u. - opopen_downgrade)) + opopen_downgrade)) return (FALSE); break; case OP_PUTFH: @@ -2582,12 +2594,12 @@ xdr_nfs_argop4(register XDR *xdrs, nfs_argop4 *objp) break; case OP_SETCLIENTID: if (!xdr_SETCLIENTID4args(xdrs, &objp->nfs_argop4_u. - opsetclientid)) + opsetclientid)) return (FALSE); break; case OP_SETCLIENTID_CONFIRM: if (!xdr_SETCLIENTID_CONFIRM4args(xdrs, &objp->nfs_argop4_u. - opsetclientid_confirm)) + opsetclientid_confirm)) return (FALSE); break; case OP_VERIFY: @@ -2600,7 +2612,7 @@ xdr_nfs_argop4(register XDR *xdrs, nfs_argop4 *objp) break; case OP_RELEASE_LOCKOWNER: if (!xdr_RELEASE_LOCKOWNER4args(xdrs, - &objp->nfs_argop4_u.oprelease_lockowner)) + &objp->nfs_argop4_u.oprelease_lockowner)) return (FALSE); break; case OP_ILLEGAL: @@ -2640,7 +2652,7 @@ xdr_nfs_resop4(register XDR *xdrs, nfs_resop4 *objp) break; case OP_DELEGRETURN: if (!xdr_DELEGRETURN4res(xdrs, &objp->nfs_resop4_u. - opdelegreturn)) + opdelegreturn)) return (FALSE); break; case OP_GETATTR: @@ -2689,12 +2701,12 @@ xdr_nfs_resop4(register XDR *xdrs, nfs_resop4 *objp) break; case OP_OPEN_CONFIRM: if (!xdr_OPEN_CONFIRM4res(xdrs, &objp->nfs_resop4_u. - opopen_confirm)) + opopen_confirm)) return (FALSE); break; case OP_OPEN_DOWNGRADE: if (!xdr_OPEN_DOWNGRADE4res(xdrs, &objp->nfs_resop4_u. - opopen_downgrade)) + opopen_downgrade)) return (FALSE); break; case OP_PUTFH: @@ -2751,12 +2763,12 @@ xdr_nfs_resop4(register XDR *xdrs, nfs_resop4 *objp) break; case OP_SETCLIENTID: if (!xdr_SETCLIENTID4res(xdrs, &objp->nfs_resop4_u. - opsetclientid)) + opsetclientid)) return (FALSE); break; case OP_SETCLIENTID_CONFIRM: if (!xdr_SETCLIENTID_CONFIRM4res(xdrs, &objp->nfs_resop4_u. - opsetclientid_confirm)) + opsetclientid_confirm)) return (FALSE); break; case OP_VERIFY: @@ -2769,7 +2781,7 @@ xdr_nfs_resop4(register XDR *xdrs, nfs_resop4 *objp) break; case OP_RELEASE_LOCKOWNER: if (!xdr_RELEASE_LOCKOWNER4res(xdrs, - &objp->nfs_resop4_u.oprelease_lockowner)) + &objp->nfs_resop4_u.oprelease_lockowner)) return (FALSE); break; case OP_ILLEGAL: @@ -2791,8 +2803,8 @@ xdr_COMPOUND4args(register XDR *xdrs, COMPOUND4args *objp) if (!xdr_uint32_t(xdrs, &objp->minorversion)) return (FALSE); if (!xdr_array(xdrs, (char **)&objp->argarray.argarray_val, - (uint_t *)&objp->argarray.argarray_len, ~0, - sizeof (nfs_argop4), (xdrproc_t)xdr_nfs_argop4)) + (uint_t *)&objp->argarray.argarray_len, ~0, + sizeof (nfs_argop4), (xdrproc_t)xdr_nfs_argop4)) return (FALSE); return (TRUE); } @@ -2806,8 +2818,8 @@ xdr_COMPOUND4res(register XDR *xdrs, COMPOUND4res *objp) if (!xdr_utf8string(xdrs, &objp->tag)) return (FALSE); if (!xdr_array(xdrs, (char **)&objp->resarray.resarray_val, - (uint_t *)&objp->resarray.resarray_len, ~0, - sizeof (nfs_resop4), (xdrproc_t)xdr_nfs_resop4)) + (uint_t *)&objp->resarray.resarray_len, ~0, + sizeof (nfs_resop4), (xdrproc_t)xdr_nfs_resop4)) return (FALSE); return (TRUE); } @@ -2896,12 +2908,12 @@ xdr_nfs_cb_argop4(register XDR *xdrs, nfs_cb_argop4 *objp) switch (objp->argop) { case OP_CB_GETATTR: if (!xdr_CB_GETATTR4args(xdrs, &objp->nfs_cb_argop4_u. - opcbgetattr)) + opcbgetattr)) return (FALSE); break; case OP_CB_RECALL: if (!xdr_CB_RECALL4args(xdrs, &objp->nfs_cb_argop4_u. - opcbrecall)) + opcbrecall)) return (FALSE); break; case OP_CB_ILLEGAL: @@ -2921,7 +2933,7 @@ xdr_nfs_cb_resop4(register XDR *xdrs, nfs_cb_resop4 *objp) switch (objp->resop) { case OP_CB_GETATTR: if (!xdr_CB_GETATTR4res(xdrs, &objp->nfs_cb_resop4_u. - opcbgetattr)) + opcbgetattr)) return (FALSE); break; case OP_CB_RECALL: @@ -2930,7 +2942,7 @@ xdr_nfs_cb_resop4(register XDR *xdrs, nfs_cb_resop4 *objp) break; case OP_CB_ILLEGAL: if (!xdr_CB_ILLEGAL4res(xdrs, - &objp->nfs_cb_resop4_u.opcbillegal)) + &objp->nfs_cb_resop4_u.opcbillegal)) return (FALSE); break; default: @@ -2950,8 +2962,8 @@ xdr_CB_COMPOUND4args(register XDR *xdrs, CB_COMPOUND4args *objp) if (!xdr_uint32_t(xdrs, &objp->callback_ident)) return (FALSE); if (!xdr_array(xdrs, (char **)&objp->argarray.argarray_val, - (uint_t *)&objp->argarray.argarray_len, ~0, - sizeof (nfs_cb_argop4), (xdrproc_t)xdr_nfs_cb_argop4)) + (uint_t *)&objp->argarray.argarray_len, ~0, + sizeof (nfs_cb_argop4), (xdrproc_t)xdr_nfs_cb_argop4)) return (FALSE); return (TRUE); } @@ -2965,8 +2977,8 @@ xdr_CB_COMPOUND4res(register XDR *xdrs, CB_COMPOUND4res *objp) if (!xdr_utf8string(xdrs, &objp->tag)) return (FALSE); if (!xdr_array(xdrs, (char **)&objp->resarray.resarray_val, - (uint_t *)&objp->resarray.resarray_len, ~0, - sizeof (nfs_cb_resop4), (xdrproc_t)xdr_nfs_cb_resop4)) + (uint_t *)&objp->resarray.resarray_len, ~0, + sizeof (nfs_cb_resop4), (xdrproc_t)xdr_nfs_cb_resop4)) return (FALSE); return (TRUE); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c index bb1db5c979..107020c140 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c @@ -18,6 +18,11 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -1152,7 +1157,7 @@ component_name(component4 *cp) static char * linktext_name(linktext4 *lp) { - return (utf8localize(lp)); + return (utf8localize((utf8string *)lp)); } /* @@ -1388,7 +1393,7 @@ detail_createtype4(createtype4 *crtp) switch (crtp->type) { case NF4LNK: sprintf(get_line(0, 0), "Linkdata = %s", - utf8localize(&crtp->createtype4_u.linkdata)); + utf8localize((utf8string *)&crtp->createtype4_u.linkdata)); break; case NF4BLK: case NF4CHR: diff --git a/usr/src/cmd/fs.d/autofs/autod_nfs.c b/usr/src/cmd/fs.d/autofs/autod_nfs.c index bf1c1c406e..ebc6b7d6d8 100644 --- a/usr/src/cmd/fs.d/autofs/autod_nfs.c +++ b/usr/src/cmd/fs.d/autofs/autod_nfs.c @@ -18,7 +18,9 @@ * * CDDL HEADER END */ + /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -68,6 +70,7 @@ #include <assert.h> #include <nfs/nfs_clnt.h> #include <rpcsvc/nfs4_prot.h> +#include <nfs/nfs4.h> #define NO_RDDIR_CACHE #include "automount.h" #include "replica.h" diff --git a/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot b/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot new file mode 100644 index 0000000000..04e670dd1b --- /dev/null +++ b/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot @@ -0,0 +1,36 @@ + * Copyright (c) 2015 IETF Trust and the persons identified + * as authors of the code. All rights reserved. + * + * Redistribution and use in source and binary forms, with + * or without modification, are permitted provided that the + * following conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * - 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. + * + * - Neither the name of Internet Society, IETF or IETF + * Trust, nor the names of specific contributors, may be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS + * 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 COPYRIGHT OWNER 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. diff --git a/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot.descrip b/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot.descrip new file mode 100644 index 0000000000..1e498b224c --- /dev/null +++ b/usr/src/head/rpcsvc/THIRDPARTYLICENSE.nfs4_prot.descrip @@ -0,0 +1 @@ +NFS VERSION 4 XDR DESCRIPTION diff --git a/usr/src/head/rpcsvc/nfs4_prot.x b/usr/src/head/rpcsvc/nfs4_prot.x index 0a218a6a36..24460cca7b 100644 --- a/usr/src/head/rpcsvc/nfs4_prot.x +++ b/usr/src/head/rpcsvc/nfs4_prot.x @@ -1,187 +1,220 @@ /* - * CDDL HEADER START + * This file was machine generated for [RFC7530]. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. + * Last updated Tue Mar 10 11:51:21 PDT 2015. + */ + +/* + * Copyright (c) 2015 IETF Trust and the persons identified + * as authors of the code. All rights reserved. + * + * Redistribution and use in source and binary forms, with + * or without modification, are permitted provided that the + * following conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. + * - 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. * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] + * - Neither the name of Internet Society, IETF or IETF + * Trust, nor the names of specific contributors, may be + * used to endorse or promote products derived from this + * software without specific prior written permission. * - * CDDL HEADER END + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS + * 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 COPYRIGHT OWNER 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. */ + /* - * Copyright (C) The Internet Society (1998-2003). - * All Rights Reserved. + * This code was derived from RFC 7531. */ /* - * nfs4_prot.x + * nfs4_prot.x + * */ /* * Basic typedefs for RFC 1832 data type definitions */ - /* - * typedef int int32_t; - * typedef unsigned int uint32_t; - * typedef hyper int64_t; - * typedef unsigned hyper uint64_t; + * typedef int int32_t; + * typedef unsigned int uint32_t; + * typedef hyper int64_t; + * typedef unsigned hyper uint64_t; */ /* * Sizes */ -const NFS4_FHSIZE = 128; -const NFS4_VERIFIER_SIZE = 8; -const NFS4_OPAQUE_LIMIT = 1024; +const NFS4_FHSIZE = 128; +const NFS4_VERIFIER_SIZE = 8; +const NFS4_OTHER_SIZE = 12; +const NFS4_OPAQUE_LIMIT = 1024; + +const NFS4_INT64_MAX = 0x7fffffffffffffff; +const NFS4_UINT64_MAX = 0xffffffffffffffff; +const NFS4_INT32_MAX = 0x7fffffff; +const NFS4_UINT32_MAX = 0xffffffff; + /* * File types */ enum nfs_ftype4 { - NF4REG = 1, /* Regular File */ - NF4DIR = 2, /* Directory */ - NF4BLK = 3, /* Special File - block device */ - NF4CHR = 4, /* Special File - character device */ - NF4LNK = 5, /* Symbolic Link */ - NF4SOCK = 6, /* Special File - socket */ - NF4FIFO = 7, /* Special File - fifo */ - NF4ATTRDIR = 8, /* Attribute Directory */ - NF4NAMEDATTR = 9 /* Named Attribute */ + NF4REG = 1, /* Regular File */ + NF4DIR = 2, /* Directory */ + NF4BLK = 3, /* Special File - block device */ + NF4CHR = 4, /* Special File - character device */ + NF4LNK = 5, /* Symbolic Link */ + NF4SOCK = 6, /* Special File - socket */ + NF4FIFO = 7, /* Special File - fifo */ + NF4ATTRDIR + = 8, /* Attribute Directory */ + NF4NAMEDATTR + = 9 /* Named Attribute */ }; /* * Error status */ enum nfsstat4 { - NFS4_OK = 0, /* everything is okay */ - NFS4ERR_PERM = 1, /* caller not privileged */ - NFS4ERR_NOENT = 2, /* no such file/directory */ - NFS4ERR_IO = 5, /* hard I/O error */ - NFS4ERR_NXIO = 6, /* no such device */ - NFS4ERR_ACCESS = 13, /* access denied */ - NFS4ERR_EXIST = 17, /* file already exists */ - NFS4ERR_XDEV = 18, /* different filesystems */ - /* Unused/reserved 19 */ - NFS4ERR_NOTDIR = 20, /* should be a directory */ - NFS4ERR_ISDIR = 21, /* should not be directory */ - NFS4ERR_INVAL = 22, /* invalid argument */ - NFS4ERR_FBIG = 27, /* file exceeds server max */ - NFS4ERR_NOSPC = 28, /* no space on filesystem */ - NFS4ERR_ROFS = 30, /* read-only filesystem */ - NFS4ERR_MLINK = 31, /* too many hard links */ - NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */ - NFS4ERR_NOTEMPTY = 66, /* directory not empty */ - NFS4ERR_DQUOT = 69, /* hard quota limit reached*/ - NFS4ERR_STALE = 70, /* file no longer exists */ - NFS4ERR_BADHANDLE = 10001,/* Illegal filehandle */ - NFS4ERR_BAD_COOKIE = 10003,/* READDIR cookie is stale */ - NFS4ERR_NOTSUPP = 10004,/* operation not supported */ - NFS4ERR_TOOSMALL = 10005,/* response limit exceeded */ - NFS4ERR_SERVERFAULT = 10006,/* undefined server error */ - NFS4ERR_BADTYPE = 10007,/* type invalid for CREATE */ - NFS4ERR_DELAY = 10008,/* file "busy" - retry */ - NFS4ERR_SAME = 10009,/* nverify says attrs same */ - NFS4ERR_DENIED = 10010,/* lock unavailable */ - NFS4ERR_EXPIRED = 10011,/* lock lease expired */ - NFS4ERR_LOCKED = 10012,/* I/O failed due to lock */ - NFS4ERR_GRACE = 10013,/* in grace period */ - NFS4ERR_FHEXPIRED = 10014,/* filehandle expired */ - NFS4ERR_SHARE_DENIED = 10015,/* share reserve denied */ - NFS4ERR_WRONGSEC = 10016,/* wrong security flavor */ - NFS4ERR_CLID_INUSE = 10017,/* clientid in use */ - NFS4ERR_RESOURCE = 10018,/* resource exhaustion */ - NFS4ERR_MOVED = 10019,/* filesystem relocated */ - NFS4ERR_NOFILEHANDLE = 10020,/* current FH is not set */ - NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */ - NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted */ - NFS4ERR_STALE_STATEID = 10023,/* server has rebooted */ - NFS4ERR_OLD_STATEID = 10024,/* state is out of sync */ - NFS4ERR_BAD_STATEID = 10025,/* incorrect stateid */ - NFS4ERR_BAD_SEQID = 10026,/* request is out of seq. */ - NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */ - NFS4ERR_LOCK_RANGE = 10028,/* lock range not supported*/ - NFS4ERR_SYMLINK = 10029,/* should be file/directory*/ - NFS4ERR_RESTOREFH = 10030,/* no saved filehandle */ - NFS4ERR_LEASE_MOVED = 10031,/* some filesystem moved */ - NFS4ERR_ATTRNOTSUPP = 10032,/* recommended attr not sup*/ - NFS4ERR_NO_GRACE = 10033,/* reclaim outside of grace*/ - NFS4ERR_RECLAIM_BAD = 10034,/* reclaim error at server */ - NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim */ - NFS4ERR_BADXDR = 10036,/* XDR decode failed */ - NFS4ERR_LOCKS_HELD = 10037,/* file locks held at CLOSE*/ - NFS4ERR_OPENMODE = 10038,/* conflict in OPEN and I/O*/ - NFS4ERR_BADOWNER = 10039,/* owner translation bad */ - NFS4ERR_BADCHAR = 10040,/* utf-8 char not supported*/ - NFS4ERR_BADNAME = 10041,/* name not supported */ - NFS4ERR_BAD_RANGE = 10042,/* lock range not supported*/ - NFS4ERR_LOCK_NOTSUPP = 10043,/* no atomic up/downgrade */ - NFS4ERR_OP_ILLEGAL = 10044,/* undefined operation */ - NFS4ERR_DEADLOCK = 10045,/* file locking deadlock */ - NFS4ERR_FILE_OPEN = 10046,/* open file blocks op. */ - NFS4ERR_ADMIN_REVOKED = 10047,/* lockowner state revoked */ - NFS4ERR_CB_PATH_DOWN = 10048 /* callback path down */ + NFS4_OK = 0, /* everything is okay */ + NFS4ERR_PERM = 1, /* caller not privileged */ + NFS4ERR_NOENT = 2, /* no such file/directory */ + NFS4ERR_IO = 5, /* hard I/O error */ + NFS4ERR_NXIO = 6, /* no such device */ + NFS4ERR_ACCESS = 13, /* access denied */ + NFS4ERR_EXIST = 17, /* file already exists */ + NFS4ERR_XDEV = 18, /* different file systems */ + /* Unused/reserved 19 */ + NFS4ERR_NOTDIR = 20, /* should be a directory */ + NFS4ERR_ISDIR = 21, /* should not be directory */ + NFS4ERR_INVAL = 22, /* invalid argument */ + NFS4ERR_FBIG = 27, /* file exceeds server max */ + NFS4ERR_NOSPC = 28, /* no space on file system */ + NFS4ERR_ROFS = 30, /* read-only file system */ + NFS4ERR_MLINK = 31, /* too many hard links */ + NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */ + NFS4ERR_NOTEMPTY = 66, /* directory not empty */ + NFS4ERR_DQUOT = 69, /* hard quota limit reached */ + NFS4ERR_STALE = 70, /* file no longer exists */ + NFS4ERR_BADHANDLE = 10001,/* Illegal filehandle */ + NFS4ERR_BAD_COOKIE = 10003,/* READDIR cookie is stale */ + NFS4ERR_NOTSUPP = 10004,/* operation not supported */ + NFS4ERR_TOOSMALL = 10005,/* response limit exceeded */ + NFS4ERR_SERVERFAULT = 10006,/* undefined server error */ + NFS4ERR_BADTYPE = 10007,/* type invalid for CREATE */ + NFS4ERR_DELAY = 10008,/* file "busy" - retry */ + NFS4ERR_SAME = 10009,/* nverify says attrs same */ + NFS4ERR_DENIED = 10010,/* lock unavailable */ + NFS4ERR_EXPIRED = 10011,/* lock lease expired */ + NFS4ERR_LOCKED = 10012,/* I/O failed due to lock */ + NFS4ERR_GRACE = 10013,/* in grace period */ + NFS4ERR_FHEXPIRED = 10014,/* filehandle expired */ + NFS4ERR_SHARE_DENIED = 10015,/* share reserve denied */ + NFS4ERR_WRONGSEC = 10016,/* wrong security flavor */ + NFS4ERR_CLID_INUSE = 10017,/* clientid in use */ + NFS4ERR_RESOURCE = 10018,/* resource exhaustion */ + NFS4ERR_MOVED = 10019,/* file system relocated */ + NFS4ERR_NOFILEHANDLE = 10020,/* current FH is not set */ + NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */ + NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted */ + NFS4ERR_STALE_STATEID = 10023,/* server has rebooted */ + NFS4ERR_OLD_STATEID = 10024,/* state is out of sync */ + NFS4ERR_BAD_STATEID = 10025,/* incorrect stateid */ + NFS4ERR_BAD_SEQID = 10026,/* request is out of seq. */ + NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */ + NFS4ERR_LOCK_RANGE = 10028,/* lock range not supported */ + NFS4ERR_SYMLINK = 10029,/* should be file/directory */ + NFS4ERR_RESTOREFH = 10030,/* no saved filehandle */ + NFS4ERR_LEASE_MOVED = 10031,/* some file system moved */ + NFS4ERR_ATTRNOTSUPP = 10032,/* recommended attr not sup */ + NFS4ERR_NO_GRACE = 10033,/* reclaim outside of grace */ + NFS4ERR_RECLAIM_BAD = 10034,/* reclaim error at server */ + NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim */ + NFS4ERR_BADXDR = 10036,/* XDR decode failed */ + NFS4ERR_LOCKS_HELD = 10037,/* file locks held at CLOSE */ + NFS4ERR_OPENMODE = 10038,/* conflict in OPEN and I/O */ + NFS4ERR_BADOWNER = 10039,/* owner translation bad */ + NFS4ERR_BADCHAR = 10040,/* UTF-8 char not supported */ + NFS4ERR_BADNAME = 10041,/* name not supported */ + NFS4ERR_BAD_RANGE = 10042,/* lock range not supported */ + NFS4ERR_LOCK_NOTSUPP = 10043,/* no atomic up/downgrade */ + NFS4ERR_OP_ILLEGAL = 10044,/* undefined operation */ + NFS4ERR_DEADLOCK = 10045,/* file locking deadlock */ + NFS4ERR_FILE_OPEN = 10046,/* open file blocks op. */ + NFS4ERR_ADMIN_REVOKED = 10047,/* lock-owner state revoked */ + NFS4ERR_CB_PATH_DOWN = 10048 /* callback path down */ }; /* * Basic data types */ -typedef uint32_t bitmap4<>; -typedef uint64_t offset4; -typedef uint32_t count4; -typedef uint64_t length4; -typedef uint64_t clientid4; -typedef uint32_t seqid4; -typedef opaque utf8string<>; -typedef utf8string utf8str_cis; -typedef utf8string utf8str_cs; -typedef utf8string utf8str_mixed; -typedef utf8str_cs component4; -typedef component4 pathname4<>; -typedef uint64_t nfs_lockid4; -typedef uint64_t nfs_cookie4; -typedef utf8str_cs linktext4; -typedef opaque sec_oid4<>; -typedef uint32_t qop4; -typedef uint32_t mode4; -typedef uint64_t changeid4; -typedef opaque verifier4[NFS4_VERIFIER_SIZE]; - -/* +typedef opaque attrlist4<>; +typedef uint32_t bitmap4<>; +typedef uint64_t changeid4; +typedef uint64_t clientid4; +typedef uint32_t count4; +typedef uint64_t length4; +typedef uint32_t mode4; +typedef uint64_t nfs_cookie4; +typedef opaque nfs_fh4<NFS4_FHSIZE>; +typedef uint32_t nfs_lease4; +typedef uint64_t offset4; +typedef uint32_t qop4; +typedef opaque sec_oid4<>; +typedef uint32_t seqid4; +typedef opaque utf8string<>; +typedef utf8string utf8str_cis; +typedef utf8string utf8str_cs; +typedef utf8string utf8str_mixed; +typedef utf8str_cs component4; +typedef opaque linktext4<>; +typedef utf8string ascii_REQUIRED4; +typedef component4 pathname4<>; +typedef uint64_t nfs_lockid4; +typedef opaque verifier4[NFS4_VERIFIER_SIZE]; + + +/* * Timeval */ struct nfstime4 { - int64_t seconds; - uint32_t nseconds; + int64_t seconds; + uint32_t nseconds; }; enum time_how4 { - SET_TO_SERVER_TIME4 = 0, - SET_TO_CLIENT_TIME4 = 1 + SET_TO_SERVER_TIME4 = 0, + SET_TO_CLIENT_TIME4 = 1 }; union settime4 switch (time_how4 set_it) { case SET_TO_CLIENT_TIME4: - nfstime4 time; + nfstime4 time; default: - void; + void; }; -/* - * File access handle - */ -typedef opaque nfs_fh4<NFS4_FHSIZE>; - /* * File attribute definitions @@ -191,30 +224,22 @@ typedef opaque nfs_fh4<NFS4_FHSIZE>; * FSID structure for major/minor */ struct fsid4 { - uint64_t major; - uint64_t minor; + uint64_t major; + uint64_t minor; }; + /* - * Filesystem locations attribute for relocation/migration + * File system locations attribute for relocation/migration */ struct fs_location4 { - utf8str_cis server<>; - pathname4 rootpath; + utf8str_cis server<>; + pathname4 rootpath; }; struct fs_locations4 { - pathname4 fs_root; - fs_location4 locations<>; -}; - -struct nfs_fsl_info { - uint_t netbuf_len; - uint_t netnm_len; - uint_t knconf_len; - string netname<MAXNETNAMELEN>; - struct netbuf *addr; - struct knetconfig *knconf; + pathname4 fs_root; + fs_location4 locations<>; }; @@ -223,98 +248,104 @@ struct nfs_fsl_info { */ /* - * Mask that indicates which Access Control Entries are supported. - * Values for the fattr4_aclsupport attribute. + * Mask that indicates which Access Control Entries + * are supported. Values for the fattr4_aclsupport attribute. */ -const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; -const ACL4_SUPPORT_DENY_ACL = 0x00000002; -const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; -const ACL4_SUPPORT_ALARM_ACL = 0x00000008; +const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; +const ACL4_SUPPORT_DENY_ACL = 0x00000002; +const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; +const ACL4_SUPPORT_ALARM_ACL = 0x00000008; + +typedef uint32_t acetype4; -typedef uint32_t acetype4; /* - * acetype4 values, others can be added as needed. + * acetype4 values; others can be added as needed. */ -const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; -const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; -const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; -const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; +const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; +const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; +const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; +const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; + /* * ACE flag */ -typedef uint32_t aceflag4; +typedef uint32_t aceflag4; + /* * ACE flag values */ -const ACE4_FILE_INHERIT_ACE = 0x00000001; -const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; -const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; -const ACE4_INHERIT_ONLY_ACE = 0x00000008; -const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; -const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; -const ACE4_IDENTIFIER_GROUP = 0x00000040; +const ACE4_FILE_INHERIT_ACE = 0x00000001; +const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; +const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; +const ACE4_INHERIT_ONLY_ACE = 0x00000008; +const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; +const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; +const ACE4_IDENTIFIER_GROUP = 0x00000040; + /* * ACE mask */ -typedef uint32_t acemask4; +typedef uint32_t acemask4; + /* * ACE mask values */ -const ACE4_READ_DATA = 0x00000001; -const ACE4_LIST_DIRECTORY = 0x00000001; -const ACE4_WRITE_DATA = 0x00000002; -const ACE4_ADD_FILE = 0x00000002; -const ACE4_APPEND_DATA = 0x00000004; -const ACE4_ADD_SUBDIRECTORY = 0x00000004; -const ACE4_READ_NAMED_ATTRS = 0x00000008; -const ACE4_WRITE_NAMED_ATTRS = 0x00000010; -const ACE4_EXECUTE = 0x00000020; -const ACE4_DELETE_CHILD = 0x00000040; -const ACE4_READ_ATTRIBUTES = 0x00000080; -const ACE4_WRITE_ATTRIBUTES = 0x00000100; - -const ACE4_DELETE = 0x00010000; -const ACE4_READ_ACL = 0x00020000; -const ACE4_WRITE_ACL = 0x00040000; -const ACE4_WRITE_OWNER = 0x00080000; -const ACE4_SYNCHRONIZE = 0x00100000; +const ACE4_READ_DATA = 0x00000001; +const ACE4_LIST_DIRECTORY = 0x00000001; +const ACE4_WRITE_DATA = 0x00000002; +const ACE4_ADD_FILE = 0x00000002; +const ACE4_APPEND_DATA = 0x00000004; +const ACE4_ADD_SUBDIRECTORY = 0x00000004; +const ACE4_READ_NAMED_ATTRS = 0x00000008; +const ACE4_WRITE_NAMED_ATTRS = 0x00000010; +const ACE4_EXECUTE = 0x00000020; +const ACE4_DELETE_CHILD = 0x00000040; +const ACE4_READ_ATTRIBUTES = 0x00000080; +const ACE4_WRITE_ATTRIBUTES = 0x00000100; + +const ACE4_DELETE = 0x00010000; +const ACE4_READ_ACL = 0x00020000; +const ACE4_WRITE_ACL = 0x00040000; +const ACE4_WRITE_OWNER = 0x00080000; +const ACE4_SYNCHRONIZE = 0x00100000; + /* - * ACE4_GENERIC_READ -- defined as combination of - * ACE4_READ_ACL | - * ACE4_READ_DATA | - * ACE4_READ_ATTRIBUTES | - * ACE4_SYNCHRONIZE + * ACE4_GENERIC_READ - defined as a combination of + * ACE4_READ_ACL | + * ACE4_READ_DATA | + * ACE4_READ_ATTRIBUTES | + * ACE4_SYNCHRONIZE */ -const ACE4_GENERIC_READ = 0x00120081; +const ACE4_GENERIC_READ = 0x00120081; /* - * ACE4_GENERIC_WRITE -- defined as combination of - * ACE4_READ_ACL | - * ACE4_WRITE_DATA | - * ACE4_WRITE_ATTRIBUTES | - * ACE4_WRITE_ACL | - * ACE4_APPEND_DATA | - * ACE4_SYNCHRONIZE + * ACE4_GENERIC_WRITE - defined as a combination of + * ACE4_READ_ACL | + * ACE4_WRITE_DATA | + * ACE4_WRITE_ATTRIBUTES | + * ACE4_WRITE_ACL | + * ACE4_APPEND_DATA | + * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_WRITE = 0x00160106; /* - * ACE4_GENERIC_EXECUTE -- defined as combination of - * ACE4_READ_ACL - * ACE4_READ_ATTRIBUTES - * ACE4_EXECUTE - * ACE4_SYNCHRONIZE + * ACE4_GENERIC_EXECUTE - defined as a combination of + * ACE4_READ_ACL + * ACE4_READ_ATTRIBUTES + * ACE4_EXECUTE + * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_EXECUTE = 0x001200A0; @@ -323,12 +354,13 @@ const ACE4_GENERIC_EXECUTE = 0x001200A0; * Access Control Entry definition */ struct nfsace4 { - acetype4 type; - aceflag4 flag; - acemask4 access_mask; - utf8str_mixed who; + acetype4 type; + aceflag4 flag; + acemask4 access_mask; + utf8str_mixed who; }; + /* * Field definitions for the fattr4_mode attribute */ @@ -345,1072 +377,982 @@ const MODE4_ROTH = 0x004; /* read permission: other */ const MODE4_WOTH = 0x002; /* write permission: other */ const MODE4_XOTH = 0x001; /* execute permission: other */ + /* * Special data/attribute associated with * file types NF4BLK and NF4CHR. */ struct specdata4 { - uint32_t specdata1; /* major device number */ - uint32_t specdata2; /* minor device number */ + uint32_t specdata1; /* major device number */ + uint32_t specdata2; /* minor device number */ }; -/* - * Values for fattr4_fh_expire_type - */ -const FH4_PERSISTENT = 0x00000000; -const FH4_NOEXPIRE_WITH_OPEN = 0x00000001; -const FH4_VOLATILE_ANY = 0x00000002; -const FH4_VOL_MIGRATION = 0x00000004; -const FH4_VOL_RENAME = 0x00000008; - - -typedef bitmap4 fattr4_supported_attrs; -typedef nfs_ftype4 fattr4_type; -typedef uint32_t fattr4_fh_expire_type; -typedef changeid4 fattr4_change; -typedef uint64_t fattr4_size; -typedef bool fattr4_link_support; -typedef bool fattr4_symlink_support; -typedef bool fattr4_named_attr; -typedef fsid4 fattr4_fsid; -typedef bool fattr4_unique_handles; -typedef uint32_t fattr4_lease_time; -typedef nfsstat4 fattr4_rdattr_error; - -typedef nfsace4 fattr4_acl<>; -typedef uint32_t fattr4_aclsupport; -typedef bool fattr4_archive; -typedef bool fattr4_cansettime; -typedef bool fattr4_case_insensitive; -typedef bool fattr4_case_preserving; -typedef bool fattr4_chown_restricted; -typedef uint64_t fattr4_fileid; -typedef uint64_t fattr4_files_avail; -typedef nfs_fh4 fattr4_filehandle; -typedef uint64_t fattr4_files_free; -typedef uint64_t fattr4_files_total; -typedef fs_locations4 fattr4_fs_locations; -typedef bool fattr4_hidden; -typedef bool fattr4_homogeneous; -typedef uint64_t fattr4_maxfilesize; -typedef uint32_t fattr4_maxlink; -typedef uint32_t fattr4_maxname; -typedef uint64_t fattr4_maxread; -typedef uint64_t fattr4_maxwrite; -typedef utf8str_cs fattr4_mimetype; -typedef mode4 fattr4_mode; -typedef uint64_t fattr4_mounted_on_fileid; -typedef bool fattr4_no_trunc; -typedef uint32_t fattr4_numlinks; -typedef utf8str_mixed fattr4_owner; -typedef utf8str_mixed fattr4_owner_group; -typedef uint64_t fattr4_quota_avail_hard; -typedef uint64_t fattr4_quota_avail_soft; -typedef uint64_t fattr4_quota_used; -typedef specdata4 fattr4_rawdev; -typedef uint64_t fattr4_space_avail; -typedef uint64_t fattr4_space_free; -typedef uint64_t fattr4_space_total; -typedef uint64_t fattr4_space_used; -typedef bool fattr4_system; -typedef nfstime4 fattr4_time_access; -typedef settime4 fattr4_time_access_set; -typedef nfstime4 fattr4_time_backup; -typedef nfstime4 fattr4_time_create; -typedef nfstime4 fattr4_time_delta; -typedef nfstime4 fattr4_time_metadata; -typedef nfstime4 fattr4_time_modify; -typedef settime4 fattr4_time_modify_set; - /* - * Mandatory Attributes - */ -const FATTR4_SUPPORTED_ATTRS = 0; -const FATTR4_TYPE = 1; -const FATTR4_FH_EXPIRE_TYPE = 2; -const FATTR4_CHANGE = 3; -const FATTR4_SIZE = 4; -const FATTR4_LINK_SUPPORT = 5; -const FATTR4_SYMLINK_SUPPORT = 6; -const FATTR4_NAMED_ATTR = 7; -const FATTR4_FSID = 8; -const FATTR4_UNIQUE_HANDLES = 9; -const FATTR4_LEASE_TIME = 10; -const FATTR4_RDATTR_ERROR = 11; -const FATTR4_FILEHANDLE = 19; - -/* - * Recommended Attributes + * Values for fattr4_fh_expire_type */ -const FATTR4_ACL = 12; -const FATTR4_ACLSUPPORT = 13; -const FATTR4_ARCHIVE = 14; -const FATTR4_CANSETTIME = 15; -const FATTR4_CASE_INSENSITIVE = 16; -const FATTR4_CASE_PRESERVING = 17; -const FATTR4_CHOWN_RESTRICTED = 18; -const FATTR4_FILEID = 20; -const FATTR4_FILES_AVAIL = 21; -const FATTR4_FILES_FREE = 22; -const FATTR4_FILES_TOTAL = 23; -const FATTR4_FS_LOCATIONS = 24; -const FATTR4_HIDDEN = 25; -const FATTR4_HOMOGENEOUS = 26; -const FATTR4_MAXFILESIZE = 27; -const FATTR4_MAXLINK = 28; -const FATTR4_MAXNAME = 29; -const FATTR4_MAXREAD = 30; -const FATTR4_MAXWRITE = 31; -const FATTR4_MIMETYPE = 32; -const FATTR4_MODE = 33; -const FATTR4_NO_TRUNC = 34; -const FATTR4_NUMLINKS = 35; -const FATTR4_OWNER = 36; -const FATTR4_OWNER_GROUP = 37; -const FATTR4_QUOTA_AVAIL_HARD = 38; -const FATTR4_QUOTA_AVAIL_SOFT = 39; -const FATTR4_QUOTA_USED = 40; -const FATTR4_RAWDEV = 41; -const FATTR4_SPACE_AVAIL = 42; -const FATTR4_SPACE_FREE = 43; -const FATTR4_SPACE_TOTAL = 44; -const FATTR4_SPACE_USED = 45; -const FATTR4_SYSTEM = 46; -const FATTR4_TIME_ACCESS = 47; -const FATTR4_TIME_ACCESS_SET = 48; -const FATTR4_TIME_BACKUP = 49; -const FATTR4_TIME_CREATE = 50; -const FATTR4_TIME_DELTA = 51; -const FATTR4_TIME_METADATA = 52; -const FATTR4_TIME_MODIFY = 53; -const FATTR4_TIME_MODIFY_SET = 54; -const FATTR4_MOUNTED_ON_FILEID = 55; - -typedef opaque attrlist4<>; +const FH4_PERSISTENT = 0x00000000; +const FH4_NOEXPIRE_WITH_OPEN = 0x00000001; +const FH4_VOLATILE_ANY = 0x00000002; +const FH4_VOL_MIGRATION = 0x00000004; +const FH4_VOL_RENAME = 0x00000008; + + +typedef bitmap4 fattr4_supported_attrs; +typedef nfs_ftype4 fattr4_type; +typedef uint32_t fattr4_fh_expire_type; +typedef changeid4 fattr4_change; +typedef uint64_t fattr4_size; +typedef bool fattr4_link_support; +typedef bool fattr4_symlink_support; +typedef bool fattr4_named_attr; +typedef fsid4 fattr4_fsid; +typedef bool fattr4_unique_handles; +typedef nfs_lease4 fattr4_lease_time; +typedef nfsstat4 fattr4_rdattr_error; + +typedef nfsace4 fattr4_acl<>; +typedef uint32_t fattr4_aclsupport; +typedef bool fattr4_archive; +typedef bool fattr4_cansettime; +typedef bool fattr4_case_insensitive; +typedef bool fattr4_case_preserving; +typedef bool fattr4_chown_restricted; +typedef uint64_t fattr4_fileid; +typedef uint64_t fattr4_files_avail; +typedef nfs_fh4 fattr4_filehandle; +typedef uint64_t fattr4_files_free; +typedef uint64_t fattr4_files_total; +typedef fs_locations4 fattr4_fs_locations; +typedef bool fattr4_hidden; +typedef bool fattr4_homogeneous; +typedef uint64_t fattr4_maxfilesize; +typedef uint32_t fattr4_maxlink; +typedef uint32_t fattr4_maxname; +typedef uint64_t fattr4_maxread; +typedef uint64_t fattr4_maxwrite; +typedef ascii_REQUIRED4 fattr4_mimetype; +typedef mode4 fattr4_mode; +typedef uint64_t fattr4_mounted_on_fileid; +typedef bool fattr4_no_trunc; +typedef uint32_t fattr4_numlinks; +typedef utf8str_mixed fattr4_owner; +typedef utf8str_mixed fattr4_owner_group; +typedef uint64_t fattr4_quota_avail_hard; +typedef uint64_t fattr4_quota_avail_soft; +typedef uint64_t fattr4_quota_used; +typedef specdata4 fattr4_rawdev; +typedef uint64_t fattr4_space_avail; +typedef uint64_t fattr4_space_free; +typedef uint64_t fattr4_space_total; +typedef uint64_t fattr4_space_used; +typedef bool fattr4_system; +typedef nfstime4 fattr4_time_access; +typedef settime4 fattr4_time_access_set; +typedef nfstime4 fattr4_time_backup; +typedef nfstime4 fattr4_time_create; +typedef nfstime4 fattr4_time_delta; +typedef nfstime4 fattr4_time_metadata; +typedef nfstime4 fattr4_time_modify; +typedef settime4 fattr4_time_modify_set; + + +/* + * Mandatory attributes + */ +const FATTR4_SUPPORTED_ATTRS = 0; +const FATTR4_TYPE = 1; +const FATTR4_FH_EXPIRE_TYPE = 2; +const FATTR4_CHANGE = 3; +const FATTR4_SIZE = 4; +const FATTR4_LINK_SUPPORT = 5; +const FATTR4_SYMLINK_SUPPORT = 6; +const FATTR4_NAMED_ATTR = 7; +const FATTR4_FSID = 8; +const FATTR4_UNIQUE_HANDLES = 9; +const FATTR4_LEASE_TIME = 10; +const FATTR4_RDATTR_ERROR = 11; +const FATTR4_FILEHANDLE = 19; + +/* + * Recommended attributes + */ +const FATTR4_ACL = 12; +const FATTR4_ACLSUPPORT = 13; +const FATTR4_ARCHIVE = 14; +const FATTR4_CANSETTIME = 15; +const FATTR4_CASE_INSENSITIVE = 16; +const FATTR4_CASE_PRESERVING = 17; +const FATTR4_CHOWN_RESTRICTED = 18; +const FATTR4_FILEID = 20; +const FATTR4_FILES_AVAIL = 21; +const FATTR4_FILES_FREE = 22; +const FATTR4_FILES_TOTAL = 23; +const FATTR4_FS_LOCATIONS = 24; +const FATTR4_HIDDEN = 25; +const FATTR4_HOMOGENEOUS = 26; +const FATTR4_MAXFILESIZE = 27; +const FATTR4_MAXLINK = 28; +const FATTR4_MAXNAME = 29; +const FATTR4_MAXREAD = 30; +const FATTR4_MAXWRITE = 31; +const FATTR4_MIMETYPE = 32; +const FATTR4_MODE = 33; +const FATTR4_NO_TRUNC = 34; +const FATTR4_NUMLINKS = 35; +const FATTR4_OWNER = 36; +const FATTR4_OWNER_GROUP = 37; +const FATTR4_QUOTA_AVAIL_HARD = 38; +const FATTR4_QUOTA_AVAIL_SOFT = 39; +const FATTR4_QUOTA_USED = 40; +const FATTR4_RAWDEV = 41; +const FATTR4_SPACE_AVAIL = 42; +const FATTR4_SPACE_FREE = 43; +const FATTR4_SPACE_TOTAL = 44; +const FATTR4_SPACE_USED = 45; +const FATTR4_SYSTEM = 46; +const FATTR4_TIME_ACCESS = 47; +const FATTR4_TIME_ACCESS_SET = 48; +const FATTR4_TIME_BACKUP = 49; +const FATTR4_TIME_CREATE = 50; +const FATTR4_TIME_DELTA = 51; +const FATTR4_TIME_METADATA = 52; +const FATTR4_TIME_MODIFY = 53; +const FATTR4_TIME_MODIFY_SET = 54; +const FATTR4_MOUNTED_ON_FILEID = 55; /* * File attribute container */ struct fattr4 { - bitmap4 attrmask; - attrlist4 attr_vals; + bitmap4 attrmask; + attrlist4 attr_vals; }; + /* * Change info for the client */ struct change_info4 { - bool atomic; - changeid4 before; - changeid4 after; + bool atomic; + changeid4 before; + changeid4 after; }; + struct clientaddr4 { - /* see struct rpcb in RFC 1833 */ - string r_netid<>; /* network id */ - string r_addr<>; /* universal address */ + /* see struct rpcb in RFC 1833 */ + string r_netid<>; /* network id */ + string r_addr<>; /* universal address */ }; + /* * Callback program info as provided by the client */ struct cb_client4 { - uint32_t cb_program; - clientaddr4 cb_location; + unsigned int cb_program; + clientaddr4 cb_location; }; + /* * Stateid */ struct stateid4 { - uint32_t seqid; - opaque other[12]; + uint32_t seqid; + opaque other[NFS4_OTHER_SIZE]; }; /* * Client ID */ struct nfs_client_id4 { - verifier4 verifier; - opaque id<NFS4_OPAQUE_LIMIT>; + verifier4 verifier; + opaque id<NFS4_OPAQUE_LIMIT>; }; + struct open_owner4 { - clientid4 clientid; - opaque owner<NFS4_OPAQUE_LIMIT>; + clientid4 clientid; + opaque owner<NFS4_OPAQUE_LIMIT>; }; + struct lock_owner4 { - clientid4 clientid; - opaque owner<NFS4_OPAQUE_LIMIT>; + clientid4 clientid; + opaque owner<NFS4_OPAQUE_LIMIT>; }; + enum nfs_lock_type4 { - READ_LT = 1, - WRITE_LT = 2, - READW_LT = 3, /* blocking read */ - WRITEW_LT = 4 /* blocking write */ + READ_LT = 1, + WRITE_LT = 2, + READW_LT = 3, /* blocking read */ + WRITEW_LT = 4 /* blocking write */ }; -/* - * ACCESS: Check access permission - */ -const ACCESS4_READ = 0x00000001; -const ACCESS4_LOOKUP = 0x00000002; -const ACCESS4_MODIFY = 0x00000004; -const ACCESS4_EXTEND = 0x00000008; -const ACCESS4_DELETE = 0x00000010; -const ACCESS4_EXECUTE = 0x00000020; + +const ACCESS4_READ = 0x00000001; +const ACCESS4_LOOKUP = 0x00000002; +const ACCESS4_MODIFY = 0x00000004; +const ACCESS4_EXTEND = 0x00000008; +const ACCESS4_DELETE = 0x00000010; +const ACCESS4_EXECUTE = 0x00000020; struct ACCESS4args { - /* CURRENT_FH: object */ - uint32_t access; + /* CURRENT_FH: object */ + uint32_t access; }; struct ACCESS4resok { - uint32_t supported; - uint32_t access; + uint32_t supported; + uint32_t access; }; union ACCESS4res switch (nfsstat4 status) { case NFS4_OK: - ACCESS4resok resok4; + ACCESS4resok resok4; default: - void; + void; }; -/* - * CLOSE: Close a file and release share reservations - */ struct CLOSE4args { - /* CURRENT_FH: object */ - seqid4 seqid; - stateid4 open_stateid; + /* CURRENT_FH: object */ + seqid4 seqid; + stateid4 open_stateid; }; union CLOSE4res switch (nfsstat4 status) { case NFS4_OK: - stateid4 open_stateid; + stateid4 open_stateid; default: - void; + void; }; -/* - * COMMIT: Commit cached data on server to stable storage - */ struct COMMIT4args { - /* CURRENT_FH: file */ - offset4 offset; - count4 count; + /* CURRENT_FH: file */ + offset4 offset; + count4 count; }; struct COMMIT4resok { - verifier4 writeverf; + verifier4 writeverf; }; - union COMMIT4res switch (nfsstat4 status) { case NFS4_OK: - COMMIT4resok resok4; + COMMIT4resok resok4; default: - void; + void; }; -/* - * CREATE: Create a non-regular file - */ union createtype4 switch (nfs_ftype4 type) { case NF4LNK: - linktext4 linkdata; + linktext4 linkdata; case NF4BLK: case NF4CHR: - specdata4 devdata; + specdata4 devdata; case NF4SOCK: case NF4FIFO: case NF4DIR: - void; + void; default: - void; /* server should return NFS4ERR_BADTYPE */ + void; /* server should return NFS4ERR_BADTYPE */ }; struct CREATE4args { - /* CURRENT_FH: directory for creation */ - createtype4 objtype; - component4 objname; - fattr4 createattrs; + /* CURRENT_FH: directory for creation */ + createtype4 objtype; + component4 objname; + fattr4 createattrs; }; struct CREATE4resok { - change_info4 cinfo; - bitmap4 attrset; /* attributes set */ + change_info4 cinfo; + bitmap4 attrset; /* attributes set */ }; union CREATE4res switch (nfsstat4 status) { case NFS4_OK: - CREATE4resok resok4; + CREATE4resok resok4; default: - void; + void; }; -/* - * DELEGPURGE: Purge Delegations Awaiting Recovery - */ struct DELEGPURGE4args { - clientid4 clientid; + clientid4 clientid; }; struct DELEGPURGE4res { - nfsstat4 status; + nfsstat4 status; }; -/* - * DELEGRETURN: Return a delegation - */ struct DELEGRETURN4args { - /* CURRENT_FH: delegated file */ - stateid4 deleg_stateid; + /* CURRENT_FH: delegated file */ + stateid4 deleg_stateid; }; struct DELEGRETURN4res { - nfsstat4 status; + nfsstat4 status; }; -/* - * GETATTR: Get file attributes - */ struct GETATTR4args { - /* CURRENT_FH: directory or file */ - bitmap4 attr_request; + /* CURRENT_FH: directory or file */ + bitmap4 attr_request; }; struct GETATTR4resok { - fattr4 obj_attributes; + fattr4 obj_attributes; }; union GETATTR4res switch (nfsstat4 status) { case NFS4_OK: - GETATTR4resok resok4; + GETATTR4resok resok4; default: - void; + void; }; -/* - * GETFH: Get current filehandle - */ struct GETFH4resok { - nfs_fh4 object; + nfs_fh4 object; }; union GETFH4res switch (nfsstat4 status) { case NFS4_OK: - GETFH4resok resok4; + GETFH4resok resok4; default: - void; + void; }; -/* - * LINK: Create link to an object - */ struct LINK4args { - /* SAVED_FH: source object */ - /* CURRENT_FH: target directory */ - component4 newname; + /* SAVED_FH: source object */ + /* CURRENT_FH: target directory */ + component4 newname; }; struct LINK4resok { - change_info4 cinfo; + change_info4 cinfo; }; union LINK4res switch (nfsstat4 status) { case NFS4_OK: - LINK4resok resok4; + LINK4resok resok4; default: - void; + void; }; /* * For LOCK, transition from open_owner to new lock_owner */ struct open_to_lock_owner4 { - seqid4 open_seqid; - stateid4 open_stateid; - seqid4 lock_seqid; - lock_owner4 lock_owner; + seqid4 open_seqid; + stateid4 open_stateid; + seqid4 lock_seqid; + lock_owner4 lock_owner; }; - + /* * For LOCK, existing lock_owner continues to request file locks */ struct exist_lock_owner4 { - stateid4 lock_stateid; - seqid4 lock_seqid; + stateid4 lock_stateid; + seqid4 lock_seqid; }; union locker4 switch (bool new_lock_owner) { case TRUE: - open_to_lock_owner4 open_owner; + open_to_lock_owner4 open_owner; case FALSE: - exist_lock_owner4 lock_owner; + exist_lock_owner4 lock_owner; }; /* * LOCK/LOCKT/LOCKU: Record lock management */ struct LOCK4args { - /* CURRENT_FH: file */ - nfs_lock_type4 locktype; - bool reclaim; - offset4 offset; - length4 length; - locker4 locker; + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + bool reclaim; + offset4 offset; + length4 length; + locker4 locker; }; struct LOCK4denied { - offset4 offset; - length4 length; - nfs_lock_type4 locktype; - lock_owner4 owner; + offset4 offset; + length4 length; + nfs_lock_type4 locktype; + lock_owner4 owner; }; struct LOCK4resok { - stateid4 lock_stateid; + stateid4 lock_stateid; }; union LOCK4res switch (nfsstat4 status) { case NFS4_OK: - LOCK4resok resok4; + LOCK4resok resok4; case NFS4ERR_DENIED: - LOCK4denied denied; + LOCK4denied denied; default: - void; + void; }; struct LOCKT4args { - /* CURRENT_FH: file */ - nfs_lock_type4 locktype; - offset4 offset; - length4 length; - lock_owner4 owner; + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + offset4 offset; + length4 length; + lock_owner4 owner; }; union LOCKT4res switch (nfsstat4 status) { case NFS4ERR_DENIED: - LOCK4denied denied; + LOCK4denied denied; case NFS4_OK: - void; + void; default: - void; + void; }; struct LOCKU4args { - /* CURRENT_FH: file */ - nfs_lock_type4 locktype; - seqid4 seqid; - stateid4 lock_stateid; - offset4 offset; - length4 length; + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + seqid4 seqid; + stateid4 lock_stateid; + offset4 offset; + length4 length; }; union LOCKU4res switch (nfsstat4 status) { - case NFS4_OK: - stateid4 lock_stateid; + case NFS4_OK: + stateid4 lock_stateid; default: - void; + void; }; -/* - * LOOKUP: Lookup filename - */ struct LOOKUP4args { - /* CURRENT_FH: directory */ - component4 objname; + /* CURRENT_FH: directory */ + component4 objname; }; struct LOOKUP4res { - /* CURRENT_FH: object */ - nfsstat4 status; + /* CURRENT_FH: object */ + nfsstat4 status; }; -/* - * LOOKUPP: Lookup parent directory - */ struct LOOKUPP4res { - /* CURRENT_FH: directory */ - nfsstat4 status; + /* CURRENT_FH: directory */ + nfsstat4 status; }; -/* - * NVERIFY: Verify attributes different - */ struct NVERIFY4args { - /* CURRENT_FH: object */ - fattr4 obj_attributes; + /* CURRENT_FH: object */ + fattr4 obj_attributes; }; struct NVERIFY4res { - nfsstat4 status; + nfsstat4 status; }; +const OPEN4_SHARE_ACCESS_READ = 0x00000001; +const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; +const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; + +const OPEN4_SHARE_DENY_NONE = 0x00000000; +const OPEN4_SHARE_DENY_READ = 0x00000001; +const OPEN4_SHARE_DENY_WRITE = 0x00000002; +const OPEN4_SHARE_DENY_BOTH = 0x00000003; /* * Various definitions for OPEN */ enum createmode4 { - UNCHECKED4 = 0, - GUARDED4 = 1, - EXCLUSIVE4 = 2 + UNCHECKED4 = 0, + GUARDED4 = 1, + EXCLUSIVE4 = 2 }; union createhow4 switch (createmode4 mode) { case UNCHECKED4: case GUARDED4: - fattr4 createattrs; + fattr4 createattrs; case EXCLUSIVE4: - verifier4 createverf; + verifier4 createverf; }; enum opentype4 { - OPEN4_NOCREATE = 0, - OPEN4_CREATE = 1 + OPEN4_NOCREATE = 0, + OPEN4_CREATE = 1 }; union openflag4 switch (opentype4 opentype) { case OPEN4_CREATE: - createhow4 how; + createhow4 how; default: - void; + void; }; /* Next definitions used for OPEN delegation */ enum limit_by4 { - NFS_LIMIT_SIZE = 1, - NFS_LIMIT_BLOCKS = 2 - /* others as needed */ + NFS_LIMIT_SIZE = 1, + NFS_LIMIT_BLOCKS = 2 + /* others as needed */ }; struct nfs_modified_limit4 { - uint32_t num_blocks; - uint32_t bytes_per_block; + uint32_t num_blocks; + uint32_t bytes_per_block; }; union nfs_space_limit4 switch (limit_by4 limitby) { /* limit specified as file size */ case NFS_LIMIT_SIZE: - uint64_t filesize; + uint64_t filesize; /* limit specified by number of blocks */ case NFS_LIMIT_BLOCKS: - nfs_modified_limit4 mod_blocks; + nfs_modified_limit4 mod_blocks; } ; -/* - * Share Access and Deny constants for open argument - */ -const OPEN4_SHARE_ACCESS_READ = 0x00000001; -const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; -const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; - -const OPEN4_SHARE_DENY_NONE = 0x00000000; -const OPEN4_SHARE_DENY_READ = 0x00000001; -const OPEN4_SHARE_DENY_WRITE = 0x00000002; -const OPEN4_SHARE_DENY_BOTH = 0x00000003; - enum open_delegation_type4 { - OPEN_DELEGATE_NONE = 0, - OPEN_DELEGATE_READ = 1, - OPEN_DELEGATE_WRITE = 2 + OPEN_DELEGATE_NONE = 0, + OPEN_DELEGATE_READ = 1, + OPEN_DELEGATE_WRITE = 2 }; - + enum open_claim_type4 { - CLAIM_NULL = 0, - CLAIM_PREVIOUS = 1, - CLAIM_DELEGATE_CUR = 2, - CLAIM_DELEGATE_PREV = 3 + CLAIM_NULL = 0, + CLAIM_PREVIOUS = 1, + CLAIM_DELEGATE_CUR = 2, + CLAIM_DELEGATE_PREV = 3 }; - + struct open_claim_delegate_cur4 { - stateid4 delegate_stateid; - component4 file; + stateid4 delegate_stateid; + component4 file; }; union open_claim4 switch (open_claim_type4 claim) { /* - * No special rights to file. Ordinary OPEN of the specified file. + * No special rights to file. + * Ordinary OPEN of the specified file. */ case CLAIM_NULL: - /* CURRENT_FH: directory */ - component4 file; - + /* CURRENT_FH: directory */ + component4 file; /* - * Right to the file established by an open previous to server - * reboot. File identified by filehandle obtained at that time - * rather than by name. + * Right to the file established by an + * open previous to server reboot. File + * identified by filehandle obtained at + * that time rather than by name. */ case CLAIM_PREVIOUS: - /* CURRENT_FH: file being reclaimed */ - open_delegation_type4 delegate_type; + /* CURRENT_FH: file being reclaimed */ + open_delegation_type4 delegate_type; /* - * Right to file based on a delegation granted by the server. - * File is specified by name. + * Right to file based on a delegation + * granted by the server. File is + * specified by name. */ case CLAIM_DELEGATE_CUR: - /* CURRENT_FH: directory */ - open_claim_delegate_cur4 delegate_cur_info; - - /* Right to file based on a delegation granted to a previous boot - * instance of the client. File is specified by name. + /* CURRENT_FH: directory */ + open_claim_delegate_cur4 delegate_cur_info; + + /* + * Right to file based on a delegation + * granted to a previous boot instance + * of the client. File is specified by name. */ case CLAIM_DELEGATE_PREV: - /* CURRENT_FH: directory */ - component4 file_delegate_prev; + /* CURRENT_FH: directory */ + component4 file_delegate_prev; }; /* * OPEN: Open a file, potentially receiving an open delegation */ struct OPEN4args { - seqid4 seqid; - uint32_t share_access; - uint32_t share_deny; - open_owner4 owner; - openflag4 openhow; - open_claim4 claim; + seqid4 seqid; + uint32_t share_access; + uint32_t share_deny; + open_owner4 owner; + openflag4 openhow; + open_claim4 claim; }; struct open_read_delegation4 { - stateid4 stateid; /* Stateid for delegation*/ - bool recall; /* Pre-recalled flag for - delegations obtained - by reclaim - (CLAIM_PREVIOUS) */ - nfsace4 permissions; /* Defines users who don't - need an ACCESS call to - open for read */ + stateid4 stateid; /* Stateid for delegation */ + bool recall; /* Pre-recalled flag for + delegations obtained + by reclaim (CLAIM_PREVIOUS). */ + + nfsace4 permissions; /* Defines users who don't + need an ACCESS call to + open for read. */ }; struct open_write_delegation4 { - stateid4 stateid; /* Stateid for delegation */ - bool recall; /* Pre-recalled flag for - delegations obtained - by reclaim - (CLAIM_PREVIOUS) */ - nfs_space_limit4 space_limit; /* Defines condition that - the client must check to - determine whether the - file needs to be flushed - to the server on close. - */ - nfsace4 permissions; /* Defines users who don't - need an ACCESS call as - part of a delegated - open. */ + stateid4 stateid; /* Stateid for delegation */ + bool recall; /* Pre-recalled flag for + delegations obtained + by reclaim + (CLAIM_PREVIOUS). */ + + nfs_space_limit4 + space_limit; /* Defines condition that + the client must check to + determine whether the + file needs to be flushed + to the server on close. */ + + nfsace4 permissions; /* Defines users who don't + need an ACCESS call as + part of a delegated + open. */ }; union open_delegation4 switch (open_delegation_type4 delegation_type) { - case OPEN_DELEGATE_NONE: - void; - case OPEN_DELEGATE_READ: - open_read_delegation4 read; - case OPEN_DELEGATE_WRITE: - open_write_delegation4 write; + case OPEN_DELEGATE_NONE: + void; + case OPEN_DELEGATE_READ: + open_read_delegation4 read; + case OPEN_DELEGATE_WRITE: + open_write_delegation4 write; }; /* * Result flags */ + /* Client must confirm open */ -const OPEN4_RESULT_CONFIRM = 0x00000002; +const OPEN4_RESULT_CONFIRM = 0x00000002; /* Type of file locking behavior at the server */ const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; struct OPEN4resok { - stateid4 stateid; /* Stateid for open */ - change_info4 cinfo; /* Directory Change Info */ - uint32_t rflags; /* Result flags */ - bitmap4 attrset; /* attribute set for create*/ - open_delegation4 delegation; /* Info on any open - delegation */ + stateid4 stateid; /* Stateid for open */ + change_info4 cinfo; /* Directory change info */ + uint32_t rflags; /* Result flags */ + bitmap4 attrset; /* attribute set for create */ + open_delegation4 delegation; /* Info on any open + delegation */ }; union OPEN4res switch (nfsstat4 status) { case NFS4_OK: - /* CURRENT_FH: opened file */ - OPEN4resok resok4; + /* CURRENT_FH: opened file */ + OPEN4resok resok4; default: - void; -}; + void; +}; -/* - * OPENATTR: open named attributes directory - */ struct OPENATTR4args { - /* CURRENT_FH: object */ - bool createdir; + /* CURRENT_FH: object */ + bool createdir; }; struct OPENATTR4res { - /* CURRENT_FH: named attr directory */ - nfsstat4 status; + /* CURRENT_FH: named attr directory */ + nfsstat4 status; }; -/* - * OPEN_CONFIRM: confirm the open - */ struct OPEN_CONFIRM4args { - /* CURRENT_FH: opened file */ - stateid4 open_stateid; - seqid4 seqid; + /* CURRENT_FH: opened file */ + stateid4 open_stateid; + seqid4 seqid; }; struct OPEN_CONFIRM4resok { - stateid4 open_stateid; + stateid4 open_stateid; }; union OPEN_CONFIRM4res switch (nfsstat4 status) { case NFS4_OK: - OPEN_CONFIRM4resok resok4; + OPEN_CONFIRM4resok resok4; default: - void; + void; }; -/* - * OPEN_DOWNGRADE: downgrade the access/deny for a file - */ struct OPEN_DOWNGRADE4args { - /* CURRENT_FH: opened file */ - stateid4 open_stateid; - seqid4 seqid; - uint32_t share_access; - uint32_t share_deny; + /* CURRENT_FH: opened file */ + stateid4 open_stateid; + seqid4 seqid; + uint32_t share_access; + uint32_t share_deny; }; struct OPEN_DOWNGRADE4resok { - stateid4 open_stateid; + stateid4 open_stateid; }; -union OPEN_DOWNGRADE4res switch(nfsstat4 status) { +union OPEN_DOWNGRADE4res switch (nfsstat4 status) { case NFS4_OK: - OPEN_DOWNGRADE4resok resok4; + OPEN_DOWNGRADE4resok resok4; default: - void; + void; }; -/* - * PUTFH: Set current filehandle - */ struct PUTFH4args { - nfs_fh4 object; + nfs_fh4 object; }; struct PUTFH4res { - /* CURRENT_FH: */ - nfsstat4 status; + /* CURRENT_FH: */ + nfsstat4 status; }; -/* - * PUTPUBFH: Set public filehandle - */ struct PUTPUBFH4res { - /* CURRENT_FH: public fh */ - nfsstat4 status; + /* CURRENT_FH: public fh */ + nfsstat4 status; }; -/* - * PUTROOTFH: Set root filehandle - */ struct PUTROOTFH4res { - /* CURRENT_FH: root fh */ - nfsstat4 status; + /* CURRENT_FH: root fh */ + nfsstat4 status; }; -/* - * READ: Read from file - */ struct READ4args { - /* CURRENT_FH: file */ - stateid4 stateid; - offset4 offset; - count4 count; + /* CURRENT_FH: file */ + stateid4 stateid; + offset4 offset; + count4 count; }; struct READ4resok { - bool eof; - opaque data<>; + bool eof; + opaque data<>; }; union READ4res switch (nfsstat4 status) { case NFS4_OK: - READ4resok resok4; + READ4resok resok4; default: - void; + void; }; -/* - * READDIR: Read directory - */ struct READDIR4args { - /* CURRENT_FH: directory */ - nfs_cookie4 cookie; - verifier4 cookieverf; - count4 dircount; - count4 maxcount; - bitmap4 attr_request; + /* CURRENT_FH: directory */ + nfs_cookie4 cookie; + verifier4 cookieverf; + count4 dircount; + count4 maxcount; + bitmap4 attr_request; }; struct entry4 { - nfs_cookie4 cookie; - component4 name; - fattr4 attrs; - entry4 *nextentry; + nfs_cookie4 cookie; + component4 name; + fattr4 attrs; + entry4 *nextentry; }; struct dirlist4 { - entry4 *entries; - bool eof; + entry4 *entries; + bool eof; }; struct READDIR4resok { - verifier4 cookieverf; - dirlist4 reply; + verifier4 cookieverf; + dirlist4 reply; }; union READDIR4res switch (nfsstat4 status) { case NFS4_OK: - READDIR4resok resok4; + READDIR4resok resok4; default: - void; + void; }; -/* - * READLINK: Read symbolic link - */ struct READLINK4resok { - linktext4 link; + linktext4 link; }; union READLINK4res switch (nfsstat4 status) { case NFS4_OK: - READLINK4resok resok4; + READLINK4resok resok4; default: - void; + void; }; -/* - * REMOVE: Remove filesystem object - */ struct REMOVE4args { - /* CURRENT_FH: directory */ - component4 target; + /* CURRENT_FH: directory */ + component4 target; }; struct REMOVE4resok { - change_info4 cinfo; + change_info4 cinfo; }; union REMOVE4res switch (nfsstat4 status) { case NFS4_OK: - REMOVE4resok resok4; + REMOVE4resok resok4; default: - void; + void; }; -/* - * RENAME: Rename directory entry - */ struct RENAME4args { - /* SAVED_FH: source directory */ - component4 oldname; - /* CURRENT_FH: target directory */ - component4 newname; + /* SAVED_FH: source directory */ + component4 oldname; + /* CURRENT_FH: target directory */ + component4 newname; }; struct RENAME4resok { - change_info4 source_cinfo; - change_info4 target_cinfo; + change_info4 source_cinfo; + change_info4 target_cinfo; }; union RENAME4res switch (nfsstat4 status) { case NFS4_OK: - RENAME4resok resok4; + RENAME4resok resok4; default: - void; + void; }; -/* - * RENEW: Renew a Lease - */ struct RENEW4args { - clientid4 clientid; + clientid4 clientid; }; struct RENEW4res { - nfsstat4 status; + nfsstat4 status; }; - -/* - * RESTOREFH: Restore saved filehandle - */ struct RESTOREFH4res { - /* CURRENT_FH: value of saved fh */ - nfsstat4 status; + /* CURRENT_FH: value of saved fh */ + nfsstat4 status; }; -/* - * SAVEFH: Save current filehandle - */ struct SAVEFH4res { - /* SAVED_FH: value of current fh */ - nfsstat4 status; + /* SAVED_FH: value of current fh */ + nfsstat4 status; }; -/* - * SECINFO: Obtain Available Security Mechanisms - */ struct SECINFO4args { - /* CURRENT_FH: directory */ - component4 name; + /* CURRENT_FH: directory */ + component4 name; }; /* * From RFC 2203 */ enum rpc_gss_svc_t { - RPC_GSS_SVC_NONE = 1, - RPC_GSS_SVC_INTEGRITY = 2, - RPC_GSS_SVC_PRIVACY = 3 + RPC_GSS_SVC_NONE = 1, + RPC_GSS_SVC_INTEGRITY = 2, + RPC_GSS_SVC_PRIVACY = 3 }; struct rpcsec_gss_info { - sec_oid4 oid; - qop4 qop; - rpc_gss_svc_t service; -}; - -/* RPCSEC_GSS has a value of '6' - See RFC 2203 */ + sec_oid4 oid; + qop4 qop; + rpc_gss_svc_t service; +}; + +/* RPCSEC_GSS has a value of '6'. See RFC 2203 */ union secinfo4 switch (uint32_t flavor) { case RPCSEC_GSS: - rpcsec_gss_info flavor_info; + rpcsec_gss_info flavor_info; default: - void; + void; }; typedef secinfo4 SECINFO4resok<>; union SECINFO4res switch (nfsstat4 status) { case NFS4_OK: - SECINFO4resok resok4; + SECINFO4resok resok4; default: - void; -}; + void; +}; -/* - * SETATTR: Set attributes - */ struct SETATTR4args { - /* CURRENT_FH: target object */ - stateid4 stateid; - fattr4 obj_attributes; + /* CURRENT_FH: target object */ + stateid4 stateid; + fattr4 obj_attributes; }; struct SETATTR4res { - nfsstat4 status; - bitmap4 attrsset; + nfsstat4 status; + bitmap4 attrsset; }; -/* - * SETCLIENTID - */ struct SETCLIENTID4args { - nfs_client_id4 client; - cb_client4 callback; - uint32_t callback_ident; -}; + nfs_client_id4 client; + cb_client4 callback; + uint32_t callback_ident; +}; struct SETCLIENTID4resok { - clientid4 clientid; - verifier4 setclientid_confirm; + clientid4 clientid; + verifier4 setclientid_confirm; }; union SETCLIENTID4res switch (nfsstat4 status) { case NFS4_OK: - SETCLIENTID4resok resok4; + SETCLIENTID4resok resok4; case NFS4ERR_CLID_INUSE: - clientaddr4 client_using; + clientaddr4 client_using; default: - void; + void; }; struct SETCLIENTID_CONFIRM4args { - clientid4 clientid; - verifier4 setclientid_confirm; + clientid4 clientid; + verifier4 setclientid_confirm; }; struct SETCLIENTID_CONFIRM4res { - nfsstat4 status; + nfsstat4 status; }; -/* - * VERIFY: Verify attributes same - */ struct VERIFY4args { - /* CURRENT_FH: object */ - fattr4 obj_attributes; + /* CURRENT_FH: object */ + fattr4 obj_attributes; }; struct VERIFY4res { - nfsstat4 status; + nfsstat4 status; }; -/* - * WRITE: Write to file - */ enum stable_how4 { - UNSTABLE4 = 0, - DATA_SYNC4 = 1, - FILE_SYNC4 = 2 + UNSTABLE4 = 0, + DATA_SYNC4 = 1, + FILE_SYNC4 = 2 }; struct WRITE4args { - /* CURRENT_FH: file */ - stateid4 stateid; - offset4 offset; - stable_how4 stable; - opaque data<>; + /* CURRENT_FH: file */ + stateid4 stateid; + offset4 offset; + stable_how4 stable; + opaque data<>; }; struct WRITE4resok { - count4 count; - stable_how4 committed; - verifier4 writeverf; + count4 count; + stable_how4 committed; + verifier4 writeverf; }; union WRITE4res switch (nfsstat4 status) { case NFS4_OK: - WRITE4resok resok4; + WRITE4resok resok4; default: - void; + void; }; -/* - * RELEASE_LOCKOWNER: Notify server to release lockowner - */ struct RELEASE_LOCKOWNER4args { - lock_owner4 lock_owner; + lock_owner4 lock_owner; }; struct RELEASE_LOCKOWNER4res { - nfsstat4 status; + nfsstat4 status; }; -/* - * ILLEGAL: Response for illegal operation numbers - */ struct ILLEGAL4res { - nfsstat4 status; + nfsstat4 status; }; /* @@ -1418,248 +1360,248 @@ struct ILLEGAL4res { */ enum nfs_opnum4 { - OP_ACCESS = 3, - OP_CLOSE = 4, - OP_COMMIT = 5, - OP_CREATE = 6, - OP_DELEGPURGE = 7, - OP_DELEGRETURN = 8, - OP_GETATTR = 9, - OP_GETFH = 10, - OP_LINK = 11, - OP_LOCK = 12, - OP_LOCKT = 13, - OP_LOCKU = 14, - OP_LOOKUP = 15, - OP_LOOKUPP = 16, - OP_NVERIFY = 17, - OP_OPEN = 18, - OP_OPENATTR = 19, - OP_OPEN_CONFIRM = 20, - OP_OPEN_DOWNGRADE = 21, - OP_PUTFH = 22, - OP_PUTPUBFH = 23, - OP_PUTROOTFH = 24, - OP_READ = 25, - OP_READDIR = 26, - OP_READLINK = 27, - OP_REMOVE = 28, - OP_RENAME = 29, - OP_RENEW = 30, - OP_RESTOREFH = 31, - OP_SAVEFH = 32, - OP_SECINFO = 33, - OP_SETATTR = 34, - OP_SETCLIENTID = 35, - OP_SETCLIENTID_CONFIRM = 36, - OP_VERIFY = 37, - OP_WRITE = 38, - OP_RELEASE_LOCKOWNER = 39, - OP_ILLEGAL = 10044 + OP_ACCESS = 3, + OP_CLOSE = 4, + OP_COMMIT = 5, + OP_CREATE = 6, + OP_DELEGPURGE = 7, + OP_DELEGRETURN = 8, + OP_GETATTR = 9, + OP_GETFH = 10, + OP_LINK = 11, + OP_LOCK = 12, + OP_LOCKT = 13, + OP_LOCKU = 14, + OP_LOOKUP = 15, + OP_LOOKUPP = 16, + OP_NVERIFY = 17, + OP_OPEN = 18, + OP_OPENATTR = 19, + OP_OPEN_CONFIRM = 20, + OP_OPEN_DOWNGRADE = 21, + OP_PUTFH = 22, + OP_PUTPUBFH = 23, + OP_PUTROOTFH = 24, + OP_READ = 25, + OP_READDIR = 26, + OP_READLINK = 27, + OP_REMOVE = 28, + OP_RENAME = 29, + OP_RENEW = 30, + OP_RESTOREFH = 31, + OP_SAVEFH = 32, + OP_SECINFO = 33, + OP_SETATTR = 34, + OP_SETCLIENTID = 35, + OP_SETCLIENTID_CONFIRM = 36, + OP_VERIFY = 37, + OP_WRITE = 38, + OP_RELEASE_LOCKOWNER = 39, + OP_ILLEGAL = 10044 }; union nfs_argop4 switch (nfs_opnum4 argop) { - case OP_ACCESS: ACCESS4args opaccess; - case OP_CLOSE: CLOSE4args opclose; - case OP_COMMIT: COMMIT4args opcommit; - case OP_CREATE: CREATE4args opcreate; - case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge; - case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn; - case OP_GETATTR: GETATTR4args opgetattr; - case OP_GETFH: void; - case OP_LINK: LINK4args oplink; - case OP_LOCK: LOCK4args oplock; - case OP_LOCKT: LOCKT4args oplockt; - case OP_LOCKU: LOCKU4args oplocku; - case OP_LOOKUP: LOOKUP4args oplookup; - case OP_LOOKUPP: void; - case OP_NVERIFY: NVERIFY4args opnverify; - case OP_OPEN: OPEN4args opopen; - case OP_OPENATTR: OPENATTR4args opopenattr; - case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm; - case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4args opopen_downgrade; - case OP_PUTFH: PUTFH4args opputfh; - case OP_PUTPUBFH: void; - case OP_PUTROOTFH: void; - case OP_READ: READ4args opread; - case OP_READDIR: READDIR4args opreaddir; - case OP_READLINK: void; - case OP_REMOVE: REMOVE4args opremove; - case OP_RENAME: RENAME4args oprename; - case OP_RENEW: RENEW4args oprenew; - case OP_RESTOREFH: void; - case OP_SAVEFH: void; - case OP_SECINFO: SECINFO4args opsecinfo; - case OP_SETATTR: SETATTR4args opsetattr; - case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; - case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args - opsetclientid_confirm; - case OP_VERIFY: VERIFY4args opverify; - case OP_WRITE: WRITE4args opwrite; - case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4args - oprelease_lockowner; - case OP_ILLEGAL: void; -}; - -union nfs_resop4 switch (nfs_opnum4 resop){ - case OP_ACCESS: ACCESS4res opaccess; - case OP_CLOSE: CLOSE4res opclose; - case OP_COMMIT: COMMIT4res opcommit; - case OP_CREATE: CREATE4res opcreate; - case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge; - case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn; - case OP_GETATTR: GETATTR4res opgetattr; - case OP_GETFH: GETFH4res opgetfh; - case OP_LINK: LINK4res oplink; - case OP_LOCK: LOCK4res oplock; - case OP_LOCKT: LOCKT4res oplockt; - case OP_LOCKU: LOCKU4res oplocku; - case OP_LOOKUP: LOOKUP4res oplookup; - case OP_LOOKUPP: LOOKUPP4res oplookupp; - case OP_NVERIFY: NVERIFY4res opnverify; - case OP_OPEN: OPEN4res opopen; - case OP_OPENATTR: OPENATTR4res opopenattr; - case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm; - case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4res opopen_downgrade; - case OP_PUTFH: PUTFH4res opputfh; - case OP_PUTPUBFH: PUTPUBFH4res opputpubfh; - case OP_PUTROOTFH: PUTROOTFH4res opputrootfh; - case OP_READ: READ4res opread; - case OP_READDIR: READDIR4res opreaddir; - case OP_READLINK: READLINK4res opreadlink; - case OP_REMOVE: REMOVE4res opremove; - case OP_RENAME: RENAME4res oprename; - case OP_RENEW: RENEW4res oprenew; - case OP_RESTOREFH: RESTOREFH4res oprestorefh; - case OP_SAVEFH: SAVEFH4res opsavefh; - case OP_SECINFO: SECINFO4res opsecinfo; - case OP_SETATTR: SETATTR4res opsetattr; - case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; - case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4res - opsetclientid_confirm; - case OP_VERIFY: VERIFY4res opverify; - case OP_WRITE: WRITE4res opwrite; - case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4res - oprelease_lockowner; - case OP_ILLEGAL: ILLEGAL4res opillegal; + case OP_ACCESS: ACCESS4args opaccess; + case OP_CLOSE: CLOSE4args opclose; + case OP_COMMIT: COMMIT4args opcommit; + case OP_CREATE: CREATE4args opcreate; + case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge; + case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn; + case OP_GETATTR: GETATTR4args opgetattr; + case OP_GETFH: void; + case OP_LINK: LINK4args oplink; + case OP_LOCK: LOCK4args oplock; + case OP_LOCKT: LOCKT4args oplockt; + case OP_LOCKU: LOCKU4args oplocku; + case OP_LOOKUP: LOOKUP4args oplookup; + case OP_LOOKUPP: void; + case OP_NVERIFY: NVERIFY4args opnverify; + case OP_OPEN: OPEN4args opopen; + case OP_OPENATTR: OPENATTR4args opopenattr; + case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm; + case OP_OPEN_DOWNGRADE: + OPEN_DOWNGRADE4args opopen_downgrade; + case OP_PUTFH: PUTFH4args opputfh; + case OP_PUTPUBFH: void; + case OP_PUTROOTFH: void; + case OP_READ: READ4args opread; + case OP_READDIR: READDIR4args opreaddir; + case OP_READLINK: void; + case OP_REMOVE: REMOVE4args opremove; + case OP_RENAME: RENAME4args oprename; + case OP_RENEW: RENEW4args oprenew; + case OP_RESTOREFH: void; + case OP_SAVEFH: void; + case OP_SECINFO: SECINFO4args opsecinfo; + case OP_SETATTR: SETATTR4args opsetattr; + case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; + case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args + opsetclientid_confirm; + case OP_VERIFY: VERIFY4args opverify; + case OP_WRITE: WRITE4args opwrite; + case OP_RELEASE_LOCKOWNER: + RELEASE_LOCKOWNER4args + oprelease_lockowner; + case OP_ILLEGAL: void; +}; + +union nfs_resop4 switch (nfs_opnum4 resop) { + case OP_ACCESS: ACCESS4res opaccess; + case OP_CLOSE: CLOSE4res opclose; + case OP_COMMIT: COMMIT4res opcommit; + case OP_CREATE: CREATE4res opcreate; + case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge; + case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn; + case OP_GETATTR: GETATTR4res opgetattr; + case OP_GETFH: GETFH4res opgetfh; + case OP_LINK: LINK4res oplink; + case OP_LOCK: LOCK4res oplock; + case OP_LOCKT: LOCKT4res oplockt; + case OP_LOCKU: LOCKU4res oplocku; + case OP_LOOKUP: LOOKUP4res oplookup; + case OP_LOOKUPP: LOOKUPP4res oplookupp; + case OP_NVERIFY: NVERIFY4res opnverify; + case OP_OPEN: OPEN4res opopen; + case OP_OPENATTR: OPENATTR4res opopenattr; + case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm; + case OP_OPEN_DOWNGRADE: + OPEN_DOWNGRADE4res + opopen_downgrade; + case OP_PUTFH: PUTFH4res opputfh; + case OP_PUTPUBFH: PUTPUBFH4res opputpubfh; + case OP_PUTROOTFH: PUTROOTFH4res opputrootfh; + case OP_READ: READ4res opread; + case OP_READDIR: READDIR4res opreaddir; + case OP_READLINK: READLINK4res opreadlink; + case OP_REMOVE: REMOVE4res opremove; + case OP_RENAME: RENAME4res oprename; + case OP_RENEW: RENEW4res oprenew; + case OP_RESTOREFH: RESTOREFH4res oprestorefh; + case OP_SAVEFH: SAVEFH4res opsavefh; + case OP_SECINFO: SECINFO4res opsecinfo; + case OP_SETATTR: SETATTR4res opsetattr; + case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; + case OP_SETCLIENTID_CONFIRM: + SETCLIENTID_CONFIRM4res + opsetclientid_confirm; + case OP_VERIFY: VERIFY4res opverify; + case OP_WRITE: WRITE4res opwrite; + case OP_RELEASE_LOCKOWNER: + RELEASE_LOCKOWNER4res + oprelease_lockowner; + case OP_ILLEGAL: ILLEGAL4res opillegal; }; struct COMPOUND4args { - utf8str_cs tag; - uint32_t minorversion; - nfs_argop4 argarray<>; + utf8str_cs tag; + uint32_t minorversion; + nfs_argop4 argarray<>; }; struct COMPOUND4res { - nfsstat4 status; - utf8str_cs tag; - nfs_resop4 resarray<>; + nfsstat4 status; + utf8str_cs tag; + nfs_resop4 resarray<>; }; + /* * Remote file service routines */ program NFS4_PROGRAM { - version NFS_V4 { - void - NFSPROC4_NULL(void) = 0; + version NFS_V4 { + void + NFSPROC4_NULL(void) = 0; - COMPOUND4res - NFSPROC4_COMPOUND(COMPOUND4args) = 1; + COMPOUND4res + NFSPROC4_COMPOUND(COMPOUND4args) = 1; - } = 4; + } = 4; } = 100003; - - -/* - * NFS4 Callback Procedure Definitions and Program - */ - /* - * CB_GETATTR: Get Current Attributes + * NFS4 callback procedure definitions and program */ struct CB_GETATTR4args { - nfs_fh4 fh; - bitmap4 attr_request; + nfs_fh4 fh; + bitmap4 attr_request; }; struct CB_GETATTR4resok { - fattr4 obj_attributes; + fattr4 obj_attributes; }; union CB_GETATTR4res switch (nfsstat4 status) { case NFS4_OK: - CB_GETATTR4resok resok4; + CB_GETATTR4resok resok4; default: - void; + void; }; -/* - * CB_RECALL: Recall an Open Delegation - */ struct CB_RECALL4args { - stateid4 stateid; - bool truncate; - nfs_fh4 fh; + stateid4 stateid; + bool truncate; + nfs_fh4 fh; }; struct CB_RECALL4res { - nfsstat4 status; + nfsstat4 status; }; /* * CB_ILLEGAL: Response for illegal operation numbers */ struct CB_ILLEGAL4res { - nfsstat4 status; + nfsstat4 status; }; /* * Various definitions for CB_COMPOUND */ enum nfs_cb_opnum4 { - OP_CB_GETATTR = 3, - OP_CB_RECALL = 4, - OP_CB_ILLEGAL = 10044 + OP_CB_GETATTR = 3, + OP_CB_RECALL = 4, + OP_CB_ILLEGAL = 10044 }; union nfs_cb_argop4 switch (unsigned argop) { - case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; - case OP_CB_RECALL: CB_RECALL4args opcbrecall; - case OP_CB_ILLEGAL: void; + case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; + case OP_CB_RECALL: CB_RECALL4args opcbrecall; + case OP_CB_ILLEGAL: void; }; -union nfs_cb_resop4 switch (unsigned resop){ - case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; - case OP_CB_RECALL: CB_RECALL4res opcbrecall; - case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal; +union nfs_cb_resop4 switch (unsigned resop) { + case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; + case OP_CB_RECALL: CB_RECALL4res opcbrecall; + case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal; }; + struct CB_COMPOUND4args { - utf8str_cs tag; - uint32_t minorversion; - uint32_t callback_ident; - nfs_cb_argop4 argarray<>; + utf8str_cs tag; + uint32_t minorversion; + uint32_t callback_ident; + nfs_cb_argop4 argarray<>; }; struct CB_COMPOUND4res { - nfsstat4 status; - utf8str_cs tag; - nfs_cb_resop4 resarray<>; + nfsstat4 status; + utf8str_cs tag; + nfs_cb_resop4 resarray<>; }; + /* - * Program number is in the transient range since the client + * Program number is in the transient range, since the client * will assign the exact transient program number and provide * that to the server via the SETCLIENTID operation. */ program NFS4_CALLBACK { - version NFS_CB { - void - CB_NULL(void) = 0; - CB_COMPOUND4res - CB_COMPOUND(CB_COMPOUND4args) = 1; - } = 1; + version NFS_CB { + void + CB_NULL(void) = 0; + CB_COMPOUND4res + CB_COMPOUND(CB_COMPOUND4args) = 1; + } = 1; } = 0x40000000; diff --git a/usr/src/lib/libbe/common/be_mount.c b/usr/src/lib/libbe/common/be_mount.c index 70ad9c4ac3..03cb03b128 100644 --- a/usr/src/lib/libbe/common/be_mount.c +++ b/usr/src/lib/libbe/common/be_mount.c @@ -24,6 +24,7 @@ */ /* * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 EveryCity Ltd. */ /* @@ -192,7 +193,6 @@ be_unmount(nvlist_t *be_attrs) if (be_name[0] == '/') { if ((ds = be_get_ds_from_dir(be_name)) != NULL) { if ((be_name_mnt = strrchr(ds, '/')) != NULL) { - free(be_name); be_name = be_name_mnt + 1; } } else { diff --git a/usr/src/stand/lib/fs/nfs/nfs4_xdr.c b/usr/src/stand/lib/fs/nfs/nfs4_xdr.c index e33f2aa4c2..022fb45791 100644 --- a/usr/src/stand/lib/fs/nfs/nfs4_xdr.c +++ b/usr/src/stand/lib/fs/nfs/nfs4_xdr.c @@ -19,13 +19,16 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/salib.h> #include <rpc/types.h> #include <rpc/xdr.h> @@ -42,7 +45,7 @@ static bool_t xdr_b_utf8string(XDR *xdrs, utf8string *objp) { return (xdr_bytes(xdrs, (char **)&objp->utf8string_val, - (uint_t *)&objp->utf8string_len, NFS4_MAX_UTF8STRING)); + (uint_t *)&objp->utf8string_len, NFS4_MAX_UTF8STRING)); } static bool_t @@ -50,7 +53,7 @@ xdr_nfs_bfh4(XDR *xdrs, struct nfs_bfh4 *objp) { char *data = (char *)&objp->data; return (xdr_bytes(xdrs, (char **)&data, (uint_t *)&objp->len, - NFS4_FHSIZE)); + NFS4_FHSIZE)); } static bool_t @@ -99,8 +102,8 @@ xdr_b_bitmap4(XDR *xdrs, b_bitmap4_t *objp) { char *arp = (char *)&objp->b_bitmap_val; return (xdr_array(xdrs, (char **)&arp, - (uint_t *)&objp->b_bitmap_len, ~0, - sizeof (uint_t), (xdrproc_t)xdr_u_int)); + (uint_t *)&objp->b_bitmap_len, ~0, + sizeof (uint_t), (xdrproc_t)xdr_u_int)); } static bool_t @@ -108,7 +111,7 @@ xdr_b_stateid4(XDR *xdrs, stateid4 *objp) { if (!xdr_u_int(xdrs, (uint_t *)&objp->seqid)) return (FALSE); - return (xdr_opaque(xdrs, objp->other, 12)); + return (xdr_opaque(xdrs, objp->other, NFS4_OTHER_SIZE)); } bool_t @@ -141,12 +144,11 @@ xdr_b_getattr_res_common(XDR *xdrs, getattrres_cmn_t *objp) bzero(&attrvals, sizeof (attrvals)); if (!xdr_bytes(xdrs, (char **)&ap, - (uint_t *)&objp->gc_attrlist_len, - sizeof (b_fattr4_t))) + (uint_t *)&objp->gc_attrlist_len, sizeof (b_fattr4_t))) return (FALSE); #ifdef DEBUG printf("xdr_b_getattr_res_common: attrlist_len = %d\n", - objp->gc_attrlist_len); + objp->gc_attrlist_len); #endif /* * Go through the bitmap and see if the server @@ -170,11 +172,11 @@ xdr_b_getattr_res_common(XDR *xdrs, getattrres_cmn_t *objp) #ifdef DEBUG printf("xdr_b_getattr_res_common: bitmap1 = %d " - " bitmap2 = %d\n", - bitmap1.word, bitmap2.word); + " bitmap2 = %d\n", + bitmap1.word, bitmap2.word); #endif xdrmem_create(&mxdrs, ap, objp->gc_attrlist_len, - XDR_DECODE); + XDR_DECODE); /* * Start with the first bitmap @@ -182,7 +184,8 @@ xdr_b_getattr_res_common(XDR *xdrs, getattrres_cmn_t *objp) if (bitmap1.word > 0) { if (bitmap1.bm_supported_attrs) { if (!xdr_b_bitmap4(&mxdrs, - (b_bitmap4_t *)&fattrp->b_supported_attrs)) + (b_bitmap4_t *)&fattrp-> + b_supported_attrs)) return (FALSE); } @@ -194,27 +197,32 @@ xdr_b_getattr_res_common(XDR *xdrs, getattrres_cmn_t *objp) } if (bitmap1.bm_fattr4_size) { if (!xdr_u_longlong_t(&mxdrs, - (u_longlong_t *)&fattrp->b_fattr4_size)) + (u_longlong_t *)&fattrp-> + b_fattr4_size)) return (FALSE); } if (bitmap1.bm_fattr4_fsid) { if (!xdr_u_longlong_t(&mxdrs, - (u_longlong_t *)&fattrp->b_fattr4_fsid.major)) + (u_longlong_t *)&fattrp-> + b_fattr4_fsid.major)) return (FALSE); if (!xdr_u_longlong_t(&mxdrs, - (u_longlong_t *)&fattrp->b_fattr4_fsid.minor)) + (u_longlong_t *)&fattrp-> + b_fattr4_fsid.minor)) return (FALSE); } if (bitmap1.bm_fattr4_filehandle) { if (!xdr_nfs_bfh4(&mxdrs, - (struct nfs_bfh4 *)&fattrp->b_fattr4_filehandle)) + (struct nfs_bfh4 *)&fattrp-> + b_fattr4_filehandle)) return (FALSE); } if (bitmap1.bm_fattr4_fileid) { if (!xdr_u_longlong_t(&mxdrs, - (u_longlong_t *)&fattrp->b_fattr4_fileid)) + (u_longlong_t *)&fattrp-> + b_fattr4_fileid)) return (FALSE); } } @@ -224,35 +232,41 @@ xdr_b_getattr_res_common(XDR *xdrs, getattrres_cmn_t *objp) */ if (bitmap2.word > 0) { if (bitmap2.bm_fattr4_mode) { - if (!xdr_u_int(&mxdrs, - (uint_t *)&objp->gc_attrs.b_fattr4_mode)) + if (!xdr_u_int(&mxdrs, (uint_t *)&objp-> + gc_attrs.b_fattr4_mode)) return (FALSE); } if (bitmap2.bm_fattr4_time_access) { if (!xdr_longlong_t(&mxdrs, - (longlong_t *)&objp->gc_attrs.b_fattr4_time_access.seconds)) + (longlong_t *)&objp->gc_attrs. + b_fattr4_time_access.seconds)) return (FALSE); if (!xdr_u_int(&mxdrs, - (uint_t *)&objp->gc_attrs.b_fattr4_time_access.nseconds)) + (uint_t *)&objp->gc_attrs. + b_fattr4_time_access.nseconds)) return (FALSE); } if (bitmap2.bm_fattr4_time_metadata) { if (!xdr_longlong_t(&mxdrs, - (longlong_t *)&objp->gc_attrs.b_fattr4_time_metadata.seconds)) + (longlong_t *)&objp->gc_attrs. + b_fattr4_time_metadata.seconds)) return (FALSE); if (!xdr_u_int(&mxdrs, - (uint_t *)&objp->gc_attrs.b_fattr4_time_metadata.nseconds)) + (uint_t *)&objp->gc_attrs. + b_fattr4_time_metadata.nseconds)) return (FALSE); } if (bitmap2.bm_fattr4_time_modify) { if (!xdr_longlong_t(&mxdrs, - (longlong_t *)&objp->gc_attrs.b_fattr4_time_modify.seconds)) + (longlong_t *)&objp->gc_attrs. + b_fattr4_time_modify.seconds)) return (FALSE); if (!xdr_u_int(&mxdrs, - (uint_t *)&objp->gc_attrs.b_fattr4_time_modify.nseconds)) + (uint_t *)&objp->gc_attrs. + b_fattr4_time_modify.nseconds)) return (FALSE); } } @@ -267,7 +281,7 @@ xdr_getattr4_res(XDR *xdrs, getattr4res_t *objp) if (!xdr_b_compound_res(xdrs, (b_compound_t *)&objp->gr_res)) return (FALSE); return (xdr_b_getattr_res_common(xdrs, - (getattrres_cmn_t *)&objp->gr_cmn)); + (getattrres_cmn_t *)&objp->gr_cmn)); } bool_t @@ -295,7 +309,7 @@ xdr_lookup4_res(XDR *xdrs, lookup4res_t *objp) return (FALSE); if (objp->lr_lookup_status == NFS4_OK) { return (xdr_b_getattr_res_common(xdrs, - (getattrres_cmn_t *)&objp->lr_gcmn)); + (getattrres_cmn_t *)&objp->lr_gcmn)); } return (TRUE); } @@ -339,7 +353,7 @@ xdr_read4_res(XDR *xdrs, read4res_t *objp) if (!xdr_bool(xdrs, (bool_t *)&objp->r_eof)) return (FALSE); return (xdr_bytes(xdrs, (char **)&objp->r_data_val, - (uint_t *)&objp->r_data_len, ~0)); + (uint_t *)&objp->r_data_len, ~0)); } return (TRUE); } @@ -377,7 +391,7 @@ xdr_b_entry4(XDR *xdrs, b_entry4_t *objp) bzero(&attrvals, sizeof (attrvals)); if (!xdr_bytes(xdrs, (char **)&ap, (uint_t *)&attrlen, - sizeof (b_fattr4_t))) + sizeof (b_fattr4_t))) return (FALSE); /* @@ -391,7 +405,7 @@ xdr_b_entry4(XDR *xdrs, b_entry4_t *objp) if (!xdr_u_longlong_t(&mxdrs, (u_longlong_t *)&objp->b_fileid)) return (FALSE); return (xdr_pointer(xdrs, (char **)&objp->b_nextentry, - sizeof (b_entry4_t), (xdrproc_t)xdr_b_entry4)); + sizeof (b_entry4_t), (xdrproc_t)xdr_b_entry4)); } bool_t @@ -407,7 +421,7 @@ xdr_readdir4_res(XDR *xdrs, readdir4res_t *objp) if (!xdr_opaque(xdrs, objp->rd_cookieverf, NFS4_VERIFIER_SIZE)) return (FALSE); if (!xdr_pointer(xdrs, (char **)&objp->rd_entries, - sizeof (b_entry4_t), (xdrproc_t)xdr_b_entry4)) + sizeof (b_entry4_t), (xdrproc_t)xdr_b_entry4)) return (FALSE); return (xdr_bool(xdrs, &objp->rd_eof)); } diff --git a/usr/src/uts/common/fs/nfs/nfs4_srv.c b/usr/src/uts/common/fs/nfs/nfs4_srv.c index fe1a10b966..2f8f776b02 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_srv.c +++ b/usr/src/uts/common/fs/nfs/nfs4_srv.c @@ -1692,7 +1692,8 @@ rfs4_op_create(nfs_argop4 *argop, nfs_resop4 *resop, struct svc_req *req, /* * symlink names must be treated as data */ - lnm = utf8_to_str(&args->ftype4_u.linkdata, &llen, NULL); + lnm = utf8_to_str((utf8string *)&args->ftype4_u.linkdata, + &llen, NULL); if (lnm == NULL) { *cs->statusp = resp->status = NFS4ERR_INVAL; @@ -3853,7 +3854,7 @@ rfs4_op_readlink(nfs_argop4 *argop, nfs_resop4 *resop, struct svc_req *req, /* * treat link name as data */ - (void) str_to_utf8(name, &resp->link); + (void) str_to_utf8(name, (utf8string *)&resp->link); if (name != data) kmem_free(name, MAXPATHLEN + 1); @@ -3869,7 +3870,7 @@ static void rfs4_op_readlink_free(nfs_resop4 *resop) { READLINK4res *resp = &resop->nfs_resop4_u.opreadlink; - utf8string *symlink = &resp->link; + utf8string *symlink = (utf8string *)&resp->link; if (symlink->utf8string_val) { UTF8STRING_FREE(*symlink) diff --git a/usr/src/uts/common/fs/nfs/nfs4_vfsops.c b/usr/src/uts/common/fs/nfs/nfs4_vfsops.c index 2350454d9c..55f6c95289 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_vfsops.c +++ b/usr/src/uts/common/fs/nfs/nfs4_vfsops.c @@ -18,7 +18,9 @@ * * CDDL HEADER END */ + /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013, Joyent, Inc. All rights reserved. */ @@ -1316,7 +1318,7 @@ recov_retry: lr_res = &resop->nfs_resop4_u.opreadlink; /* treat symlink name as data */ - *linktextp = utf8_to_str(&lr_res->link, &len, NULL); + *linktextp = utf8_to_str((utf8string *)&lr_res->link, &len, NULL); if (! recovery) nfs4_end_op(mi, NULL, NULL, &recov_state, needrecov); diff --git a/usr/src/uts/common/fs/nfs/nfs4_vnops.c b/usr/src/uts/common/fs/nfs/nfs4_vnops.c index 8a71cf7cd7..2b3fdfdd55 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c +++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c @@ -18,12 +18,14 @@ * * CDDL HEADER END */ + /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ + /* - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ /* @@ -4587,7 +4589,7 @@ recov_retry: /* * treat symlink names as data */ - linkdata = utf8_to_str(&lr_res->link, &len, NULL); + linkdata = utf8_to_str((utf8string *)&lr_res->link, &len, NULL); if (linkdata != NULL) { int uio_len = len - 1; /* len includes null byte, which we won't uiomove */ diff --git a/usr/src/uts/common/fs/nfs/nfs4_xdr.c b/usr/src/uts/common/fs/nfs/nfs4_xdr.c index 6d94aa0f39..572e0aa0df 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_xdr.c +++ b/usr/src/uts/common/fs/nfs/nfs4_xdr.c @@ -18,12 +18,16 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. */ @@ -2544,7 +2548,7 @@ xdr_CLOSE4args(XDR *xdrs, CLOSE4args *objp) return (FALSE); if (!xdr_u_int(xdrs, &objp->open_stateid.seqid)) return (FALSE); - return (xdr_opaque(xdrs, objp->open_stateid.other, 12)); + return (xdr_opaque(xdrs, objp->open_stateid.other, NFS4_OTHER_SIZE)); } static bool_t @@ -2556,7 +2560,7 @@ xdr_CLOSE4res(XDR *xdrs, CLOSE4res *objp) return (TRUE); if (!xdr_u_int(xdrs, &objp->open_stateid.seqid)) return (FALSE); - return (xdr_opaque(xdrs, objp->open_stateid.other, 12)); + return (xdr_opaque(xdrs, objp->open_stateid.other, NFS4_OTHER_SIZE)); } static bool_t @@ -2568,8 +2572,8 @@ xdr_CREATE4args(XDR *xdrs, CREATE4args *objp) switch (objp->type) { case NF4LNK: if (!xdr_bytes(xdrs, - (char **)&objp->ftype4_u.linkdata.utf8string_val, - (uint_t *)&objp->ftype4_u.linkdata.utf8string_len, + (char **)&objp->ftype4_u.linkdata.linktext4_val, + (uint_t *)&objp->ftype4_u.linkdata.linktext4_len, NFS4_MAX_UTF8STRING)) return (FALSE); break; @@ -2597,9 +2601,9 @@ xdr_CREATE4args(XDR *xdrs, CREATE4args *objp) * Optimized free case */ if (objp->type == NF4LNK) { - if (objp->ftype4_u.linkdata.utf8string_val != NULL) - kmem_free(objp->ftype4_u.linkdata.utf8string_val, - objp->ftype4_u.linkdata.utf8string_len); + if (objp->ftype4_u.linkdata.linktext4_val != NULL) + kmem_free(objp->ftype4_u.linkdata.linktext4_val, + objp->ftype4_u.linkdata.linktext4_len); } if (objp->objname.utf8string_val != NULL) kmem_free(objp->objname.utf8string_val, @@ -2705,7 +2709,7 @@ xdr_LOCK4args(XDR *xdrs, LOCK4args *objp) open_stateid.seqid)) return (FALSE); if (!xdr_opaque(xdrs, objp->locker.locker4_u.open_owner. - open_stateid.other, 12)) + open_stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_u_int(xdrs, &objp->locker.locker4_u.open_owner. lock_seqid)) @@ -2729,7 +2733,7 @@ xdr_LOCK4args(XDR *xdrs, LOCK4args *objp) lock_stateid.seqid)) return (FALSE); if (!xdr_opaque(xdrs, objp->locker.locker4_u.lock_owner. - lock_stateid.other, 12)) + lock_stateid.other, NFS4_OTHER_SIZE)) return (FALSE); return (xdr_u_int(xdrs, &objp->locker.locker4_u.lock_owner. lock_seqid)); @@ -2762,7 +2766,8 @@ xdr_LOCK4res(XDR *xdrs, LOCK4res *objp) &objp->LOCK4res_u.lock_stateid.seqid)) return (FALSE); return (xdr_opaque(xdrs, - objp->LOCK4res_u.lock_stateid.other, 12)); + objp->LOCK4res_u.lock_stateid.other, + NFS4_OTHER_SIZE)); } if (objp->status != NFS4ERR_DENIED) return (TRUE); @@ -2870,7 +2875,7 @@ xdr_LOCKU4args(XDR *xdrs, LOCKU4args *objp) return (FALSE); if (!xdr_u_int(xdrs, &objp->lock_stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, objp->lock_stateid.other, 12)) + if (!xdr_opaque(xdrs, objp->lock_stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_u_longlong_t(xdrs, (u_longlong_t *)&objp->offset)) return (FALSE); @@ -2943,7 +2948,7 @@ xdr_OPEN4args(XDR *xdrs, OPEN4args *objp) return (FALSE); if (!xdr_opaque(xdrs, objp->open_claim4_u. delegate_cur_info.delegate_stateid.other, - 12)) + NFS4_OTHER_SIZE)) return (FALSE); return (xdr_bytes(xdrs, (char **)&objp->open_claim4_u. delegate_cur_info.file.utf8string_val, @@ -3119,7 +3124,7 @@ xdr_OPEN4cargs(XDR *xdrs, OPEN4cargs *objp) return (FALSE); if (!xdr_opaque(xdrs, objp->open_claim4_u. delegate_cur_info.delegate_stateid.other, - 12)) + NFS4_OTHER_SIZE)) return (FALSE); len = strlen(objp->open_claim4_u.delegate_cur_info.cfile); if (len > NFS4_MAX_UTF8STRING) @@ -3154,7 +3159,7 @@ xdr_OPEN4res(XDR *xdrs, OPEN4res *objp) return (TRUE); if (!xdr_u_int(xdrs, &objp->stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, objp->stateid.other, 12)) + if (!xdr_opaque(xdrs, objp->stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_bool(xdrs, &objp->cinfo.atomic)) return (FALSE); @@ -3179,7 +3184,7 @@ xdr_OPEN4res(XDR *xdrs, OPEN4res *objp) return (FALSE); if (!xdr_opaque(xdrs, objp->delegation. open_delegation4_u.read.stateid.other, - 12)) + NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_bool(xdrs, &objp->delegation. open_delegation4_u.read.recall)) @@ -3192,7 +3197,7 @@ xdr_OPEN4res(XDR *xdrs, OPEN4res *objp) return (FALSE); if (!xdr_opaque(xdrs, objp->delegation. open_delegation4_u.write.stateid.other, - 12)) + NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_bool(xdrs, &objp->delegation. open_delegation4_u.write.recall)) @@ -3268,7 +3273,7 @@ xdr_OPEN_CONFIRM4res(XDR *xdrs, OPEN_CONFIRM4res *objp) return (TRUE); if (!xdr_u_int(xdrs, &objp->open_stateid.seqid)) return (FALSE); - return (xdr_opaque(xdrs, objp->open_stateid.other, 12)); + return (xdr_opaque(xdrs, objp->open_stateid.other, NFS4_OTHER_SIZE)); } static bool_t @@ -3276,7 +3281,7 @@ xdr_OPEN_DOWNGRADE4args(XDR *xdrs, OPEN_DOWNGRADE4args *objp) { if (!xdr_u_int(xdrs, &objp->open_stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, objp->open_stateid.other, 12)) + if (!xdr_opaque(xdrs, objp->open_stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_u_int(xdrs, &objp->seqid)) return (FALSE); @@ -3294,7 +3299,7 @@ xdr_OPEN_DOWNGRADE4res(XDR *xdrs, OPEN_DOWNGRADE4res *objp) return (TRUE); if (!xdr_u_int(xdrs, &objp->open_stateid.seqid)) return (FALSE); - return (xdr_opaque(xdrs, objp->open_stateid.other, 12)); + return (xdr_opaque(xdrs, objp->open_stateid.other, NFS4_OTHER_SIZE)); } static bool_t @@ -3306,7 +3311,7 @@ xdr_READ4args(XDR *xdrs, READ4args *objp) if (!xdr_u_int(xdrs, &objp->stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, objp->stateid.other, 12)) + if (!xdr_opaque(xdrs, objp->stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_u_longlong_t(xdrs, (u_longlong_t *)&objp->offset)) return (FALSE); @@ -3718,8 +3723,8 @@ xdr_READLINK4res(XDR *xdrs, READLINK4res *objp) return (FALSE); if (objp->status != NFS4_OK) return (TRUE); - return (xdr_bytes(xdrs, (char **)&objp->link.utf8string_val, - (uint_t *)&objp->link.utf8string_len, + return (xdr_bytes(xdrs, (char **)&objp->link.linktext4_val, + (uint_t *)&objp->link.linktext4_len, NFS4_MAX_UTF8STRING)); } @@ -3728,8 +3733,8 @@ xdr_READLINK4res(XDR *xdrs, READLINK4res *objp) */ if (objp->status != NFS4_OK) return (TRUE); - if (objp->link.utf8string_val != NULL) - kmem_free(objp->link.utf8string_val, objp->link.utf8string_len); + if (objp->link.linktext4_val != NULL) + kmem_free(objp->link.linktext4_val, objp->link.linktext4_len); return (TRUE); } @@ -3880,7 +3885,7 @@ xdr_WRITE4args(XDR *xdrs, WRITE4args *objp) if (xdrs->x_op != XDR_FREE) { if (!xdr_u_int(xdrs, &objp->stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, objp->stateid.other, 12)) + if (!xdr_opaque(xdrs, objp->stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_u_longlong_t(xdrs, (u_longlong_t *)&objp->offset)) return (FALSE); @@ -4174,7 +4179,8 @@ xdr_nfs_argop4(XDR *xdrs, nfs_argop4 *objp) &objp->nfs_argop4_u.opdelegreturn.deleg_stateid.seqid)) return (FALSE); return (xdr_opaque(xdrs, - objp->nfs_argop4_u.opdelegreturn.deleg_stateid.other, 12)); + objp->nfs_argop4_u.opdelegreturn.deleg_stateid.other, + NFS4_OTHER_SIZE)); case OP_LOOKUPP: return (TRUE); case OP_READDIR: @@ -4217,7 +4223,7 @@ xdr_nfs_argop4(XDR *xdrs, nfs_argop4 *objp) open_stateid.seqid)) return (FALSE); if (!xdr_opaque(xdrs, objp->nfs_argop4_u.opopen_confirm. - open_stateid.other, 12)) + open_stateid.other, NFS4_OTHER_SIZE)) return (FALSE); return (xdr_u_int(xdrs, &objp->nfs_argop4_u.opopen_confirm. seqid)); @@ -4265,7 +4271,7 @@ xdr_nfs_argop4(XDR *xdrs, nfs_argop4 *objp) stateid.seqid)) return (FALSE); if (!xdr_opaque(xdrs, objp->nfs_argop4_u.opsetattr. - stateid.other, 12)) + stateid.other, NFS4_OTHER_SIZE)) return (FALSE); return (xdr_fattr4(xdrs, &objp->nfs_argop4_u.opsetattr. obj_attributes)); @@ -4698,7 +4704,7 @@ xdr_nfs_resop4(XDR *xdrs, nfs_resop4 *objp) return (FALSE); return (xdr_opaque(xdrs, objp->nfs_resop4_u.oplocku.lock_stateid.other, - 12)); + NFS4_OTHER_SIZE)); case OP_NVERIFY: return (xdr_int(xdrs, (int32_t *)&objp->nfs_resop4_u.opnverify.status)); @@ -4880,7 +4886,7 @@ xdr_nfs_resop4_clnt(XDR *xdrs, nfs_resop4 *objp, nfs_argop4 *aobjp) return (FALSE); return (xdr_opaque(xdrs, objp->nfs_resop4_u.oplocku.lock_stateid.other, - 12)); + NFS4_OTHER_SIZE)); case OP_OPENATTR: return (xdr_int(xdrs, (int32_t *)&objp->nfs_resop4_u.opopenattr.status)); @@ -5135,7 +5141,7 @@ xdr_snfs_cb_argop4(XDR *xdrs, nfs_cb_argop4 *objp) if (!XDR_PUTINT32(xdrs, (int32_t *)&rargs->stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, rargs->stateid.other, 12)) + if (!xdr_opaque(xdrs, rargs->stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!XDR_PUTINT32(xdrs, (int32_t *)&rargs->truncate)) return (FALSE); @@ -5173,7 +5179,7 @@ xdr_cnfs_cb_argop4(XDR *xdrs, nfs_cb_argop4 *objp) if (!xdr_u_int(xdrs, &rargs->stateid.seqid)) return (FALSE); - if (!xdr_opaque(xdrs, rargs->stateid.other, 12)) + if (!xdr_opaque(xdrs, rargs->stateid.other, NFS4_OTHER_SIZE)) return (FALSE); if (!xdr_bool(xdrs, &rargs->truncate)) return (FALSE); diff --git a/usr/src/uts/common/nfs/nfs4.h b/usr/src/uts/common/nfs/nfs4.h index c0d20ad5e7..e27bd42ae4 100644 --- a/usr/src/uts/common/nfs/nfs4.h +++ b/usr/src/uts/common/nfs/nfs4.h @@ -18,12 +18,14 @@ * * CDDL HEADER END */ + /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ + /* - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _NFS4_H @@ -49,9 +51,19 @@ extern "C" { #endif +#define NFS4_MAX_SECOID4 65536 #define NFS4_MAX_UTF8STRING 65536 +#define NFS4_MAX_LINKTEXT4 65536 #define NFS4_MAX_PATHNAME4 65536 -#define NFS4_MAX_SECOID4 65536 + +struct nfs_fsl_info { + uint_t netbuf_len; + uint_t netnm_len; + uint_t knconf_len; + char *netname; + struct netbuf *addr; + struct knetconfig *knconf; +}; #ifdef _KERNEL diff --git a/usr/src/uts/common/nfs/nfs4_kprot.h b/usr/src/uts/common/nfs/nfs4_kprot.h index be30bed10c..30d1e438cd 100644 --- a/usr/src/uts/common/nfs/nfs4_kprot.h +++ b/usr/src/uts/common/nfs/nfs4_kprot.h @@ -18,6 +18,11 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -43,6 +48,7 @@ extern "C" { #define NFS4_FHSIZE 128 #define NFS4_VERIFIER_SIZE 8 +#define NFS4_OTHER_SIZE 12 /* * Reasonable upper bounds to catch badly behaving partners @@ -151,6 +157,8 @@ typedef uint64_t length4; typedef uint64_t clientid4; +typedef uint32_t nfs_lease4; + typedef uint32_t seqid4; typedef struct { @@ -169,7 +177,12 @@ typedef uint64_t nfs_lockid4; typedef uint64_t nfs_cookie4; -typedef utf8string linktext4; +typedef struct { + uint_t linktext4_len; + char *linktext4_val; +} linktext4; + +typedef utf8string ascii_REQUIRED4; typedef struct { uint_t sec_oid4_len; @@ -227,14 +240,10 @@ struct fs_locations4 { }; typedef struct fs_locations4 fs_locations4; -struct nfs_fsl_info { - uint_t netbuf_len; - uint_t netnm_len; - uint_t knconf_len; - char *netname; - struct netbuf *addr; - struct knetconfig *knconf; -}; +/* + * This structure is declared in nfs4.h + */ +struct nfs_fsl_info; /* * ACL support @@ -412,7 +421,7 @@ typedef fsid4 fattr4_fsid; typedef bool_t fattr4_unique_handles; -typedef uint32_t fattr4_lease_time; +typedef nfs_lease4 fattr4_lease_time; typedef nfsstat4 fattr4_rdattr_error; @@ -459,7 +468,7 @@ typedef uint64_t fattr4_maxread; typedef uint64_t fattr4_maxwrite; -typedef utf8string fattr4_mimetype; +typedef ascii_REQUIRED4 fattr4_mimetype; typedef mode4 fattr4_mode; @@ -584,14 +593,14 @@ struct clientaddr4 { typedef struct clientaddr4 clientaddr4; struct cb_client4 { - uint32_t cb_program; + uint_t cb_program; clientaddr4 cb_location; }; typedef struct cb_client4 cb_client4; struct stateid4 { uint32_t seqid; - char other[12]; + char other[NFS4_OTHER_SIZE]; }; typedef struct stateid4 stateid4; |