Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: move ftype conversion functions to libxfs

These functions are needed in userspace for repair and mkfs to
do the right thing. Move them to libxfs so they can be easily
shared.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Dave Chinner and committed by
Dave Chinner
1b767ee3 2d3d0c53

+24 -24
+16
fs/xfs/libxfs/xfs_dir2.c
··· 38 38 39 39 struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; 40 40 41 + /* 42 + * @mode, if set, indicates that the type field needs to be set up. 43 + * This uses the transformation from file mode to DT_* as defined in linux/fs.h 44 + * for file type specification. This will be propagated into the directory 45 + * structure if appropriate for the given operation and filesystem config. 46 + */ 47 + const unsigned char xfs_mode_to_ftype[S_IFMT >> S_SHIFT] = { 48 + [0] = XFS_DIR3_FT_UNKNOWN, 49 + [S_IFREG >> S_SHIFT] = XFS_DIR3_FT_REG_FILE, 50 + [S_IFDIR >> S_SHIFT] = XFS_DIR3_FT_DIR, 51 + [S_IFCHR >> S_SHIFT] = XFS_DIR3_FT_CHRDEV, 52 + [S_IFBLK >> S_SHIFT] = XFS_DIR3_FT_BLKDEV, 53 + [S_IFIFO >> S_SHIFT] = XFS_DIR3_FT_FIFO, 54 + [S_IFSOCK >> S_SHIFT] = XFS_DIR3_FT_SOCK, 55 + [S_IFLNK >> S_SHIFT] = XFS_DIR3_FT_SYMLINK, 56 + }; 41 57 42 58 /* 43 59 * ASCII case-insensitive (ie. A-Z) support for directories that was
+6
fs/xfs/libxfs/xfs_dir2.h
··· 32 32 extern struct xfs_name xfs_name_dotdot; 33 33 34 34 /* 35 + * directory filetype conversion tables. 36 + */ 37 + #define S_SHIFT 12 38 + extern const unsigned char xfs_mode_to_ftype[]; 39 + 40 + /* 35 41 * directory operations vector for encode/decode routines 36 42 */ 37 43 struct xfs_dir_ops {
-6
fs/xfs/libxfs/xfs_dir2_priv.h
··· 161 161 extern int xfs_dir_cilookup_result(struct xfs_da_args *args, 162 162 const unsigned char *name, int len); 163 163 164 - #define S_SHIFT 12 165 - extern const unsigned char xfs_mode_to_ftype[]; 166 - 167 - extern unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp, 168 - __uint8_t filetype); 169 - 170 164 171 165 /* xfs_dir2_block.c */ 172 166 extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
+1 -17
fs/xfs/xfs_dir2_readdir.c
··· 44 44 DT_FIFO, DT_SOCK, DT_LNK, DT_WHT, 45 45 }; 46 46 47 - unsigned char 47 + static unsigned char 48 48 xfs_dir3_get_dtype( 49 49 struct xfs_mount *mp, 50 50 __uint8_t filetype) ··· 57 57 58 58 return xfs_dir3_filetype_table[filetype]; 59 59 } 60 - /* 61 - * @mode, if set, indicates that the type field needs to be set up. 62 - * This uses the transformation from file mode to DT_* as defined in linux/fs.h 63 - * for file type specification. This will be propagated into the directory 64 - * structure if appropriate for the given operation and filesystem config. 65 - */ 66 - const unsigned char xfs_mode_to_ftype[S_IFMT >> S_SHIFT] = { 67 - [0] = XFS_DIR3_FT_UNKNOWN, 68 - [S_IFREG >> S_SHIFT] = XFS_DIR3_FT_REG_FILE, 69 - [S_IFDIR >> S_SHIFT] = XFS_DIR3_FT_DIR, 70 - [S_IFCHR >> S_SHIFT] = XFS_DIR3_FT_CHRDEV, 71 - [S_IFBLK >> S_SHIFT] = XFS_DIR3_FT_BLKDEV, 72 - [S_IFIFO >> S_SHIFT] = XFS_DIR3_FT_FIFO, 73 - [S_IFSOCK >> S_SHIFT] = XFS_DIR3_FT_SOCK, 74 - [S_IFLNK >> S_SHIFT] = XFS_DIR3_FT_SYMLINK, 75 - }; 76 60 77 61 STATIC int 78 62 xfs_dir2_sf_getdents(
+1 -1
fs/xfs/xfs_iops.c
··· 37 37 #include "xfs_icache.h" 38 38 #include "xfs_symlink.h" 39 39 #include "xfs_da_btree.h" 40 - #include "xfs_dir2_priv.h" 40 + #include "xfs_dir2.h" 41 41 #include "xfs_dinode.h" 42 42 #include "xfs_trans_space.h" 43 43