diff mbox series

[pynfs,v2,6/7] nfs4.1: add support for the "delstid" draft

Message ID 20241014-cb_getattr-v2-6-3782e0d7c598@kernel.org (mailing list archive)
State New
Headers show
Series pynfs: add CB_GETATTR tests and tests for delegated timestamps | expand

Commit Message

Jeff Layton Oct. 14, 2024, 8:50 p.m. UTC
Add the new .x snippet to nfs4.x, and the necessary info about the new
attributes.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 nfs4.1/nfs4lib.py                   |   3 +
 nfs4.1/server41tests/environment.py |   3 +
 nfs4.1/xdrdef/nfs4.x                | 111 ++++++++++++++++++++++++++++++++++--
 3 files changed, 113 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py
index b1a247b02f66a529da7f2bd98ec436f168b30873..d3a1550f1ce1e135b124a59fa1518c9ff89fd502 100644
--- a/nfs4.1/nfs4lib.py
+++ b/nfs4.1/nfs4lib.py
@@ -731,5 +731,8 @@  attr_info = { FATTR4_SUPPORTED_ATTRS : A("r", "fs"),
               FATTR4_MODE_SET_MASKED : A("w", "obj"),
               FATTR4_FS_CHARSET_CAP : A("r", "fs"),
               FATTR4_XATTR_SUPPORT : A("r", "obj"),
+              FATTR4_TIME_DELEG_ACCESS : A("w", "obj"),
+              FATTR4_TIME_DELEG_MODIFY : A("w", "obj"),
+              FATTR4_OPEN_ARGUMENTS : A("r", "fs"),
               }
 del A
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 0b7c976d8582a0e4ef5bd1d21ce34247f26899e4..48284e029634fff60b7690e058cd4131bfea9b08 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -108,6 +108,9 @@  class Environment(testmod.Environment):
         AttrInfo('time_modify_set', 'w', settime4(0)),
         AttrInfo('mounted_on_fileid', 'r', 0),
         AttrInfo('xattr_support', 'r', False),
+        AttrInfo('time_deleg_access', 'r', nfstime4(0, 0)),
+        AttrInfo('time_deleg_modify', 'r', nfstime4(0, 0)),
+        AttrInfo('open_arguments', 'r', open_arguments4()),
         ]
 
     home = property(lambda s: use_obj(s.opts.home))
