| /linux/fs/kernfs/ |
| H A D | dir.c | 32 static bool __kernfs_active(struct kernfs_node *kn) in __kernfs_active() argument 34 return atomic_read(&kn->active) >= 0; in __kernfs_active() 37 static bool kernfs_active(struct kernfs_node *kn) in kernfs_active() argument 39 lockdep_assert_held(&kernfs_root(kn)->kernfs_rwsem); in kernfs_active() 40 return __kernfs_active(kn); in kernfs_active() 43 static bool kernfs_lockdep(struct kernfs_node *kn) in kernfs_lockdep() argument 46 return kn->flags & KERNFS_LOCKDEP; in kernfs_lockdep() 73 da = kernfs_depth(ra->kn, a); in kernfs_common_ancestor() 74 db = kernfs_depth(rb->kn, b); in kernfs_common_ancestor() 128 struct kernfs_node *kn, *common; in kernfs_path_from_node_locked() local [all …]
|
| H A D | inode.c | 27 static struct kernfs_iattrs *__kernfs_iattrs(struct kernfs_node *kn, bool alloc) in __kernfs_iattrs() argument 32 attr = READ_ONCE(kn->iattr); in __kernfs_iattrs() 53 if (!try_cmpxchg(&kn->iattr, &attr, ret)) in __kernfs_iattrs() 54 return READ_ONCE(kn->iattr); in __kernfs_iattrs() 59 static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) in kernfs_iattrs() argument 61 return __kernfs_iattrs(kn, true); in kernfs_iattrs() 64 static struct kernfs_iattrs *kernfs_iattrs_noalloc(struct kernfs_node *kn) in kernfs_iattrs_noalloc() argument 66 return __kernfs_iattrs(kn, false); in kernfs_iattrs_noalloc() 69 int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) in __kernfs_setattr() argument 74 attrs = kernfs_iattrs(kn); in __kernfs_setattr() [all …]
|
| H A D | file.c | 43 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() 80 if (!kernfs_get_active(of->kn)) in kernfs_get_active_of() 88 return kernfs_put_active(of->kn); in kernfs_put_active_of() 109 kernfs_deref_open_node_locked(struct kernfs_node *kn) in kernfs_deref_open_node_locked() argument 111 return rcu_dereference_protected(kn->attr.open, in kernfs_deref_open_node_locked() 112 lockdep_is_held(kernfs_open_file_mutex_ptr(kn))); in kernfs_deref_open_node_locked() [all …]
|
| H A D | kernfs-internal.h | 36 struct kernfs_node *kn; member 71 static inline struct kernfs_root *kernfs_root(const struct kernfs_node *kn) in kernfs_root() argument 76 knp = rcu_dereference(kn->__parent); in kernfs_root() 78 kn = knp; in kernfs_root() 79 return kn->dir.root; in kernfs_root() 107 static inline bool kernfs_root_is_locked(const struct kernfs_node *kn) in kernfs_root_is_locked() argument 109 return lockdep_is_held(&kernfs_root(kn)->kernfs_rwsem); in kernfs_root_is_locked() 112 static inline bool kernfs_rename_is_locked(const struct kernfs_node *kn) in kernfs_rename_is_locked() argument 114 return lockdep_is_held(&kernfs_root(kn)->kernfs_rename_lock); in kernfs_rename_is_locked() 117 static inline const char *kernfs_rcu_name(const struct kernfs_node *kn) in kernfs_rcu_name() argument [all …]
|
| H A D | mount.c | 85 struct kernfs_node *kn = inode->i_private; in kernfs_encode_fh() local 93 *(u64 *)fh = kn->id; in kernfs_encode_fh() 102 struct kernfs_node *kn; in __kernfs_fh_to_dentry() local 127 kn = kernfs_find_and_get_node_by_id(info->root, id); in __kernfs_fh_to_dentry() 128 if (!kn) in __kernfs_fh_to_dentry() 134 parent = kernfs_get_parent(kn); in __kernfs_fh_to_dentry() 135 kernfs_put(kn); in __kernfs_fh_to_dentry() 136 kn = parent; in __kernfs_fh_to_dentry() 137 if (!kn) in __kernfs_fh_to_dentry() 141 inode = kernfs_get_inode(sb, kn); in __kernfs_fh_to_dentry() [all …]
|
| /linux/fs/sysfs/ |
| H A D | symlink.c | 24 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 …]
|
| H A D | group.c | 132 struct kernfs_node *kn; in internal_create_group() local 160 kn = kernfs_find_and_get(kobj->sd, grp->name); in internal_create_group() 161 if (!kn) { in internal_create_group() 168 kernfs_put(kn); in internal_create_group() 176 kn = kernfs_create_dir_ns(kobj->sd, grp->name, mode, in internal_create_group() 178 if (IS_ERR(kn)) { in internal_create_group() 179 if (PTR_ERR(kn) == -EEXIST) in internal_create_group() 181 return PTR_ERR(kn); in internal_create_group() 185 kn = kobj->sd; in internal_create_group() 188 kernfs_get(kn); in internal_create_group() [all …]
|
| /linux/kernel/cgroup/ |
| H A D | cgroup.c | 675 static struct cgroup *kn_priv(struct kernfs_node *kn) in kn_priv() argument 683 parent = rcu_dereference_check(kn->__parent, in kn_priv() 684 kernfs_root_flags(kn) & KERNFS_ROOT_INVARIANT_PARENT); in kn_priv() 690 struct cgroup *cgrp = kn_priv(of->kn); in of_css() 1681 void cgroup_kn_unlock(struct kernfs_node *kn) in cgroup_kn_unlock() argument 1685 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_unlock() 1686 cgrp = kn->priv; in cgroup_kn_unlock() 1688 cgrp = kn_priv(kn); in cgroup_kn_unlock() 1692 kernfs_unbreak_active_protection(kn); in cgroup_kn_unlock() 1713 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) in cgroup_kn_lock_live() argument [all …]
|
| H A D | debug.c | 48 if (!cgroup_kn_lock_live(of->kn, false)) in current_css_set_read() 70 cgroup_kn_unlock(of->kn); in current_css_set_read() 208 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_subsys_states_read() 228 cgroup_kn_unlock(of->kn); in cgroup_subsys_states_read() 256 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_masks_read() 263 cgroup_kn_unlock(of->kn); in cgroup_masks_read()
|
| H A D | cgroup-v1.c | 508 cgrp = cgroup_kn_lock_live(of->kn, false); in __cgroup1_procs_write() 537 cgroup_kn_unlock(of->kn); in __cgroup1_procs_write() 571 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_release_agent_write() 578 cgroup_kn_unlock(of->kn); in cgroup_release_agent_write() 721 struct kernfs_node *kn = kernfs_node_from_dentry(dentry); in cgroupstats_build() local 727 if (dentry->d_sb->s_type != &cgroup_fs_type || !kn || in cgroupstats_build() 728 kernfs_type(kn) != KERNFS_DIR) in cgroupstats_build() 737 cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); in cgroupstats_build() 847 static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, in cgroup1_rename() argument 850 struct cgroup *cgrp = kn->priv; in cgroup1_rename() [all …]
|
| H A D | cgroup-internal.h | 230 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline); 231 void cgroup_kn_unlock(struct kernfs_node *kn); 266 int cgroup_rmdir(struct kernfs_node *kn);
|
| /linux/scripts/gdb/linux/ |
| H A D | device.py | 73 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/drivers/net/ethernet/apm/xgene/ |
| H A D | xgene_enet_cle.c | 50 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/include/linux/ |
| H A D | sysfs.h | 420 void sysfs_unbreak_active_protection(struct kernfs_node *kn); 478 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 480 return kernfs_enable_ns(kn); in sysfs_enable_ns() 564 static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument 711 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 789 static inline void sysfs_notify_dirent(struct kernfs_node *kn) in sysfs_notify_dirent() argument 791 kernfs_notify(kn); in sysfs_notify_dirent() 800 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) in sysfs_get() argument 802 kernfs_get(kn); in sysfs_get() 803 return kn; in sysfs_get() [all …]
|
| H A D | cgroup.h | 336 return cgrp->kn->id; in cgroup_id() 591 return kernfs_ino(cgrp->kn); in cgroup_ino() 597 return of->kn->priv; in of_cft() 620 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name() 625 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path() 630 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name() 635 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
|
| H A D | cgroup-defs.h | 167 struct kernfs_node *kn; member 524 struct kernfs_node *kn; /* cgroup kernfs entry */ member
|
| /linux/drivers/of/ |
| H A D | kobj.c | 43 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()
|
| /linux/tools/testing/selftests/bpf/progs/ |
| H A D | test_cgroup1_hierarchy.c | 37 if (cgrp->kn->id == target_ancestor_cgid) in bpf_link_create_verify() 44 if (ancestor->kn->id == target_ancestor_cgid) in bpf_link_create_verify()
|
| H A D | iters_css.c | 53 last_cg_id = cur_cgrp->kn->id; in iter_css_for_each() 60 first_cg_id = cur_cgrp->kn->id; in iter_css_for_each()
|
| /linux/fs/resctrl/ |
| H A D | monitor.c | 999 struct mon_evt *mevt = rdt_kn_parent_priv(of->kn); in event_filter_show() 1033 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_mbm_assign_on_mkdir_show() 1056 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_mbm_assign_on_mkdir_write() 1352 struct mon_evt *mevt = rdt_kn_parent_priv(of->kn); in event_filter_write() 1391 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_mbm_assign_mode_show() 1421 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_mbm_assign_mode_write() 1494 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_num_mbm_cntrs_show() 1518 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); in resctrl_available_mbm_cntrs_show() 1566 rdtgrp = rdtgroup_kn_lock_live(of->kn); in mbm_L3_assignments_show() 1600 rdtgroup_kn_unlock(of->kn); in mbm_L3_assignments_show() [all …]
|
| /linux/drivers/usb/core/ |
| H A D | port.c | 61 struct kernfs_node *kn; in disable_show() local 74 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); in disable_show() 75 if (!kn) { in disable_show() 90 sysfs_unbreak_active_protection(kn); in disable_show() 112 struct kernfs_node *kn; in disable_store() local 129 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); in disable_store() 130 if (!kn) { in disable_store() 156 sysfs_unbreak_active_protection(kn); in disable_store()
|
| /linux/tools/sched_ext/ |
| H A D | scx_flatcg.bpf.c | 169 scx_bpf_error("cgrp_ctx lookup failed for cgid %llu", cgrp->kn->id); in find_cgrp_ctx() 279 u64 cgid = cgrp->kn->id; in cgrp_enqueued() 391 scx_bpf_dsq_insert(p, cgrp->kn->id, SCX_SLICE_DFL, enq_flags); in BPF_STRUCT_OPS() 402 scx_bpf_dsq_insert_vtime(p, cgrp->kn->id, SCX_SLICE_DFL, in BPF_STRUCT_OPS() 836 u64 cgid = cgrp->kn->id; in BPF_STRUCT_OPS_SLEEPABLE() 903 u64 cgid = cgrp->kn->id; in BPF_STRUCT_OPS()
|
| /linux/tools/cgroup/ |
| H A D | memcg_slabinfo.py | 41 name = prefix + '/' + css.cgroup.kn.name.string_().decode('utf-8') 43 MEMCGS[css.cgroup.kn.id.value_()] = memcg
|
| /linux/tools/perf/util/bpf_skel/ |
| H A D | off_cpu.bpf.c | 155 return BPF_CORE_READ(t, cgroups, dfl_cgrp, kn, id); in get_cgroup_id() 167 return BPF_CORE_READ(cgrp, kn, id); in get_cgroup_id()
|
| /linux/drivers/cpufreq/ |
| H A D | powernv-cpufreq.c | 831 struct kernfs_node *kn; in powernv_cpufreq_cpu_init() local 839 kn = kernfs_find_and_get(policy->kobj.sd, throttle_attr_grp.name); in powernv_cpufreq_cpu_init() 840 if (!kn) { in powernv_cpufreq_cpu_init() 850 kernfs_put(kn); in powernv_cpufreq_cpu_init()
|