Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btf: Switch vmlinux BTF attribute to sysfs_bin_attr_simple_read()

The generic function from the sysfs core can replace the custom one.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20241228-sysfs-const-bin_attr-simple-v2-2-7c6f3f1767a3@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
42369b9a 3675a926

+2 -10
+2 -10
kernel/bpf/sysfs_btf.c
··· 12 12 extern char __start_BTF[]; 13 13 extern char __stop_BTF[]; 14 14 15 - static ssize_t 16 - btf_vmlinux_read(struct file *file, struct kobject *kobj, 17 - struct bin_attribute *bin_attr, 18 - char *buf, loff_t off, size_t len) 19 - { 20 - memcpy(buf, __start_BTF + off, len); 21 - return len; 22 - } 23 - 24 15 static struct bin_attribute bin_attr_btf_vmlinux __ro_after_init = { 25 16 .attr = { .name = "vmlinux", .mode = 0444, }, 26 - .read = btf_vmlinux_read, 17 + .read_new = sysfs_bin_attr_simple_read, 27 18 }; 28 19 29 20 struct kobject *btf_kobj; 30 21 31 22 static int __init btf_vmlinux_init(void) 32 23 { 24 + bin_attr_btf_vmlinux.private = __start_BTF; 33 25 bin_attr_btf_vmlinux.size = __stop_BTF - __start_BTF; 34 26 35 27 if (bin_attr_btf_vmlinux.size == 0)