| /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 | symlink.c | 29 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 = kernfs_parent(target); in kernfs_get_target_path() [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/include/linux/ |
| H A D | kernfs.h | 247 int (*rmdir)(struct kernfs_node *kn); 248 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent, 250 int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, 258 struct kernfs_node *kn; member 343 static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) in kernfs_type() argument 345 return kn->flags & KERNFS_TYPE_MASK; in kernfs_type() 366 static inline ino_t kernfs_ino(struct kernfs_node *kn) in kernfs_ino() argument 368 return kernfs_id_ino(kn->id); in kernfs_ino() 371 static inline ino_t kernfs_gen(struct kernfs_node *kn) in kernfs_gen() argument 373 return kernfs_id_gen(kn->id); in kernfs_gen() [all …]
|
| H A D | sysfs.h | 410 void sysfs_unbreak_active_protection(struct kernfs_node *kn); 468 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 470 return kernfs_enable_ns(kn); in sysfs_enable_ns() 554 static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument 701 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 779 static inline void sysfs_notify_dirent(struct kernfs_node *kn) in sysfs_notify_dirent() argument 781 kernfs_notify(kn); in sysfs_notify_dirent() 790 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) in sysfs_get() argument 792 kernfs_get(kn); in sysfs_get() 793 return kn; in sysfs_get() [all …]
|
| H A D | cgroup.h | 335 return cgrp->kn->id; in cgroup_id() 590 return kernfs_ino(cgrp->kn); in cgroup_ino() 596 return of->kn->priv; in of_cft() 619 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name() 624 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path() 629 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name() 634 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
|
| /linux/fs/sysfs/ |
| H A D | file.c | 22 static struct kobject *sysfs_file_kobj(struct kernfs_node *kn) in sysfs_file_kobj() argument 25 return rcu_dereference(kn->__parent)->priv; in sysfs_file_kobj() 32 static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) in sysfs_file_ops() argument 34 struct kobject *kobj = sysfs_file_kobj(kn); in sysfs_file_ops() 36 if (kn->flags & KERNFS_LOCKDEP) in sysfs_file_ops() 37 lockdep_assert_held(kn); in sysfs_file_ops() 49 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_seq_show() 50 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_seq_show() 65 count = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_seq_show() 86 const struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_read() [all …]
|
| H A D | dir.c | 42 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 …]
|
| 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 | 126 struct kernfs_node *kn; in internal_create_group() local 154 kn = kernfs_find_and_get(kobj->sd, grp->name); in internal_create_group() 155 if (!kn) { in internal_create_group() 162 kernfs_put(kn); in internal_create_group() 170 kn = kernfs_create_dir_ns(kobj->sd, grp->name, mode, in internal_create_group() 172 if (IS_ERR(kn)) { in internal_create_group() 173 if (PTR_ERR(kn) == -EEXIST) in internal_create_group() 175 return PTR_ERR(kn); in internal_create_group() 179 kn = kobj->sd; in internal_create_group() 182 kernfs_get(kn); in internal_create_group() [all …]
|
| /linux/fs/resctrl/ |
| H A D | rdtgroup.c | 272 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) in rdtgroup_kn_set_ugid() argument 282 return kernfs_setattr(kn, &iattr); in rdtgroup_kn_set_ugid() 287 struct kernfs_node *kn; in rdtgroup_add_file() local 290 kn = __kernfs_create_file(parent_kn, rft->name, rft->mode, in rdtgroup_add_file() 293 if (IS_ERR(kn)) in rdtgroup_add_file() 294 return PTR_ERR(kn); in rdtgroup_add_file() 296 ret = rdtgroup_kn_set_ugid(kn); in rdtgroup_add_file() 298 kernfs_remove(kn); in rdtgroup_add_file() 308 struct rftype *rft = of->kn->priv; in rdtgroup_seqfile_show() 318 struct rftype *rft = of->kn->priv; in rdtgroup_file_write() [all …]
|
| H A D | ctrlmondata.c | 317 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_write() 319 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write() 380 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write() 419 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_show() 446 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_show() 468 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mba_mbps_event_write() 470 rdtgroup_kn_unlock(of->kn); in rdtgroup_mba_mbps_event_write() 492 rdtgroup_kn_unlock(of->kn); in rdtgroup_mba_mbps_event_write() 503 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mba_mbps_event_show() 522 rdtgroup_kn_unlock(of->kn); in rdtgroup_mba_mbps_event_show() [all …]
|
| H A D | internal.h | 206 struct kernfs_node *kn; member 301 static inline const char *rdt_kn_name(const struct kernfs_node *kn) in rdt_kn_name() argument 303 return rcu_dereference_check(kn->name, lockdep_is_held(&rdtgroup_mutex)); in rdt_kn_name() 319 struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn); 321 void rdtgroup_kn_unlock(struct kernfs_node *kn); 395 void *rdt_kn_parent_priv(struct kernfs_node *kn);
|
| /linux/kernel/cgroup/ |
| H A D | cgroup.c | 676 static struct cgroup *kn_priv(struct kernfs_node *kn) in kn_priv() argument 684 parent = rcu_dereference_check(kn->__parent, in kn_priv() 685 kernfs_root_flags(kn) & KERNFS_ROOT_INVARIANT_PARENT); in kn_priv() 691 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 …]
|
| /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/tools/testing/selftests/bpf/progs/ |
| H A D | cgrp_ls_sleepable.c | 39 cgroup_id = cgrp->kn->id; in cgroup_iter() 53 cgroup_id = cgrp->kn->id; in __no_rcu_lock() 111 cgroup_id = cgrp->kn->id; in yes_rcu_lock() 122 cgroup_id = cgrp->kn->id; in yes_rcu_lock()
|
| 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()
|
| /linux/arch/s390/pci/ |
| H A D | pci_sysfs.c | 83 struct kernfs_node *kn; in recover_store() local 98 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); in recover_store() 99 WARN_ON_ONCE(!kn); in recover_store() 125 if (kn) in recover_store() 126 sysfs_unbreak_active_protection(kn); in recover_store()
|
| /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()
|