linux/fs/kernfs
Valentine Sinitsyn 0fedefd4c4 kernfs: sysfs: support custom llseek method for sysfs entries
As of now, seeking in sysfs files is handled by generic_file_llseek().
There are situations where one may want to customize seeking logic:

- Many sysfs entries are fixed files while generic_file_llseek() accepts
  past-the-end positions. Not only being useless by itself, this
  also means a bug in userspace code will trigger not at lseek(), but at
  some later point making debugging harder.
- generic_file_llseek() relies on f_mapping->host to get the file size
  which might not be correct for all sysfs entries.
  See commit 636b21b501 ("PCI: Revoke mappings like devmem") as an example.

Implement llseek method to override this behavior at sysfs attribute
level. The method is optional, and if it is absent,
generic_file_llseek() is called to preserve backwards compatibility.

Signed-off-by: Valentine Sinitsyn <valesini@yandex-team.ru>
Link: https://lore.kernel.org/r/20230925084013.309399-1-valesini@yandex-team.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05 13:42:11 +02:00
..
dir.c Driver core changes for 6.6-rc1 2023-09-01 09:43:18 -07:00
file.c kernfs: sysfs: support custom llseek method for sysfs entries 2023-10-05 13:42:11 +02:00
inode.c v6.6-vfs.tmpfs 2023-08-28 09:55:25 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kernfs-internal.h kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info. 2023-03-29 12:23:45 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mount.c kernfs: attach uuid for every kernfs and report it in fsid 2023-08-05 08:32:39 +02:00
symlink.c kernfs: fix all kernel-doc warnings and multiple typos 2022-11-23 19:28:26 +01:00