[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169813641.1427432.4373717443417893238.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 18:00:52 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, bschubert@....com
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
bernd@...ernd.com, miklos@...redi.hu, joannelkoong@...il.com, neal@...pa.dev
Subject: [PATCH 06/22] libfuse: add upper-level iomap add device function
From: Darrick J. Wong <djwong@...nel.org>
Make it so that the upper level fuse library can add iomap devices too.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
include/fuse.h | 19 +++++++++++++++++++
lib/fuse.c | 16 ++++++++++++++++
lib/fuse_versionscript | 2 ++
3 files changed, 37 insertions(+)
diff --git a/include/fuse.h b/include/fuse.h
index 958034a539abe6..524b77b5d7bbd0 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -1381,6 +1381,25 @@ void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn,
struct fuse_config *cfg);
void fuse_fs_destroy(struct fuse_fs *fs);
+/**
+ * Attach an open file descriptor to a fuse+iomap mount. Currently must be
+ * a block device.
+ *
+ * @param fd file descriptor of an open block device
+ * @param flags flags for the operation; none defined so far
+ * @return positive nonzero device id on success, or negative errno on failure
+ */
+int fuse_fs_iomap_device_add(int fd, unsigned int flags);
+
+/**
+ * Detach an open file from a fuse+iomap mount. Must be a device id returned
+ * by fuse_lowlevel_iomap_device_add.
+ *
+ * @param device_id device index as returned by fuse_lowlevel_iomap_device_add
+ * @return 0 on success, or negative errno on failure
+ */
+int fuse_fs_iomap_device_remove(int device_id);
+
int fuse_notify_poll(struct fuse_pollhandle *ph);
/**
diff --git a/lib/fuse.c b/lib/fuse.c
index 6f86edb07ba5d2..0d9dfe83608e1e 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -2836,6 +2836,22 @@ static int fuse_fs_iomap_end(struct fuse_fs *fs, const char *path,
written, iomap);
}
+int fuse_fs_iomap_device_add(int fd, unsigned int flags)
+{
+ struct fuse_context *ctxt = fuse_get_context();
+ struct fuse_session *se = fuse_get_session(ctxt->fuse);
+
+ return fuse_lowlevel_iomap_device_add(se, fd, flags);
+}
+
+int fuse_fs_iomap_device_remove(int device_id)
+{
+ struct fuse_context *ctxt = fuse_get_context();
+ struct fuse_session *se = fuse_get_session(ctxt->fuse);
+
+ return fuse_lowlevel_iomap_device_remove(se, device_id);
+}
+
static void fuse_lib_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
int valid, struct fuse_file_info *fi)
{
diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript
index e796100c5ee414..c42fae5d4a3c50 100644
--- a/lib/fuse_versionscript
+++ b/lib/fuse_versionscript
@@ -224,6 +224,8 @@ FUSE_3.99 {
fuse_reply_iomap_begin;
fuse_lowlevel_iomap_device_add;
fuse_lowlevel_iomap_device_remove;
+ fuse_fs_iomap_device_add;
+ fuse_fs_iomap_device_remove;
} FUSE_3.18;
# Local Variables:
Powered by blists - more mailing lists