]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: abstract out dev_t conversions
authorChristoph Hellwig <hch@lst.de>
Mon, 27 Nov 2017 20:23:38 +0000 (14:23 -0600)
committerEric Sandeen <sandeen@redhat.com>
Mon, 27 Nov 2017 20:23:38 +0000 (14:23 -0600)
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>
include/xfs_inode.h
libxfs/libxfs_priv.h
libxfs/xfs_inode_fork.c

index 005a5b26f7d47d27b83e63fd50901f8ff15e7a4f..11a549e36724320f100dd1858575e54fb640e66e 100644 (file)
@@ -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;
index 709b4b81e72c984099e6464da013508704750654..82ae2e9cc7d01247014de3b2fd7a56a7e73c5a3f 100644 (file)
@@ -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
index 79e0398c86aa9e0ee34896934107c68b7dbb6b40..3c0be58ba25c29fa595520e0622df141e44f43cc 100644 (file)
@@ -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;