Home
last modified time | relevance | path

Searched refs:kn (Results 1 – 12 of 12) sorted by relevance

/fs/kernfs/
Ddir.c27 static bool kernfs_active(struct kernfs_node *kn) in kernfs_active() argument
30 return atomic_read(&kn->active) >= 0; in kernfs_active()
33 static bool kernfs_lockdep(struct kernfs_node *kn) in kernfs_lockdep() argument
36 return kn->flags & KERNFS_LOCKDEP; in kernfs_lockdep()
42 static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen) in kernfs_name_locked() argument
44 return strlcpy(buf, kn->parent ? kn->name : "/", buflen); in kernfs_name_locked()
47 static char * __must_check kernfs_path_locked(struct kernfs_node *kn, char *buf, in kernfs_path_locked() argument
56 len = strlen(kn->name); in kernfs_path_locked()
63 memcpy(p, kn->name, len); in kernfs_path_locked()
65 kn = kn->parent; in kernfs_path_locked()
[all …]
Dfile.c64 static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn) in kernfs_ops() argument
66 if (kn->flags & KERNFS_LOCKDEP) in kernfs_ops()
67 lockdep_assert_held(kn); in kernfs_ops()
68 return kn->attr.ops; in kernfs_ops()
96 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_stop_active()
100 kernfs_put_active(of->kn); in kernfs_seq_stop_active()
113 if (!kernfs_get_active(of->kn)) in kernfs_seq_start()
116 ops = kernfs_ops(of->kn); in kernfs_seq_start()
135 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_next()
166 of->event = atomic_read(&of->kn->attr.open->event); in kernfs_seq_show()
[all …]
Dsymlink.c29 struct kernfs_node *kn; in kernfs_create_link() local
32 kn = kernfs_new_node(parent, name, S_IFLNK|S_IRWXUGO, KERNFS_LINK); in kernfs_create_link()
33 if (!kn) in kernfs_create_link()
37 kn->ns = target->ns; in kernfs_create_link()
38 kn->symlink.target_kn = target; in kernfs_create_link()
41 error = kernfs_add_one(kn); in kernfs_create_link()
43 return kn; in kernfs_create_link()
45 kernfs_put(kn); in kernfs_create_link()
52 struct kernfs_node *base, *kn; in kernfs_get_target_path() local
59 kn = target->parent; in kernfs_get_target_path()
[all …]
Dinode.c37 static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) in kernfs_iattrs() argument
45 if (kn->iattr) in kernfs_iattrs()
48 kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); in kernfs_iattrs()
49 if (!kn->iattr) in kernfs_iattrs()
51 iattrs = &kn->iattr->ia_iattr; in kernfs_iattrs()
54 iattrs->ia_mode = kn->mode; in kernfs_iattrs()
59 simple_xattrs_init(&kn->iattr->xattrs); in kernfs_iattrs()
61 ret = kn->iattr; in kernfs_iattrs()
66 static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) in __kernfs_setattr() argument
72 attrs = kernfs_iattrs(kn); in __kernfs_setattr()
[all …]
Dkernfs-internal.h40 static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) in kernfs_root() argument
43 if (kn->parent) in kernfs_root()
44 kn = kn->parent; in kernfs_root()
45 return kn->dir.root; in kernfs_root()
99 struct kernfs_node *kernfs_get_active(struct kernfs_node *kn);
100 void kernfs_put_active(struct kernfs_node *kn);
101 int kernfs_add_one(struct kernfs_node *kn);
111 void kernfs_unmap_bin_file(struct kernfs_node *kn);
Dmount.c80 inode = kernfs_get_inode(sb, info->root->kn); in kernfs_fill_super()
93 kernfs_get(info->root->kn); in kernfs_fill_super()
94 root->d_fsdata = info->root->kn; in kernfs_fill_super()
/fs/sysfs/
Dfile.c29 static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) in sysfs_file_ops() argument
31 struct kobject *kobj = kn->parent->priv; in sysfs_file_ops()
33 if (kn->flags & KERNFS_LOCKDEP) in sysfs_file_ops()
34 lockdep_assert_held(kn); in sysfs_file_ops()
46 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_seq_show()
47 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_seq_show()
64 count = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_seq_show()
86 struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_read()
87 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_bin_read()
110 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_read()
[all …]
Ddir.c43 struct kernfs_node *parent, *kn; in sysfs_create_dir_ns() local
55 kn = kernfs_create_dir_ns(parent, kobject_name(kobj), in sysfs_create_dir_ns()
57 if (IS_ERR(kn)) { in sysfs_create_dir_ns()
58 if (PTR_ERR(kn) == -EEXIST) in sysfs_create_dir_ns()
60 return PTR_ERR(kn); in sysfs_create_dir_ns()
63 kobj->sd = kn; in sysfs_create_dir_ns()
77 struct kernfs_node *kn = kobj->sd; in sysfs_remove_dir() local
95 if (kn) { in sysfs_remove_dir()
96 WARN_ON_ONCE(kernfs_type(kn) != KERNFS_DIR); in sysfs_remove_dir()
97 kernfs_remove(kn); in sysfs_remove_dir()
[all …]
Dsymlink.c25 struct kernfs_node *kn, *target = NULL; in sysfs_do_create_link_sd() local
44 kn = kernfs_create_link(parent, name, target); in sysfs_do_create_link_sd()
47 if (!IS_ERR(kn)) in sysfs_do_create_link_sd()
50 if (warn && PTR_ERR(kn) == -EEXIST) in sysfs_do_create_link_sd()
52 return PTR_ERR(kn); in sysfs_do_create_link_sd()
61 int sysfs_create_link_sd(struct kernfs_node *kn, struct kobject *target, in sysfs_create_link_sd() argument
64 return sysfs_do_create_link_sd(kn, target, name, 1); in sysfs_create_link_sd()
168 struct kernfs_node *parent, *kn = NULL; in sysfs_rename_link_ns() local
181 kn = kernfs_find_and_get_ns(parent, old, old_ns); in sysfs_rename_link_ns()
182 if (!kn) in sysfs_rename_link_ns()
[all …]
Dgroup.c110 struct kernfs_node *kn; in internal_create_group() local
124 kn = kernfs_create_dir(kobj->sd, grp->name, in internal_create_group()
126 if (IS_ERR(kn)) { in internal_create_group()
127 if (PTR_ERR(kn) == -EEXIST) in internal_create_group()
129 return PTR_ERR(kn); in internal_create_group()
132 kn = kobj->sd; in internal_create_group()
133 kernfs_get(kn); in internal_create_group()
134 error = create_files(kn, kobj, grp, update); in internal_create_group()
137 kernfs_remove(kn); in internal_create_group()
139 kernfs_put(kn); in internal_create_group()
[all …]
Dsysfs.h40 int sysfs_create_link_sd(struct kernfs_node *kn, struct kobject *target,
Dmount.c74 sysfs_root_kn = sysfs_root->kn; in sysfs_init()