file: simplify and harden cleanup handling
Get series with b4
b4 am [email protected] change-id 20260917-work-file-fd_prepare-ea5966d68a95Versions newest first
- v1 Latest4 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | file: simplify FD_PREPARE()include/ | +41 | 0 replies | |
| 2/4 | file: declare the FD_PREPARE() variable with __cleanup() directlyinclude/ | +3 | 1 reply | |
| 3/4 | cleanup: remove CLASS_INIT()include/ | +0 | 0 replies | |
| 4/4 | file: make struct fd_prepare const and kill its err fieldarch/ drivers/ drivers/ +16 more | +95 | 1 reply |
Reviews trailers per patch
None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Jan Kara |
|---|---|
| Series | R-b |
| 1/4 | |
| 2/4 | |
| 3/4 | |
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/4] file: simplify and harden cleanup handling
The cleanup guards rely on unnecessary infrastructure and make the code more complicated to follow than it needs to be. Clean it up. Also shrink the struct a bit and get rid of the unnecessary error variable. We can just make this more ergonomic by using fdf->fd directly. Also expose the struct itself as const and hide the actual underlying local variable behind a UNIQUE_ID() named variable so we avoid risking shadow variables and polluting callsites. Code generation wise the outcome is exactly the same but simpler.
---
Christian Brauner (4):
file: simplify FD_PREPARE()
file: declare the FD_PREPARE() variable with __cleanup() directly
cleanup: remove CLASS_INIT()
file: make struct fd_prepare const and kill its err field
arch/powerpc/platforms/cell/spufs/inode.c | 12 +-- drivers/gpio/gpiolib-cdev.c | 18 ++--- drivers/gpu/drm/msm/msm_perfcntr.c | 4 +- drivers/media/mc/mc-request.c | 8 +- drivers/misc/ntsync.c | 6 +- fs/eventfd.c | 4 +- fs/eventpoll.c | 6 +- fs/file.c | 8 +- fs/namespace.c | 12 +-- fs/nsfs.c | 4 +- fs/xfs/xfs_handle.c | 6 +- include/linux/cleanup.h | 7 -- include/linux/file.h | 130 +++++++++++------------------- io_uring/mock_file.c | 8 +- kernel/bpf/bpf_iter.c | 6 +- kernel/bpf/token.c | 6 +- mm/userfaultfd.c | 6 +- net/core/scm.c | 8 +- net/handshake/netlink.c | 8 +- net/kcm/kcmsock.c | 6 +- 20 files changed, 117 insertions(+), 156 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260917-work-file-fd_prepare-ea5966d68a95