mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] file: simplify and harden cleanup handling
@ 2026-09-17  9:09 Christian Brauner
  2026-09-17  9:09 ` [PATCH 1/4] file: simplify FD_PREPARE() Christian Brauner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Christian Brauner @ 2026-09-17  9:09 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Jan Kara, linuxppc-dev, linux-gpio,
	linux-arm-msm, dri-devel, freedreno, linux-media, wine-devel,
	linux-xfs, io-uring, bpf, linux-mm, netdev, linux-kernel,
	Christian Brauner (Amutable)

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.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-17 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17  9:09 [PATCH 0/4] file: simplify and harden cleanup handling Christian Brauner
2026-09-17  9:09 ` [PATCH 1/4] file: simplify FD_PREPARE() Christian Brauner
2026-09-17  9:09 ` [PATCH 2/4] file: declare the FD_PREPARE() variable with __cleanup() directly Christian Brauner
2026-09-17 12:22   ` David Laight
2026-09-17  9:09 ` [PATCH 3/4] cleanup: remove CLASS_INIT() Christian Brauner
2026-09-17  9:09 ` [PATCH 4/4] file: make struct fd_prepare const and kill its err field Christian Brauner
2026-09-17 12:29   ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®