Skip to contentSkip to conversation

fs: fuse: add dev id to /dev/fuse fdinfo

PATCH In review Chen Linxuan 2 participants 2 messages May 13, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: fuse: add dev id to /dev/fuse fdinfo

This commit add fuse connection device id to
fdinfo of opened /dev/fuse files.

Related discussions can be found at links below.

---
 fs/fuse/dev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
fs/fuse/dev.c +13 -0
index 6dcbaa218b7a1..a36c244e1a0b0 100644
@@ -23,6 +23,7 @@
 #include <linux/swap.h>
 #include <linux/splice.h>
 #include <linux/sched.h>
+#include <linux/seq_file.h>
 
 #define CREATE_TRACE_POINTS
 #include "fuse_trace.h"
@@ -2602,6 +2603,15 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
 	}
 }
 
+static void fuse_dev_show_fdinfo(struct seq_file *seq, struct file *file)
+{
+	struct fuse_dev *fud = fuse_get_dev(file);
+	if (!fud)
+		return ;
+
+	seq_printf(seq, "fuse_connection:\t%u\n", fud->fc->dev);
+}
+
 const struct file_operations fuse_dev_operations = {
 	.owner		= THIS_MODULE,
 	.open		= fuse_dev_open,
@@ -2617,6 +2627,9 @@ const struct file_operations fuse_dev_operations = {
 #ifdef CONFIG_FUSE_IO_URING
 	.uring_cmd	= fuse_uring_cmd,
 #endif
+#ifdef CONFIG_PROC_FS
+	.show_fdinfo	= fuse_dev_show_fdinfo,
+#endif
 };
 EXPORT_SYMBOL_GPL(fuse_dev_operations);
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 5 lines · Chen Linxuan

This commit add fuse connection device id to
fdinfo of opened /dev/fuse files.

Related discussions can be found at links below.

Applied thanks.

Miklos