On Thu 17-09-26 11:09:41, Christian Brauner wrote:
> 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) <[email protected]>

I know I'm really late but FWIW this looks really great! I know this is in
PR to Linus so feel free to ignore:

Reviewed-by: Jan Kara <[email protected]>

;)
                                                                Honza

> ---
> 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
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR

Reply via email to