]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: Rename struct reparse_posix_data to reparse_nfs_data_buffer and move to common...
authorPali Rohár <pali@kernel.org>
Fri, 13 Sep 2024 09:46:35 +0000 (11:46 +0200)
committerSteve French <stfrench@microsoft.com>
Wed, 29 Jan 2025 23:18:55 +0000 (17:18 -0600)
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>
fs/smb/client/cifspdu.h
fs/smb/client/reparse.c
fs/smb/common/smb2pdu.h

index 5c047b00516f2e9489c666a0760de79d48aa00a8..c285f0e5ce0f0cc4e51e16d6c4661f97690cd588 100644 (file)
@@ -1484,20 +1484,6 @@ struct file_notify_information {
        __u8  FileName[];
 } __attribute__((packed));
 
-/* For IO_REPARSE_TAG_NFS */
-#define NFS_SPECFILE_LNK       0x00000000014B4E4C
-#define NFS_SPECFILE_CHR       0x0000000000524843
-#define NFS_SPECFILE_BLK       0x00000000004B4C42
-#define NFS_SPECFILE_FIFO      0x000000004F464946
-#define NFS_SPECFILE_SOCK      0x000000004B434F53
-struct reparse_posix_data {
-       __le32  ReparseTag;
-       __le16  ReparseDataLength;
-       __u16   Reserved;
-       __le64  InodeType; /* LNK, FIFO, CHR etc. */
-       __u8    DataBuffer[];
-} __attribute__((packed));
-
 struct cifs_quota_data {
        __u32   rsrvd1;  /* 0 */
        __u32   sid_size;
index 77f891f718c0c5d9ac406dea2386b86ca1707778..3be2173a026d02a442181614b54484d09794ade8 100644 (file)
@@ -242,7 +242,7 @@ static int detect_directory_symlink_target(struct cifs_sb_info *cifs_sb,
        return 0;
 }
 
-static int nfs_set_reparse_buf(struct reparse_posix_data *buf,
+static int nfs_set_reparse_buf(struct reparse_nfs_data_buffer *buf,
                               mode_t mode, dev_t dev,
                               struct kvec *iov)
 {
@@ -281,13 +281,13 @@ static int mknod_nfs(unsigned int xid, struct inode *inode,
                     const char *full_path, umode_t mode, dev_t dev)
 {
        struct cifs_open_info_data data;
-       struct reparse_posix_data *p;
+       struct reparse_nfs_data_buffer *p;
        struct inode *new;
        struct kvec iov;
        __u8 buf[sizeof(*p) + sizeof(__le64)];
        int rc;
 
-       p = (struct reparse_posix_data *)buf;
+       p = (struct reparse_nfs_data_buffer *)buf;
        rc = nfs_set_reparse_buf(p, mode, dev, &iov);
        if (rc)
                return rc;
@@ -474,7 +474,7 @@ int smb2_mknod_reparse(unsigned int xid, struct inode *inode,
 }
 
 /* See MS-FSCC 2.1.2.6 for the 'NFS' style reparse tags */
-static int parse_reparse_posix(struct reparse_posix_data *buf,
+static int parse_reparse_nfs(struct reparse_nfs_data_buffer *buf,
                               struct cifs_sb_info *cifs_sb,
                               struct cifs_open_info_data *data)
 {
@@ -702,7 +702,7 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
        /* See MS-FSCC 2.1.2 */
        switch (le32_to_cpu(buf->ReparseTag)) {
        case IO_REPARSE_TAG_NFS:
-               return parse_reparse_posix((struct reparse_posix_data *)buf,
+               return parse_reparse_nfs((struct reparse_nfs_data_buffer *)buf,
                                           cifs_sb, data);
        case IO_REPARSE_TAG_SYMLINK:
                return parse_reparse_symlink(
@@ -816,7 +816,7 @@ static bool posix_reparse_to_fattr(struct cifs_sb_info *cifs_sb,
                                   struct cifs_fattr *fattr,
                                   struct cifs_open_info_data *data)
 {
-       struct reparse_posix_data *buf = (struct reparse_posix_data *)data->reparse.buf;
+       struct reparse_nfs_data_buffer *buf = (struct reparse_nfs_data_buffer *)data->reparse.buf;
 
        if (buf == NULL)
                return true;
index 3c7c706c797d2aa3cb67c789fe722013d5fb9af9..3336df2ea5d4a50d2c24318fe520e389a4b05af7 100644 (file)
@@ -1550,7 +1550,19 @@ struct reparse_symlink_data_buffer {
        __u8    PathBuffer[]; /* Variable Length */
 } __packed;
 
-/* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */
+/* For IO_REPARSE_TAG_NFS - see MS-FSCC 2.1.2.6 */
+#define NFS_SPECFILE_LNK       0x00000000014B4E4C
+#define NFS_SPECFILE_CHR       0x0000000000524843
+#define NFS_SPECFILE_BLK       0x00000000004B4C42
+#define NFS_SPECFILE_FIFO      0x000000004F464946
+#define NFS_SPECFILE_SOCK      0x000000004B434F53
+struct reparse_nfs_data_buffer {
+       __le32  ReparseTag;
+       __le16  ReparseDataLength;
+       __u16   Reserved;
+       __le64  InodeType; /* NFS_SPECFILE_* */
+       __u8    DataBuffer[];
+} __packed;
 
 /* For IO_REPARSE_TAG_LX_SYMLINK */
 struct reparse_wsl_symlink_data_buffer {