kn 54 arch/s390/pci/pci_sysfs.c struct kernfs_node *kn; kn 69 arch/s390/pci/pci_sysfs.c kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); kn 70 arch/s390/pci/pci_sysfs.c WARN_ON_ONCE(!kn); kn 95 arch/s390/pci/pci_sysfs.c if (kn) kn 96 arch/s390/pci/pci_sysfs.c sysfs_unbreak_active_protection(kn); kn 378 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 380 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgroup_kn_unlock(of->kn); kn 435 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgroup_kn_unlock(of->kn); kn 468 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 494 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgroup_kn_unlock(of->kn); kn 524 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 530 arch/x86/kernel/cpu/resctrl/ctrlmondata.c md.priv = of->kn->priv; kn 552 arch/x86/kernel/cpu/resctrl/ctrlmondata.c rdtgroup_kn_unlock(of->kn); kn 202 arch/x86/kernel/cpu/resctrl/internal.h struct kernfs_node *kn; kn 552 arch/x86/kernel/cpu/resctrl/internal.h struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn); kn 553 arch/x86/kernel/cpu/resctrl/internal.h void rdtgroup_kn_unlock(struct kernfs_node *kn); kn 1336 arch/x86/kernel/cpu/resctrl/pseudo_lock.c plr->debugfs_dir = debugfs_create_dir(rdtgrp->kn->name, kn 1346 arch/x86/kernel/cpu/resctrl/pseudo_lock.c rdtgrp, "%s", rdtgrp->kn->name); kn 1558 arch/x86/kernel/cpu/resctrl/pseudo_lock.c return kasprintf(GFP_KERNEL, "pseudo_lock/%s", rdtgrp->kn->name); kn 189 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_kn_set_ugid(struct kernfs_node *kn) kn 199 arch/x86/kernel/cpu/resctrl/rdtgroup.c return kernfs_setattr(kn, &iattr); kn 204 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 207 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = __kernfs_create_file(parent_kn, rft->name, rft->mode, kn 210 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (IS_ERR(kn)) kn 211 arch/x86/kernel/cpu/resctrl/rdtgroup.c return PTR_ERR(kn); kn 213 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_kn_set_ugid(kn); kn 215 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(kn); kn 225 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rftype *rft = of->kn->priv; kn 235 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rftype *rft = of->kn->priv; kn 256 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rftype *rft = of->kn->priv; kn 268 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 289 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 463 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 502 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 677 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 679 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 694 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 718 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 723 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 746 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 755 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 764 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 773 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 796 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 874 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 883 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 893 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 905 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 914 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 923 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 933 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdt_resource *r = of->kn->parent->priv; kn 957 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 959 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 965 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 1187 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 1189 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 1239 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 1295 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(of->kn); kn 1297 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 1341 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(of->kn); kn 1484 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) kn 1496 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_add_file(kn, rft); kn 1507 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove_by_name(kn, rft->name); kn 1532 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 1535 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = kernfs_find_and_get_ns(r->kn, name, NULL); kn 1536 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (!kn) kn 1539 arch/x86/kernel/cpu/resctrl/rdtgroup.c switch (kernfs_type(kn)) { kn 1551 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = kernfs_setattr(kn, &iattr); kn 1552 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_put(kn); kn 1571 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn, *parent; kn 1583 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = kernfs_find_and_get_ns(r->kn, name, NULL); kn 1584 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (!kn) kn 1587 arch/x86/kernel/cpu/resctrl/rdtgroup.c switch (kernfs_type(kn)) { kn 1589 arch/x86/kernel/cpu/resctrl/rdtgroup.c parent = kernfs_get_parent(kn); kn 1604 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = kernfs_setattr(kn, &iattr); kn 1605 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_put(kn); kn 1687 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 1691 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = kernfs_create_dir(parent_kn, name, parent_kn->mode, prgrp); kn 1692 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (IS_ERR(kn)) kn 1693 arch/x86/kernel/cpu/resctrl/rdtgroup.c return PTR_ERR(kn); kn 1696 arch/x86/kernel/cpu/resctrl/rdtgroup.c *dest_kn = kn; kn 1702 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_get(kn); kn 1704 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_kn_set_ugid(kn); kn 1708 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_activate(kn); kn 1713 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(kn); kn 1878 arch/x86/kernel/cpu/resctrl/rdtgroup.c static struct rdtgroup *kernfs_to_rdtgroup(struct kernfs_node *kn) kn 1880 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (kernfs_type(kn) == KERNFS_DIR) { kn 1887 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (kn == kn_info || kn->parent == kn_info) kn 1890 arch/x86/kernel/cpu/resctrl/rdtgroup.c return kn->priv; kn 1892 arch/x86/kernel/cpu/resctrl/rdtgroup.c return kn->parent->priv; kn 1896 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn) kn 1898 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdtgroup *rdtgrp = kernfs_to_rdtgroup(kn); kn 1904 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_break_active_protection(kn); kn 1915 arch/x86/kernel/cpu/resctrl/rdtgroup.c void rdtgroup_kn_unlock(struct kernfs_node *kn) kn 1917 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct rdtgroup *rdtgrp = kernfs_to_rdtgroup(kn); kn 1929 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_unbreak_active_protection(kn); kn 1930 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_put(rdtgrp->kn); kn 1933 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_unbreak_active_protection(kn); kn 1980 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_create_info_dir(rdtgroup_default.kn); kn 1985 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mongroup_create_dir(rdtgroup_default.kn, kn 1992 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mkdir_mondata_all(rdtgroup_default.kn, kn 2261 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(rdtgrp->kn); kn 2311 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 2314 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = __kernfs_create_file(parent_kn, name, 0444, kn 2317 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (IS_ERR(kn)) kn 2318 arch/x86/kernel/cpu/resctrl/rdtgroup.c return PTR_ERR(kn); kn 2320 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_kn_set_ugid(kn); kn 2322 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(kn); kn 2355 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 2363 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = kernfs_create_dir(parent_kn, name, parent_kn->mode, prgrp); kn 2364 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (IS_ERR(kn)) kn 2365 arch/x86/kernel/cpu/resctrl/rdtgroup.c return PTR_ERR(kn); kn 2371 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_get(kn); kn 2372 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_kn_set_ugid(kn); kn 2385 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mon_addfile(kn, mevt->name, priv.priv); kn 2392 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_activate(kn); kn 2396 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(kn); kn 2464 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 2470 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mongroup_create_dir(parent_kn, prgrp, "mon_data", &kn); kn 2475 arch/x86/kernel/cpu/resctrl/rdtgroup.c *dest_kn = kn; kn 2482 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mkdir_mondata_subdir_alldom(kn, r, prgrp); kn 2490 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(kn); kn 2665 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 2696 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp); kn 2697 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (IS_ERR(kn)) { kn 2698 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = PTR_ERR(kn); kn 2702 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp->kn = kn; kn 2710 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_get(kn); kn 2712 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_kn_set_ugid(kn); kn 2719 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_add_files(kn, files); kn 2733 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mkdir_mondata_all(kn, rdtgrp, &rdtgrp->mon.mon_data_kn); kn 2739 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_activate(kn); kn 2749 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(rdtgrp->kn); kn 2759 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(rgrp->kn); kn 2804 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *kn; kn 2813 arch/x86/kernel/cpu/resctrl/rdtgroup.c kn = rdtgrp->kn; kn 2834 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = mongroup_create_dir(kn, rdtgrp, "mon_groups", NULL); kn 2864 arch/x86/kernel/cpu/resctrl/rdtgroup.c static bool is_mon_groups(struct kernfs_node *kn, const char *name) kn 2866 arch/x86/kernel/cpu/resctrl/rdtgroup.c return (!strcmp(kn->name, "mon_groups") && kn 2882 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (rdt_alloc_capable && parent_kn == rdtgroup_default.kn) kn 2895 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, kn 2927 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_get(kn); kn 2928 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(rdtgrp->kn); kn 2933 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_ctrl_remove(struct kernfs_node *kn, kn 2943 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_get(kn); kn 2944 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_remove(rdtgrp->kn); kn 2948 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, kn 2976 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_ctrl_remove(kn, rdtgrp); kn 2986 arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdtgroup_rmdir(struct kernfs_node *kn) kn 2988 arch/x86/kernel/cpu/resctrl/rdtgroup.c struct kernfs_node *parent_kn = kn->parent; kn 2996 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgrp = rdtgroup_kn_lock_live(kn); kn 3009 arch/x86/kernel/cpu/resctrl/rdtgroup.c if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn && kn 3013 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_ctrl_remove(kn, rdtgrp); kn 3015 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_rmdir_ctrl(kn, rdtgrp, tmpmask); kn 3018 arch/x86/kernel/cpu/resctrl/rdtgroup.c is_mon_groups(parent_kn, kn->name)) { kn 3019 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_rmdir_mon(kn, rdtgrp, tmpmask); kn 3025 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_kn_unlock(kn); kn 3070 arch/x86/kernel/cpu/resctrl/rdtgroup.c ret = rdtgroup_add_files(rdt_root->kn, RF_CTRL_BASE); kn 3076 arch/x86/kernel/cpu/resctrl/rdtgroup.c rdtgroup_default.kn = rdt_root->kn; kn 3077 arch/x86/kernel/cpu/resctrl/rdtgroup.c kernfs_activate(rdtgroup_default.kn); kn 829 drivers/cpufreq/powernv-cpufreq.c struct kernfs_node *kn; kn 837 drivers/cpufreq/powernv-cpufreq.c kn = kernfs_find_and_get(policy->kobj.sd, throttle_attr_grp.name); kn 838 drivers/cpufreq/powernv-cpufreq.c if (!kn) { kn 848 drivers/cpufreq/powernv-cpufreq.c kernfs_put(kn); kn 50 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c static void xgene_cle_kn_to_hw(struct xgene_cle_ptree_kn *kn, u32 *buf) kn 55 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c buf[j++] = SET_VAL(CLE_TYPE, kn->node_type); kn 56 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c for (i = 0; i < kn->num_keys; i++) { kn 57 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c struct xgene_cle_ptree_key *key = &kn->key[i]; kn 569 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c struct xgene_cle_ptree_kn *kn = ptree->kn; kn 585 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c xgene_cle_kn_to_hw(&kn[j - num_dn], buf); kn 767 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c struct xgene_cle_ptree_kn kn; kn 806 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c memset(&kn, 0, sizeof(kn)); kn 807 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c kn.node_type = KN; kn 808 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c kn.num_keys = 1; kn 809 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c kn.key[0].priority = 0; kn 810 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c kn.key[0].result_pointer = DB_RES_ACCEPT; kn 812 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c ptree->kn = &kn; kn 269 drivers/net/ethernet/apm/xgene/xgene_enet_cle.h struct xgene_cle_ptree_kn *kn; kn 43 drivers/of/kobj.c struct kernfs_node *kn; kn 47 drivers/of/kobj.c while (i < 16 && (kn = sysfs_get_dirent(kobj->sd, name))) { kn 48 drivers/of/kobj.c sysfs_put(kn); kn 173 drivers/s390/block/dasd_eckd.c int dn, kn; kn 185 drivers/s390/block/dasd_eckd.c kn = ceil_quot(kl + 6, 232) + 1; kn 186 drivers/s390/block/dasd_eckd.c return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) + kn 193 drivers/s390/block/dasd_eckd.c kn = ceil_quot(kl + 6, 232) + 1; kn 194 drivers/s390/block/dasd_eckd.c return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) + kn 732 drivers/scsi/scsi_sysfs.c struct kernfs_node *kn; kn 742 drivers/scsi/scsi_sysfs.c kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); kn 743 drivers/scsi/scsi_sysfs.c WARN_ON_ONCE(!kn); kn 756 drivers/scsi/scsi_sysfs.c if (kn) kn 757 drivers/scsi/scsi_sysfs.c sysfs_unbreak_active_protection(kn); kn 27 fs/kernfs/dir.c static bool kernfs_active(struct kernfs_node *kn) kn 30 fs/kernfs/dir.c return atomic_read(&kn->active) >= 0; kn 33 fs/kernfs/dir.c static bool kernfs_lockdep(struct kernfs_node *kn) kn 36 fs/kernfs/dir.c return kn->flags & KERNFS_LOCKDEP; kn 42 fs/kernfs/dir.c static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen) kn 44 fs/kernfs/dir.c if (!kn) kn 47 fs/kernfs/dir.c return strlcpy(buf, kn->parent ? kn->name : "/", buflen); kn 71 fs/kernfs/dir.c da = kernfs_depth(ra->kn, a); kn 72 fs/kernfs/dir.c db = kernfs_depth(rb->kn, b); kn 126 fs/kernfs/dir.c struct kernfs_node *kn, *common; kn 135 fs/kernfs/dir.c kn_from = kernfs_root(kn_to)->kn; kn 158 fs/kernfs/dir.c for (kn = kn_to, j = 0; j < i; j++) kn 159 fs/kernfs/dir.c kn = kn->parent; kn 162 fs/kernfs/dir.c len += strlcpy(buf + len, kn->name, kn 183 fs/kernfs/dir.c int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen) kn 189 fs/kernfs/dir.c ret = kernfs_name_locked(kn, buf, buflen); kn 229 fs/kernfs/dir.c void pr_cont_kernfs_name(struct kernfs_node *kn) kn 235 fs/kernfs/dir.c kernfs_name_locked(kn, kernfs_pr_cont_buf, sizeof(kernfs_pr_cont_buf)); kn 247 fs/kernfs/dir.c void pr_cont_kernfs_path(struct kernfs_node *kn) kn 254 fs/kernfs/dir.c sz = kernfs_path_from_node_locked(kn, NULL, kernfs_pr_cont_buf, kn 279 fs/kernfs/dir.c struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn) kn 285 fs/kernfs/dir.c parent = kn->parent; kn 316 fs/kernfs/dir.c const void *ns, const struct kernfs_node *kn) kn 318 fs/kernfs/dir.c if (hash < kn->hash) kn 320 fs/kernfs/dir.c if (hash > kn->hash) kn 322 fs/kernfs/dir.c if (ns < kn->ns) kn 324 fs/kernfs/dir.c if (ns > kn->ns) kn 326 fs/kernfs/dir.c return strcmp(name, kn->name); kn 348 fs/kernfs/dir.c static int kernfs_link_sibling(struct kernfs_node *kn) kn 350 fs/kernfs/dir.c struct rb_node **node = &kn->parent->dir.children.rb_node; kn 359 fs/kernfs/dir.c result = kernfs_sd_compare(kn, pos); kn 369 fs/kernfs/dir.c rb_link_node(&kn->rb, parent, node); kn 370 fs/kernfs/dir.c rb_insert_color(&kn->rb, &kn->parent->dir.children); kn 373 fs/kernfs/dir.c if (kernfs_type(kn) == KERNFS_DIR) kn 374 fs/kernfs/dir.c kn->parent->dir.subdirs++; kn 390 fs/kernfs/dir.c static bool kernfs_unlink_sibling(struct kernfs_node *kn) kn 392 fs/kernfs/dir.c if (RB_EMPTY_NODE(&kn->rb)) kn 395 fs/kernfs/dir.c if (kernfs_type(kn) == KERNFS_DIR) kn 396 fs/kernfs/dir.c kn->parent->dir.subdirs--; kn 398 fs/kernfs/dir.c rb_erase(&kn->rb, &kn->parent->dir.children); kn 399 fs/kernfs/dir.c RB_CLEAR_NODE(&kn->rb); kn 413 fs/kernfs/dir.c struct kernfs_node *kernfs_get_active(struct kernfs_node *kn) kn 415 fs/kernfs/dir.c if (unlikely(!kn)) kn 418 fs/kernfs/dir.c if (!atomic_inc_unless_negative(&kn->active)) kn 421 fs/kernfs/dir.c if (kernfs_lockdep(kn)) kn 422 fs/kernfs/dir.c rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_); kn 423 fs/kernfs/dir.c return kn; kn 433 fs/kernfs/dir.c void kernfs_put_active(struct kernfs_node *kn) kn 437 fs/kernfs/dir.c if (unlikely(!kn)) kn 440 fs/kernfs/dir.c if (kernfs_lockdep(kn)) kn 441 fs/kernfs/dir.c rwsem_release(&kn->dep_map, 1, _RET_IP_); kn 442 fs/kernfs/dir.c v = atomic_dec_return(&kn->active); kn 446 fs/kernfs/dir.c wake_up_all(&kernfs_root(kn)->deactivate_waitq); kn 457 fs/kernfs/dir.c static void kernfs_drain(struct kernfs_node *kn) kn 460 fs/kernfs/dir.c struct kernfs_root *root = kernfs_root(kn); kn 463 fs/kernfs/dir.c WARN_ON_ONCE(kernfs_active(kn)); kn 467 fs/kernfs/dir.c if (kernfs_lockdep(kn)) { kn 468 fs/kernfs/dir.c rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_); kn 469 fs/kernfs/dir.c if (atomic_read(&kn->active) != KN_DEACTIVATED_BIAS) kn 470 fs/kernfs/dir.c lock_contended(&kn->dep_map, _RET_IP_); kn 475 fs/kernfs/dir.c atomic_read(&kn->active) == KN_DEACTIVATED_BIAS); kn 477 fs/kernfs/dir.c if (kernfs_lockdep(kn)) { kn 478 fs/kernfs/dir.c lock_acquired(&kn->dep_map, _RET_IP_); kn 479 fs/kernfs/dir.c rwsem_release(&kn->dep_map, 1, _RET_IP_); kn 482 fs/kernfs/dir.c kernfs_drain_open_files(kn); kn 491 fs/kernfs/dir.c void kernfs_get(struct kernfs_node *kn) kn 493 fs/kernfs/dir.c if (kn) { kn 494 fs/kernfs/dir.c WARN_ON(!atomic_read(&kn->count)); kn 495 fs/kernfs/dir.c atomic_inc(&kn->count); kn 506 fs/kernfs/dir.c void kernfs_put(struct kernfs_node *kn) kn 515 fs/kernfs/dir.c if (!kn || !atomic_dec_and_test(&kn->count)) kn 517 fs/kernfs/dir.c root = kernfs_root(kn); kn 523 fs/kernfs/dir.c parent = kn->parent; kn 525 fs/kernfs/dir.c WARN_ONCE(atomic_read(&kn->active) != KN_DEACTIVATED_BIAS, kn 527 fs/kernfs/dir.c parent ? parent->name : "", kn->name, atomic_read(&kn->active)); kn 529 fs/kernfs/dir.c if (kernfs_type(kn) == KERNFS_LINK) kn 530 fs/kernfs/dir.c kernfs_put(kn->symlink.target_kn); kn 532 fs/kernfs/dir.c kfree_const(kn->name); kn 534 fs/kernfs/dir.c if (kn->iattr) { kn 535 fs/kernfs/dir.c simple_xattrs_free(&kn->iattr->xattrs); kn 536 fs/kernfs/dir.c kmem_cache_free(kernfs_iattrs_cache, kn->iattr); kn 539 fs/kernfs/dir.c idr_remove(&root->ino_idr, kn->id.ino); kn 541 fs/kernfs/dir.c kmem_cache_free(kernfs_node_cache, kn); kn 543 fs/kernfs/dir.c kn = parent; kn 544 fs/kernfs/dir.c if (kn) { kn 545 fs/kernfs/dir.c if (atomic_dec_and_test(&kn->count)) kn 557 fs/kernfs/dir.c struct kernfs_node *kn; kn 566 fs/kernfs/dir.c kn = kernfs_dentry_node(dentry); kn 570 fs/kernfs/dir.c if (!kernfs_active(kn)) kn 574 fs/kernfs/dir.c if (kernfs_dentry_node(dentry->d_parent) != kn->parent) kn 578 fs/kernfs/dir.c if (strcmp(dentry->d_name.name, kn->name) != 0) kn 582 fs/kernfs/dir.c if (kn->parent && kernfs_ns_enabled(kn->parent) && kn 583 fs/kernfs/dir.c kernfs_info(dentry->d_sb)->ns != kn->ns) kn 623 fs/kernfs/dir.c struct kernfs_node *kn; kn 631 fs/kernfs/dir.c kn = kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL); kn 632 fs/kernfs/dir.c if (!kn) kn 637 fs/kernfs/dir.c ret = idr_alloc_cyclic(&root->ino_idr, kn, 1, 0, GFP_ATOMIC); kn 646 fs/kernfs/dir.c kn->id.ino = ret; kn 647 fs/kernfs/dir.c kn->id.generation = gen; kn 653 fs/kernfs/dir.c atomic_set_release(&kn->count, 1); kn 654 fs/kernfs/dir.c atomic_set(&kn->active, KN_DEACTIVATED_BIAS); kn 655 fs/kernfs/dir.c RB_CLEAR_NODE(&kn->rb); kn 657 fs/kernfs/dir.c kn->name = name; kn 658 fs/kernfs/dir.c kn->mode = mode; kn 659 fs/kernfs/dir.c kn->flags = flags; kn 668 fs/kernfs/dir.c ret = __kernfs_setattr(kn, &iattr); kn 674 fs/kernfs/dir.c ret = security_kernfs_init_security(parent, kn); kn 679 fs/kernfs/dir.c return kn; kn 682 fs/kernfs/dir.c idr_remove(&root->ino_idr, kn->id.ino); kn 684 fs/kernfs/dir.c kmem_cache_free(kernfs_node_cache, kn); kn 695 fs/kernfs/dir.c struct kernfs_node *kn; kn 697 fs/kernfs/dir.c kn = __kernfs_new_node(kernfs_root(parent), parent, kn 699 fs/kernfs/dir.c if (kn) { kn 701 fs/kernfs/dir.c kn->parent = parent; kn 703 fs/kernfs/dir.c return kn; kn 717 fs/kernfs/dir.c struct kernfs_node *kn; kn 720 fs/kernfs/dir.c kn = idr_find(&root->ino_idr, ino); kn 721 fs/kernfs/dir.c if (!kn) kn 731 fs/kernfs/dir.c if (!atomic_inc_not_zero(&kn->count)) { kn 732 fs/kernfs/dir.c kn = NULL; kn 743 fs/kernfs/dir.c if (kn->id.ino != ino) kn 747 fs/kernfs/dir.c return kn; kn 750 fs/kernfs/dir.c kernfs_put(kn); kn 766 fs/kernfs/dir.c int kernfs_add_one(struct kernfs_node *kn) kn 768 fs/kernfs/dir.c struct kernfs_node *parent = kn->parent; kn 777 fs/kernfs/dir.c if (WARN(has_ns != (bool)kn->ns, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n", kn 778 fs/kernfs/dir.c has_ns ? "required" : "invalid", parent->name, kn->name)) kn 791 fs/kernfs/dir.c kn->hash = kernfs_name_hash(kn->name, kn->ns); kn 793 fs/kernfs/dir.c ret = kernfs_link_sibling(kn); kn 813 fs/kernfs/dir.c if (!(kernfs_root(kn)->flags & KERNFS_ROOT_CREATE_DEACTIVATED)) kn 814 fs/kernfs/dir.c kernfs_activate(kn); kn 849 fs/kernfs/dir.c struct kernfs_node *kn; kn 852 fs/kernfs/dir.c kn = rb_to_kn(node); kn 853 fs/kernfs/dir.c result = kernfs_name_compare(hash, name, ns, kn); kn 859 fs/kernfs/dir.c return kn; kn 909 fs/kernfs/dir.c struct kernfs_node *kn; kn 912 fs/kernfs/dir.c kn = kernfs_find_ns(parent, name, ns); kn 913 fs/kernfs/dir.c kernfs_get(kn); kn 916 fs/kernfs/dir.c return kn; kn 933 fs/kernfs/dir.c struct kernfs_node *kn; kn 936 fs/kernfs/dir.c kn = kernfs_walk_ns(parent, path, ns); kn 937 fs/kernfs/dir.c kernfs_get(kn); kn 940 fs/kernfs/dir.c return kn; kn 956 fs/kernfs/dir.c struct kernfs_node *kn; kn 966 fs/kernfs/dir.c kn = __kernfs_new_node(root, NULL, "", S_IFDIR | S_IRUGO | S_IXUGO, kn 969 fs/kernfs/dir.c if (!kn) { kn 975 fs/kernfs/dir.c kn->priv = priv; kn 976 fs/kernfs/dir.c kn->dir.root = root; kn 980 fs/kernfs/dir.c root->kn = kn; kn 984 fs/kernfs/dir.c kernfs_activate(kn); kn 998 fs/kernfs/dir.c kernfs_remove(root->kn); /* will also free @root */ kn 1018 fs/kernfs/dir.c struct kernfs_node *kn; kn 1022 fs/kernfs/dir.c kn = kernfs_new_node(parent, name, mode | S_IFDIR, kn 1024 fs/kernfs/dir.c if (!kn) kn 1027 fs/kernfs/dir.c kn->dir.root = parent->dir.root; kn 1028 fs/kernfs/dir.c kn->ns = ns; kn 1029 fs/kernfs/dir.c kn->priv = priv; kn 1032 fs/kernfs/dir.c rc = kernfs_add_one(kn); kn 1034 fs/kernfs/dir.c return kn; kn 1036 fs/kernfs/dir.c kernfs_put(kn); kn 1050 fs/kernfs/dir.c struct kernfs_node *kn; kn 1054 fs/kernfs/dir.c kn = kernfs_new_node(parent, name, S_IRUGO|S_IXUGO|S_IFDIR, kn 1056 fs/kernfs/dir.c if (!kn) kn 1059 fs/kernfs/dir.c kn->flags |= KERNFS_EMPTY_DIR; kn 1060 fs/kernfs/dir.c kn->dir.root = parent->dir.root; kn 1061 fs/kernfs/dir.c kn->ns = NULL; kn 1062 fs/kernfs/dir.c kn->priv = NULL; kn 1065 fs/kernfs/dir.c rc = kernfs_add_one(kn); kn 1067 fs/kernfs/dir.c return kn; kn 1069 fs/kernfs/dir.c kernfs_put(kn); kn 1079 fs/kernfs/dir.c struct kernfs_node *kn; kn 1088 fs/kernfs/dir.c kn = kernfs_find_ns(parent, dentry->d_name.name, ns); kn 1091 fs/kernfs/dir.c if (!kn || !kernfs_active(kn)) { kn 1097 fs/kernfs/dir.c inode = kernfs_get_inode(dir->i_sb, kn); kn 1131 fs/kernfs/dir.c struct kernfs_node *kn = kernfs_dentry_node(dentry); kn 1132 fs/kernfs/dir.c struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops; kn 1138 fs/kernfs/dir.c if (!kernfs_get_active(kn)) kn 1141 fs/kernfs/dir.c ret = scops->rmdir(kn); kn 1143 fs/kernfs/dir.c kernfs_put_active(kn); kn 1151 fs/kernfs/dir.c struct kernfs_node *kn = kernfs_dentry_node(old_dentry); kn 1153 fs/kernfs/dir.c struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops; kn 1162 fs/kernfs/dir.c if (!kernfs_get_active(kn)) kn 1166 fs/kernfs/dir.c kernfs_put_active(kn); kn 1170 fs/kernfs/dir.c ret = scops->rename(kn, new_parent, new_dentry->d_name.name); kn 1173 fs/kernfs/dir.c kernfs_put_active(kn); kn 1257 fs/kernfs/dir.c void kernfs_activate(struct kernfs_node *kn) kn 1264 fs/kernfs/dir.c while ((pos = kernfs_next_descendant_post(pos, kn))) { kn 1278 fs/kernfs/dir.c static void __kernfs_remove(struct kernfs_node *kn) kn 1289 fs/kernfs/dir.c if (!kn || (kn->parent && RB_EMPTY_NODE(&kn->rb))) kn 1292 fs/kernfs/dir.c pr_debug("kernfs %s: removing\n", kn->name); kn 1296 fs/kernfs/dir.c while ((pos = kernfs_next_descendant_post(pos, kn))) kn 1302 fs/kernfs/dir.c pos = kernfs_leftmost_descendant(kn); kn 1318 fs/kernfs/dir.c if (kn->flags & KERNFS_ACTIVATED) kn 1321 fs/kernfs/dir.c WARN_ON_ONCE(atomic_read(&kn->active) != KN_DEACTIVATED_BIAS); kn 1341 fs/kernfs/dir.c } while (pos != kn); kn 1350 fs/kernfs/dir.c void kernfs_remove(struct kernfs_node *kn) kn 1353 fs/kernfs/dir.c __kernfs_remove(kn); kn 1371 fs/kernfs/dir.c void kernfs_break_active_protection(struct kernfs_node *kn) kn 1377 fs/kernfs/dir.c kernfs_put_active(kn); kn 1395 fs/kernfs/dir.c void kernfs_unbreak_active_protection(struct kernfs_node *kn) kn 1406 fs/kernfs/dir.c atomic_inc(&kn->active); kn 1407 fs/kernfs/dir.c if (kernfs_lockdep(kn)) kn 1408 fs/kernfs/dir.c rwsem_acquire(&kn->dep_map, 0, 1, _RET_IP_); kn 1437 fs/kernfs/dir.c bool kernfs_remove_self(struct kernfs_node *kn) kn 1442 fs/kernfs/dir.c kernfs_break_active_protection(kn); kn 1453 fs/kernfs/dir.c if (!(kn->flags & KERNFS_SUICIDAL)) { kn 1454 fs/kernfs/dir.c kn->flags |= KERNFS_SUICIDAL; kn 1455 fs/kernfs/dir.c __kernfs_remove(kn); kn 1456 fs/kernfs/dir.c kn->flags |= KERNFS_SUICIDED; kn 1459 fs/kernfs/dir.c wait_queue_head_t *waitq = &kernfs_root(kn)->deactivate_waitq; kn 1465 fs/kernfs/dir.c if ((kn->flags & KERNFS_SUICIDED) && kn 1466 fs/kernfs/dir.c atomic_read(&kn->active) == KN_DEACTIVATED_BIAS) kn 1474 fs/kernfs/dir.c WARN_ON_ONCE(!RB_EMPTY_NODE(&kn->rb)); kn 1482 fs/kernfs/dir.c kernfs_unbreak_active_protection(kn); kn 1500 fs/kernfs/dir.c struct kernfs_node *kn; kn 1510 fs/kernfs/dir.c kn = kernfs_find_ns(parent, name, ns); kn 1511 fs/kernfs/dir.c if (kn) kn 1512 fs/kernfs/dir.c __kernfs_remove(kn); kn 1516 fs/kernfs/dir.c if (kn) kn 1529 fs/kernfs/dir.c int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, kn 1537 fs/kernfs/dir.c if (!kn->parent) kn 1543 fs/kernfs/dir.c if (!kernfs_active(kn) || !kernfs_active(new_parent) || kn 1548 fs/kernfs/dir.c if ((kn->parent == new_parent) && (kn->ns == new_ns) && kn 1549 fs/kernfs/dir.c (strcmp(kn->name, new_name) == 0)) kn 1557 fs/kernfs/dir.c if (strcmp(kn->name, new_name) != 0) { kn 1569 fs/kernfs/dir.c kernfs_unlink_sibling(kn); kn 1575 fs/kernfs/dir.c old_parent = kn->parent; kn 1576 fs/kernfs/dir.c kn->parent = new_parent; kn 1578 fs/kernfs/dir.c kn->ns = new_ns; kn 1580 fs/kernfs/dir.c old_name = kn->name; kn 1581 fs/kernfs/dir.c kn->name = new_name; kn 1586 fs/kernfs/dir.c kn->hash = kernfs_name_hash(kn->name, kn->ns); kn 1587 fs/kernfs/dir.c kernfs_link_sibling(kn); kn 1599 fs/kernfs/dir.c static inline unsigned char dt_type(struct kernfs_node *kn) kn 1601 fs/kernfs/dir.c return (kn->mode >> 12) & 15; kn 63 fs/kernfs/file.c static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn) kn 65 fs/kernfs/file.c if (kn->flags & KERNFS_LOCKDEP) kn 66 fs/kernfs/file.c lockdep_assert_held(kn); kn 67 fs/kernfs/file.c return kn->attr.ops; kn 95 fs/kernfs/file.c const struct kernfs_ops *ops = kernfs_ops(of->kn); kn 99 fs/kernfs/file.c kernfs_put_active(of->kn); kn 112 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 115 fs/kernfs/file.c ops = kernfs_ops(of->kn); kn 134 fs/kernfs/file.c const struct kernfs_ops *ops = kernfs_ops(of->kn); kn 165 fs/kernfs/file.c of->event = atomic_read(&of->kn->attr.open->event); kn 167 fs/kernfs/file.c return of->kn->attr.ops->seq_show(sf, v); kn 204 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) { kn 210 fs/kernfs/file.c of->event = atomic_read(&of->kn->attr.open->event); kn 211 fs/kernfs/file.c ops = kernfs_ops(of->kn); kn 217 fs/kernfs/file.c kernfs_put_active(of->kn); kn 250 fs/kernfs/file.c if (of->kn->flags & KERNFS_HAS_SEQ_SHOW) kn 307 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) { kn 313 fs/kernfs/file.c ops = kernfs_ops(of->kn); kn 319 fs/kernfs/file.c kernfs_put_active(of->kn); kn 341 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 347 fs/kernfs/file.c kernfs_put_active(of->kn); kn 359 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 366 fs/kernfs/file.c kernfs_put_active(of->kn); kn 379 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 388 fs/kernfs/file.c kernfs_put_active(of->kn); kn 402 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 409 fs/kernfs/file.c kernfs_put_active(of->kn); kn 424 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 431 fs/kernfs/file.c kernfs_put_active(of->kn); kn 445 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 452 fs/kernfs/file.c kernfs_put_active(of->kn); kn 482 fs/kernfs/file.c if (!(of->kn->flags & KERNFS_HAS_MMAP)) kn 488 fs/kernfs/file.c if (!kernfs_get_active(of->kn)) kn 491 fs/kernfs/file.c ops = kernfs_ops(of->kn); kn 521 fs/kernfs/file.c kernfs_put_active(of->kn); kn 542 fs/kernfs/file.c static int kernfs_get_open_node(struct kernfs_node *kn, kn 551 fs/kernfs/file.c if (!kn->attr.open && new_on) { kn 552 fs/kernfs/file.c kn->attr.open = new_on; kn 556 fs/kernfs/file.c on = kn->attr.open; kn 593 fs/kernfs/file.c static void kernfs_put_open_node(struct kernfs_node *kn, kn 596 fs/kernfs/file.c struct kernfs_open_node *on = kn->attr.open; kn 606 fs/kernfs/file.c kn->attr.open = NULL; kn 618 fs/kernfs/file.c struct kernfs_node *kn = inode->i_private; kn 619 fs/kernfs/file.c struct kernfs_root *root = kernfs_root(kn); kn 625 fs/kernfs/file.c if (!kernfs_get_active(kn)) kn 628 fs/kernfs/file.c ops = kernfs_ops(kn); kn 671 fs/kernfs/file.c of->kn = kn; kn 717 fs/kernfs/file.c error = kernfs_get_open_node(kn, of); kn 729 fs/kernfs/file.c kernfs_put_active(kn); kn 733 fs/kernfs/file.c kernfs_put_open_node(kn, of); kn 740 fs/kernfs/file.c kernfs_put_active(kn); kn 745 fs/kernfs/file.c static void kernfs_release_file(struct kernfs_node *kn, kn 763 fs/kernfs/file.c kn->attr.ops->release(of); kn 770 fs/kernfs/file.c struct kernfs_node *kn = inode->i_private; kn 773 fs/kernfs/file.c if (kn->flags & KERNFS_HAS_RELEASE) { kn 775 fs/kernfs/file.c kernfs_release_file(kn, of); kn 779 fs/kernfs/file.c kernfs_put_open_node(kn, of); kn 787 fs/kernfs/file.c void kernfs_drain_open_files(struct kernfs_node *kn) kn 792 fs/kernfs/file.c if (!(kn->flags & (KERNFS_HAS_MMAP | KERNFS_HAS_RELEASE))) kn 796 fs/kernfs/file.c on = kn->attr.open; kn 808 fs/kernfs/file.c if (kn->flags & KERNFS_HAS_MMAP) kn 811 fs/kernfs/file.c if (kn->flags & KERNFS_HAS_RELEASE) kn 812 fs/kernfs/file.c kernfs_release_file(kn, of); kn 817 fs/kernfs/file.c kernfs_put_open_node(kn, NULL); kn 836 fs/kernfs/file.c struct kernfs_node *kn = kernfs_dentry_node(of->file->f_path.dentry); kn 837 fs/kernfs/file.c struct kernfs_open_node *on = kn->attr.open; kn 850 fs/kernfs/file.c struct kernfs_node *kn = kernfs_dentry_node(filp->f_path.dentry); kn 853 fs/kernfs/file.c if (!kernfs_get_active(kn)) kn 856 fs/kernfs/file.c if (kn->attr.ops->poll) kn 857 fs/kernfs/file.c ret = kn->attr.ops->poll(of, wait); kn 861 fs/kernfs/file.c kernfs_put_active(kn); kn 867 fs/kernfs/file.c struct kernfs_node *kn; kn 872 fs/kernfs/file.c kn = kernfs_notify_list; kn 873 fs/kernfs/file.c if (kn == KERNFS_NOTIFY_EOL) { kn 877 fs/kernfs/file.c kernfs_notify_list = kn->attr.notify_next; kn 878 fs/kernfs/file.c kn->attr.notify_next = NULL; kn 884 fs/kernfs/file.c list_for_each_entry(info, &kernfs_root(kn)->supers, node) { kn 895 fs/kernfs/file.c inode = ilookup(info->sb, kn->id.ino); kn 899 fs/kernfs/file.c name = (struct qstr)QSTR_INIT(kn->name, strlen(kn->name)); kn 900 fs/kernfs/file.c parent = kernfs_get_parent(kn); kn 920 fs/kernfs/file.c kernfs_put(kn); kn 931 fs/kernfs/file.c void kernfs_notify(struct kernfs_node *kn) kn 937 fs/kernfs/file.c if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) kn 942 fs/kernfs/file.c on = kn->attr.open; kn 951 fs/kernfs/file.c if (!kn->attr.notify_next) { kn 952 fs/kernfs/file.c kernfs_get(kn); kn 953 fs/kernfs/file.c kn->attr.notify_next = kernfs_notify_list; kn 954 fs/kernfs/file.c kernfs_notify_list = kn; kn 995 fs/kernfs/file.c struct kernfs_node *kn; kn 1001 fs/kernfs/file.c kn = kernfs_new_node(parent, name, (mode & S_IALLUGO) | S_IFREG, kn 1003 fs/kernfs/file.c if (!kn) kn 1006 fs/kernfs/file.c kn->attr.ops = ops; kn 1007 fs/kernfs/file.c kn->attr.size = size; kn 1008 fs/kernfs/file.c kn->ns = ns; kn 1009 fs/kernfs/file.c kn->priv = priv; kn 1013 fs/kernfs/file.c lockdep_init_map(&kn->dep_map, "kn->count", key, 0); kn 1014 fs/kernfs/file.c kn->flags |= KERNFS_LOCKDEP; kn 1024 fs/kernfs/file.c kn->flags |= KERNFS_HAS_SEQ_SHOW; kn 1026 fs/kernfs/file.c kn->flags |= KERNFS_HAS_MMAP; kn 1028 fs/kernfs/file.c kn->flags |= KERNFS_HAS_RELEASE; kn 1030 fs/kernfs/file.c rc = kernfs_add_one(kn); kn 1032 fs/kernfs/file.c kernfs_put(kn); kn 1035 fs/kernfs/file.c return kn; kn 33 fs/kernfs/inode.c static struct kernfs_iattrs *__kernfs_iattrs(struct kernfs_node *kn, int alloc) kn 40 fs/kernfs/inode.c if (kn->iattr || !alloc) kn 43 fs/kernfs/inode.c kn->iattr = kmem_cache_zalloc(kernfs_iattrs_cache, GFP_KERNEL); kn 44 fs/kernfs/inode.c if (!kn->iattr) kn 48 fs/kernfs/inode.c kn->iattr->ia_uid = GLOBAL_ROOT_UID; kn 49 fs/kernfs/inode.c kn->iattr->ia_gid = GLOBAL_ROOT_GID; kn 51 fs/kernfs/inode.c ktime_get_real_ts64(&kn->iattr->ia_atime); kn 52 fs/kernfs/inode.c kn->iattr->ia_mtime = kn->iattr->ia_atime; kn 53 fs/kernfs/inode.c kn->iattr->ia_ctime = kn->iattr->ia_atime; kn 55 fs/kernfs/inode.c simple_xattrs_init(&kn->iattr->xattrs); kn 57 fs/kernfs/inode.c ret = kn->iattr; kn 62 fs/kernfs/inode.c static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) kn 64 fs/kernfs/inode.c return __kernfs_iattrs(kn, 1); kn 67 fs/kernfs/inode.c static struct kernfs_iattrs *kernfs_iattrs_noalloc(struct kernfs_node *kn) kn 69 fs/kernfs/inode.c return __kernfs_iattrs(kn, 0); kn 72 fs/kernfs/inode.c int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) kn 77 fs/kernfs/inode.c attrs = kernfs_iattrs(kn); kn 92 fs/kernfs/inode.c kn->mode = iattr->ia_mode; kn 103 fs/kernfs/inode.c int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) kn 108 fs/kernfs/inode.c ret = __kernfs_setattr(kn, iattr); kn 116 fs/kernfs/inode.c struct kernfs_node *kn = inode->i_private; kn 119 fs/kernfs/inode.c if (!kn) kn 127 fs/kernfs/inode.c error = __kernfs_setattr(kn, iattr); kn 141 fs/kernfs/inode.c struct kernfs_node *kn = kernfs_dentry_node(dentry); kn 144 fs/kernfs/inode.c attrs = kernfs_iattrs(kn); kn 168 fs/kernfs/inode.c static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) kn 170 fs/kernfs/inode.c struct kernfs_iattrs *attrs = kn->iattr; kn 172 fs/kernfs/inode.c inode->i_mode = kn->mode; kn 180 fs/kernfs/inode.c if (kernfs_type(kn) == KERNFS_DIR) kn 181 fs/kernfs/inode.c set_nlink(inode, kn->dir.subdirs + 2); kn 188 fs/kernfs/inode.c struct kernfs_node *kn = inode->i_private; kn 191 fs/kernfs/inode.c kernfs_refresh_inode(kn, inode); kn 198 fs/kernfs/inode.c static void kernfs_init_inode(struct kernfs_node *kn, struct inode *inode) kn 200 fs/kernfs/inode.c kernfs_get(kn); kn 201 fs/kernfs/inode.c inode->i_private = kn; kn 204 fs/kernfs/inode.c inode->i_generation = kn->id.generation; kn 206 fs/kernfs/inode.c set_default_inode_attr(inode, kn->mode); kn 207 fs/kernfs/inode.c kernfs_refresh_inode(kn, inode); kn 210 fs/kernfs/inode.c switch (kernfs_type(kn)) { kn 214 fs/kernfs/inode.c if (kn->flags & KERNFS_EMPTY_DIR) kn 218 fs/kernfs/inode.c inode->i_size = kn->attr.size; kn 246 fs/kernfs/inode.c struct inode *kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn) kn 250 fs/kernfs/inode.c inode = iget_locked(sb, kn->id.ino); kn 252 fs/kernfs/inode.c kernfs_init_inode(kn, inode); kn 266 fs/kernfs/inode.c struct kernfs_node *kn = inode->i_private; kn 270 fs/kernfs/inode.c kernfs_put(kn); kn 275 fs/kernfs/inode.c struct kernfs_node *kn; kn 280 fs/kernfs/inode.c kn = inode->i_private; kn 283 fs/kernfs/inode.c kernfs_refresh_inode(kn, inode); kn 289 fs/kernfs/inode.c int kernfs_xattr_get(struct kernfs_node *kn, const char *name, kn 292 fs/kernfs/inode.c struct kernfs_iattrs *attrs = kernfs_iattrs_noalloc(kn); kn 299 fs/kernfs/inode.c int kernfs_xattr_set(struct kernfs_node *kn, const char *name, kn 302 fs/kernfs/inode.c struct kernfs_iattrs *attrs = kernfs_iattrs(kn); kn 314 fs/kernfs/inode.c struct kernfs_node *kn = inode->i_private; kn 316 fs/kernfs/inode.c return kernfs_xattr_get(kn, name, value, size); kn 325 fs/kernfs/inode.c struct kernfs_node *kn = inode->i_private; kn 327 fs/kernfs/inode.c return kernfs_xattr_set(kn, name, value, size, flags); kn 42 fs/kernfs/kernfs-internal.h static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) kn 45 fs/kernfs/kernfs-internal.h if (kn->parent) kn 46 fs/kernfs/kernfs-internal.h kn = kn->parent; kn 47 fs/kernfs/kernfs-internal.h return kn->dir.root; kn 95 fs/kernfs/kernfs-internal.h int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); kn 105 fs/kernfs/kernfs-internal.h struct kernfs_node *kernfs_get_active(struct kernfs_node *kn); kn 106 fs/kernfs/kernfs-internal.h void kernfs_put_active(struct kernfs_node *kn); kn 107 fs/kernfs/kernfs-internal.h int kernfs_add_one(struct kernfs_node *kn); kn 120 fs/kernfs/kernfs-internal.h void kernfs_drain_open_files(struct kernfs_node *kn); kn 63 fs/kernfs/mount.c struct kernfs_node *kn; kn 65 fs/kernfs/mount.c kn = kernfs_find_and_get_node_by_ino(root, id->ino); kn 66 fs/kernfs/mount.c if (!kn) kn 68 fs/kernfs/mount.c if (kn->id.generation != id->generation) { kn 69 fs/kernfs/mount.c kernfs_put(kn); kn 72 fs/kernfs/mount.c return kn; kn 80 fs/kernfs/mount.c struct kernfs_node *kn; kn 85 fs/kernfs/mount.c kn = kernfs_find_and_get_node_by_ino(info->root, ino); kn 86 fs/kernfs/mount.c if (!kn) kn 88 fs/kernfs/mount.c inode = kernfs_get_inode(sb, kn); kn 89 fs/kernfs/mount.c kernfs_put(kn); kn 117 fs/kernfs/mount.c struct kernfs_node *kn = kernfs_dentry_node(child); kn 119 fs/kernfs/mount.c return d_obtain_alias(kernfs_get_inode(child->d_sb, kn->parent)); kn 172 fs/kernfs/mount.c struct dentry *kernfs_node_dentry(struct kernfs_node *kn, kn 183 fs/kernfs/mount.c if (!kn->parent) kn 186 fs/kernfs/mount.c knparent = find_next_ancestor(kn, NULL); kn 196 fs/kernfs/mount.c if (kn == knparent) kn 198 fs/kernfs/mount.c kntmp = find_next_ancestor(kn, knparent); kn 236 fs/kernfs/mount.c inode = kernfs_get_inode(sb, info->root->kn); kn 29 fs/kernfs/symlink.c struct kernfs_node *kn; kn 39 fs/kernfs/symlink.c kn = kernfs_new_node(parent, name, S_IFLNK|S_IRWXUGO, uid, gid, kn 41 fs/kernfs/symlink.c if (!kn) kn 45 fs/kernfs/symlink.c kn->ns = target->ns; kn 46 fs/kernfs/symlink.c kn->symlink.target_kn = target; kn 49 fs/kernfs/symlink.c error = kernfs_add_one(kn); kn 51 fs/kernfs/symlink.c return kn; kn 53 fs/kernfs/symlink.c kernfs_put(kn); kn 60 fs/kernfs/symlink.c struct kernfs_node *base, *kn; kn 67 fs/kernfs/symlink.c kn = target->parent; kn 68 fs/kernfs/symlink.c while (kn->parent && base != kn) kn 69 fs/kernfs/symlink.c kn = kn->parent; kn 71 fs/kernfs/symlink.c if (base == kn) kn 83 fs/kernfs/symlink.c kn = target; kn 84 fs/kernfs/symlink.c while (kn->parent && kn != base) { kn 85 fs/kernfs/symlink.c len += strlen(kn->name) + 1; kn 86 fs/kernfs/symlink.c kn = kn->parent; kn 97 fs/kernfs/symlink.c kn = target; kn 98 fs/kernfs/symlink.c while (kn->parent && kn != base) { kn 99 fs/kernfs/symlink.c int slen = strlen(kn->name); kn 102 fs/kernfs/symlink.c memcpy(s + len, kn->name, slen); kn 106 fs/kernfs/symlink.c kn = kn->parent; kn 114 fs/kernfs/symlink.c struct kernfs_node *kn = inode->i_private; kn 115 fs/kernfs/symlink.c struct kernfs_node *parent = kn->parent; kn 116 fs/kernfs/symlink.c struct kernfs_node *target = kn->symlink.target_kn; kn 42 fs/sysfs/dir.c struct kernfs_node *parent, *kn; kn 59 fs/sysfs/dir.c kn = kernfs_create_dir_ns(parent, kobject_name(kobj), kn 62 fs/sysfs/dir.c if (IS_ERR(kn)) { kn 63 fs/sysfs/dir.c if (PTR_ERR(kn) == -EEXIST) kn 65 fs/sysfs/dir.c return PTR_ERR(kn); kn 68 fs/sysfs/dir.c kobj->sd = kn; kn 82 fs/sysfs/dir.c struct kernfs_node *kn = kobj->sd; kn 100 fs/sysfs/dir.c if (kn) { kn 101 fs/sysfs/dir.c WARN_ON_ONCE(kernfs_type(kn) != KERNFS_DIR); kn 102 fs/sysfs/dir.c kernfs_remove(kn); kn 121 fs/sysfs/dir.c struct kernfs_node *kn = kobj->sd; kn 127 fs/sysfs/dir.c return kernfs_rename_ns(kn, new_parent, kn->name, new_ns); kn 137 fs/sysfs/dir.c struct kernfs_node *kn, *parent = parent_kobj->sd; kn 139 fs/sysfs/dir.c kn = kernfs_create_empty_dir(parent, name); kn 140 fs/sysfs/dir.c if (IS_ERR(kn)) { kn 141 fs/sysfs/dir.c if (PTR_ERR(kn) == -EEXIST) kn 143 fs/sysfs/dir.c return PTR_ERR(kn); kn 25 fs/sysfs/file.c static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) kn 27 fs/sysfs/file.c struct kobject *kobj = kn->parent->priv; kn 29 fs/sysfs/file.c if (kn->flags & KERNFS_LOCKDEP) kn 30 fs/sysfs/file.c lockdep_assert_held(kn); kn 42 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 43 fs/sysfs/file.c const struct sysfs_ops *ops = sysfs_file_ops(of->kn); kn 60 fs/sysfs/file.c count = ops->show(kobj, of->kn->priv, buf); kn 82 fs/sysfs/file.c struct bin_attribute *battr = of->kn->priv; kn 83 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 106 fs/sysfs/file.c const struct sysfs_ops *ops = sysfs_file_ops(of->kn); kn 107 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 116 fs/sysfs/file.c len = ops->show(kobj, of->kn->priv, buf); kn 132 fs/sysfs/file.c const struct sysfs_ops *ops = sysfs_file_ops(of->kn); kn 133 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 138 fs/sysfs/file.c return ops->store(kobj, of->kn->priv, buf, count); kn 145 fs/sysfs/file.c struct bin_attribute *battr = of->kn->priv; kn 146 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 166 fs/sysfs/file.c struct bin_attribute *battr = of->kn->priv; kn 167 fs/sysfs/file.c struct kobject *kobj = of->kn->parent->priv; kn 174 fs/sysfs/file.c struct kernfs_node *kn = kobj->sd, *tmp; kn 176 fs/sysfs/file.c if (kn && dir) kn 177 fs/sysfs/file.c kn = kernfs_find_and_get(kn, dir); kn 179 fs/sysfs/file.c kernfs_get(kn); kn 181 fs/sysfs/file.c if (kn && attr) { kn 182 fs/sysfs/file.c tmp = kernfs_find_and_get(kn, attr); kn 183 fs/sysfs/file.c kernfs_put(kn); kn 184 fs/sysfs/file.c kn = tmp; kn 187 fs/sysfs/file.c if (kn) { kn 188 fs/sysfs/file.c kernfs_notify(kn); kn 189 fs/sysfs/file.c kernfs_put(kn); kn 251 fs/sysfs/file.c struct kernfs_node *kn; kn 305 fs/sysfs/file.c kn = __kernfs_create_file(parent, attr->name, mode & 0777, uid, gid, kn 307 fs/sysfs/file.c if (IS_ERR(kn)) { kn 308 fs/sysfs/file.c if (PTR_ERR(kn) == -EEXIST) kn 310 fs/sysfs/file.c return PTR_ERR(kn); kn 394 fs/sysfs/file.c struct kernfs_node *kn; kn 398 fs/sysfs/file.c kn = kernfs_find_and_get(kobj->sd, attr->name); kn 399 fs/sysfs/file.c if (!kn) kn 402 fs/sysfs/file.c newattrs.ia_mode = (mode & S_IALLUGO) | (kn->mode & ~S_IALLUGO); kn 405 fs/sysfs/file.c rc = kernfs_setattr(kn, &newattrs); kn 407 fs/sysfs/file.c kernfs_put(kn); kn 425 fs/sysfs/file.c struct kernfs_node *kn; kn 428 fs/sysfs/file.c kn = kernfs_find_and_get(kobj->sd, attr->name); kn 429 fs/sysfs/file.c if (kn) kn 430 fs/sysfs/file.c kernfs_break_active_protection(kn); kn 431 fs/sysfs/file.c return kn; kn 446 fs/sysfs/file.c void sysfs_unbreak_active_protection(struct kernfs_node *kn) kn 448 fs/sysfs/file.c struct kobject *kobj = kn->parent->priv; kn 450 fs/sysfs/file.c kernfs_unbreak_active_protection(kn); kn 451 fs/sysfs/file.c kernfs_put(kn); kn 483 fs/sysfs/file.c struct kernfs_node *kn; kn 486 fs/sysfs/file.c kn = kernfs_find_and_get(parent, attr->name); kn 487 fs/sysfs/file.c if (WARN_ON_ONCE(!kn)) kn 490 fs/sysfs/file.c ret = kernfs_remove_self(kn); kn 492 fs/sysfs/file.c kernfs_put(kn); kn 110 fs/sysfs/group.c struct kernfs_node *kn; kn 129 fs/sysfs/group.c kn = kernfs_find_and_get(kobj->sd, grp->name); kn 130 fs/sysfs/group.c if (!kn) { kn 136 fs/sysfs/group.c kn = kernfs_create_dir_ns(kobj->sd, grp->name, kn 139 fs/sysfs/group.c if (IS_ERR(kn)) { kn 140 fs/sysfs/group.c if (PTR_ERR(kn) == -EEXIST) kn 142 fs/sysfs/group.c return PTR_ERR(kn); kn 146 fs/sysfs/group.c kn = kobj->sd; kn 147 fs/sysfs/group.c kernfs_get(kn); kn 148 fs/sysfs/group.c error = create_files(kn, kobj, uid, gid, grp, update); kn 151 fs/sysfs/group.c kernfs_remove(kn); kn 153 fs/sysfs/group.c kernfs_put(kn); kn 156 fs/sysfs/group.c kernfs_put(kn); kn 273 fs/sysfs/group.c struct kernfs_node *kn; kn 276 fs/sysfs/group.c kn = kernfs_find_and_get(parent, grp->name); kn 277 fs/sysfs/group.c if (!kn) { kn 278 fs/sysfs/group.c WARN(!kn, KERN_WARNING kn 284 fs/sysfs/group.c kn = parent; kn 285 fs/sysfs/group.c kernfs_get(kn); kn 288 fs/sysfs/group.c remove_files(kn, grp); kn 290 fs/sysfs/group.c kernfs_remove(kn); kn 292 fs/sysfs/group.c kernfs_put(kn); kn 106 fs/sysfs/mount.c sysfs_root_kn = sysfs_root->kn; kn 24 fs/sysfs/symlink.c struct kernfs_node *kn, *target = NULL; kn 44 fs/sysfs/symlink.c kn = kernfs_create_link(parent, name, target); kn 47 fs/sysfs/symlink.c if (!IS_ERR(kn)) kn 50 fs/sysfs/symlink.c if (warn && PTR_ERR(kn) == -EEXIST) kn 52 fs/sysfs/symlink.c return PTR_ERR(kn); kn 61 fs/sysfs/symlink.c int sysfs_create_link_sd(struct kernfs_node *kn, struct kobject *target, kn 64 fs/sysfs/symlink.c return sysfs_do_create_link_sd(kn, target, name, 1); kn 169 fs/sysfs/symlink.c struct kernfs_node *parent, *kn = NULL; kn 182 fs/sysfs/symlink.c kn = kernfs_find_and_get_ns(parent, old, old_ns); kn 183 fs/sysfs/symlink.c if (!kn) kn 187 fs/sysfs/symlink.c if (kernfs_type(kn) != KERNFS_LINK) kn 189 fs/sysfs/symlink.c if (kn->symlink.target_kn->priv != targ) kn 192 fs/sysfs/symlink.c result = kernfs_rename_ns(kn, parent, new, new_ns); kn 195 fs/sysfs/symlink.c kernfs_put(kn); kn 38 fs/sysfs/sysfs.h int sysfs_create_link_sd(struct kernfs_node *kn, struct kobject *target, kn 121 include/linux/cgroup-defs.h struct kernfs_node *kn; kn 410 include/linux/cgroup-defs.h struct kernfs_node *kn; /* cgroup kernfs entry */ kn 621 include/linux/cgroup.h return cgrp->kn->id.ino; kn 627 include/linux/cgroup.h return of->kn->priv; kn 650 include/linux/cgroup.h return kernfs_name(cgrp->kn, buf, buflen); kn 655 include/linux/cgroup.h return kernfs_path(cgrp->kn, buf, buflen); kn 660 include/linux/cgroup.h pr_cont_kernfs_name(cgrp->kn); kn 665 include/linux/cgroup.h pr_cont_kernfs_path(cgrp->kn); kn 694 include/linux/cgroup.h return &cgrp->kn->id; kn 176 include/linux/kernfs.h int (*rmdir)(struct kernfs_node *kn); kn 177 include/linux/kernfs.h int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent, kn 179 include/linux/kernfs.h int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, kn 185 include/linux/kernfs.h struct kernfs_node *kn; kn 202 include/linux/kernfs.h struct kernfs_node *kn; kn 290 include/linux/kernfs.h static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) kn 292 include/linux/kernfs.h return kn->flags & KERNFS_TYPE_MASK; kn 303 include/linux/kernfs.h static inline void kernfs_enable_ns(struct kernfs_node *kn) kn 305 include/linux/kernfs.h WARN_ON_ONCE(kernfs_type(kn) != KERNFS_DIR); kn 306 include/linux/kernfs.h WARN_ON_ONCE(!RB_EMPTY_ROOT(&kn->dir.children)); kn 307 include/linux/kernfs.h kn->flags |= KERNFS_NS; kn 316 include/linux/kernfs.h static inline bool kernfs_ns_enabled(struct kernfs_node *kn) kn 318 include/linux/kernfs.h return kn->flags & KERNFS_NS; kn 321 include/linux/kernfs.h int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen); kn 322 include/linux/kernfs.h int kernfs_path_from_node(struct kernfs_node *root_kn, struct kernfs_node *kn, kn 324 include/linux/kernfs.h void pr_cont_kernfs_name(struct kernfs_node *kn); kn 325 include/linux/kernfs.h void pr_cont_kernfs_path(struct kernfs_node *kn); kn 326 include/linux/kernfs.h struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn); kn 331 include/linux/kernfs.h void kernfs_get(struct kernfs_node *kn); kn 332 include/linux/kernfs.h void kernfs_put(struct kernfs_node *kn); kn 336 include/linux/kernfs.h struct inode *kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn); kn 338 include/linux/kernfs.h struct dentry *kernfs_node_dentry(struct kernfs_node *kn, kn 360 include/linux/kernfs.h void kernfs_activate(struct kernfs_node *kn); kn 361 include/linux/kernfs.h void kernfs_remove(struct kernfs_node *kn); kn 362 include/linux/kernfs.h void kernfs_break_active_protection(struct kernfs_node *kn); kn 363 include/linux/kernfs.h void kernfs_unbreak_active_protection(struct kernfs_node *kn); kn 364 include/linux/kernfs.h bool kernfs_remove_self(struct kernfs_node *kn); kn 367 include/linux/kernfs.h int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, kn 369 include/linux/kernfs.h int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); kn 372 include/linux/kernfs.h void kernfs_notify(struct kernfs_node *kn); kn 374 include/linux/kernfs.h int kernfs_xattr_get(struct kernfs_node *kn, const char *name, kn 376 include/linux/kernfs.h int kernfs_xattr_set(struct kernfs_node *kn, const char *name, kn 390 include/linux/kernfs.h static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) kn 393 include/linux/kernfs.h static inline void kernfs_enable_ns(struct kernfs_node *kn) { } kn 395 include/linux/kernfs.h static inline bool kernfs_ns_enabled(struct kernfs_node *kn) kn 398 include/linux/kernfs.h static inline int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen) kn 402 include/linux/kernfs.h struct kernfs_node *kn, kn 406 include/linux/kernfs.h static inline void pr_cont_kernfs_name(struct kernfs_node *kn) { } kn 407 include/linux/kernfs.h static inline void pr_cont_kernfs_path(struct kernfs_node *kn) { } kn 409 include/linux/kernfs.h static inline struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn) kn 421 include/linux/kernfs.h static inline void kernfs_get(struct kernfs_node *kn) { } kn 422 include/linux/kernfs.h static inline void kernfs_put(struct kernfs_node *kn) { } kn 431 include/linux/kernfs.h kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn) kn 459 include/linux/kernfs.h static inline void kernfs_activate(struct kernfs_node *kn) { } kn 461 include/linux/kernfs.h static inline void kernfs_remove(struct kernfs_node *kn) { } kn 463 include/linux/kernfs.h static inline bool kernfs_remove_self(struct kernfs_node *kn) kn 466 include/linux/kernfs.h static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn, kn 470 include/linux/kernfs.h static inline int kernfs_rename_ns(struct kernfs_node *kn, kn 475 include/linux/kernfs.h static inline int kernfs_setattr(struct kernfs_node *kn, kn 479 include/linux/kernfs.h static inline void kernfs_notify(struct kernfs_node *kn) { } kn 481 include/linux/kernfs.h static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name, kn 485 include/linux/kernfs.h static inline int kernfs_xattr_set(struct kernfs_node *kn, const char *name, kn 515 include/linux/kernfs.h static inline int kernfs_path(struct kernfs_node *kn, char *buf, size_t buflen) kn 517 include/linux/kernfs.h return kernfs_path_from_node(kn, NULL, buf, buflen); kn 521 include/linux/kernfs.h kernfs_find_and_get(struct kernfs_node *kn, const char *name) kn 523 include/linux/kernfs.h return kernfs_find_and_get_ns(kn, name, NULL); kn 527 include/linux/kernfs.h kernfs_walk_and_get(struct kernfs_node *kn, const char *path) kn 529 include/linux/kernfs.h return kernfs_walk_and_get_ns(kn, path, NULL); kn 571 include/linux/kernfs.h static inline int kernfs_rename(struct kernfs_node *kn, kn 575 include/linux/kernfs.h return kernfs_rename_ns(kn, new_parent, new_name, NULL); kn 1598 include/linux/lsm_hooks.h struct kernfs_node *kn); kn 358 include/linux/security.h struct kernfs_node *kn); kn 879 include/linux/security.h struct kernfs_node *kn) kn 251 include/linux/sysfs.h void sysfs_unbreak_active_protection(struct kernfs_node *kn); kn 308 include/linux/sysfs.h static inline void sysfs_enable_ns(struct kernfs_node *kn) kn 310 include/linux/sysfs.h return kernfs_enable_ns(kn); kn 374 include/linux/sysfs.h static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) kn 521 include/linux/sysfs.h static inline void sysfs_enable_ns(struct kernfs_node *kn) kn 545 include/linux/sysfs.h static inline void sysfs_notify_dirent(struct kernfs_node *kn) kn 547 include/linux/sysfs.h kernfs_notify(kn); kn 556 include/linux/sysfs.h static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn) kn 558 include/linux/sysfs.h kernfs_get(kn); kn 559 include/linux/sysfs.h return kn; kn 562 include/linux/sysfs.h static inline void sysfs_put(struct kernfs_node *kn) kn 564 include/linux/sysfs.h kernfs_put(kn); kn 154 include/trace/events/writeback.h return wb->memcg_css->cgroup->kn->id.ino; kn 262 include/trace/events/writeback.h __entry->page_cgroup_ino = page->mem_cgroup->css.cgroup->kn->id.ino; kn 320 kernel/bpf/helpers.c return cgrp->kn->id.id; kn 572 kernel/bpf/local_storage.c storage->key.cgroup_inode_id = cgroup->kn->id.id; kn 213 kernel/cgroup/cgroup-internal.h struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline); kn 214 kernel/cgroup/cgroup-internal.h void cgroup_kn_unlock(struct kernfs_node *kn); kn 242 kernel/cgroup/cgroup-internal.h int cgroup_rmdir(struct kernfs_node *kn); kn 500 kernel/cgroup/cgroup-v1.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 528 kernel/cgroup/cgroup-v1.c cgroup_kn_unlock(of->kn); kn 552 kernel/cgroup/cgroup-v1.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 559 kernel/cgroup/cgroup-v1.c cgroup_kn_unlock(of->kn); kn 692 kernel/cgroup/cgroup-v1.c struct kernfs_node *kn = kernfs_node_from_dentry(dentry); kn 698 kernel/cgroup/cgroup-v1.c if (dentry->d_sb->s_type != &cgroup_fs_type || !kn || kn 699 kernel/cgroup/cgroup-v1.c kernfs_type(kn) != KERNFS_DIR) kn 710 kernel/cgroup/cgroup-v1.c cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); kn 818 kernel/cgroup/cgroup-v1.c static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, kn 821 kernel/cgroup/cgroup-v1.c struct cgroup *cgrp = kn->priv; kn 824 kernel/cgroup/cgroup-v1.c if (kernfs_type(kn) != KERNFS_DIR) kn 826 kernel/cgroup/cgroup-v1.c if (kn->parent != new_parent) kn 835 kernel/cgroup/cgroup-v1.c kernfs_break_active_protection(kn); kn 839 kernel/cgroup/cgroup-v1.c ret = kernfs_rename(kn, new_parent, new_name_str); kn 845 kernel/cgroup/cgroup-v1.c kernfs_unbreak_active_protection(kn); kn 632 kernel/cgroup/cgroup.c struct cgroup *cgrp = of->kn->parent->priv; kn 1284 kernel/cgroup/cgroup.c struct cgroup *root_cgrp = kf_root->kn->priv; kn 1563 kernel/cgroup/cgroup.c void cgroup_kn_unlock(struct kernfs_node *kn) kn 1567 kernel/cgroup/cgroup.c if (kernfs_type(kn) == KERNFS_DIR) kn 1568 kernel/cgroup/cgroup.c cgrp = kn->priv; kn 1570 kernel/cgroup/cgroup.c cgrp = kn->parent->priv; kn 1574 kernel/cgroup/cgroup.c kernfs_unbreak_active_protection(kn); kn 1595 kernel/cgroup/cgroup.c struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) kn 1599 kernel/cgroup/cgroup.c if (kernfs_type(kn) == KERNFS_DIR) kn 1600 kernel/cgroup/cgroup.c cgrp = kn->priv; kn 1602 kernel/cgroup/cgroup.c cgrp = kn->parent->priv; kn 1612 kernel/cgroup/cgroup.c kernfs_break_active_protection(kn); kn 1622 kernel/cgroup/cgroup.c cgroup_kn_unlock(kn); kn 1637 kernel/cgroup/cgroup.c cfile->kn = NULL; kn 1643 kernel/cgroup/cgroup.c kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); kn 1685 kernel/cgroup/cgroup.c if ((css->flags & CSS_VISIBLE) || !cgrp->kn) kn 1785 kernel/cgroup/cgroup.c kernfs_activate(dcgrp->kn); kn 1803 kernel/cgroup/cgroup.c len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX); kn 2037 kernel/cgroup/cgroup.c root_cgrp->kn = root->kf_root->kn; kn 2075 kernel/cgroup/cgroup.c kernfs_activate(root_cgrp->kn); kn 2120 kernel/cgroup/cgroup.c nsdentry = kernfs_node_dentry(cgrp->kn, sb); kn 2295 kernel/cgroup/cgroup.c return kernfs_path_from_node(cgrp->kn, root->kn, buf, buflen); kn 3312 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, true); kn 3363 kernel/cgroup/cgroup.c kernfs_activate(cgrp->kn); kn 3365 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3452 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, true); kn 3459 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3495 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 3501 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3538 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 3544 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3631 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 3636 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3707 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 3713 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 3720 kernel/cgroup/cgroup.c struct cftype *cft = of->kn->priv; kn 3729 kernel/cgroup/cgroup.c struct cftype *cft = of->kn->priv; kn 3739 kernel/cgroup/cgroup.c struct cgroup *cgrp = of->kn->parent->priv; kn 3740 kernel/cgroup/cgroup.c struct cftype *cft = of->kn->priv; kn 3787 kernel/cgroup/cgroup.c struct cftype *cft = of->kn->priv; kn 3850 kernel/cgroup/cgroup.c static int cgroup_kn_set_ugid(struct kernfs_node *kn) kn 3860 kernel/cgroup/cgroup.c return kernfs_setattr(kn, &iattr); kn 3873 kernel/cgroup/cgroup.c struct kernfs_node *kn; kn 3880 kernel/cgroup/cgroup.c kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), kn 3885 kernel/cgroup/cgroup.c if (IS_ERR(kn)) kn 3886 kernel/cgroup/cgroup.c return PTR_ERR(kn); kn 3888 kernel/cgroup/cgroup.c ret = cgroup_kn_set_ugid(kn); kn 3890 kernel/cgroup/cgroup.c kernfs_remove(kn); kn 3900 kernel/cgroup/cgroup.c cfile->kn = kn; kn 3977 kernel/cgroup/cgroup.c kernfs_activate(root->kn); kn 4149 kernel/cgroup/cgroup.c if (cfile->kn) { kn 4156 kernel/cgroup/cgroup.c kernfs_notify(cfile->kn); kn 4745 kernel/cgroup/cgroup.c inode = kernfs_get_inode(sb, com_cgrp->procs_file.kn); kn 4773 kernel/cgroup/cgroup.c dst_cgrp = cgroup_kn_lock_live(of->kn, false); kn 4797 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 4816 kernel/cgroup/cgroup.c dst_cgrp = cgroup_kn_lock_live(of->kn, false); kn 4846 kernel/cgroup/cgroup.c cgroup_kn_unlock(of->kn); kn 5001 kernel/cgroup/cgroup.c kernfs_put(cgrp->kn); kn 5064 kernel/cgroup/cgroup.c if (cgrp->kn) kn 5065 kernel/cgroup/cgroup.c RCU_INIT_POINTER(*(void __rcu __force **)&cgrp->kn->priv, kn 5372 kernel/cgroup/cgroup.c struct kernfs_node *kn; kn 5395 kernel/cgroup/cgroup.c kn = kernfs_create_dir(parent->kn, name, mode, cgrp); kn 5396 kernel/cgroup/cgroup.c if (IS_ERR(kn)) { kn 5397 kernel/cgroup/cgroup.c ret = PTR_ERR(kn); kn 5400 kernel/cgroup/cgroup.c cgrp->kn = kn; kn 5406 kernel/cgroup/cgroup.c kernfs_get(kn); kn 5408 kernel/cgroup/cgroup.c ret = cgroup_kn_set_ugid(kn); kn 5423 kernel/cgroup/cgroup.c kernfs_activate(kn); kn 5580 kernel/cgroup/cgroup.c kernfs_remove(cgrp->kn); kn 5608 kernel/cgroup/cgroup.c int cgroup_rmdir(struct kernfs_node *kn) kn 5613 kernel/cgroup/cgroup.c cgrp = cgroup_kn_lock_live(kn, false); kn 5621 kernel/cgroup/cgroup.c cgroup_kn_unlock(kn); kn 5856 kernel/cgroup/cgroup.c struct kernfs_node *kn; kn 5858 kernel/cgroup/cgroup.c kn = kernfs_get_node_by_id(cgrp_dfl_root.kf_root, id); kn 5859 kernel/cgroup/cgroup.c if (!kn) kn 5861 kernel/cgroup/cgroup.c kernfs_path(kn, buf, buflen); kn 5862 kernel/cgroup/cgroup.c kernfs_put(kn); kn 6203 kernel/cgroup/cgroup.c struct kernfs_node *kn = kernfs_node_from_dentry(dentry); kn 6210 kernel/cgroup/cgroup.c !kn || kernfs_type(kn) != KERNFS_DIR) kn 6220 kernel/cgroup/cgroup.c cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); kn 6256 kernel/cgroup/cgroup.c struct kernfs_node *kn; kn 6261 kernel/cgroup/cgroup.c kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path); kn 6262 kernel/cgroup/cgroup.c if (kn) { kn 6263 kernel/cgroup/cgroup.c if (kernfs_type(kn) == KERNFS_DIR) { kn 6264 kernel/cgroup/cgroup.c cgrp = kn->priv; kn 6269 kernel/cgroup/cgroup.c kernfs_put(kn); kn 2360 kernel/cgroup/cpuset.c kernfs_break_active_protection(of->kn); kn 2390 kernel/cgroup/cpuset.c kernfs_unbreak_active_protection(of->kn); kn 48 kernel/cgroup/debug.c if (!cgroup_kn_lock_live(of->kn, false)) kn 72 kernel/cgroup/debug.c cgroup_kn_unlock(of->kn); kn 212 kernel/cgroup/debug.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 232 kernel/cgroup/debug.c cgroup_kn_unlock(of->kn); kn 260 kernel/cgroup/debug.c cgrp = cgroup_kn_lock_live(of->kn, false); kn 267 kernel/cgroup/debug.c cgroup_kn_unlock(of->kn); kn 4094 net/core/filter.c return cgrp->kn->id.id; kn 4119 net/core/filter.c return ancestor->kn->id.id; kn 45 net/mac802154/llsec.c struct ieee802154_llsec_key_entry *key, *kn; kn 63 net/mac802154/llsec.c list_for_each_entry_safe(key, kn, &sec->table.keys, list) { kn 1366 security/security.c struct kernfs_node *kn) kn 1368 security/security.c return call_int_hook(kernfs_init_security, 0, kn_dir, kn); kn 3462 security/selinux/hooks.c struct kernfs_node *kn) kn 3495 security/selinux/hooks.c u16 secclass = inode_mode_to_security_class(kn->mode); kn 3498 security/selinux/hooks.c q.name = kn->name; kn 3499 security/selinux/hooks.c q.hash_len = hashlen_string(kn_dir, kn->name); kn 3513 security/selinux/hooks.c rc = kernfs_xattr_set(kn, XATTR_NAME_SELINUX, context, clen,