ANDROID: fuse-bpf: Add /sys/fs flags for fuse-bpf version
Note that this is specific for the non-upstreamed version Bug: 202785178 Test: cat /sys/fs/fuse/fuse_bpf_major_version Change-Id: I68f9ca56778874975428839dfc1fd8f48b11bd75 Signed-off-by: Paul Lawrence <paullawrence@google.com>
This commit is contained in:
19
Documentation/ABI/testing/sysfs-fs-fuse
Normal file
19
Documentation/ABI/testing/sysfs-fs-fuse
Normal file
@@ -0,0 +1,19 @@
|
||||
What: /sys/fs/fuse/features/fuse_bpf
|
||||
Date: December 2022
|
||||
Contact: Paul Lawrence <paullawrence@google.com>
|
||||
Description:
|
||||
Read-only file that contains the word 'supported' if fuse-bpf is
|
||||
supported, does not exist otherwise
|
||||
|
||||
What: /sys/fs/fuse/bpf_prog_type_fuse
|
||||
Date: December 2022
|
||||
Contact: Paul Lawrence <paullawrence@google.com>
|
||||
Description:
|
||||
bpf_prog_type_fuse defines the program type of bpf programs that
|
||||
may be passed to fuse-bpf. For upstream bpf program types, this
|
||||
is a constant defined in a contiguous array of constants.
|
||||
bpf_prog_type_fuse is appended to the end of the list, so it may
|
||||
change and therefore its value must be read from this file.
|
||||
|
||||
Contents is ASCII decimal representation of bpf_prog_type_fuse
|
||||
|
||||
@@ -2027,7 +2027,31 @@ static void fuse_fs_cleanup(void)
|
||||
|
||||
static struct kobject *fuse_kobj;
|
||||
|
||||
/* TODO Remove this once BPF_PROG_TYPE_FUSE is upstreamed */
|
||||
static ssize_t fuse_bpf_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buff)
|
||||
{
|
||||
return sysfs_emit(buff, "supported\n");
|
||||
}
|
||||
|
||||
static struct kobj_attribute fuse_bpf_attr =
|
||||
__ATTR_RO(fuse_bpf);
|
||||
|
||||
static struct attribute *bpf_features[] = {
|
||||
&fuse_bpf_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group bpf_features_group = {
|
||||
.name = "features",
|
||||
.attrs = bpf_features,
|
||||
};
|
||||
|
||||
/*
|
||||
* TODO Remove this once fuse-bpf is upstreamed
|
||||
*
|
||||
* bpf_prog_type_fuse exports the bpf_prog_type_fuse 'constant', which cannot be
|
||||
* constant until the code is upstreamed
|
||||
*/
|
||||
static ssize_t bpf_prog_type_fuse_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buff)
|
||||
{
|
||||
@@ -2045,6 +2069,13 @@ static struct attribute *bpf_attributes[] = {
|
||||
static const struct attribute_group bpf_attr_group = {
|
||||
.attrs = bpf_attributes,
|
||||
};
|
||||
|
||||
static const struct attribute_group *attribute_groups[] = {
|
||||
&bpf_features_group,
|
||||
&bpf_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* TODO remove to here */
|
||||
|
||||
static int fuse_sysfs_init(void)
|
||||
@@ -2062,7 +2093,7 @@ static int fuse_sysfs_init(void)
|
||||
goto out_fuse_unregister;
|
||||
|
||||
/* TODO Remove when BPF_PROG_TYPE_FUSE is upstreamed */
|
||||
err = sysfs_create_group(fuse_kobj, &bpf_attr_group);
|
||||
err = sysfs_create_groups(fuse_kobj, attribute_groups);
|
||||
if (err)
|
||||
goto out_fuse_remove_mount_point;
|
||||
|
||||
@@ -2078,6 +2109,7 @@ static int fuse_sysfs_init(void)
|
||||
|
||||
static void fuse_sysfs_cleanup(void)
|
||||
{
|
||||
sysfs_remove_groups(fuse_kobj, attribute_groups);
|
||||
sysfs_remove_mount_point(fuse_kobj, "connections");
|
||||
kobject_put(fuse_kobj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user