io_uring: add ->show_fdinfo() for the io_uring file descriptor
commit87ce955b24c9940cb2ca7e5173fcf175578d9fe9
authorJens Axboe <axboe@kernel.dk>
Thu, 30 Jan 2020 15:25:34 +0000 (30 08:25 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Jan 2020 19:40:35 +0000 (30 12:40 -0700)
tree29b896e28b28cee849ef4fc3cc4082583e706a13
parent39bed42de2e7d74686a2d5a45638d6a5d7e7d473
io_uring: add ->show_fdinfo() for the io_uring file descriptor

It can be hard to know exactly what is registered with the ring.
Especially for credentials, it'd be handy to be able to see which
ones are registered, what personalities they have, and what the ID
of each of them is.

This adds support for showing information registered in the ring from
the fdinfo of the io_uring fd. Here's an example from a test case that
registers 4 files (two of them sparse), 4 buffers, and 2 personalities:

pos: 0
flags: 02000002
mnt_id: 14
UserFiles: 4
    0: file-no-1
    1: file-no-2
    2: <none>
    3: <none>
UserBufs: 4
    0: 0x563817c46000/128
    1: 0x563817c47000/256
    2: 0x563817c48000/512
    3: 0x563817c49000/1024
Personalities:
    1
Uid: 0 0 0 0
Gid: 0 0 0 0
Groups: 0
CapEff: 0000003fffffffff
    2
Uid: 0 0 0 0
Gid: 0 0 0 0
Groups: 0
CapEff: 0000003fffffffff

Suggested-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c