Skip to content

Commit 31884d4

Browse files
ZhangGuoDongsmfrench
authored andcommitted
smb: move file_basic_info into common/fscc.h
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>
1 parent a5e5810 commit 31884d4

4 files changed

Lines changed: 17 additions & 25 deletions

File tree

fs/smb/client/smb1pdu.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,15 +2061,6 @@ typedef struct {
20612061
__le32 EASize;
20622062
} __packed FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */
20632063

2064-
typedef struct {
2065-
__le64 CreationTime;
2066-
__le64 LastAccessTime;
2067-
__le64 LastWriteTime;
2068-
__le64 ChangeTime;
2069-
__le32 Attributes;
2070-
__u32 Pad;
2071-
} __packed FILE_BASIC_INFO; /* size info, level 0x101 */
2072-
20732064
struct file_allocation_info {
20742065
__le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
20752066
} __packed; /* size used on disk, for level 0x103 for set, 0x105 for query */

fs/smb/common/fscc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ struct smb2_file_all_info { /* data block encoding of response to level 18 */
216216
};
217217
} __packed; /* level 18 Query */
218218

219+
/* See MS-FSCC 2.4.7 */
220+
typedef struct file_basic_info { /* data block encoding of response to level 18 */
221+
__le64 CreationTime;
222+
__le64 LastAccessTime;
223+
__le64 LastWriteTime;
224+
__le64 ChangeTime;
225+
__le32 Attributes;
226+
__u32 Pad;
227+
} __packed FILE_BASIC_INFO; /* size info, level 0x101 */
228+
219229
/* See MS-FSCC 2.4.8 */
220230
typedef struct {
221231
__le32 NextEntryOffset;

fs/smb/server/smb2pdu.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4858,7 +4858,7 @@ static void get_file_access_info(struct smb2_query_info_rsp *rsp,
48584858
static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
48594859
struct ksmbd_file *fp, void *rsp_org)
48604860
{
4861-
struct smb2_file_basic_info *basic_info;
4861+
struct file_basic_info *basic_info;
48624862
struct kstat stat;
48634863
u64 time;
48644864
int ret;
@@ -4874,7 +4874,7 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
48744874
if (ret)
48754875
return ret;
48764876

4877-
basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
4877+
basic_info = (struct file_basic_info *)rsp->Buffer;
48784878
basic_info->CreationTime = cpu_to_le64(fp->create_time);
48794879
time = ksmbd_UnixTimeToNT(stat.atime);
48804880
basic_info->LastAccessTime = cpu_to_le64(time);
@@ -4883,9 +4883,9 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
48834883
time = ksmbd_UnixTimeToNT(stat.ctime);
48844884
basic_info->ChangeTime = cpu_to_le64(time);
48854885
basic_info->Attributes = fp->f_ci->m_fattr;
4886-
basic_info->Pad1 = 0;
4886+
basic_info->Pad = 0;
48874887
rsp->OutputBufferLength =
4888-
cpu_to_le32(sizeof(struct smb2_file_basic_info));
4888+
cpu_to_le32(sizeof(struct file_basic_info));
48894889
return 0;
48904890
}
48914891

@@ -6222,7 +6222,7 @@ static int smb2_create_link(struct ksmbd_work *work,
62226222
}
62236223

62246224
static int set_file_basic_info(struct ksmbd_file *fp,
6225-
struct smb2_file_basic_info *file_info,
6225+
struct file_basic_info *file_info,
62266226
struct ksmbd_share_config *share)
62276227
{
62286228
struct iattr attrs;
@@ -6504,10 +6504,10 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
65046504
switch (req->FileInfoClass) {
65056505
case FILE_BASIC_INFORMATION:
65066506
{
6507-
if (buf_len < sizeof(struct smb2_file_basic_info))
6507+
if (buf_len < sizeof(struct file_basic_info))
65086508
return -EMSGSIZE;
65096509

6510-
return set_file_basic_info(fp, (struct smb2_file_basic_info *)buffer, share);
6510+
return set_file_basic_info(fp, (struct file_basic_info *)buffer, share);
65116511
}
65126512
case FILE_ALLOCATION_INFORMATION:
65136513
{

fs/smb/server/smb2pdu.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,6 @@ struct smb2_file_alignment_info {
186186
__le32 AlignmentRequirement;
187187
} __packed;
188188

189-
struct smb2_file_basic_info { /* data block encoding of response to level 18 */
190-
__le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
191-
__le64 LastAccessTime;
192-
__le64 LastWriteTime;
193-
__le64 ChangeTime;
194-
__le32 Attributes;
195-
__u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
196-
} __packed;
197-
198189
struct smb2_file_alt_name_info {
199190
__le32 FileNameLength;
200191
char FileName[];

0 commit comments

Comments
 (0)