introduce fd_file(), convert all accessors to it.
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 31 May 2024 18:12:01 +0000 (14:12 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 13 Aug 2024 02:00:43 +0000 (22:00 -0400)
commit1da91ea87aefe2c25b68c9f96947a9271ba6325d
treee0d317b1ee86d7b03238e98f25f1f23f233b2511
parent8400291e289ee6b2bf9779ff1c83a291501f017b
introduce fd_file(), convert all accessors to it.

For any changes of struct fd representation we need to
turn existing accesses to fields into calls of wrappers.
Accesses to struct fd::flags are very few (3 in linux/file.h,
1 in net/socket.c, 3 in fs/overlayfs/file.c and 3 more in
explicit initializers).
Those can be dealt with in the commit converting to
new layout; accesses to struct fd::file are too many for that.
This commit converts (almost) all of f.file to
fd_file(f).  It's not entirely mechanical ('file' is used as
a member name more than just in struct fd) and it does not
even attempt to distinguish the uses in pointer context from
those in boolean context; the latter will be eventually turned
into a separate helper (fd_empty()).

NOTE: mass conversion to fd_empty(), tempting as it
might be, is a bad idea; better do that piecewise in commit
that convert from fdget...() to CLASS(...).

[conflicts in fs/fhandle.c, kernel/bpf/syscall.c, mm/memcontrol.c
caught by git; fs/stat.c one got caught by git grep]
[fs/xattr.c conflict]

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
83 files changed:
arch/alpha/kernel/osf_sys.c
arch/arm/kernel/sys_oabi-compat.c
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/powerpc.c
arch/powerpc/platforms/cell/spu_syscalls.c
arch/x86/kernel/cpu/sgx/main.c
arch/x86/kvm/svm/sev.c
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
drivers/gpu/drm/drm_syncobj.c
drivers/infiniband/core/ucma.c
drivers/infiniband/core/uverbs_cmd.c
drivers/media/mc/mc-request.c
drivers/media/rc/lirc_dev.c
drivers/vfio/group.c
drivers/vfio/virqfd.c
drivers/virt/acrn/irqfd.c
drivers/xen/privcmd.c
fs/btrfs/ioctl.c
fs/coda/inode.c
fs/eventfd.c
fs/eventpoll.c
fs/ext4/ioctl.c
fs/f2fs/file.c
fs/fcntl.c
fs/fhandle.c
fs/fsopen.c
fs/fuse/dev.c
fs/ioctl.c
fs/kernel_read_file.c
fs/locks.c
fs/namei.c
fs/namespace.c
fs/notify/fanotify/fanotify_user.c
fs/notify/inotify/inotify_user.c
fs/ocfs2/cluster/heartbeat.c
fs/open.c
fs/overlayfs/file.c
fs/quota/quota.c
fs/read_write.c
fs/readdir.c
fs/remap_range.c
fs/select.c
fs/signalfd.c
fs/smb/client/ioctl.c
fs/splice.c
fs/stat.c
fs/statfs.c
fs/sync.c
fs/timerfd.c
fs/utimes.c
fs/xattr.c
fs/xfs/xfs_exchrange.c
fs/xfs/xfs_handle.c
fs/xfs/xfs_ioctl.c
include/linux/cleanup.h
include/linux/file.h
io_uring/sqpoll.c
ipc/mqueue.c
kernel/bpf/bpf_inode_storage.c
kernel/bpf/btf.c
kernel/bpf/syscall.c
kernel/bpf/token.c
kernel/cgroup/cgroup.c
kernel/events/core.c
kernel/module/main.c
kernel/nsproxy.c
kernel/pid.c
kernel/signal.c
kernel/sys.c
kernel/taskstats.c
kernel/watch_queue.c
mm/fadvise.c
mm/filemap.c
mm/memcontrol-v1.c
mm/readahead.c
net/core/net_namespace.c
net/socket.c
security/integrity/ima/ima_main.c
security/landlock/syscalls.c
security/loadpin/loadpin.c
sound/core/pcm_native.c
virt/kvm/eventfd.c
virt/kvm/vfio.c