2)sysfs_init通过kernfs_create_root(struct kernfs_syscall_ops *scops, unsigned int flags, void *priv)一个新的 kernfs 层次,然后将其保存在静态全局变量sysfs_root中,供各处使用。然后通过register_filesystem将其注册为名为 sysfs 的文件系统。 int __init sysfs_init(void) { int err; sysfs_root = k...
intsysfs_create_dir_ns(structkobject*kobj,constvoid*ns){structkernfs_node*parent,*kn;kuid_tuid;kgid_tgid;//这里根据层次关系, 找到parent的kn节点if(kobj->parent)parent=kobj->parent->sd;else//here using the root of sysfs dir entry//if kset parent not existparent=sysfs_root_kn;...kn=ke...
if (!(kernfs_root(kn)->flags & KERNFS_ROOT_CREATE_DEACTIVATED)) kernfs_activate(kn); return 0; out_unlock: mutex_unlock(&kernfs_mutex); return ret; } /** * kernfs_find_ns - find kernfs_node with the given name * @parent: kernfs_node to search under ...
kernfs_create_root+0xbc/0x154 kernfs_create_root from sysfs_init+0x18/0x5c sysfs_init from mnt_init+0xc4/0x220 mnt_init from vfs_caches_init+0x6c/0x88 vfs_caches_init from start_kernel+0x474/0x528 start_kernel from 0x0 Let's rever the commit. It's undesirable to spread out raw ...
(info->root, ino); if (!kn) return ERR_PTR(-ESTALE); inode = kernfs_get_inode(sb, kn); kernfs_put(kn); if (!inode) return ERR_PTR(-ESTALE); if (generation && inode->i_generation != generation) { /* we didn't find the right inode.. */ iput(inode); retu...
*/ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops, unsigned int flags, void *priv) { struct kernfs_root *root; struct kernfs_node *kn; root = kzalloc(sizeof(*root), GFP_KERNEL); if (!root) return ERR_PTR(-ENOMEM); idr_init(&root->ino_idr); init_rwse...
We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {...
Provide feedback We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up {...