aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-12-03 17:43:17 -0500
committerDave Chinner <david@fromorbit.com>2014-12-03 17:43:17 -0500
commit1b767ee386c5f58660ca9be70d3076f2b6484e72 (patch)
treeca368107e810c67a75214966cb1399af52ceb727 /fs/xfs
parent2d3d0c53df99587e1d58759f805c3aae79fac453 (diff)
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_dir2.c16
-rw-r--r--fs/xfs/libxfs/xfs_dir2.h6
-rw-r--r--fs/xfs/libxfs/xfs_dir2_priv.h6
-rw-r--r--fs/xfs/xfs_dir2_readdir.c18
-rw-r--r--fs/xfs/xfs_iops.c2
5 files changed, 24 insertions, 24 deletions
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 7075aaf131f4..0246877d2d2e 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -38,6 +38,22 @@
38 38
39struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; 39struct 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 */
47const 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 * ASCII case-insensitive (ie. A-Z) support for directories that was 59 * ASCII case-insensitive (ie. A-Z) support for directories that was
diff --git a/fs/xfs/libxfs/xfs_dir2.h b/fs/xfs/libxfs/xfs_dir2.h
index 4dff261e6ed5..874720dbd865 100644
--- a/fs/xfs/libxfs/xfs_dir2.h
+++ b/fs/xfs/libxfs/xfs_dir2.h
@@ -32,6 +32,12 @@ struct xfs_dir2_data_unused;
32extern struct xfs_name xfs_name_dotdot; 32extern struct xfs_name xfs_name_dotdot;
33 33
34/* 34/*
35 * directory filetype conversion tables.
36 */
37#define S_SHIFT 12
38extern const unsigned char xfs_mode_to_ftype[];
39
40/*
35 * directory operations vector for encode/decode routines 41 * directory operations vector for encode/decode routines
36 */ 42 */
37struct xfs_dir_ops { 43struct xfs_dir_ops {
diff --git a/fs/xfs/libxfs/xfs_dir2_priv.h b/fs/xfs/libxfs/xfs_dir2_priv.h
index 27ce0794d196..27096ba91dde 100644
--- a/fs/xfs/libxfs/xfs_dir2_priv.h
+++ b/fs/xfs/libxfs/xfs_dir2_priv.h
@@ -161,12 +161,6 @@ extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
161extern int xfs_dir_cilookup_result(struct xfs_da_args *args, 161extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
162 const unsigned char *name, int len); 162 const unsigned char *name, int len);
163 163
164#define S_SHIFT 12
165extern const unsigned char xfs_mode_to_ftype[];
166
167extern unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp,
168 __uint8_t filetype);
169
170 164
171/* xfs_dir2_block.c */ 165/* xfs_dir2_block.c */
172extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp, 166extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index f1b69edcdf31..d4b301a85288 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -44,7 +44,7 @@ static unsigned char xfs_dir3_filetype_table[] = {
44 DT_FIFO, DT_SOCK, DT_LNK, DT_WHT, 44 DT_FIFO, DT_SOCK, DT_LNK, DT_WHT,
45}; 45};
46 46
47unsigned char 47static unsigned char
48xfs_dir3_get_dtype( 48xfs_dir3_get_dtype(
49 struct xfs_mount *mp, 49 struct xfs_mount *mp,
50 __uint8_t filetype) 50 __uint8_t filetype)
@@ -57,22 +57,6 @@ xfs_dir3_get_dtype(
57 57
58 return xfs_dir3_filetype_table[filetype]; 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 */
66const 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
77STATIC int 61STATIC int
78xfs_dir2_sf_getdents( 62xfs_dir2_sf_getdents(
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index ec6dcdc181ee..4b7802aff9ec 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -37,7 +37,7 @@
37#include "xfs_icache.h" 37#include "xfs_icache.h"
38#include "xfs_symlink.h" 38#include "xfs_symlink.h"
39#include "xfs_da_btree.h" 39#include "xfs_da_btree.h"
40#include "xfs_dir2_priv.h" 40#include "xfs_dir2.h"
41#include "xfs_dinode.h" 41#include "xfs_dinode.h"
42#include "xfs_trans_space.h" 42#include "xfs_trans_space.h"
43 43