Skip to content

Commit 699230f

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
ksmbd: Move more definitions into the shared area
Move SMB2_SessionSetup, SMB2_Close, SMB2_Read, SMB2_Write and SMB2_ChangeNotify commands into smbfs_common/smb2pdu.h Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d6c9ad2 commit 699230f

File tree

2 files changed

+4
-192
lines changed

2 files changed

+4
-192
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6086,7 +6086,7 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work)
60866086
rsp->Reserved = 0;
60876087
rsp->DataLength = cpu_to_le32(nbytes);
60886088
rsp->DataRemaining = 0;
6089-
rsp->Reserved2 = 0;
6089+
rsp->Flags = 0;
60906090
inc_rfc1001_len(work->response_buf, nbytes);
60916091
return 0;
60926092

@@ -6224,7 +6224,7 @@ int smb2_read(struct ksmbd_work *work)
62246224
rsp->Reserved = 0;
62256225
rsp->DataLength = cpu_to_le32(nbytes);
62266226
rsp->DataRemaining = cpu_to_le32(remain_bytes);
6227-
rsp->Reserved2 = 0;
6227+
rsp->Flags = 0;
62286228
inc_rfc1001_len(work->response_buf, 16);
62296229
work->resp_hdr_sz = get_rfc1002_len(work->response_buf) + 4;
62306230
work->aux_payload_sz = nbytes;
@@ -8128,8 +8128,8 @@ int smb2_oplock_break(struct ksmbd_work *work)
81288128
*/
81298129
int smb2_notify(struct ksmbd_work *work)
81308130
{
8131-
struct smb2_notify_req *req;
8132-
struct smb2_notify_rsp *rsp;
8131+
struct smb2_change_notify_req *req;
8132+
struct smb2_change_notify_rsp *rsp;
81338133

81348134
WORK_BUFFERS(work, req, rsp);
81358135

fs/ksmbd/smb2pdu.h

Lines changed: 0 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -97,59 +97,10 @@ struct preauth_integrity_info {
9797
#define OFFSET_OF_NEG_CONTEXT 0xd0
9898
#endif
9999

100-
/* Flags */
101-
#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
102-
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
103-
104100
#define SMB2_SESSION_EXPIRED (0)
105101
#define SMB2_SESSION_IN_PROGRESS BIT(0)
106102
#define SMB2_SESSION_VALID BIT(1)
107103

108-
/* Flags */
109-
#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
110-
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
111-
112-
struct smb2_sess_setup_req {
113-
struct smb2_hdr hdr;
114-
__le16 StructureSize; /* Must be 25 */
115-
__u8 Flags;
116-
__u8 SecurityMode;
117-
__le32 Capabilities;
118-
__le32 Channel;
119-
__le16 SecurityBufferOffset;
120-
__le16 SecurityBufferLength;
121-
__le64 PreviousSessionId;
122-
__u8 Buffer[1]; /* variable length GSS security buffer */
123-
} __packed;
124-
125-
/* Flags/Reserved for SMB3.1.1 */
126-
#define SMB2_SHAREFLAG_CLUSTER_RECONNECT 0x0001
127-
128-
/* Currently defined SessionFlags */
129-
#define SMB2_SESSION_FLAG_IS_GUEST_LE cpu_to_le16(0x0001)
130-
#define SMB2_SESSION_FLAG_IS_NULL_LE cpu_to_le16(0x0002)
131-
#define SMB2_SESSION_FLAG_ENCRYPT_DATA_LE cpu_to_le16(0x0004)
132-
struct smb2_sess_setup_rsp {
133-
struct smb2_hdr hdr;
134-
__le16 StructureSize; /* Must be 9 */
135-
__le16 SessionFlags;
136-
__le16 SecurityBufferOffset;
137-
__le16 SecurityBufferLength;
138-
__u8 Buffer[1]; /* variable length GSS security buffer */
139-
} __packed;
140-
141-
struct smb2_logoff_req {
142-
struct smb2_hdr hdr;
143-
__le16 StructureSize; /* Must be 4 */
144-
__le16 Reserved;
145-
} __packed;
146-
147-
struct smb2_logoff_rsp {
148-
struct smb2_hdr hdr;
149-
__le16 StructureSize; /* Must be 4 */
150-
__le16 Reserved;
151-
} __packed;
152-
153104
#define ATTR_READONLY_LE cpu_to_le32(ATTR_READONLY)
154105
#define ATTR_HIDDEN_LE cpu_to_le32(ATTR_HIDDEN)
155106
#define ATTR_SYSTEM_LE cpu_to_le32(ATTR_SYSTEM)
@@ -448,114 +399,12 @@ struct create_lease_v2 {
448399
__u8 Pad[4];
449400
} __packed;
450401

451-
/* Currently defined values for close flags */
452-
#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
453-
struct smb2_close_req {
454-
struct smb2_hdr hdr;
455-
__le16 StructureSize; /* Must be 24 */
456-
__le16 Flags;
457-
__le32 Reserved;
458-
__le64 PersistentFileId;
459-
__le64 VolatileFileId;
460-
} __packed;
461-
462-
struct smb2_close_rsp {
463-
struct smb2_hdr hdr;
464-
__le16 StructureSize; /* 60 */
465-
__le16 Flags;
466-
__le32 Reserved;
467-
__le64 CreationTime;
468-
__le64 LastAccessTime;
469-
__le64 LastWriteTime;
470-
__le64 ChangeTime;
471-
__le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
472-
__le64 EndOfFile;
473-
__le32 Attributes;
474-
} __packed;
475-
476-
struct smb2_flush_req {
477-
struct smb2_hdr hdr;
478-
__le16 StructureSize; /* Must be 24 */
479-
__le16 Reserved1;
480-
__le32 Reserved2;
481-
__le64 PersistentFileId;
482-
__le64 VolatileFileId;
483-
} __packed;
484-
485-
struct smb2_flush_rsp {
486-
struct smb2_hdr hdr;
487-
__le16 StructureSize;
488-
__le16 Reserved;
489-
} __packed;
490-
491402
struct smb2_buffer_desc_v1 {
492403
__le64 offset;
493404
__le32 token;
494405
__le32 length;
495406
} __packed;
496407

497-
#define SMB2_CHANNEL_NONE cpu_to_le32(0x00000000)
498-
#define SMB2_CHANNEL_RDMA_V1 cpu_to_le32(0x00000001)
499-
#define SMB2_CHANNEL_RDMA_V1_INVALIDATE cpu_to_le32(0x00000002)
500-
501-
struct smb2_read_req {
502-
struct smb2_hdr hdr;
503-
__le16 StructureSize; /* Must be 49 */
504-
__u8 Padding; /* offset from start of SMB2 header to place read */
505-
__u8 Reserved;
506-
__le32 Length;
507-
__le64 Offset;
508-
__le64 PersistentFileId;
509-
__le64 VolatileFileId;
510-
__le32 MinimumCount;
511-
__le32 Channel; /* Reserved MBZ */
512-
__le32 RemainingBytes;
513-
__le16 ReadChannelInfoOffset; /* Reserved MBZ */
514-
__le16 ReadChannelInfoLength; /* Reserved MBZ */
515-
__u8 Buffer[1];
516-
} __packed;
517-
518-
struct smb2_read_rsp {
519-
struct smb2_hdr hdr;
520-
__le16 StructureSize; /* Must be 17 */
521-
__u8 DataOffset;
522-
__u8 Reserved;
523-
__le32 DataLength;
524-
__le32 DataRemaining;
525-
__u32 Reserved2;
526-
__u8 Buffer[1];
527-
} __packed;
528-
529-
/* For write request Flags field below the following flag is defined: */
530-
#define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001
531-
532-
struct smb2_write_req {
533-
struct smb2_hdr hdr;
534-
__le16 StructureSize; /* Must be 49 */
535-
__le16 DataOffset; /* offset from start of SMB2 header to write data */
536-
__le32 Length;
537-
__le64 Offset;
538-
__le64 PersistentFileId;
539-
__le64 VolatileFileId;
540-
__le32 Channel; /* Reserved MBZ */
541-
__le32 RemainingBytes;
542-
__le16 WriteChannelInfoOffset; /* Reserved MBZ */
543-
__le16 WriteChannelInfoLength; /* Reserved MBZ */
544-
__le32 Flags;
545-
__u8 Buffer[1];
546-
} __packed;
547-
548-
struct smb2_write_rsp {
549-
struct smb2_hdr hdr;
550-
__le16 StructureSize; /* Must be 17 */
551-
__u8 DataOffset;
552-
__u8 Reserved;
553-
__le32 DataLength;
554-
__le32 DataRemaining;
555-
__u32 Reserved2;
556-
__u8 Buffer[1];
557-
} __packed;
558-
559408
#define SMB2_0_IOCTL_IS_FSCTL 0x00000001
560409

561410
struct duplicate_extents_to_file {
@@ -705,43 +554,6 @@ struct reparse_data_buffer {
705554
__u8 DataBuffer[]; /* Variable Length */
706555
} __packed;
707556

708-
/* Completion Filter flags for Notify */
709-
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
710-
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
711-
#define FILE_NOTIFY_CHANGE_NAME 0x00000003
712-
#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
713-
#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
714-
#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
715-
#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
716-
#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
717-
#define FILE_NOTIFY_CHANGE_EA 0x00000080
718-
#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
719-
#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
720-
#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
721-
#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
722-
723-
/* Flags */
724-
#define SMB2_WATCH_TREE 0x0001
725-
726-
struct smb2_notify_req {
727-
struct smb2_hdr hdr;
728-
__le16 StructureSize; /* Must be 32 */
729-
__le16 Flags;
730-
__le32 OutputBufferLength;
731-
__le64 PersistentFileId;
732-
__le64 VolatileFileId;
733-
__u32 CompletionFileter;
734-
__u32 Reserved;
735-
} __packed;
736-
737-
struct smb2_notify_rsp {
738-
struct smb2_hdr hdr;
739-
__le16 StructureSize; /* Must be 9 */
740-
__le16 OutputBufferOffset;
741-
__le32 OutputBufferLength;
742-
__u8 Buffer[1];
743-
} __packed;
744-
745557
/* SMB2 Notify Action Flags */
746558
#define FILE_ACTION_ADDED 0x00000001
747559
#define FILE_ACTION_REMOVED 0x00000002

0 commit comments

Comments
 (0)