From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org
Subject: [PATCH 1/3] vfs: create ioctls to query and set the filesystem uuids
Date: Thu, 27 Feb 2020 13:33:41 -0800 [thread overview]
Message-ID: <158283922171.904118.10312419179350062263.stgit@magnolia> (raw)
In-Reply-To: <158283921562.904118.13877489081184026686.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
Define a pair of ioctls to get and set the filesystem uuid.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_fs.h | 2 ++
include/uapi/linux/fs.h | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 558a396c74b3..c968eaf56ec3 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -814,6 +814,8 @@ struct xfs_scrub_metadata {
#define XFS_IOC_FSGEOMETRY _IOR ('X', 126, struct xfs_fsop_geom)
#define XFS_IOC_BULKSTAT _IOR ('X', 127, struct xfs_bulkstat_req)
#define XFS_IOC_INUMBERS _IOR ('X', 128, struct xfs_inumbers_req)
+/* FS_IOC_GETFSUUID ----------- uses 129 */
+/* FS_IOC_SETFSUUID ----------- uses 130 */
/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 379a612f8f1d..a5423d540ecd 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -142,6 +142,32 @@ struct fsxattr {
#define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+/* Get and set filesystem UUID. */
+struct ioc_fsuuid {
+ uint32_t fu_flags;
+ uint16_t fu_length;
+ uint16_t fu_reserved;
+ uint64_t fu_reserved1;
+};
+
+/*
+ * Set the UUID even if that would require setting of an incompat or rocompat
+ * feature flag. This will make the filesystem unmountable on older kernels.
+ */
+#define FS_IOC_SETFSUUID_FORCE_INCOMPAT (1 << 0)
+
+#define FS_IOC_SETFSUUID_ALL (FS_IOC_SETFSUUID_FORCE_INCOMPAT)
+
+static inline size_t ioc_fsuuid_sizeof(size_t payload_len)
+{
+ return sizeof(struct ioc_fsuuid) + payload_len;
+}
+
+static inline char *ioc_fsuuid_payload(struct ioc_fsuuid *fu)
+{
+ return (char *)(fu + 1);
+}
+
/* the read-only stuff doesn't really belong here, but any other place is
probably as bad and I don't want to create yet another include file. */
@@ -214,6 +240,8 @@ struct fsxattr {
#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
#define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])
#define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX])
+#define FS_IOC_GETFSUUID _IOR('X', 129, struct ioc_fsuuid)
+#define FS_IOC_SETFSUUID _IOW('X', 130, struct ioc_fsuuid)
/*
* Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
next prev parent reply other threads:[~2020-02-27 21:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 21:33 [PATCH RFC 0/3] fs: online filesystem uuid operations Darrick J. Wong
2020-02-27 21:33 ` Darrick J. Wong [this message]
2020-02-27 21:33 ` [PATCH 2/3] xfs: allow online filesystem uuid queries Darrick J. Wong
2020-02-27 21:33 ` [PATCH 3/3] ext4: " Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=158283922171.904118.10312419179350062263.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.