Home
last modified time | relevance | path

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

123

/linux-6.6.21/fs/kernfs/
Ddir.c34 static bool __kernfs_active(struct kernfs_node *kn) in __kernfs_active() argument
36 return atomic_read(&kn->active) >= 0; in __kernfs_active()
39 static bool kernfs_active(struct kernfs_node *kn) in kernfs_active() argument
41 lockdep_assert_held(&kernfs_root(kn)->kernfs_rwsem); in kernfs_active()
42 return __kernfs_active(kn); in kernfs_active()
45 static bool kernfs_lockdep(struct kernfs_node *kn) in kernfs_lockdep() argument
48 return kn->flags & KERNFS_LOCKDEP; in kernfs_lockdep()
54 static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen) in kernfs_name_locked() argument
56 if (!kn) in kernfs_name_locked()
59 return strlcpy(buf, kn->parent ? kn->name : "/", buflen); in kernfs_name_locked()
[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.c43 static inline struct mutex *kernfs_open_file_mutex_ptr(struct kernfs_node *kn) in kernfs_open_file_mutex_ptr() argument
45 int idx = hash_ptr(kn, NR_KERNFS_LOCK_BITS); in kernfs_open_file_mutex_ptr()
50 static inline struct mutex *kernfs_open_file_mutex_lock(struct kernfs_node *kn) in kernfs_open_file_mutex_lock() argument
54 lock = kernfs_open_file_mutex_ptr(kn); in kernfs_open_file_mutex_lock()
69 return rcu_dereference_protected(of->kn->attr.open, in of_on()
91 kernfs_deref_open_node_locked(struct kernfs_node *kn) in kernfs_deref_open_node_locked() argument
93 return rcu_dereference_protected(kn->attr.open, in kernfs_deref_open_node_locked()
94 lockdep_is_held(kernfs_open_file_mutex_ptr(kn))); in kernfs_deref_open_node_locked()
106 static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn) in kernfs_ops() argument
108 if (kn->flags & KERNFS_LOCKDEP) in kernfs_ops()
[all …]
Dkernfs-internal.h36 struct kernfs_node *kn; member
65 static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) in kernfs_root() argument
68 if (kn->parent) in kernfs_root()
69 kn = kn->parent; in kernfs_root()
70 return kn->dir.root; in kernfs_root()
140 int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
149 struct kernfs_node *kernfs_get_active(struct kernfs_node *kn);
150 void kernfs_put_active(struct kernfs_node *kn);
151 int kernfs_add_one(struct kernfs_node *kn);
162 bool kernfs_should_drain_open_files(struct kernfs_node *kn);
[all …]
Dmount.c69 struct kernfs_node *kn = inode->i_private; in kernfs_encode_fh() local
77 *(u64 *)fh = kn->id; in kernfs_encode_fh()
86 struct kernfs_node *kn; in __kernfs_fh_to_dentry() local
111 kn = kernfs_find_and_get_node_by_id(info->root, id); in __kernfs_fh_to_dentry()
112 if (!kn) in __kernfs_fh_to_dentry()
118 parent = kernfs_get_parent(kn); in __kernfs_fh_to_dentry()
119 kernfs_put(kn); in __kernfs_fh_to_dentry()
120 kn = parent; in __kernfs_fh_to_dentry()
121 if (!kn) in __kernfs_fh_to_dentry()
125 inode = kernfs_get_inode(sb, kn); in __kernfs_fh_to_dentry()
[all …]
/linux-6.6.21/include/linux/
Dkernfs.h240 int (*rmdir)(struct kernfs_node *kn);
241 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent,
243 int (*show_path)(struct seq_file *sf, struct kernfs_node *kn,
251 struct kernfs_node *kn; member
335 static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) in kernfs_type() argument
337 return kn->flags & KERNFS_TYPE_MASK; in kernfs_type()
358 static inline ino_t kernfs_ino(struct kernfs_node *kn) in kernfs_ino() argument
360 return kernfs_id_ino(kn->id); in kernfs_ino()
363 static inline ino_t kernfs_gen(struct kernfs_node *kn) in kernfs_gen() argument
365 return kernfs_id_gen(kn->id); in kernfs_gen()
[all …]
Dsysfs.h282 void sysfs_unbreak_active_protection(struct kernfs_node *kn);
340 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument
342 return kernfs_enable_ns(kn); in sysfs_enable_ns()
422 static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument
569 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument
638 static inline void sysfs_notify_dirent(struct kernfs_node *kn) in sysfs_notify_dirent() argument
640 kernfs_notify(kn); in sysfs_notify_dirent()
649 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) in sysfs_get() argument
651 kernfs_get(kn); in sysfs_get()
652 return kn; in sysfs_get()
[all …]
Dcgroup.h327 return cgrp->kn->id; in cgroup_id()
567 return kernfs_ino(cgrp->kn); in cgroup_ino()
573 return of->kn->priv; in of_cft()
596 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name()
601 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path()
606 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name()
611 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
/linux-6.6.21/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
131 kn = kernfs_find_and_get(kobj->sd, grp->name); in internal_create_group()
132 if (!kn) { in internal_create_group()
138 kn = kernfs_create_dir_ns(kobj->sd, grp->name, in internal_create_group()
141 if (IS_ERR(kn)) { in internal_create_group()
142 if (PTR_ERR(kn) == -EEXIST) in internal_create_group()
144 return PTR_ERR(kn); in internal_create_group()
148 kn = kobj->sd; in internal_create_group()
151 kernfs_get(kn); in internal_create_group()
152 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 …]
/linux-6.6.21/arch/x86/kernel/cpu/resctrl/
Drdtgroup.c205 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) in rdtgroup_kn_set_ugid() argument
215 return kernfs_setattr(kn, &iattr); in rdtgroup_kn_set_ugid()
220 struct kernfs_node *kn; in rdtgroup_add_file() local
223 kn = __kernfs_create_file(parent_kn, rft->name, rft->mode, in rdtgroup_add_file()
226 if (IS_ERR(kn)) in rdtgroup_add_file()
227 return PTR_ERR(kn); in rdtgroup_add_file()
229 ret = rdtgroup_kn_set_ugid(kn); in rdtgroup_add_file()
231 kernfs_remove(kn); in rdtgroup_add_file()
241 struct rftype *rft = of->kn->priv; in rdtgroup_seqfile_show()
251 struct rftype *rft = of->kn->priv; in rdtgroup_file_write()
[all …]
Dctrlmondata.c381 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_write()
383 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write()
445 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write()
492 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_show()
519 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_show()
551 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mondata_show()
557 md.priv = of->kn->priv; in rdtgroup_mondata_show()
579 rdtgroup_kn_unlock(of->kn); in rdtgroup_mondata_show()
Dinternal.h223 struct kernfs_node *kn; member
509 struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn);
510 void rdtgroup_kn_unlock(struct kernfs_node *kn);
/linux-6.6.21/kernel/cgroup/
Dcgroup.c636 struct cgroup *cgrp = of->kn->parent->priv; in of_css()
1591 void cgroup_kn_unlock(struct kernfs_node *kn) in cgroup_kn_unlock() argument
1595 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_unlock()
1596 cgrp = kn->priv; in cgroup_kn_unlock()
1598 cgrp = kn->parent->priv; in cgroup_kn_unlock()
1602 kernfs_unbreak_active_protection(kn); in cgroup_kn_unlock()
1623 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) in cgroup_kn_lock_live() argument
1627 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_lock_live()
1628 cgrp = kn->priv; in cgroup_kn_lock_live()
1630 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.c498 cgrp = cgroup_kn_lock_live(of->kn, false); in __cgroup1_procs_write()
527 cgroup_kn_unlock(of->kn); in __cgroup1_procs_write()
561 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_release_agent_write()
568 cgroup_kn_unlock(of->kn); in cgroup_release_agent_write()
700 struct kernfs_node *kn = kernfs_node_from_dentry(dentry); in cgroupstats_build() local
706 if (dentry->d_sb->s_type != &cgroup_fs_type || !kn || in cgroupstats_build()
707 kernfs_type(kn) != KERNFS_DIR) in cgroupstats_build()
716 cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); in cgroupstats_build()
826 static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, in cgroup1_rename() argument
829 struct cgroup *cgrp = kn->priv; in cgroup1_rename()
[all …]
Dcgroup-internal.h227 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline);
228 void cgroup_kn_unlock(struct kernfs_node *kn);
260 int cgroup_rmdir(struct kernfs_node *kn);
/linux-6.6.21/scripts/gdb/linux/
Ddevice.py73 for kn in klist_for_each(bus['klist_devices']):
74 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_bus')
79 for kn in klist_for_each(cls['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-6.6.21/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-6.6.21/tools/testing/selftests/bpf/progs/
Dcgrp_ls_sleepable.c36 cgroup_id = cgrp->kn->id; in cgroup_iter()
56 cgroup_id = cgrp->kn->id; in no_rcu_lock()
76 cgroup_id = cgrp->kn->id; in yes_rcu_lock()
/linux-6.6.21/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-6.6.21/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()

123