dma-buf: improve dma_buf_show_fdinfo output
Improve the readability of /proc/<pid>/fdinfo output for DMA-BUF by including file flags and ensuring consistent format specifiers for size and other fields.
This patch also fixes incorrect format specifiers and removes references to obsolete struct members (num_attachments and num_mappings) that no longer exist in the DMA-BUF framework.
Reported-by: kernel test robot lkp@intel.com Closes: https://lore.kernel.org/oe-kbuild-all/202510220802.svbgdYsJ-lkp@intel.com/ --- drivers/dma-buf/dma-buf.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 1c0035601c4f..4541f8ec5d62 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -571,24 +571,22 @@ static long dma_buf_ioctl(struct file *file, } }
-static void dma_buf_show_fdinfo(struct seq_file *s, struct file *f) +static void dma_buf_show_fdinfo(struct seq_file *s, struct file *file) { - struct dma_buf *dmabuf = f->private_data; + struct dma_buf *dmabuf;
- if (!dmabuf) - return; + dmabuf = file->private_data; + if (!dmabuf) + return;
- seq_printf(s, "flags:\t%lu\n", f->f_flags); - seq_printf(s, "size:\t%llu\n", dmabuf->size); - seq_printf(s, "count:\t%ld\n", file_count(dmabuf->file) - 1); - seq_printf(s, "attachments:\t%d\n", atomic_read(&dmabuf->num_attachments)); - seq_printf(s, "mappings:\t%d\n", atomic_read(&dmabuf->num_mappings)); - seq_printf(s, "exp_name:\t%s\n", dmabuf->exp_name ? dmabuf->exp_name : "N/A"); + seq_printf(s, "size:\t%zu\n", dmabuf->size); + seq_printf(s, "count:\t%ld\n", file_count(dmabuf->file) - 1); + seq_printf(s, "exp_name:\t%s\n", dmabuf->exp_name ? dmabuf->exp_name : "N/A");
- spin_lock(&dmabuf->name_lock); - if (dmabuf->name) - seq_printf(s, "name:\t%s\n", dmabuf->name); - spin_unlock(&dmabuf->name_lock); + spin_lock(&dmabuf->name_lock); + if (dmabuf->name) + seq_printf(s, "name:\t%s\n", dmabuf->name); + spin_unlock(&dmabuf->name_lock); }