From: zhang.guodong@linux.dev
To: smfrench@gmail.com, linkinjeon@kernel.org, chenxiaosong@chenxiaosong.com
Cc: linux-cifs@vger.kernel.org,
ZhangGuoDong <zhangguodong@kylinos.cn>,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH v4 2/5] smb: move file_basic_info into common/fscc.h
Date: Wed, 25 Feb 2026 04:10:57 +0000 [thread overview]
Message-ID: <20260225041100.707468-3-zhang.guodong@linux.dev> (raw)
In-Reply-To: <20260225041100.707468-1-zhang.guodong@linux.dev>
From: ZhangGuoDong <zhangguodong@kylinos.cn>
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>
---
fs/smb/client/smb1pdu.h | 9 ---------
fs/smb/common/fscc.h | 10 ++++++++++
fs/smb/server/smb2pdu.c | 14 +++++++-------
fs/smb/server/smb2pdu.h | 9 ---------
4 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/fs/smb/client/smb1pdu.h b/fs/smb/client/smb1pdu.h
index 97f7e1244a8b..7584e94d9b2b 100644
--- a/fs/smb/client/smb1pdu.h
+++ b/fs/smb/client/smb1pdu.h
@@ -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 */
diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index 415cba02d1c9..076cbcffa26a 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -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;
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 95901a78951c..c787d9fd6dd2 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4838,7 +4838,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;
@@ -4854,7 +4854,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);
@@ -4863,9 +4863,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;
}
@@ -6136,7 +6136,7 @@ static int smb2_create_link(struct ksmbd_work *work,
}
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;
@@ -6418,10 +6418,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:
{
diff --git a/fs/smb/server/smb2pdu.h b/fs/smb/server/smb2pdu.h
index 257c6d26df26..9b3c4c9acb11 100644
--- a/fs/smb/server/smb2pdu.h
+++ b/fs/smb/server/smb2pdu.h
@@ -183,15 +183,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[];
--
2.53.0
next prev parent reply other threads:[~2026-02-25 4:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 4:10 [PATCH v4 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
2026-02-25 4:10 ` [PATCH v4 1/5] smb: move some definitions from common/smb2pdu.h into common/fscc.h zhang.guodong
2026-02-25 4:10 ` zhang.guodong [this message]
2026-02-25 4:10 ` [PATCH v4 3/5] smb: move filesystem_vol_info " zhang.guodong
2026-02-27 2:37 ` Namjae Jeon
2026-02-27 2:48 ` ZhangGuoDong
2026-02-25 4:10 ` [PATCH v4 4/5] smb: update some doc references zhang.guodong
2026-03-01 17:41 ` Steve French
2026-02-25 4:11 ` [PATCH v4 5/5] smb: introduce struct file_posix_info zhang.guodong
2026-02-27 4:37 ` Namjae Jeon
2026-03-03 2:41 ` ZhangGuoDong
2026-03-03 3:00 ` ZhangGuoDong
2026-03-03 7:31 ` ChenXiaoSong
2026-03-03 8:58 ` ChenXiaoSong
2026-03-03 9:41 ` ChenXiaoSong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225041100.707468-3-zhang.guodong@linux.dev \
--to=zhang.guodong@linux.dev \
--cc=chenxiaosong@chenxiaosong.com \
--cc=chenxiaosong@kylinos.cn \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
--cc=zhangguodong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.