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_direct_read()
210 of->event = atomic_read(&of->kn->attr.open->event); in kernfs_file_direct_read()
211 ops = kernfs_ops(of->kn); in kernfs_file_direct_read()
228 kernfs_put_active(of->kn); in kernfs_file_direct_read()
248 if (of->kn->flags & KERNFS_HAS_SEQ_SHOW) in kernfs_fop_read()
298 if (!kernfs_get_active(of->kn)) { in kernfs_fop_write()
310 ops = kernfs_ops(of->kn); in kernfs_fop_write()
320 kernfs_put_active(of->kn); in kernfs_fop_write()
336 if (!kernfs_get_active(of->kn)) in kernfs_vma_open()
342 kernfs_put_active(of->kn); in kernfs_vma_open()
354 if (!kernfs_get_active(of->kn)) in kernfs_vma_fault()
361 kernfs_put_active(of->kn); in kernfs_vma_fault()
375 if (!kernfs_get_active(of->kn)) in kernfs_vma_page_mkwrite()
384 kernfs_put_active(of->kn); in kernfs_vma_page_mkwrite()
398 if (!kernfs_get_active(of->kn)) in kernfs_vma_access()
405 kernfs_put_active(of->kn); in kernfs_vma_access()
420 if (!kernfs_get_active(of->kn)) in kernfs_vma_set_policy()
427 kernfs_put_active(of->kn); in kernfs_vma_set_policy()
441 if (!kernfs_get_active(of->kn)) in kernfs_vma_get_policy()
448 kernfs_put_active(of->kn); in kernfs_vma_get_policy()
478 if (!(of->kn->flags & KERNFS_HAS_MMAP)) in kernfs_fop_mmap()
484 if (!kernfs_get_active(of->kn)) in kernfs_fop_mmap()
487 ops = kernfs_ops(of->kn); in kernfs_fop_mmap()
517 kernfs_put_active(of->kn); in kernfs_fop_mmap()
538 static int kernfs_get_open_node(struct kernfs_node *kn, in kernfs_get_open_node() argument
547 if (!kn->attr.open && new_on) { in kernfs_get_open_node()
548 kn->attr.open = new_on; in kernfs_get_open_node()
552 on = kn->attr.open; in kernfs_get_open_node()
589 static void kernfs_put_open_node(struct kernfs_node *kn, in kernfs_put_open_node() argument
592 struct kernfs_open_node *on = kn->attr.open; in kernfs_put_open_node()
602 kn->attr.open = NULL; in kernfs_put_open_node()
614 struct kernfs_node *kn = file->f_path.dentry->d_fsdata; in kernfs_fop_open() local
615 struct kernfs_root *root = kernfs_root(kn); in kernfs_fop_open()
621 if (!kernfs_get_active(kn)) in kernfs_fop_open()
624 ops = kernfs_ops(kn); in kernfs_fop_open()
667 of->kn = kn; in kernfs_fop_open()
711 error = kernfs_get_open_node(kn, of); in kernfs_fop_open()
716 kernfs_put_active(kn); in kernfs_fop_open()
725 kernfs_put_active(kn); in kernfs_fop_open()
731 struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; in kernfs_fop_release() local
734 kernfs_put_open_node(kn, of); in kernfs_fop_release()
742 void kernfs_unmap_bin_file(struct kernfs_node *kn) in kernfs_unmap_bin_file() argument
747 if (!(kn->flags & KERNFS_HAS_MMAP)) in kernfs_unmap_bin_file()
751 on = kn->attr.open; in kernfs_unmap_bin_file()
765 kernfs_put_open_node(kn, NULL); in kernfs_unmap_bin_file()
785 struct kernfs_node *kn = filp->f_path.dentry->d_fsdata; in kernfs_fop_poll() local
786 struct kernfs_open_node *on = kn->attr.open; in kernfs_fop_poll()
788 if (!kernfs_get_active(kn)) in kernfs_fop_poll()
793 kernfs_put_active(kn); in kernfs_fop_poll()
806 struct kernfs_node *kn; in kernfs_notify_workfn() local
812 kn = kernfs_notify_list; in kernfs_notify_workfn()
813 if (kn == KERNFS_NOTIFY_EOL) { in kernfs_notify_workfn()
817 kernfs_notify_list = kn->attr.notify_next; in kernfs_notify_workfn()
818 kn->attr.notify_next = NULL; in kernfs_notify_workfn()
824 on = kn->attr.open; in kernfs_notify_workfn()
835 list_for_each_entry(info, &kernfs_root(kn)->supers, node) { in kernfs_notify_workfn()
845 inode = ilookup(info->sb, kn->ino); in kernfs_notify_workfn()
849 parent = kernfs_get_parent(kn); in kernfs_notify_workfn()
856 inode, FSNOTIFY_EVENT_INODE, kn->name, 0); in kernfs_notify_workfn()
864 kn->name, 0); in kernfs_notify_workfn()
869 kernfs_put(kn); in kernfs_notify_workfn()
880 void kernfs_notify(struct kernfs_node *kn) in kernfs_notify() argument
885 if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) in kernfs_notify()
889 if (!kn->attr.notify_next) { in kernfs_notify()
890 kernfs_get(kn); in kernfs_notify()
891 kn->attr.notify_next = kernfs_notify_list; in kernfs_notify()
892 kernfs_notify_list = kn; in kernfs_notify()
929 struct kernfs_node *kn; in __kernfs_create_file() local
935 kn = kernfs_new_node(parent, name, (mode & S_IALLUGO) | S_IFREG, flags); in __kernfs_create_file()
936 if (!kn) in __kernfs_create_file()
939 kn->attr.ops = ops; in __kernfs_create_file()
940 kn->attr.size = size; in __kernfs_create_file()
941 kn->ns = ns; in __kernfs_create_file()
942 kn->priv = priv; in __kernfs_create_file()
946 lockdep_init_map(&kn->dep_map, "s_active", key, 0); in __kernfs_create_file()
947 kn->flags |= KERNFS_LOCKDEP; in __kernfs_create_file()
957 kn->flags |= KERNFS_HAS_SEQ_SHOW; in __kernfs_create_file()
959 kn->flags |= KERNFS_HAS_MMAP; in __kernfs_create_file()
961 rc = kernfs_add_one(kn); in __kernfs_create_file()
963 kernfs_put(kn); in __kernfs_create_file()
966 return kn; in __kernfs_create_file()