]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: move some duplicate struct definitions to common/fscc.h
authorChenXiaoSong <chenxiaosong@kylinos.cn>
Sun, 2 Nov 2025 07:30:55 +0000 (15:30 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 1 Dec 2025 03:11:45 +0000 (21:11 -0600)
Modify the following places:

  - smb2_file_ntwrk_info -> smb2_file_network_open_info
  - struct filesystem_device_info -> FILE_SYSTEM_DEVICE_INFO
  - struct file_directory_info -> FILE_DIRECTORY_INFO
  - struct file_full_directory_info -> FILE_FULL_DIRECTORY_INFO
  - struct file_both_directory_info -> FILE_BOTH_DIRECTORY_INFO
  - struct file_id_full_dir_info -> FILE_ID_FULL_DIR_INFO
  - struct filesystem_posix_info -> FILE_SYSTEM_POSIX_INFO

The fields of these structures are exactly the same on both client and
server, so move duplicate definitions to common header file.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifspdu.h
fs/smb/client/inode.c
fs/smb/client/readdir.c
fs/smb/client/smb2pdu.c
fs/smb/client/smb2pdu.h
fs/smb/common/fscc.h
fs/smb/server/smb2pdu.c
fs/smb/server/smb2pdu.h
fs/smb/server/smb_common.h
fs/smb/server/vfs.c

index 7816bd3da8d71e523786132a5b4a4a59d4de60ff..39f43105186009cd9dd100e7320f4649ba4459eb 100644 (file)
@@ -2036,28 +2036,6 @@ typedef struct {
 
 #define CIFS_POSIX_EXTENSIONS           0x00000010 /* support for new QFSInfo */
 
-typedef struct {
-       /* For undefined recommended transfer size return -1 in that field */
-       __le32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
-       __le32 BlockSize;
-    /* The next three fields are in terms of the block size.
-       (above). If block size is unknown, 4096 would be a
-       reasonable block size for a server to report.
-       Note that returning the blocks/blocksavail removes need
-       to make a second call (to QFSInfo level 0x103 to get this info.
-       UserBlockAvail is typically less than or equal to BlocksAvail,
-       if no distinction is made return the same value in each */
-       __le64 TotalBlocks;
-       __le64 BlocksAvail;       /* bfree */
-       __le64 UserBlocksAvail;   /* bavail */
-    /* For undefined Node fields or FSID return -1 */
-       __le64 TotalFileNodes;
-       __le64 FreeFileNodes;
-       __le64 FileSysIdentifier;   /* fsid */
-       /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
-       /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
-} __attribute__((packed)) FILE_SYSTEM_POSIX_INFO;
-
 /* DeviceType Flags */
 #define FILE_DEVICE_CD_ROM              0x00000002
 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
@@ -2092,11 +2070,6 @@ typedef struct {
 #define FILE_PORTABLE_DEVICE                   0x00004000
 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
 
-typedef struct {
-       __le32 DeviceType;
-       __le32 DeviceCharacteristics;
-} __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */
-
 /* minimum includes first three fields, and empty FS Name */
 #define MIN_FS_ATTR_INFO_SIZE 12
 
@@ -2332,70 +2305,6 @@ typedef struct {
        };
 } __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */
 
-typedef struct {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       char FileName[];
-} __attribute__((packed)) FILE_DIRECTORY_INFO;   /* level 0x101 FF resp data */
-
-typedef struct {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize; /* length of the xattrs */
-       char FileName[];
-} __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */
-
-typedef struct {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize; /* EA size */
-       __le32 Reserved;
-       __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
-       char FileName[];
-} __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
-
-typedef struct {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize; /* length of the xattrs */
-       __u8   ShortNameLength;
-       __u8   Reserved;
-       __u8   ShortName[24];
-       char FileName[];
-} __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */
-
 typedef struct {
        __u32  ResumeKey;
        __le16 CreationDate; /* SMB Date */
index cac355364e43c4bc5e5304c4277bd8d8260c2034..c2ac39d89df26163c18012191c4a991bdc35d065 100644 (file)
@@ -1328,7 +1328,7 @@ static int cifs_get_fattr(struct cifs_open_info_data *data,
                        /* for easier reading */
                        FILE_ALL_INFO *fi;
                        FILE_DIRECTORY_INFO *fdi;
-                       SEARCH_ID_FULL_DIR_INFO *si;
+                       FILE_ID_FULL_DIR_INFO *si;
 
                        rc = cifs_backup_query_path_info(xid, tcon, sb,
                                                         full_path,
@@ -1339,7 +1339,7 @@ static int cifs_get_fattr(struct cifs_open_info_data *data,
 
                        move_cifs_info_to_smb2(&data->fi, fi);
                        fdi = (FILE_DIRECTORY_INFO *)fi;
-                       si = (SEARCH_ID_FULL_DIR_INFO *)fi;
+                       si = (FILE_ID_FULL_DIR_INFO *)fi;
 
                        cifs_dir_info_to_fattr(fattr, fdi, cifs_sb);
                        fattr->cf_uniqueid = le64_to_cpu(si->UniqueId);
index f0ce26622a140b9a06e87ce4173e74f96a4a0492..2fd95c1e91ab6bb4afe4f266f5c22a20e85ca242 100644 (file)
@@ -548,7 +548,7 @@ static void cifs_fill_dirent_full(struct cifs_dirent *de,
 }
 
 static void cifs_fill_dirent_search(struct cifs_dirent *de,
-               const SEARCH_ID_FULL_DIR_INFO *info)
+               const FILE_ID_FULL_DIR_INFO *info)
 {
        de->name = &info->FileName[0];
        de->namelen = le32_to_cpu(info->FileNameLength);
index fe2147c45839823e23b888236daed39b51abe548..62ced22fc5a6e136440b8ed1fbf13e904edb0622 100644 (file)
@@ -5454,7 +5454,7 @@ smb2_parse_query_directory(struct cifs_tcon *tcon,
                info_buf_size = sizeof(FILE_DIRECTORY_INFO);
                break;
        case SMB_FIND_FILE_ID_FULL_DIR_INFO:
-               info_buf_size = sizeof(SEARCH_ID_FULL_DIR_INFO);
+               info_buf_size = sizeof(FILE_ID_FULL_DIR_INFO);
                break;
        case SMB_FIND_FILE_POSIX_INFO:
                /* note that posix payload are variable size */
index 98ed7a22cd57a751e981af35b209230138908fc5..78bb99f29d38c37999b7e9cc103078a705ebb3c8 100644 (file)
@@ -224,19 +224,6 @@ struct smb2_file_reparse_point_info {
        __le32 Tag;
 } __packed;
 
-struct smb2_file_network_open_info {
-       struct_group_attr(network_open_info, __packed,
-               __le64 CreationTime;
-               __le64 LastAccessTime;
-               __le64 LastWriteTime;
-               __le64 ChangeTime;
-               __le64 AllocationSize;
-               __le64 EndOfFile;
-               __le32 Attributes;
-       );
-       __le32 Reserved;
-} __packed; /* level 34 Query also similar returned in close rsp and open rsp */
-
 /* See MS-FSCC 2.4.21 */
 struct smb2_file_id_information {
        __le64  VolumeSerialNumber;
index c8bfb87232ac07b4be9efedd4691cc51cc336cbe..6fa7c65d304b58876b2e3b63b7f42f7b57252b64 100644 (file)
 #ifndef _COMMON_SMB_FSCC_H
 #define _COMMON_SMB_FSCC_H
 
+/* See MS-FSCC 2.4.8 */
+typedef struct {
+       __le32 NextEntryOffset;
+       __u32 FileIndex;
+       __le64 CreationTime;
+       __le64 LastAccessTime;
+       __le64 LastWriteTime;
+       __le64 ChangeTime;
+       __le64 EndOfFile;
+       __le64 AllocationSize;
+       __le32 ExtFileAttributes;
+       __le32 FileNameLength;
+       __le32 EaSize; /* length of the xattrs */
+       __u8   ShortNameLength;
+       __u8   Reserved;
+       __u8   ShortName[24];
+       char FileName[];
+} __packed FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */
+
+/* See MS-FSCC 2.4.10 */
+typedef struct {
+       __le32 NextEntryOffset;
+       __u32 FileIndex;
+       __le64 CreationTime;
+       __le64 LastAccessTime;
+       __le64 LastWriteTime;
+       __le64 ChangeTime;
+       __le64 EndOfFile;
+       __le64 AllocationSize;
+       __le32 ExtFileAttributes;
+       __le32 FileNameLength;
+       char FileName[];
+} __packed FILE_DIRECTORY_INFO;   /* level 0x101 FF resp data */
+
+/* See MS-FSCC 2.4.14 */
+typedef struct {
+       __le32 NextEntryOffset;
+       __u32 FileIndex;
+       __le64 CreationTime;
+       __le64 LastAccessTime;
+       __le64 LastWriteTime;
+       __le64 ChangeTime;
+       __le64 EndOfFile;
+       __le64 AllocationSize;
+       __le32 ExtFileAttributes;
+       __le32 FileNameLength;
+       __le32 EaSize; /* length of the xattrs */
+       char FileName[];
+} __packed FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */
+
+/* See MS-FSCC 2.4.24 */
+typedef struct {
+       __le32 NextEntryOffset;
+       __u32 FileIndex;
+       __le64 CreationTime;
+       __le64 LastAccessTime;
+       __le64 LastWriteTime;
+       __le64 ChangeTime;
+       __le64 EndOfFile;
+       __le64 AllocationSize;
+       __le32 ExtFileAttributes;
+       __le32 FileNameLength;
+       __le32 EaSize; /* EA size */
+       __le32 Reserved;
+       __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
+       char FileName[];
+} __packed FILE_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
+
+/* See MS-FSCC 2.4.34 */
+struct smb2_file_network_open_info {
+       struct_group_attr(network_open_info, __packed,
+               __le64 CreationTime;
+               __le64 LastAccessTime;
+               __le64 LastWriteTime;
+               __le64 ChangeTime;
+               __le64 AllocationSize;
+               __le64 EndOfFile;
+               __le32 Attributes;
+       );
+       __le32 Reserved;
+} __packed; /* level 34 Query also similar returned in close rsp and open rsp */
+
 /* List of FileSystemAttributes - see MS-FSCC 2.5.1 */
 #define FILE_SUPPORTS_SPARSE_VDL       0x10000000 /* faster nonsparse extend */
 #define FILE_SUPPORTS_BLOCK_REFCOUNTING        0x08000000 /* allow ioctl dup extents */
 #define FILE_CASE_PRESERVED_NAMES      0x00000002
 #define FILE_CASE_SENSITIVE_SEARCH     0x00000001
 
+/* See MS-FSCC 2.5.10 */
+typedef struct {
+       __le32 DeviceType;
+       __le32 DeviceCharacteristics;
+} __packed FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */
+
+/*
+ * See POSIX Extensions to MS-FSCC 2.3.2.1
+ * Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/fscc_posix_extensions.md
+ */
+typedef struct {
+       /* For undefined recommended transfer size return -1 in that field */
+       __le32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
+       __le32 BlockSize;
+       /* The next three fields are in terms of the block size.
+        * (above). If block size is unknown, 4096 would be a
+        * reasonable block size for a server to report.
+        * Note that returning the blocks/blocksavail removes need
+        * to make a second call (to QFSInfo level 0x103 to get this info.
+        * UserBlockAvail is typically less than or equal to BlocksAvail,
+        * if no distinction is made return the same value in each
+        */
+       __le64 TotalBlocks;
+       __le64 BlocksAvail;       /* bfree */
+       __le64 UserBlocksAvail;   /* bavail */
+       /* For undefined Node fields or FSID return -1 */
+       __le64 TotalFileNodes;
+       __le64 FreeFileNodes;
+       __le64 FileSysIdentifier;   /* fsid */
+       /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
+       /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
+} __packed FILE_SYSTEM_POSIX_INFO;
+
 #endif /* _COMMON_SMB_FSCC_H */
index 1f0ed9fb1e836bf70e373e75ac62099251e5adf3..5696ac8bf5e891427bcf05ed295038034b34bad6 100644 (file)
@@ -3786,15 +3786,15 @@ static int readdir_info_level_struct_sz(int info_level)
 {
        switch (info_level) {
        case FILE_FULL_DIRECTORY_INFORMATION:
-               return sizeof(struct file_full_directory_info);
+               return sizeof(FILE_FULL_DIRECTORY_INFO);
        case FILE_BOTH_DIRECTORY_INFORMATION:
-               return sizeof(struct file_both_directory_info);
+               return sizeof(FILE_BOTH_DIRECTORY_INFO);
        case FILE_DIRECTORY_INFORMATION:
-               return sizeof(struct file_directory_info);
+               return sizeof(FILE_DIRECTORY_INFO);
        case FILE_NAMES_INFORMATION:
                return sizeof(struct file_names_info);
        case FILEID_FULL_DIRECTORY_INFORMATION:
-               return sizeof(struct file_id_full_dir_info);
+               return sizeof(FILE_ID_FULL_DIR_INFO);
        case FILEID_BOTH_DIRECTORY_INFORMATION:
                return sizeof(struct file_id_both_directory_info);
        case SMB_FIND_FILE_POSIX_INFO:
@@ -3809,9 +3809,9 @@ static int dentry_name(struct ksmbd_dir_info *d_info, int info_level)
        switch (info_level) {
        case FILE_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_full_directory_info *ffdinfo;
+               FILE_FULL_DIRECTORY_INFO *ffdinfo;
 
-               ffdinfo = (struct file_full_directory_info *)d_info->rptr;
+               ffdinfo = (FILE_FULL_DIRECTORY_INFO *)d_info->rptr;
                d_info->rptr += le32_to_cpu(ffdinfo->NextEntryOffset);
                d_info->name = ffdinfo->FileName;
                d_info->name_len = le32_to_cpu(ffdinfo->FileNameLength);
@@ -3819,9 +3819,9 @@ static int dentry_name(struct ksmbd_dir_info *d_info, int info_level)
        }
        case FILE_BOTH_DIRECTORY_INFORMATION:
        {
-               struct file_both_directory_info *fbdinfo;
+               FILE_BOTH_DIRECTORY_INFO *fbdinfo;
 
-               fbdinfo = (struct file_both_directory_info *)d_info->rptr;
+               fbdinfo = (FILE_BOTH_DIRECTORY_INFO *)d_info->rptr;
                d_info->rptr += le32_to_cpu(fbdinfo->NextEntryOffset);
                d_info->name = fbdinfo->FileName;
                d_info->name_len = le32_to_cpu(fbdinfo->FileNameLength);
@@ -3829,9 +3829,9 @@ static int dentry_name(struct ksmbd_dir_info *d_info, int info_level)
        }
        case FILE_DIRECTORY_INFORMATION:
        {
-               struct file_directory_info *fdinfo;
+               FILE_DIRECTORY_INFO *fdinfo;
 
-               fdinfo = (struct file_directory_info *)d_info->rptr;
+               fdinfo = (FILE_DIRECTORY_INFO *)d_info->rptr;
                d_info->rptr += le32_to_cpu(fdinfo->NextEntryOffset);
                d_info->name = fdinfo->FileName;
                d_info->name_len = le32_to_cpu(fdinfo->FileNameLength);
@@ -3849,9 +3849,9 @@ static int dentry_name(struct ksmbd_dir_info *d_info, int info_level)
        }
        case FILEID_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_id_full_dir_info *dinfo;
+               FILE_ID_FULL_DIR_INFO *dinfo;
 
-               dinfo = (struct file_id_full_dir_info *)d_info->rptr;
+               dinfo = (FILE_ID_FULL_DIR_INFO *)d_info->rptr;
                d_info->rptr += le32_to_cpu(dinfo->NextEntryOffset);
                d_info->name = dinfo->FileName;
                d_info->name_len = le32_to_cpu(dinfo->FileNameLength);
@@ -3934,9 +3934,9 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
        switch (info_level) {
        case FILE_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_full_directory_info *ffdinfo;
+               FILE_FULL_DIRECTORY_INFO *ffdinfo;
 
-               ffdinfo = (struct file_full_directory_info *)kstat;
+               ffdinfo = (FILE_FULL_DIRECTORY_INFO *)kstat;
                ffdinfo->FileNameLength = cpu_to_le32(conv_len);
                ffdinfo->EaSize =
                        smb2_get_reparse_tag_special_file(ksmbd_kstat->kstat->mode);
@@ -3950,9 +3950,9 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
        }
        case FILE_BOTH_DIRECTORY_INFORMATION:
        {
-               struct file_both_directory_info *fbdinfo;
+               FILE_BOTH_DIRECTORY_INFO *fbdinfo;
 
-               fbdinfo = (struct file_both_directory_info *)kstat;
+               fbdinfo = (FILE_BOTH_DIRECTORY_INFO *)kstat;
                fbdinfo->FileNameLength = cpu_to_le32(conv_len);
                fbdinfo->EaSize =
                        smb2_get_reparse_tag_special_file(ksmbd_kstat->kstat->mode);
@@ -3968,9 +3968,9 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
        }
        case FILE_DIRECTORY_INFORMATION:
        {
-               struct file_directory_info *fdinfo;
+               FILE_DIRECTORY_INFO *fdinfo;
 
-               fdinfo = (struct file_directory_info *)kstat;
+               fdinfo = (FILE_DIRECTORY_INFO *)kstat;
                fdinfo->FileNameLength = cpu_to_le32(conv_len);
                if (d_info->hide_dot_file && d_info->name[0] == '.')
                        fdinfo->ExtFileAttributes |= FILE_ATTRIBUTE_HIDDEN_LE;
@@ -3990,9 +3990,9 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
        }
        case FILEID_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_id_full_dir_info *dinfo;
+               FILE_ID_FULL_DIR_INFO *dinfo;
 
-               dinfo = (struct file_id_full_dir_info *)kstat;
+               dinfo = (FILE_ID_FULL_DIR_INFO *)kstat;
                dinfo->FileNameLength = cpu_to_le32(conv_len);
                dinfo->EaSize =
                        smb2_get_reparse_tag_special_file(ksmbd_kstat->kstat->mode);
@@ -4196,9 +4196,9 @@ static int reserve_populate_dentry(struct ksmbd_dir_info *d_info,
        switch (info_level) {
        case FILE_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_full_directory_info *ffdinfo;
+               FILE_FULL_DIRECTORY_INFO *ffdinfo;
 
-               ffdinfo = (struct file_full_directory_info *)d_info->wptr;
+               ffdinfo = (FILE_FULL_DIRECTORY_INFO *)d_info->wptr;
                memcpy(ffdinfo->FileName, d_info->name, d_info->name_len);
                ffdinfo->FileName[d_info->name_len] = 0x00;
                ffdinfo->FileNameLength = cpu_to_le32(d_info->name_len);
@@ -4207,9 +4207,9 @@ static int reserve_populate_dentry(struct ksmbd_dir_info *d_info,
        }
        case FILE_BOTH_DIRECTORY_INFORMATION:
        {
-               struct file_both_directory_info *fbdinfo;
+               FILE_BOTH_DIRECTORY_INFO *fbdinfo;
 
-               fbdinfo = (struct file_both_directory_info *)d_info->wptr;
+               fbdinfo = (FILE_BOTH_DIRECTORY_INFO *)d_info->wptr;
                memcpy(fbdinfo->FileName, d_info->name, d_info->name_len);
                fbdinfo->FileName[d_info->name_len] = 0x00;
                fbdinfo->FileNameLength = cpu_to_le32(d_info->name_len);
@@ -4218,9 +4218,9 @@ static int reserve_populate_dentry(struct ksmbd_dir_info *d_info,
        }
        case FILE_DIRECTORY_INFORMATION:
        {
-               struct file_directory_info *fdinfo;
+               FILE_DIRECTORY_INFO *fdinfo;
 
-               fdinfo = (struct file_directory_info *)d_info->wptr;
+               fdinfo = (FILE_DIRECTORY_INFO *)d_info->wptr;
                memcpy(fdinfo->FileName, d_info->name, d_info->name_len);
                fdinfo->FileName[d_info->name_len] = 0x00;
                fdinfo->FileNameLength = cpu_to_le32(d_info->name_len);
@@ -4240,9 +4240,9 @@ static int reserve_populate_dentry(struct ksmbd_dir_info *d_info,
        }
        case FILEID_FULL_DIRECTORY_INFORMATION:
        {
-               struct file_id_full_dir_info *dinfo;
+               FILE_ID_FULL_DIR_INFO *dinfo;
 
-               dinfo = (struct file_id_full_dir_info *)d_info->wptr;
+               dinfo = (FILE_ID_FULL_DIR_INFO *)d_info->wptr;
                memcpy(dinfo->FileName, d_info->name, d_info->name_len);
                dinfo->FileName[d_info->name_len] = 0x00;
                dinfo->FileNameLength = cpu_to_le32(d_info->name_len);
@@ -4504,7 +4504,7 @@ again:
                        goto err_out;
        } else {
 no_buf_len:
-               ((struct file_directory_info *)
+               ((FILE_DIRECTORY_INFO *)
                ((char *)rsp->Buffer + d_info.last_entry_offset))
                ->NextEntryOffset = 0;
                if (d_info.data_count >= d_info.last_entry_off_align)
@@ -5123,7 +5123,7 @@ static int get_file_internal_info(struct smb2_query_info_rsp *rsp,
 static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
                                      struct ksmbd_file *fp, void *rsp_org)
 {
-       struct smb2_file_ntwrk_info *file_info;
+       struct smb2_file_network_open_info *file_info;
        struct kstat stat;
        u64 time;
        int ret;
@@ -5139,7 +5139,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
        if (ret)
                return ret;
 
-       file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer;
+       file_info = (struct smb2_file_network_open_info *)rsp->Buffer;
 
        file_info->CreationTime = cpu_to_le64(fp->create_time);
        time = ksmbd_UnixTimeToNT(stat.atime);
@@ -5158,7 +5158,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
        }
        file_info->Reserved = cpu_to_le32(0);
        rsp->OutputBufferLength =
-               cpu_to_le32(sizeof(struct smb2_file_ntwrk_info));
+               cpu_to_le32(sizeof(struct smb2_file_network_open_info));
        return 0;
 }
 
@@ -5466,9 +5466,9 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
        switch (fsinfoclass) {
        case FS_DEVICE_INFORMATION:
        {
-               struct filesystem_device_info *info;
+               FILE_SYSTEM_DEVICE_INFO *info;
 
-               info = (struct filesystem_device_info *)rsp->Buffer;
+               info = (FILE_SYSTEM_DEVICE_INFO *)rsp->Buffer;
 
                info->DeviceType = cpu_to_le32(FILE_DEVICE_DISK);
                info->DeviceCharacteristics =
@@ -5623,14 +5623,14 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
        }
        case FS_POSIX_INFORMATION:
        {
-               struct filesystem_posix_info *info;
+               FILE_SYSTEM_POSIX_INFO *info;
 
                if (!work->tcon->posix_extensions) {
                        pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n");
                        path_put(&path);
                        return -EOPNOTSUPP;
                } else {
-                       info = (struct filesystem_posix_info *)(rsp->Buffer);
+                       info = (FILE_SYSTEM_POSIX_INFO *)(rsp->Buffer);
                        info->OptimalTransferSize = cpu_to_le32(stfs.f_bsize);
                        info->BlockSize = cpu_to_le32(stfs.f_bsize);
                        info->TotalBlocks = cpu_to_le64(stfs.f_blocks);
index d10374e440931f85d5241562503194f6607889a3..b94de41049f401019c71592e94d9eb5028be09be 100644 (file)
@@ -217,17 +217,6 @@ struct smb2_file_stream_info {
        char   StreamName[];
 } __packed;
 
-struct smb2_file_ntwrk_info {
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 AllocationSize;
-       __le64 EndOfFile;
-       __le32 Attributes;
-       __le32 Reserved;
-} __packed;
-
 struct smb2_file_standard_info {
        __le64 AllocationSize;
        __le64 EndOfFile;
index 653e369efbe876c751194750c1057ab907434ff4..c171c1e190a549d5812fb641e781f318e03b7bbf 100644 (file)
@@ -104,11 +104,6 @@ struct filesystem_attribute_info {
        __le16 FileSystemName[]; /* do not have to save this - get subset? */
 } __packed;
 
-struct filesystem_device_info {
-       __le32 DeviceType;
-       __le32 DeviceCharacteristics;
-} __packed; /* device info level 0x104 */
-
 struct filesystem_vol_info {
        __le64 VolumeCreationTime;
        __le32 SerialNumber;
@@ -140,20 +135,6 @@ struct object_id_info {
        struct fs_extended_info extended_info;
 } __packed;
 
-struct file_directory_info {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       char FileName[];
-} __packed;   /* level 0x101 FF resp data */
-
 struct file_names_info {
        __le32 NextEntryOffset;
        __u32 FileIndex;
@@ -161,39 +142,6 @@ struct file_names_info {
        char FileName[];
 } __packed;   /* level 0xc FF resp data */
 
-struct file_full_directory_info {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize;
-       char FileName[];
-} __packed; /* level 0x102 FF resp */
-
-struct file_both_directory_info {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize; /* length of the xattrs */
-       __u8   ShortNameLength;
-       __u8   Reserved;
-       __u8   ShortName[24];
-       char FileName[];
-} __packed; /* level 0x104 FFrsp data */
-
 struct file_id_both_directory_info {
        __le32 NextEntryOffset;
        __u32 FileIndex;
@@ -214,46 +162,6 @@ struct file_id_both_directory_info {
        char FileName[];
 } __packed;
 
-struct file_id_full_dir_info {
-       __le32 NextEntryOffset;
-       __u32 FileIndex;
-       __le64 CreationTime;
-       __le64 LastAccessTime;
-       __le64 LastWriteTime;
-       __le64 ChangeTime;
-       __le64 EndOfFile;
-       __le64 AllocationSize;
-       __le32 ExtFileAttributes;
-       __le32 FileNameLength;
-       __le32 EaSize; /* EA size */
-       __le32 Reserved;
-       __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
-       char FileName[];
-} __packed; /* level 0x105 FF rsp data */
-
-struct filesystem_posix_info {
-       /* For undefined recommended transfer size return -1 in that field */
-       __le32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
-       __le32 BlockSize;
-       /* The next three fields are in terms of the block size.
-        * (above). If block size is unknown, 4096 would be a
-        * reasonable block size for a server to report.
-        * Note that returning the blocks/blocksavail removes need
-        * to make a second call (to QFSInfo level 0x103 to get this info.
-        * UserBlockAvail is typically less than or equal to BlocksAvail,
-        * if no distinction is made return the same value in each
-        */
-       __le64 TotalBlocks;
-       __le64 BlocksAvail;       /* bfree */
-       __le64 UserBlocksAvail;   /* bavail */
-       /* For undefined Node fields or FSID return -1 */
-       __le64 TotalFileNodes;
-       __le64 FreeFileNodes;
-       __le64 FileSysIdentifier;   /* fsid */
-       /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
-       /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
-} __packed;
-
 struct smb_version_ops {
        u16 (*get_cmd_val)(struct ksmbd_work *swork);
        int (*init_rsp_hdr)(struct ksmbd_work *swork);
index 90e693e4e41497813133a0c013759696e1b85232..39db6992e4c932c7704f91e741d46b0b9d9ce80b 100644 (file)
@@ -1657,7 +1657,7 @@ int ksmbd_vfs_get_dos_attrib_xattr(struct mnt_idmap *idmap,
  */
 void *ksmbd_vfs_init_kstat(char **p, struct ksmbd_kstat *ksmbd_kstat)
 {
-       struct file_directory_info *info = (struct file_directory_info *)(*p);
+       FILE_DIRECTORY_INFO *info = (FILE_DIRECTORY_INFO *)(*p);
        struct kstat *kstat = ksmbd_kstat->kstat;
        u64 time;