/linux-6.12.1/fs/kernfs/ |
D | dir.c | 34 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 strscpy(buf, kn->parent ? kn->name : "/", buflen); in kernfs_name_locked() [all …]
|
D | inode.c | 27 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 …]
|
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() 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 …]
|
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 = target->parent; in kernfs_get_target_path() [all …]
|
D | kernfs-internal.h | 36 struct kernfs_node *kn; member 67 static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) in kernfs_root() argument 70 if (kn->parent) in kernfs_root() 71 kn = kn->parent; in kernfs_root() 72 return kn->dir.root; in kernfs_root() 142 int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); 151 struct kernfs_node *kernfs_get_active(struct kernfs_node *kn); 152 void kernfs_put_active(struct kernfs_node *kn); 153 int kernfs_add_one(struct kernfs_node *kn); 164 bool kernfs_should_drain_open_files(struct kernfs_node *kn); [all …]
|
D | mount.c | 70 struct kernfs_node *kn = inode->i_private; in kernfs_encode_fh() local 78 *(u64 *)fh = kn->id; in kernfs_encode_fh() 87 struct kernfs_node *kn; in __kernfs_fh_to_dentry() local 112 kn = kernfs_find_and_get_node_by_id(info->root, id); in __kernfs_fh_to_dentry() 113 if (!kn) in __kernfs_fh_to_dentry() 119 parent = kernfs_get_parent(kn); in __kernfs_fh_to_dentry() 120 kernfs_put(kn); in __kernfs_fh_to_dentry() 121 kn = parent; in __kernfs_fh_to_dentry() 122 if (!kn) in __kernfs_fh_to_dentry() 126 inode = kernfs_get_inode(sb, kn); in __kernfs_fh_to_dentry() [all …]
|
/linux-6.12.1/include/linux/ |
D | kernfs.h | 242 int (*rmdir)(struct kernfs_node *kn); 243 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent, 245 int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, 253 struct kernfs_node *kn; member 338 static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) in kernfs_type() argument 340 return kn->flags & KERNFS_TYPE_MASK; in kernfs_type() 361 static inline ino_t kernfs_ino(struct kernfs_node *kn) in kernfs_ino() argument 363 return kernfs_id_ino(kn->id); in kernfs_ino() 366 static inline ino_t kernfs_gen(struct kernfs_node *kn) in kernfs_gen() argument 368 return kernfs_id_gen(kn->id); in kernfs_gen() [all …]
|
D | sysfs.h | 413 void sysfs_unbreak_active_protection(struct kernfs_node *kn); 471 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 473 return kernfs_enable_ns(kn); in sysfs_enable_ns() 557 static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument 704 static inline void sysfs_enable_ns(struct kernfs_node *kn) in sysfs_enable_ns() argument 782 static inline void sysfs_notify_dirent(struct kernfs_node *kn) in sysfs_notify_dirent() argument 784 kernfs_notify(kn); in sysfs_notify_dirent() 793 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) in sysfs_get() argument 795 kernfs_get(kn); in sysfs_get() 796 return kn; in sysfs_get() [all …]
|
D | cgroup.h | 326 return cgrp->kn->id; in cgroup_id() 565 return kernfs_ino(cgrp->kn); in cgroup_ino() 571 return of->kn->priv; in of_cft() 594 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name() 599 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path() 604 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name() 609 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
|
/linux-6.12.1/fs/sysfs/ |
D | file.c | 26 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 …]
|
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 …]
|
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 …]
|
D | group.c | 123 struct kernfs_node *kn; in internal_create_group() local 151 kn = kernfs_find_and_get(kobj->sd, grp->name); in internal_create_group() 152 if (!kn) { in internal_create_group() 159 kernfs_put(kn); in internal_create_group() 167 kn = kernfs_create_dir_ns(kobj->sd, grp->name, mode, in internal_create_group() 169 if (IS_ERR(kn)) { in internal_create_group() 170 if (PTR_ERR(kn) == -EEXIST) in internal_create_group() 172 return PTR_ERR(kn); in internal_create_group() 176 kn = kobj->sd; in internal_create_group() 179 kernfs_get(kn); in internal_create_group() [all …]
|
/linux-6.12.1/arch/x86/kernel/cpu/resctrl/ |
D | rdtgroup.c | 231 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) in rdtgroup_kn_set_ugid() argument 241 return kernfs_setattr(kn, &iattr); in rdtgroup_kn_set_ugid() 246 struct kernfs_node *kn; in rdtgroup_add_file() local 249 kn = __kernfs_create_file(parent_kn, rft->name, rft->mode, in rdtgroup_add_file() 252 if (IS_ERR(kn)) in rdtgroup_add_file() 253 return PTR_ERR(kn); in rdtgroup_add_file() 255 ret = rdtgroup_kn_set_ugid(kn); in rdtgroup_add_file() 257 kernfs_remove(kn); in rdtgroup_add_file() 267 struct rftype *rft = of->kn->priv; in rdtgroup_seqfile_show() 277 struct rftype *rft = of->kn->priv; in rdtgroup_file_write() [all …]
|
D | ctrlmondata.c | 371 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_write() 373 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write() 434 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_write() 483 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_schemata_show() 510 rdtgroup_kn_unlock(of->kn); in rdtgroup_schemata_show() 572 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mondata_show() 578 md.priv = of->kn->priv; in rdtgroup_mondata_show() 625 rdtgroup_kn_unlock(of->kn); in rdtgroup_mondata_show()
|
/linux-6.12.1/kernel/cgroup/ |
D | cgroup.c | 638 struct cgroup *cgrp = of->kn->parent->priv; in of_css() 1608 void cgroup_kn_unlock(struct kernfs_node *kn) in cgroup_kn_unlock() argument 1612 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_unlock() 1613 cgrp = kn->priv; in cgroup_kn_unlock() 1615 cgrp = kn->parent->priv; in cgroup_kn_unlock() 1619 kernfs_unbreak_active_protection(kn); in cgroup_kn_unlock() 1640 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) in cgroup_kn_lock_live() argument 1644 if (kernfs_type(kn) == KERNFS_DIR) in cgroup_kn_lock_live() 1645 cgrp = kn->priv; in cgroup_kn_lock_live() 1647 cgrp = kn->parent->priv; in cgroup_kn_lock_live() [all …]
|
D | debug.c | 48 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()
|
D | cgroup-v1.c | 504 cgrp = cgroup_kn_lock_live(of->kn, false); in __cgroup1_procs_write() 533 cgroup_kn_unlock(of->kn); in __cgroup1_procs_write() 567 cgrp = cgroup_kn_lock_live(of->kn, false); in cgroup_release_agent_write() 574 cgroup_kn_unlock(of->kn); in cgroup_release_agent_write() 709 struct kernfs_node *kn = kernfs_node_from_dentry(dentry); in cgroupstats_build() local 715 if (dentry->d_sb->s_type != &cgroup_fs_type || !kn || in cgroupstats_build() 716 kernfs_type(kn) != KERNFS_DIR) in cgroupstats_build() 725 cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); in cgroupstats_build() 835 static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, in cgroup1_rename() argument 838 struct cgroup *cgrp = kn->priv; in cgroup1_rename() [all …]
|
/linux-6.12.1/scripts/gdb/linux/ |
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-6.12.1/drivers/net/ethernet/apm/xgene/ |
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-6.12.1/tools/testing/selftests/bpf/progs/ |
D | cgrp_ls_sleepable.c | 40 cgroup_id = cgrp->kn->id; in cgroup_iter() 54 cgroup_id = cgrp->kn->id; in __no_rcu_lock() 112 cgroup_id = cgrp->kn->id; in yes_rcu_lock() 123 cgroup_id = cgrp->kn->id; in yes_rcu_lock()
|
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()
|
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-6.12.1/arch/s390/pci/ |
D | pci_sysfs.c | 88 struct kernfs_node *kn; in recover_store() local 103 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); in recover_store() 104 WARN_ON_ONCE(!kn); in recover_store() 130 if (kn) in recover_store() 131 sysfs_unbreak_active_protection(kn); in recover_store()
|
/linux-6.12.1/drivers/of/ |
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()
|