aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-11-27 14:23:38 -0600
committerEric Sandeen <sandeen@redhat.com>2017-11-27 14:23:38 -0600
commitdc9b1f58bffb702ea7f17720f9412677d903964a (patch)
tree15abd294eba95439c558c5ca87575138cfa14f27
parentc822b63d201b0f683f915de217930cf9b5cf7482 (diff)
downloadxfsprogs-dev-dc9b1f58bffb702ea7f17720f9412677d903964a.tar.gz
xfs: abstract out dev_t conversions
Source kernel commit: 274e0a1f4777b9362fc03a34e86358cc36003e48 And move them to xfs_linux.h so that xfsprogs can stub them out more easily. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> [sandeen: stub them out in xfsprogs] Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--include/xfs_inode.h2
-rw-r--r--libxfs/libxfs_priv.h14
-rw-r--r--libxfs/xfs_inode_fork.c8
3 files changed, 9 insertions, 15 deletions
diff --git a/include/xfs_inode.h b/include/xfs_inode.h
index 005a5b26f7..11a549e367 100644
--- a/include/xfs_inode.h
+++ b/include/xfs_inode.h
@@ -36,7 +36,7 @@ struct xfs_dir_ops;
struct inode {
mode_t i_mode;
uint32_t i_nlink;
- dev_t i_rdev;
+ xfs_dev_t i_rdev; /* This actually holds xfs_dev_t */
uint32_t i_generation;
uint64_t i_version;
struct timespec i_atime;
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 709b4b81e7..82ae2e9cc7 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -87,14 +87,12 @@ extern char *progname;
#undef ASSERT
#define ASSERT(ex) assert(ex)
-#define MKDEV(major, minor) IRIX_MKDEV(major, minor)
-#define sysv_major(dev) IRIX_DEV_MAJOR(dev)
-#define sysv_minor(dev) IRIX_DEV_MINOR(dev)
-
-static inline uint32_t sysv_encode_dev(dev_t dev)
-{
- return IRIX_DEV_MINOR(dev) | (IRIX_DEV_MAJOR(dev) << 18);
-}
+/*
+ * We have no need for the "linux" dev_t in userspace, so these
+ * are no-ops, and an xfs_dev_t is stored in VFS_I(ip)->i_rdev
+ */
+#define xfs_to_linux_dev_t(dev) dev
+#define linux_to_xfs_dev_t(dev) dev
#ifndef EWRONGFS
#define EWRONGFS EINVAL
diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c
index 79e0398c86..3c0be58ba2 100644
--- a/libxfs/xfs_inode_fork.c
+++ b/libxfs/xfs_inode_fork.c
@@ -39,11 +39,6 @@ STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int);
STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int);
STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int);
-static inline dev_t xfs_to_linux_dev_t(xfs_dev_t dev)
-{
- return MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
-}
-
/*
* Copy inode type and data and attr format specific information from the
* on-disk inode to the in-core inode and fork structures. For fifos, devices,
@@ -789,7 +784,8 @@ xfs_iflush_fork(
case XFS_DINODE_FMT_DEV:
if (iip->ili_fields & XFS_ILOG_DEV) {
ASSERT(whichfork == XFS_DATA_FORK);
- xfs_dinode_put_rdev(dip, sysv_encode_dev(VFS_I(ip)->i_rdev));
+ xfs_dinode_put_rdev(dip,
+ linux_to_xfs_dev_t(VFS_I(ip)->i_rdev));
}
break;