• Home
  • Raw
  • Download

Lines Matching refs:head

40 static bool is_empty_dir(struct ctl_table_header *head)  in is_empty_dir()  argument
42 return head->ctl_table[0].child == sysctl_mount_point; in is_empty_dir()
88 static int insert_links(struct ctl_table_header *head);
117 struct ctl_table_header *head; in find_entry() local
128 head = ctl_node->header; in find_entry()
129 entry = &head->ctl_table[ctl_node - head->node]; in find_entry()
138 *phead = head; in find_entry()
145 static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry) in insert_entry() argument
147 struct rb_node *node = &head->node[entry - head->ctl_table].node; in insert_entry()
148 struct rb_node **p = &head->parent->root.rb_node; in insert_entry()
173 sysctl_print_dir(head->parent); in insert_entry()
180 rb_insert_color(node, &head->parent->root); in insert_entry()
184 static void erase_entry(struct ctl_table_header *head, struct ctl_table *entry) in erase_entry() argument
186 struct rb_node *node = &head->node[entry - head->ctl_table].node; in erase_entry()
188 rb_erase(node, &head->parent->root); in erase_entry()
191 static void init_header(struct ctl_table_header *head, in init_header() argument
195 head->ctl_table = table; in init_header()
196 head->ctl_table_arg = table; in init_header()
197 head->used = 0; in init_header()
198 head->count = 1; in init_header()
199 head->nreg = 1; in init_header()
200 head->unregistering = NULL; in init_header()
201 head->root = root; in init_header()
202 head->set = set; in init_header()
203 head->parent = NULL; in init_header()
204 head->node = node; in init_header()
205 INIT_HLIST_HEAD(&head->inodes); in init_header()
209 node->header = head; in init_header()
213 static void erase_header(struct ctl_table_header *head) in erase_header() argument
216 for (entry = head->ctl_table; entry->procname; entry++) in erase_header()
217 erase_entry(head, entry); in erase_header()
275 static void proc_sys_invalidate_dcache(struct ctl_table_header *head) in proc_sys_invalidate_dcache() argument
277 proc_invalidate_siblings_dcache(&head->inodes, &sysctl_lock); in proc_sys_invalidate_dcache()
311 static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) in sysctl_head_grab() argument
313 BUG_ON(!head); in sysctl_head_grab()
315 if (!use_table(head)) in sysctl_head_grab()
316 head = ERR_PTR(-ENOENT); in sysctl_head_grab()
318 return head; in sysctl_head_grab()
321 static void sysctl_head_finish(struct ctl_table_header *head) in sysctl_head_finish() argument
323 if (!head) in sysctl_head_finish()
326 unuse_table(head); in sysctl_head_finish()
343 struct ctl_table_header *head; in lookup_entry() local
347 entry = find_entry(&head, dir, name, namelen); in lookup_entry()
348 if (entry && use_table(head)) in lookup_entry()
349 *phead = head; in lookup_entry()
371 struct ctl_table_header *head = NULL; in first_entry() local
379 head = ctl_node->header; in first_entry()
380 entry = &head->ctl_table[ctl_node - head->node]; in first_entry()
382 *phead = head; in first_entry()
388 struct ctl_table_header *head = *phead; in next_entry() local
390 struct ctl_node *ctl_node = &head->node[entry - head->ctl_table]; in next_entry()
393 unuse_table(head); in next_entry()
397 head = NULL; in next_entry()
399 head = ctl_node->header; in next_entry()
400 entry = &head->ctl_table[ctl_node - head->node]; in next_entry()
402 *phead = head; in next_entry()
422 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op) in sysctl_perm() argument
424 struct ctl_table_root *root = head->root; in sysctl_perm()
428 mode = root->permissions(head, table); in sysctl_perm()
436 struct ctl_table_header *head, struct ctl_table *table) in proc_sys_make_inode() argument
438 struct ctl_table_root *root = head->root; in proc_sys_make_inode()
451 if (unlikely(head->unregistering)) { in proc_sys_make_inode()
456 ei->sysctl = head; in proc_sys_make_inode()
458 hlist_add_head_rcu(&ei->sibling_inodes, &head->inodes); in proc_sys_make_inode()
459 head->count++; in proc_sys_make_inode()
472 if (is_empty_dir(head)) in proc_sys_make_inode()
477 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
486 void proc_sys_evict_inode(struct inode *inode, struct ctl_table_header *head) in proc_sys_evict_inode() argument
490 if (!--head->count) in proc_sys_evict_inode()
491 kfree_rcu(head, rcu); in proc_sys_evict_inode()
497 struct ctl_table_header *head = PROC_I(inode)->sysctl; in grab_header() local
498 if (!head) in grab_header()
499 head = &sysctl_table_root.default_set.dir.header; in grab_header()
500 return sysctl_head_grab(head); in grab_header()
506 struct ctl_table_header *head = grab_header(dir); in proc_sys_lookup() local
515 if (IS_ERR(head)) in proc_sys_lookup()
516 return ERR_CAST(head); in proc_sys_lookup()
518 ctl_dir = container_of(head, struct ctl_dir, header); in proc_sys_lookup()
531 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); in proc_sys_lookup()
543 sysctl_head_finish(head); in proc_sys_lookup()
551 struct ctl_table_header *head = grab_header(inode); in proc_sys_call_handler() local
557 if (IS_ERR(head)) in proc_sys_call_handler()
558 return PTR_ERR(head); in proc_sys_call_handler()
565 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ)) in proc_sys_call_handler()
588 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, &kbuf, &count, in proc_sys_call_handler()
608 sysctl_head_finish(head); in proc_sys_call_handler()
625 struct ctl_table_header *head = grab_header(inode); in proc_sys_open() local
629 if (IS_ERR(head)) in proc_sys_open()
630 return PTR_ERR(head); in proc_sys_open()
635 sysctl_head_finish(head); in proc_sys_open()
643 struct ctl_table_header *head = grab_header(inode); in proc_sys_poll() local
649 if (IS_ERR(head)) in proc_sys_poll()
667 sysctl_head_finish(head); in proc_sys_poll()
674 struct ctl_table_header *head, in proc_sys_fill_cache() argument
695 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
723 struct ctl_table_header *head, in proc_sys_link_fill_cache() argument
728 head = sysctl_head_grab(head); in proc_sys_link_fill_cache()
729 if (IS_ERR(head)) in proc_sys_link_fill_cache()
733 if (sysctl_follow_link(&head, &table)) in proc_sys_link_fill_cache()
736 ret = proc_sys_fill_cache(file, ctx, head, table); in proc_sys_link_fill_cache()
738 sysctl_head_finish(head); in proc_sys_link_fill_cache()
742 static int scan(struct ctl_table_header *head, struct ctl_table *table, in scan() argument
752 res = proc_sys_link_fill_cache(file, ctx, head, table); in scan()
754 res = proc_sys_fill_cache(file, ctx, head, table); in scan()
764 struct ctl_table_header *head = grab_header(file_inode(file)); in proc_sys_readdir() local
770 if (IS_ERR(head)) in proc_sys_readdir()
771 return PTR_ERR(head); in proc_sys_readdir()
773 ctl_dir = container_of(head, struct ctl_dir, header); in proc_sys_readdir()
787 sysctl_head_finish(head); in proc_sys_readdir()
797 struct ctl_table_header *head; in proc_sys_permission() local
805 head = grab_header(inode); in proc_sys_permission()
806 if (IS_ERR(head)) in proc_sys_permission()
807 return PTR_ERR(head); in proc_sys_permission()
813 error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK); in proc_sys_permission()
815 sysctl_head_finish(head); in proc_sys_permission()
840 struct ctl_table_header *head = grab_header(inode); in proc_sys_getattr() local
843 if (IS_ERR(head)) in proc_sys_getattr()
844 return PTR_ERR(head); in proc_sys_getattr()
850 sysctl_head_finish(head); in proc_sys_getattr()
913 struct ctl_table_header *head; in proc_sys_compare() local
926 head = rcu_dereference(PROC_I(inode)->sysctl); in proc_sys_compare()
927 return !head || !sysctl_is_seen(head); in proc_sys_compare()
939 struct ctl_table_header *head; in find_subdir() local
942 entry = find_entry(&head, dir, name, namelen); in find_subdir()
947 return container_of(head, struct ctl_dir, header); in find_subdir()
1054 struct ctl_table_header *head; in sysctl_follow_link() local
1070 head = NULL; in sysctl_follow_link()
1071 entry = find_entry(&head, dir, procname, strlen(procname)); in sysctl_follow_link()
1073 if (entry && use_table(head)) { in sysctl_follow_link()
1075 *phead = head; in sysctl_follow_link()
1200 struct ctl_table_header *head; in get_links() local
1206 link = find_entry(&head, dir, procname, strlen(procname)); in get_links()
1219 link = find_entry(&head, dir, procname, strlen(procname)); in get_links()
1220 head->nreg++; in get_links()
1225 static int insert_links(struct ctl_table_header *head) in insert_links() argument
1232 if (head->set == root_set) in insert_links()
1235 core_parent = xlate_dir(root_set, head->parent); in insert_links()
1239 if (get_links(core_parent, head->ctl_table, head->root)) in insert_links()
1245 links = new_links(core_parent, head->ctl_table, head->root); in insert_links()
1253 if (get_links(core_parent, head->ctl_table, head->root)) { in insert_links()