OSDN Git Service

smb3: Add protocol structs for change notify support
authorSteve French <stfrench@microsoft.com>
Sun, 5 May 2019 22:25:12 +0000 (17:25 -0500)
committerSteve French <stfrench@microsoft.com>
Wed, 8 May 2019 04:24:55 +0000 (23:24 -0500)
Add the SMB3 protocol flag definitions and structs for
change notify.  Future patches will add the hooks to
allow it to be invoked from the client.

See MS-FSCC 2.6 and MS-SMB2 2.2.35

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
fs/cifs/smb2pdu.h

index aaf3f03..93dd3b4 100644 (file)
@@ -1145,6 +1145,42 @@ struct smb2_write_rsp {
        __u8   Buffer[1];
 } __packed;
 
+/* notify flags */
+#define SMB2_WATCH_TREE                        0x0001
+
+/* notify completion filter flags. See MS-FSCC 2.6 and MS-SMB2 2.2.35 */
+#define FILE_NOTIFY_CHANGE_FILE_NAME           0x00000001
+#define FILE_NOTIFY_CHANGE_DIR_NAME            0x00000002
+#define FILE_NOTIFY_CHANGE_ATTRIBUTES          0x00000004
+#define FILE_NOTIFY_CHANGE_SIZE                        0x00000008
+#define FILE_NOTIFY_CHANGE_LAST_WRITE          0x00000010
+#define FILE_NOTIFY_CHANGE_LAST_ACCESS         0x00000020
+#define FILE_NOTIFY_CHANGE_CREATION            0x00000040
+#define FILE_NOTIFY_CHANGE_EA                  0x00000080
+#define FILE_NOTIFY_CHANGE_SECURITY            0x00000100
+#define FILE_NOTIFY_CHANGE_STREAM_NAME         0x00000200
+#define FILE_NOTIFY_CHANGE_STREAM_SIZE         0x00000400
+#define FILE_NOTIFY_CHANGE_STREAM_WRITE                0x00000800
+
+struct smb2_change_notify_req {
+       struct smb2_sync_hdr sync_hdr;
+       __le16  StructureSize;
+       __le16  Flags;
+       __le32  OutputBufferLength;
+       __u64   PersistentFileId; /* opaque endianness */
+       __u64   VolatileFileId; /* opaque endianness */
+       __le32  CompletionFilter;
+       __u32   Reserved;
+} __packed;
+
+struct smb2_change_notify_rsp {
+       struct smb2_sync_hdr sync_hdr;
+       __le16  StructureSize;  /* Must be 9 */
+       __le16  OutputBufferOffset;
+       __le32  OutputBufferLength;
+       __u8    Buffer[1]; /* array of file notify structs */
+} __packed;
+
 #define SMB2_LOCKFLAG_SHARED_LOCK      0x0001
 #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK   0x0002
 #define SMB2_LOCKFLAG_UNLOCK           0x0004