Home
last modified time | relevance | path

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

12

/linux-5.19.10/fs/kernfs/
Ddir.c34 static bool kernfs_active(struct kernfs_node *kn) in kernfs_active() argument
36 lockdep_assert_held(&kernfs_root(kn)->kernfs_rwsem); in kernfs_active()
37 return atomic_read(&kn->active) >= 0; in kernfs_active()
40 static bool kernfs_lockdep(struct kernfs_node *kn) in kernfs_lockdep() argument
43 return kn->flags & KERNFS_LOCKDEP; in kernfs_lockdep()
49 static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen) in kernfs_name_locked() argument
51 if (!kn) in kernfs_name_locked()
54 return strlcpy(buf, kn->parent ? kn->name : "/", buflen); in kernfs_name_locked()
78 da = kernfs_depth(ra->kn, a); in kernfs_common_ancestor()
79 db = kernfs_depth(rb->kn, b); in kernfs_common_ancestor()
[all …]
Dinode.c27 static struct kernfs_iattrs *__kernfs_iattrs(struct kernfs_node *kn, int alloc) in __kernfs_iattrs() argument
34 if (kn->iattr || !alloc) in __kernfs_iattrs()
37 kn->iattr = kmem_cache_zalloc(kernfs_iattrs_cache, GFP_KERNEL); in __kernfs_iattrs()
38 if (!kn->iattr) in __kernfs_iattrs()
42 kn->iattr->ia_uid = GLOBAL_ROOT_UID; in __kernfs_iattrs()
43 kn->iattr->ia_gid = GLOBAL_ROOT_GID; in __kernfs_iattrs()
45 ktime_get_real_ts64(&kn->iattr->ia_atime); in __kernfs_iattrs()
46 kn->iattr->ia_mtime = kn->iattr->ia_atime; in __kernfs_iattrs()
47 kn->iattr->ia_ctime = kn->iattr->ia_atime; in __kernfs_iattrs()
49 simple_xattrs_init(&kn->iattr->xattrs); in __kernfs_iattrs()
[all …]
Dsymlink.c29 struct kernfs_node *kn; in kernfs_create_link() local
39 kn = kernfs_new_node(parent, name, S_IFLNK|0777, uid, gid, KERNFS_LINK); in kernfs_create_link()
40 if (!kn) in kernfs_create_link()
44 kn->ns = target->ns; in kernfs_create_link()
45 kn->symlink.target_kn = target; in kernfs_create_link()
48 error = kernfs_add_one(kn); in kernfs_create_link()
50 return kn; in kernfs_create_link()
52 kernfs_put(kn); in kernfs_create_link()
59 struct kernfs_node *base, *kn; in kernfs_get_target_path() local
66 kn = target->parent; in kernfs_get_target_path()
[all …]
Dfile.c63 static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn) in kernfs_ops() argument
65 if (kn->flags & KERNFS_LOCKDEP) in kernfs_ops()
66 lockdep_assert_held(kn); in kernfs_ops()
67 return kn->attr.ops; in kernfs_ops()
95 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_stop_active()
99 kernfs_put_active(of->kn); in kernfs_seq_stop_active()
112 if (!kernfs_get_active(of->kn)) in kernfs_seq_start()
115 ops = kernfs_ops(of->kn); in kernfs_seq_start()
129 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_next()
160 of->event = atomic_read(&of->kn->attr.open->event); in kernfs_seq_show()
[all …]
Dkernfs-internal.h36 struct kernfs_node *kn; member
63 static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) in kernfs_root() argument
66 if (kn->parent) in kernfs_root()
67 kn = kn->parent; in kernfs_root()
68 return kn->dir.root; in kernfs_root()
138 int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
147 struct kernfs_node *kernfs_get_active(struct kernfs_node *kn);
148 void kernfs_put_active(struct kernfs_node *kn);
149 int kernfs_add_one(struct kernfs_node *kn);
160 void kernfs_drain_open_files(struct kernfs_node *kn);
Dmount.c59 struct kernfs_node *kn = inode->i_private; in kernfs_encode_fh() local
67 *(u64 *)fh = kn->id; in kernfs_encode_fh()
76 struct kernfs_node *kn; in __kernfs_fh_to_dentry() local
101 kn = kernfs_find_and_get_node_by_id(info->root, id); in __kernfs_fh_to_dentry()
102 if (!kn) in __kernfs_fh_to_dentry()
108 parent = kernfs_get_parent(kn); in __kernfs_fh_to_dentry()
109 kernfs_put(kn); in __kernfs_fh_to_dentry()
110 kn = parent; in __kernfs_fh_to_dentry()
111 if (!kn) in __kernfs_fh_to_dentry()
115 inode = kernfs_get_inode(sb, kn); in __kernfs_fh_to_dentry()
[all …]
/linux-5.19.10/include/linux/
Dkernfs.h181 int (*rmdir)(struct kernfs_node *kn);
182 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent,
184 int (*show_path)(struct seq_file *sf, struct kernfs_node *kn,
192 struct kernfs_node *kn; member
276 static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) in kernfs_type() argument
278 return kn->flags & KERNFS_TYPE_MASK; in kernfs_type()
299 static inline ino_t kernfs_ino(struct kernfs_node *kn) in kernfs_ino() argument
301 return kernfs_id_ino(kn->id); in kernfs_ino()
304 static inline ino_t kernfs_gen(struct kernfs_node *kn) in kernfs_gen() argument
306 return kernfs_id_gen(kn->id); in kernfs_gen()
[all …]
Dsysfs.h266 void sysfs_unbreak_active_protection(struct kernfs_node *kn);
324 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument
326 return kernfs_enable_ns(kn); in sysfs_enable_ns()
406 static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument
553 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument
622 static inline void sysfs_notify_dirent(struct kernfs_node *kn) in sysfs_notify_dirent() argument
624 kernfs_notify(kn); in sysfs_notify_dirent()
633 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) in sysfs_get() argument
635 kernfs_get(kn); in sysfs_get()
636 return kn; in sysfs_get()
[all …]
Dcgroup.h312 return cgrp->kn->id; in cgroup_id()
628 return kernfs_ino(cgrp->kn); in cgroup_ino()
634 return of->kn->priv; in of_cft()
657 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name()
662 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path()
667 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name()
672 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
/linux-5.19.10/fs/sysfs/
Dfile.c26 static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) in sysfs_file_ops() argument
28 struct kobject *kobj = kn->parent->priv; in sysfs_file_ops()
30 if (kn->flags & KERNFS_LOCKDEP) in sysfs_file_ops()
31 lockdep_assert_held(kn); in sysfs_file_ops()
43 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_seq_show()
44 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_seq_show()
59 count = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_seq_show()
80 struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_read()
81 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_bin_read()
104 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_read()
[all …]
Ddir.c42 struct kernfs_node *parent, *kn; in sysfs_create_dir_ns() local
59 kn = kernfs_create_dir_ns(parent, kobject_name(kobj), 0755, uid, gid, in sysfs_create_dir_ns()
61 if (IS_ERR(kn)) { in sysfs_create_dir_ns()
62 if (PTR_ERR(kn) == -EEXIST) in sysfs_create_dir_ns()
64 return PTR_ERR(kn); in sysfs_create_dir_ns()
67 kobj->sd = kn; in sysfs_create_dir_ns()
81 struct kernfs_node *kn = kobj->sd; in sysfs_remove_dir() local
99 if (kn) { in sysfs_remove_dir()
100 WARN_ON_ONCE(kernfs_type(kn) != KERNFS_DIR); in sysfs_remove_dir()
101 kernfs_remove(kn); in sysfs_remove_dir()
[all …]
Dgroup.c110 struct kernfs_node *kn; in internal_create_group() local
129 kn = kernfs_find_and_get(kobj->sd, grp->name); in internal_create_group()
130 if (!kn) { in internal_create_group()
136 kn = kernfs_create_dir_ns(kobj->sd, grp->name, in internal_create_group()
139 if (IS_ERR(kn)) { in internal_create_group()
140 if (PTR_ERR(kn) == -EEXIST) in internal_create_group()
142 return PTR_ERR(kn); in internal_create_group()
146 kn = kobj->sd; in internal_create_group()
147 kernfs_get(kn); in internal_create_group()
148 error = create_files(kn, kobj, uid, gid, grp, update); in internal_create_group()
[all …]
Dsymlink.c24 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()
169 struct kernfs_node *parent, *kn = NULL; in sysfs_rename_link_ns() local
182 kn = kernfs_find_and_get_ns(parent, old, old_ns); in sysfs_rename_link_ns()
183 if (!kn) in sysfs_rename_link_ns()
[all …]
Dsysfs.h40 int sysfs_create_link_sd(struct kernfs_node *kn, struct kobject *target,
/linux-5.19.10/arch/x86/kernel/cpu/resctrl/
Drdtgroup.c192 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) in rdtgroup_kn_set_ugid() argument
202 return kernfs_setattr(kn, &iattr); in rdtgroup_kn_set_ugid()
207 struct kernfs_node *kn; in rdtgroup_add_file() local
210 kn = __kernfs_create_file(parent_kn, rft->name, rft->mode, in rdtgroup_add_file()
213 if (IS_ERR(kn)) in rdtgroup_add_file()
214 return PTR_ERR(kn); in rdtgroup_add_file()
216 ret = rdtgroup_kn_set_ugid(kn); in rdtgroup_add_file()
218 kernfs_remove(kn); in rdtgroup_add_file()
228 struct rftype *rft = of->kn->priv; in rdtgroup_seqfile_show()
238 struct rftype *rft = of->kn->priv; in rdtgroup_file_write()
[all …]
Dctrlmondata.c367 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_write()
369 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write()
425 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write()
470 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_show()
497 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_show()
530 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mondata_show()
536 md.priv = of->kn->priv; in rdtgroup_mondata_show()
559 rdtgroup_kn_unlock(of->kn); in rdtgroup_mondata_show()
Dinternal.h217 struct kernfs_node *kn; member
500 struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn);
501 void rdtgroup_kn_unlock(struct kernfs_node *kn);
/linux-5.19.10/scripts/gdb/linux/
Ddevice.py73 for kn in klist_for_each(bus['p']['klist_devices']):
74 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_bus')
79 for kn in klist_for_each(cls['p']['klist_devices']):
80 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_class')
85 for kn in klist_for_each(dev['p']['klist_children']):
86 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_parent')
/linux-5.19.10/kernel/cgroup/
Dcgroup.c654 struct cgroup *cgrp = of->kn->parent->priv; in of_css()
1585 void cgroup_kn_unlock(struct kernfs_node *kn) in cgroup_kn_unlock() argument
1589 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_unlock()
1590 cgrp = kn->priv; in cgroup_kn_unlock()
1592 cgrp = kn->parent->priv; in cgroup_kn_unlock()
1596 kernfs_unbreak_active_protection(kn); in cgroup_kn_unlock()
1617 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) in cgroup_kn_lock_live() argument
1621 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_lock_live()
1622 cgrp = kn->priv; in cgroup_kn_lock_live()
1624 cgrp = kn->parent->priv; in cgroup_kn_lock_live()
[all …]
Ddebug.c48 if (!cgroup_kn_lock_live(of->kn, false)) in current_css_set_read()
72 cgroup_kn_unlock(of->kn); in current_css_set_read()
212 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_subsys_states_read()
232 cgroup_kn_unlock(of->kn); in cgroup_subsys_states_read()
260 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_masks_read()
267 cgroup_kn_unlock(of->kn); in cgroup_masks_read()
Dcgroup-v1.c499 cgrp = cgroup_kn_lock_live(of->kn, false); in __cgroup1_procs_write()
528 cgroup_kn_unlock(of->kn); in __cgroup1_procs_write()
562 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_release_agent_write()
569 cgroup_kn_unlock(of->kn); in cgroup_release_agent_write()
701 struct kernfs_node *kn = kernfs_node_from_dentry(dentry); in cgroupstats_build() local
707 if (dentry->d_sb->s_type != &cgroup_fs_type || !kn || in cgroupstats_build()
708 kernfs_type(kn) != KERNFS_DIR) in cgroupstats_build()
717 cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); in cgroupstats_build()
827 static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, in cgroup1_rename() argument
830 struct cgroup *cgrp = kn->priv; in cgroup1_rename()
[all …]
Dcgroup-internal.h231 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline);
232 void cgroup_kn_unlock(struct kernfs_node *kn);
261 int cgroup_rmdir(struct kernfs_node *kn);
/linux-5.19.10/drivers/net/ethernet/apm/xgene/
Dxgene_enet_cle.c50 static void xgene_cle_kn_to_hw(struct xgene_cle_ptree_kn *kn, u32 *buf) in xgene_cle_kn_to_hw() argument
55 buf[j++] = SET_VAL(CLE_TYPE, kn->node_type); in xgene_cle_kn_to_hw()
56 for (i = 0; i < kn->num_keys; i++) { in xgene_cle_kn_to_hw()
57 struct xgene_cle_ptree_key *key = &kn->key[i]; in xgene_cle_kn_to_hw()
569 struct xgene_cle_ptree_kn *kn = ptree->kn; in xgene_cle_setup_node() local
585 xgene_cle_kn_to_hw(&kn[j - num_dn], buf); in xgene_cle_setup_node()
767 struct xgene_cle_ptree_kn kn; in xgene_enet_cle_init() local
806 memset(&kn, 0, sizeof(kn)); in xgene_enet_cle_init()
807 kn.node_type = KN; in xgene_enet_cle_init()
808 kn.num_keys = 1; in xgene_enet_cle_init()
[all …]
/linux-5.19.10/arch/s390/pci/
Dpci_sysfs.c55 struct kernfs_node *kn; in recover_store() local
70 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); in recover_store()
71 WARN_ON_ONCE(!kn); in recover_store()
117 if (kn) in recover_store()
118 sysfs_unbreak_active_protection(kn); in recover_store()
/linux-5.19.10/drivers/of/
Dkobj.c43 struct kernfs_node *kn; in safe_name() local
47 while (i < 16 && (kn = sysfs_get_dirent(kobj->sd, name))) { in safe_name()
48 sysfs_put(kn); in safe_name()

12