How can I get kobject and kset in Linux

186 Views Asked by At

I want to get the kobject and kset struct of /sys/fs/f2fs in Linux kernel. I tried the following method:

kset_find_obj(fs_kobj->kset, "f2fs")

But null pointer error happened.

fs_kobj->kset seems to be null.

How can I do it?

1

There are 1 best solutions below

0
user1651758 On

I find a method as below:

struct kernfs_node *node = kernfs_find_and_get(fs_kobj->sd, "f2fs");
struct kobject *kobj = (struct kobject *)(node->priv);