• Home
  • Raw
  • Download

Lines Matching refs:kn

64 static const struct kernfs_ops *kernfs_ops(struct kernfs_node *kn)  in kernfs_ops()  argument
66 if (kn->flags & KERNFS_LOCKDEP) in kernfs_ops()
67 lockdep_assert_held(kn); in kernfs_ops()
68 return kn->attr.ops; in kernfs_ops()
96 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_stop_active()
100 kernfs_put_active(of->kn); in kernfs_seq_stop_active()
113 if (!kernfs_get_active(of->kn)) in kernfs_seq_start()
116 ops = kernfs_ops(of->kn); in kernfs_seq_start()
135 const struct kernfs_ops *ops = kernfs_ops(of->kn); in kernfs_seq_next()
166 of->event = atomic_read(&of->kn->attr.open->event); in kernfs_seq_show()
168 return of->kn->attr.ops->seq_show(sf, v); in kernfs_seq_show()
204 if (!kernfs_get_active(of->kn)) { in kernfs_file_read_iter()
210 of->event = atomic_read(&of->kn->attr.open->event); in kernfs_file_read_iter()
211 ops = kernfs_ops(of->kn); in kernfs_file_read_iter()
217 kernfs_put_active(of->kn); in kernfs_file_read_iter()
240 if (kernfs_of(iocb->ki_filp)->kn->flags & KERNFS_HAS_SEQ_SHOW) in kernfs_fop_read_iter()
288 if (!kernfs_get_active(of->kn)) { in kernfs_fop_write_iter()
294 ops = kernfs_ops(of->kn); in kernfs_fop_write_iter()
300 kernfs_put_active(of->kn); in kernfs_fop_write_iter()
322 if (!kernfs_get_active(of->kn)) in kernfs_vma_open()
328 kernfs_put_active(of->kn); in kernfs_vma_open()
340 if (!kernfs_get_active(of->kn)) in kernfs_vma_fault()
347 kernfs_put_active(of->kn); in kernfs_vma_fault()
360 if (!kernfs_get_active(of->kn)) in kernfs_vma_page_mkwrite()
369 kernfs_put_active(of->kn); in kernfs_vma_page_mkwrite()
383 if (!kernfs_get_active(of->kn)) in kernfs_vma_access()
390 kernfs_put_active(of->kn); in kernfs_vma_access()
405 if (!kernfs_get_active(of->kn)) in kernfs_vma_set_policy()
412 kernfs_put_active(of->kn); in kernfs_vma_set_policy()
426 if (!kernfs_get_active(of->kn)) in kernfs_vma_get_policy()
433 kernfs_put_active(of->kn); in kernfs_vma_get_policy()
463 if (!(of->kn->flags & KERNFS_HAS_MMAP)) in kernfs_fop_mmap()
469 if (!kernfs_get_active(of->kn)) in kernfs_fop_mmap()
472 ops = kernfs_ops(of->kn); in kernfs_fop_mmap()
502 kernfs_put_active(of->kn); in kernfs_fop_mmap()
523 static int kernfs_get_open_node(struct kernfs_node *kn, in kernfs_get_open_node() argument
532 if (!kn->attr.open && new_on) { in kernfs_get_open_node()
533 kn->attr.open = new_on; in kernfs_get_open_node()
537 on = kn->attr.open; in kernfs_get_open_node()
574 static void kernfs_put_open_node(struct kernfs_node *kn, in kernfs_put_open_node() argument
577 struct kernfs_open_node *on = kn->attr.open; in kernfs_put_open_node()
587 kn->attr.open = NULL; in kernfs_put_open_node()
599 struct kernfs_node *kn = inode->i_private; in kernfs_fop_open() local
600 struct kernfs_root *root = kernfs_root(kn); in kernfs_fop_open()
606 if (!kernfs_get_active(kn)) in kernfs_fop_open()
609 ops = kernfs_ops(kn); in kernfs_fop_open()
652 of->kn = kn; in kernfs_fop_open()
698 error = kernfs_get_open_node(kn, of); in kernfs_fop_open()
710 kernfs_put_active(kn); in kernfs_fop_open()
714 kernfs_put_open_node(kn, of); in kernfs_fop_open()
721 kernfs_put_active(kn); in kernfs_fop_open()
726 static void kernfs_release_file(struct kernfs_node *kn, in kernfs_release_file() argument
744 kn->attr.ops->release(of); in kernfs_release_file()
751 struct kernfs_node *kn = inode->i_private; in kernfs_fop_release() local
754 if (kn->flags & KERNFS_HAS_RELEASE) { in kernfs_fop_release()
756 kernfs_release_file(kn, of); in kernfs_fop_release()
760 kernfs_put_open_node(kn, of); in kernfs_fop_release()
768 void kernfs_drain_open_files(struct kernfs_node *kn) in kernfs_drain_open_files() argument
773 if (!(kn->flags & (KERNFS_HAS_MMAP | KERNFS_HAS_RELEASE))) in kernfs_drain_open_files()
777 on = kn->attr.open; in kernfs_drain_open_files()
789 if (kn->flags & KERNFS_HAS_MMAP) in kernfs_drain_open_files()
792 if (kn->flags & KERNFS_HAS_RELEASE) in kernfs_drain_open_files()
793 kernfs_release_file(kn, of); in kernfs_drain_open_files()
798 kernfs_put_open_node(kn, NULL); in kernfs_drain_open_files()
817 struct kernfs_node *kn = kernfs_dentry_node(of->file->f_path.dentry); in kernfs_generic_poll() local
818 struct kernfs_open_node *on = kn->attr.open; in kernfs_generic_poll()
831 struct kernfs_node *kn = kernfs_dentry_node(filp->f_path.dentry); in kernfs_fop_poll() local
834 if (!kernfs_get_active(kn)) in kernfs_fop_poll()
837 if (kn->attr.ops->poll) in kernfs_fop_poll()
838 ret = kn->attr.ops->poll(of, wait); in kernfs_fop_poll()
842 kernfs_put_active(kn); in kernfs_fop_poll()
848 struct kernfs_node *kn; in kernfs_notify_workfn() local
853 kn = kernfs_notify_list; in kernfs_notify_workfn()
854 if (kn == KERNFS_NOTIFY_EOL) { in kernfs_notify_workfn()
858 kernfs_notify_list = kn->attr.notify_next; in kernfs_notify_workfn()
859 kn->attr.notify_next = NULL; in kernfs_notify_workfn()
865 list_for_each_entry(info, &kernfs_root(kn)->supers, node) { in kernfs_notify_workfn()
877 inode = ilookup(info->sb, kernfs_ino(kn)); in kernfs_notify_workfn()
881 name = (struct qstr)QSTR_INIT(kn->name, strlen(kn->name)); in kernfs_notify_workfn()
882 parent = kernfs_get_parent(kn); in kernfs_notify_workfn()
902 kernfs_put(kn); in kernfs_notify_workfn()
913 void kernfs_notify(struct kernfs_node *kn) in kernfs_notify() argument
919 if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) in kernfs_notify()
924 on = kn->attr.open; in kernfs_notify()
933 if (!kn->attr.notify_next) { in kernfs_notify()
934 kernfs_get(kn); in kernfs_notify()
935 kn->attr.notify_next = kernfs_notify_list; in kernfs_notify()
936 kernfs_notify_list = kn; in kernfs_notify()
979 struct kernfs_node *kn; in __kernfs_create_file() local
985 kn = kernfs_new_node(parent, name, (mode & S_IALLUGO) | S_IFREG, in __kernfs_create_file()
987 if (!kn) in __kernfs_create_file()
990 kn->attr.ops = ops; in __kernfs_create_file()
991 kn->attr.size = size; in __kernfs_create_file()
992 kn->ns = ns; in __kernfs_create_file()
993 kn->priv = priv; in __kernfs_create_file()
997 lockdep_init_map(&kn->dep_map, "kn->active", key, 0); in __kernfs_create_file()
998 kn->flags |= KERNFS_LOCKDEP; in __kernfs_create_file()
1008 kn->flags |= KERNFS_HAS_SEQ_SHOW; in __kernfs_create_file()
1010 kn->flags |= KERNFS_HAS_MMAP; in __kernfs_create_file()
1012 kn->flags |= KERNFS_HAS_RELEASE; in __kernfs_create_file()
1014 rc = kernfs_add_one(kn); in __kernfs_create_file()
1016 kernfs_put(kn); in __kernfs_create_file()
1019 return kn; in __kernfs_create_file()