diff --git a/nfs4.1/xdrdef/nfs4.x b/nfs4.1/xdrdef/nfs4.x
index 7b4e755369d749c2570a624895c234b1454df0cb..ee3da8aa7a342e4d3829f4b1b1f82543275199c5 100644
--- a/nfs4.1/xdrdef/nfs4.x
+++ b/nfs4.1/xdrdef/nfs4.x
@@ -1742,10 +1742,12 @@  const
  = 0x20000;
 
 enum open_delegation_type4 {
-        OPEN_DELEGATE_NONE      = 0,
-        OPEN_DELEGATE_READ      = 1,
-        OPEN_DELEGATE_WRITE     = 2,
-        OPEN_DELEGATE_NONE_EXT  = 3 /* new to v4.1 */
+        OPEN_DELEGATE_NONE              = 0,
+        OPEN_DELEGATE_READ              = 1,
+        OPEN_DELEGATE_WRITE             = 2,
+        OPEN_DELEGATE_NONE_EXT          = 3, /* new to v4.1 */
+        OPEN_DELEGATE_READ_ATTRS_DELEG  = 4,
+        OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5
 };
 
 enum open_claim_type4 {
@@ -1921,8 +1923,10 @@  switch (open_delegation_type4 delegation_type) {
         case OPEN_DELEGATE_NONE:
                 void;
         case OPEN_DELEGATE_READ:
+        case OPEN_DELEGATE_READ_ATTRS_DELEG:
                 open_read_delegation4 read;
         case OPEN_DELEGATE_WRITE:
+        case OPEN_DELEGATE_WRITE_ATTRS_DELEG:
                 open_write_delegation4 write;
         case OPEN_DELEGATE_NONE_EXT: /* new to v4.1 */
                 open_none_delegation4 od_whynone;
@@ -3949,3 +3953,102 @@  program NFS4_CALLBACK {
                         CB_COMPOUND(CB_COMPOUND4args) = 1;
         } = 1;
 } = 0x40000000;
+
+/*
+ * The following content was extracted from draft-ietf-nfsv4-delstid
+ */
+
+typedef bool            fattr4_offline;
+
+
+const FATTR4_OFFLINE            = 83;
+
+
+struct open_arguments4 {
+  bitmap4  oa_share_access;
+  bitmap4  oa_share_deny;
+  bitmap4  oa_share_access_want;
+  bitmap4  oa_open_claim;
+  bitmap4  oa_create_mode;
+};
+
+
+enum open_args_share_access4 {
+   OPEN_ARGS_SHARE_ACCESS_READ  = 1,
+   OPEN_ARGS_SHARE_ACCESS_WRITE = 2,
+   OPEN_ARGS_SHARE_ACCESS_BOTH  = 3
+};
+
+
+enum open_args_share_deny4 {
+   OPEN_ARGS_SHARE_DENY_NONE  = 0,
+   OPEN_ARGS_SHARE_DENY_READ  = 1,
+   OPEN_ARGS_SHARE_DENY_WRITE = 2,
+   OPEN_ARGS_SHARE_DENY_BOTH  = 3
+};
+
+
+enum open_args_share_access_want4 {
+   OPEN_ARGS_SHARE_ACCESS_WANT_ANY_DELEG           = 3,
+   OPEN_ARGS_SHARE_ACCESS_WANT_NO_DELEG            = 4,
+   OPEN_ARGS_SHARE_ACCESS_WANT_CANCEL              = 5,
+   OPEN_ARGS_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL
+                                                   = 17,
+   OPEN_ARGS_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED
+                                                   = 18,
+   OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS    = 20,
+   OPEN_ARGS_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION = 21
+};
+
+
+enum open_args_open_claim4 {
+   OPEN_ARGS_OPEN_CLAIM_NULL          = 0,
+   OPEN_ARGS_OPEN_CLAIM_PREVIOUS      = 1,
+   OPEN_ARGS_OPEN_CLAIM_DELEGATE_CUR  = 2,
+   OPEN_ARGS_OPEN_CLAIM_DELEGATE_PREV = 3,
+   OPEN_ARGS_OPEN_CLAIM_FH            = 4,
+   OPEN_ARGS_OPEN_CLAIM_DELEG_CUR_FH  = 5,
+   OPEN_ARGS_OPEN_CLAIM_DELEG_PREV_FH = 6
+};
+
+
+enum open_args_createmode4 {
+   OPEN_ARGS_CREATEMODE_UNCHECKED4     = 0,
+   OPEN_ARGS_CREATE_MODE_GUARDED       = 1,
+   OPEN_ARGS_CREATEMODE_EXCLUSIVE4     = 2,
+   OPEN_ARGS_CREATE_MODE_EXCLUSIVE4_1  = 3
+};
+
+
+typedef open_arguments4 fattr4_open_arguments;
+
+
+%/*
+% * Determine what OPEN supports.
+% */
+const FATTR4_OPEN_ARGUMENTS     = 86;
+
+
+const OPEN4_SHARE_ACCESS_WANT_OPEN_XOR_DELEGATION = 0x200000;
+
+
+const OPEN4_RESULT_NO_OPEN_STATEID = 0x00000010;
+
+
+/*
+ * attributes for the delegation times being
+ * cached and served by the "client"
+ */
+typedef nfstime4        fattr4_time_deleg_access;
+typedef nfstime4        fattr4_time_deleg_modify;
+
+
+%/*
+% * New RECOMMENDED Attribute for
+% * delegation caching of times
+% */
+const FATTR4_TIME_DELEG_ACCESS  = 84;
+const FATTR4_TIME_DELEG_MODIFY  = 85;
+
+
+const OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000;