mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
smb: move FILE_SYSTEM_ATTRIBUTE_INFO to common/fscc.h
Modify the following places: - struct filesystem_attribute_info -> FILE_SYSTEM_ATTRIBUTE_INFO - Remove MIN_FS_ATTR_INFO_SIZE definition - Introduce MAX_FS_NAME_LEN - max_len of FileFsAttributeInformation -> sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) + MAX_FS_NAME_LEN - min_len of FileFsAttributeInformation -> sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) - SMB2_QFS_attr(): memcpy(..., min_len) Then move FILE_SYSTEM_ATTRIBUTE_INFO to common header file. I have tested the relevant code related to FILE_SYSTEM_ATTRIBUTE_INFO (Link[1]). Link[1]: https://chenxiaosong.com/en/FILE_SYSTEM_ATTRIBUTE_INFO.html Suggested-by: Namjae Jeon <linkinjeon@kernel.org> Tested-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
committed by
Steve French
parent
e4442b2e95
commit
c4a2a49f7d
@@ -2068,16 +2068,6 @@ typedef struct {
|
||||
#define FILE_PORTABLE_DEVICE 0x00004000
|
||||
#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
|
||||
|
||||
/* minimum includes first three fields, and empty FS Name */
|
||||
#define MIN_FS_ATTR_INFO_SIZE 12
|
||||
|
||||
typedef struct {
|
||||
__le32 Attributes;
|
||||
__le32 MaxPathNameComponentLength;
|
||||
__le32 FileSystemNameLen;
|
||||
char FileSystemName[52]; /* do not have to save this - get subset? */
|
||||
} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
|
||||
|
||||
/******************************************************************************/
|
||||
/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -5981,8 +5981,8 @@ replay_again:
|
||||
max_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
|
||||
min_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
|
||||
} else if (level == FS_ATTRIBUTE_INFORMATION) {
|
||||
max_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO);
|
||||
min_len = MIN_FS_ATTR_INFO_SIZE;
|
||||
max_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) + MAX_FS_NAME_LEN;
|
||||
min_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO);
|
||||
} else if (level == FS_SECTOR_SIZE_INFORMATION) {
|
||||
max_len = sizeof(struct smb3_fs_ss_info);
|
||||
min_len = sizeof(struct smb3_fs_ss_info);
|
||||
@@ -6028,7 +6028,7 @@ replay_again:
|
||||
if (level == FS_ATTRIBUTE_INFORMATION)
|
||||
memcpy(&tcon->fsAttrInfo, offset
|
||||
+ (char *)rsp, min_t(unsigned int,
|
||||
rsp_len, max_len));
|
||||
rsp_len, min_len));
|
||||
else if (level == FS_DEVICE_INFORMATION)
|
||||
memcpy(&tcon->fsDevInfo, offset
|
||||
+ (char *)rsp, sizeof(FILE_SYSTEM_DEVICE_INFO));
|
||||
|
||||
@@ -94,6 +94,15 @@ struct smb2_file_network_open_info {
|
||||
__le32 Reserved;
|
||||
} __packed; /* level 34 Query also similar returned in close rsp and open rsp */
|
||||
|
||||
/* See MS-FSCC 2.5.1 */
|
||||
#define MAX_FS_NAME_LEN 52
|
||||
typedef struct {
|
||||
__le32 Attributes;
|
||||
__le32 MaxPathNameComponentLength;
|
||||
__le32 FileSystemNameLen;
|
||||
__le16 FileSystemName[]; /* do not have to save this - get subset? */
|
||||
} __packed FILE_SYSTEM_ATTRIBUTE_INFO;
|
||||
|
||||
/* 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 */
|
||||
|
||||
@@ -5479,10 +5479,10 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
|
||||
}
|
||||
case FS_ATTRIBUTE_INFORMATION:
|
||||
{
|
||||
struct filesystem_attribute_info *info;
|
||||
FILE_SYSTEM_ATTRIBUTE_INFO *info;
|
||||
size_t sz;
|
||||
|
||||
info = (struct filesystem_attribute_info *)rsp->Buffer;
|
||||
info = (FILE_SYSTEM_ATTRIBUTE_INFO *)rsp->Buffer;
|
||||
info->Attributes = cpu_to_le32(FILE_SUPPORTS_OBJECT_IDS |
|
||||
FILE_PERSISTENT_ACLS |
|
||||
FILE_UNICODE_ON_DISK |
|
||||
@@ -5501,7 +5501,7 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
|
||||
"NTFS", PATH_MAX, conn->local_nls, 0);
|
||||
len = len * 2;
|
||||
info->FileSystemNameLen = cpu_to_le32(len);
|
||||
sz = sizeof(struct filesystem_attribute_info) + len;
|
||||
sz = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) + len;
|
||||
rsp->OutputBufferLength = cpu_to_le32(sz);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -90,13 +90,6 @@ struct smb_negotiate_rsp {
|
||||
__le16 ByteCount;
|
||||
} __packed;
|
||||
|
||||
struct filesystem_attribute_info {
|
||||
__le32 Attributes;
|
||||
__le32 MaxPathNameComponentLength;
|
||||
__le32 FileSystemNameLen;
|
||||
__le16 FileSystemName[]; /* do not have to save this - get subset? */
|
||||
} __packed;
|
||||
|
||||
struct filesystem_vol_info {
|
||||
__le64 VolumeCreationTime;
|
||||
__le32 SerialNumber;
|
||||
|
||||
Reference in New Issue
Block a user