Skip to content

Commit b6d002f

Browse files
paliSteve French
authored andcommitted
cifs: Rename struct reparse_posix_data to reparse_nfs_data_buffer and move to common/smb2pdu.h
Function parse_reparse_posix() parses NFS-style reparse points, which are used only by Windows NFS server since Windows Server 2012 version. This style is not understood by Microsoft POSIX/Interix/SFU/SUA subsystems. So make it clear that parse_reparse_posix() function and reparse_posix_data structure are not POSIX general, but rather NFS specific. All reparse buffer structures are defined in common/smb2pdu.h and have _buffer suffix. So move struct reparse_posix_data from client/cifspdu.h to common/smb2pdu.h and rename it to reparse_nfs_data_buffer for consistency. Note that also SMB specification in [MS-FSCC] document, section 2.1.2.6 defines it under name "Network File System (NFS) Reparse Data Buffer". So use this name for consistency. Having this structure in common/smb2pdu.h can be useful for ksmbd server code as NFS-style reparse points is the preferred way for implementing support for special files. Signed-off-by: Pali Rohár <pali@kernel.org> Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 65cccce commit b6d002f

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

fs/smb/client/cifspdu.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,20 +1484,6 @@ struct file_notify_information {
14841484
__u8 FileName[];
14851485
} __attribute__((packed));
14861486

1487-
/* For IO_REPARSE_TAG_NFS */
1488-
#define NFS_SPECFILE_LNK 0x00000000014B4E4C
1489-
#define NFS_SPECFILE_CHR 0x0000000000524843
1490-
#define NFS_SPECFILE_BLK 0x00000000004B4C42
1491-
#define NFS_SPECFILE_FIFO 0x000000004F464946
1492-
#define NFS_SPECFILE_SOCK 0x000000004B434F53
1493-
struct reparse_posix_data {
1494-
__le32 ReparseTag;
1495-
__le16 ReparseDataLength;
1496-
__u16 Reserved;
1497-
__le64 InodeType; /* LNK, FIFO, CHR etc. */
1498-
__u8 DataBuffer[];
1499-
} __attribute__((packed));
1500-
15011487
struct cifs_quota_data {
15021488
__u32 rsrvd1; /* 0 */
15031489
__u32 sid_size;

fs/smb/client/reparse.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int detect_directory_symlink_target(struct cifs_sb_info *cifs_sb,
242242
return 0;
243243
}
244244

245-
static int nfs_set_reparse_buf(struct reparse_posix_data *buf,
245+
static int nfs_set_reparse_buf(struct reparse_nfs_data_buffer *buf,
246246
mode_t mode, dev_t dev,
247247
struct kvec *iov)
248248
{
@@ -281,13 +281,13 @@ static int mknod_nfs(unsigned int xid, struct inode *inode,
281281
const char *full_path, umode_t mode, dev_t dev)
282282
{
283283
struct cifs_open_info_data data;
284-
struct reparse_posix_data *p;
284+
struct reparse_nfs_data_buffer *p;
285285
struct inode *new;
286286
struct kvec iov;
287287
__u8 buf[sizeof(*p) + sizeof(__le64)];
288288
int rc;
289289

290-
p = (struct reparse_posix_data *)buf;
290+
p = (struct reparse_nfs_data_buffer *)buf;
291291
rc = nfs_set_reparse_buf(p, mode, dev, &iov);
292292
if (rc)
293293
return rc;
@@ -474,7 +474,7 @@ int smb2_mknod_reparse(unsigned int xid, struct inode *inode,
474474
}
475475

476476
/* See MS-FSCC 2.1.2.6 for the 'NFS' style reparse tags */
477-
static int parse_reparse_posix(struct reparse_posix_data *buf,
477+
static int parse_reparse_nfs(struct reparse_nfs_data_buffer *buf,
478478
struct cifs_sb_info *cifs_sb,
479479
struct cifs_open_info_data *data)
480480
{
@@ -702,7 +702,7 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
702702
/* See MS-FSCC 2.1.2 */
703703
switch (le32_to_cpu(buf->ReparseTag)) {
704704
case IO_REPARSE_TAG_NFS:
705-
return parse_reparse_posix((struct reparse_posix_data *)buf,
705+
return parse_reparse_nfs((struct reparse_nfs_data_buffer *)buf,
706706
cifs_sb, data);
707707
case IO_REPARSE_TAG_SYMLINK:
708708
return parse_reparse_symlink(
@@ -816,7 +816,7 @@ static bool posix_reparse_to_fattr(struct cifs_sb_info *cifs_sb,
816816
struct cifs_fattr *fattr,
817817
struct cifs_open_info_data *data)
818818
{
819-
struct reparse_posix_data *buf = (struct reparse_posix_data *)data->reparse.buf;
819+
struct reparse_nfs_data_buffer *buf = (struct reparse_nfs_data_buffer *)data->reparse.buf;
820820

821821
if (buf == NULL)
822822
return true;

fs/smb/common/smb2pdu.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,19 @@ struct reparse_symlink_data_buffer {
15501550
__u8 PathBuffer[]; /* Variable Length */
15511551
} __packed;
15521552

1553-
/* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */
1553+
/* For IO_REPARSE_TAG_NFS - see MS-FSCC 2.1.2.6 */
1554+
#define NFS_SPECFILE_LNK 0x00000000014B4E4C
1555+
#define NFS_SPECFILE_CHR 0x0000000000524843
1556+
#define NFS_SPECFILE_BLK 0x00000000004B4C42
1557+
#define NFS_SPECFILE_FIFO 0x000000004F464946
1558+
#define NFS_SPECFILE_SOCK 0x000000004B434F53
1559+
struct reparse_nfs_data_buffer {
1560+
__le32 ReparseTag;
1561+
__le16 ReparseDataLength;
1562+
__u16 Reserved;
1563+
__le64 InodeType; /* NFS_SPECFILE_* */
1564+
__u8 DataBuffer[];
1565+
} __packed;
15541566

15551567
/* For IO_REPARSE_TAG_LX_SYMLINK */
15561568
struct reparse_wsl_symlink_data_buffer {

0 commit comments

Comments
 (0)