diff options
| author | Chen Linxuan <chenlinxuan@uniontech.com> | 2025-05-13 12:20:49 +0800 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2025-05-15 09:43:19 +0200 |
| commit | f09222980d775199de2f5d739cf453f7bf39aa4a (patch) | |
| tree | fde2b3a37a476411214001ee9cd0e2b6569634b0 | |
| parent | 18ee43c398af0b7e2eb2a4cd8469967834b0802d (diff) | |
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.
Link: https://lore.kernel.org/all/CAJfpegvEYUgEbpATpQx8NqVR33Mv-VK96C+gbTag1CEUeBqvnA@mail.gmail.com/
Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| -rw-r--r-- | fs/fuse/dev.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 155bb6aeaef5..07e08362d5b9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -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" @@ -2618,6 +2619,17 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd, } } +#ifdef CONFIG_PROC_FS +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); +} +#endif + const struct file_operations fuse_dev_operations = { .owner = THIS_MODULE, .open = fuse_dev_open, @@ -2633,6 +2645,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); |
