]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: move file_basic_info into common/fscc.h
authorZhangGuoDong <zhangguodong@kylinos.cn>
Tue, 3 Mar 2026 15:13:15 +0000 (15:13 +0000)
committerSteve French <stfrench@microsoft.com>
Sun, 12 Apr 2026 23:07:54 +0000 (18:07 -0500)
This struct definition is specified in MS-FSCC, so move them into fscc.h.

Modify the following places:

  - smb2_file_basic_info -> file_basic_info
  - Pad1 -> Pad

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb1pdu.h
fs/smb/common/fscc.h
fs/smb/server/smb2pdu.c
fs/smb/server/smb2pdu.h

index 97f7e1244a8b3b00d819eb3afe682c2b80eac001..7584e94d9b2bfaf1b0fd39c532838f00779ce0fa 100644 (file)
@@ -2061,15 +2061,6 @@ typedef struct {
        __le32 EASize;
 } __packed FILE_INFO_STANDARD;  /* level 1 SetPath/FileInfo */
 
-typedef struct {
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le32 Attributes;
-       __u32 Pad;
-} __packed FILE_BASIC_INFO;    /* size info, level 0x101 */
-
 struct file_allocation_info {
        __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
 } __packed; /* size used on disk, for level 0x103 for set, 0x105 for query */
index 415cba02d1c92fb560bd2747ad8c9dcb05e0d48d..076cbcffa26a049ea2ab5379c6365591c0c5d28a 100644 (file)
@@ -216,6 +216,16 @@ struct smb2_file_all_info { /* data block encoding of response to level 18 */
        };
 } __packed; /* level 18 Query */
 
+/* See MS-FSCC 2.4.7 */
+typedef struct file_basic_info { /* data block encoding of response to level 18 */
+       __le64 CreationTime;
+       __le64 LastAccessTime;
+       __le64 LastWriteTime;
+       __le64 ChangeTime;
+       __le32 Attributes;
+       __u32  Pad;
+} __packed FILE_BASIC_INFO;    /* size info, level 0x101 */
+
 /* See MS-FSCC 2.4.8 */
 typedef struct {
        __le32 NextEntryOffset;
index 8e4cfdc0ba025a96d786b11bdc90276ea737206a..18b9b14d17539fe8205f1a22ce25bb900feae3c1 100644 (file)
@@ -4858,7 +4858,7 @@ static void get_file_access_info(struct smb2_query_info_rsp *rsp,
 static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
                               struct ksmbd_file *fp, void *rsp_org)
 {
-       struct smb2_file_basic_info *basic_info;
+       struct file_basic_info *basic_info;
        struct kstat stat;
        u64 time;
        int ret;
@@ -4874,7 +4874,7 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
        if (ret)
                return ret;
 
-       basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
+       basic_info = (struct file_basic_info *)rsp->Buffer;
        basic_info->CreationTime = cpu_to_le64(fp->create_time);
        time = ksmbd_UnixTimeToNT(stat.atime);
        basic_info->LastAccessTime = cpu_to_le64(time);
@@ -4883,9 +4883,9 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
        time = ksmbd_UnixTimeToNT(stat.ctime);
        basic_info->ChangeTime = cpu_to_le64(time);
        basic_info->Attributes = fp->f_ci->m_fattr;
-       basic_info->Pad1 = 0;
+       basic_info->Pad = 0;
        rsp->OutputBufferLength =
-               cpu_to_le32(sizeof(struct smb2_file_basic_info));
+               cpu_to_le32(sizeof(struct file_basic_info));
        return 0;
 }
 
@@ -6222,7 +6222,7 @@ out:
 }
 
 static int set_file_basic_info(struct ksmbd_file *fp,
-                              struct smb2_file_basic_info *file_info,
+                              struct file_basic_info *file_info,
                               struct ksmbd_share_config *share)
 {
        struct iattr attrs;
@@ -6504,10 +6504,10 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
        switch (req->FileInfoClass) {
        case FILE_BASIC_INFORMATION:
        {
-               if (buf_len < sizeof(struct smb2_file_basic_info))
+               if (buf_len < sizeof(struct file_basic_info))
                        return -EMSGSIZE;
 
-               return set_file_basic_info(fp, (struct smb2_file_basic_info *)buffer, share);
+               return set_file_basic_info(fp, (struct file_basic_info *)buffer, share);
        }
        case FILE_ALLOCATION_INFORMATION:
        {
index 8b6eafb70dca041534121a6150e935b766be21ca..e7cf573e59f00c1fdeb5a81e5761ce31b128f6c4 100644 (file)
@@ -186,15 +186,6 @@ struct smb2_file_alignment_info {
        __le32 AlignmentRequirement;
 } __packed;
 
-struct smb2_file_basic_info { /* data block encoding of response to level 18 */
-       __le64 CreationTime;    /* Beginning of FILE_BASIC_INFO equivalent */
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le32 Attributes;
-       __u32  Pad1;            /* End of FILE_BASIC_INFO_INFO equivalent */
-} __packed;
-
 struct smb2_file_alt_name_info {
        __le32 FileNameLength;
        char FileName[];