Lines Matching refs:head

92 static int insert_links(struct ctl_table_header *head);
116 struct ctl_table_header *head; in find_entry() local
127 head = ctl_node->header; in find_entry()
128 entry = &head->ctl_table[ctl_node - head->node]; in find_entry()
137 *phead = head; in find_entry()
144 static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry) in insert_entry() argument
146 struct rb_node *node = &head->node[entry - head->ctl_table].node; in insert_entry()
147 struct rb_node **p = &head->parent->root.rb_node; in insert_entry()
172 sysctl_print_dir(head->parent); in insert_entry()
179 rb_insert_color(node, &head->parent->root); in insert_entry()
183 static void erase_entry(struct ctl_table_header *head, struct ctl_table *entry) in erase_entry() argument
185 struct rb_node *node = &head->node[entry - head->ctl_table].node; in erase_entry()
187 rb_erase(node, &head->parent->root); in erase_entry()
190 static void init_header(struct ctl_table_header *head, in init_header() argument
194 head->ctl_table = table; in init_header()
195 head->ctl_table_size = table_size; 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 list_for_each_table_entry(entry, head) { in init_header()
210 node->header = head; in init_header()
216 static void erase_header(struct ctl_table_header *head) in erase_header() argument
220 list_for_each_table_entry(entry, head) in erase_header()
221 erase_entry(head, entry); in erase_header()
281 static void proc_sys_invalidate_dcache(struct ctl_table_header *head) in proc_sys_invalidate_dcache() argument
283 proc_invalidate_siblings_dcache(&head->inodes, &sysctl_lock); in proc_sys_invalidate_dcache()
317 static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) in sysctl_head_grab() argument
319 BUG_ON(!head); in sysctl_head_grab()
321 if (!use_table(head)) in sysctl_head_grab()
322 head = ERR_PTR(-ENOENT); in sysctl_head_grab()
324 return head; in sysctl_head_grab()
327 static void sysctl_head_finish(struct ctl_table_header *head) in sysctl_head_finish() argument
329 if (!head) in sysctl_head_finish()
332 unuse_table(head); in sysctl_head_finish()
349 struct ctl_table_header *head; in lookup_entry() local
353 entry = find_entry(&head, dir, name, namelen); in lookup_entry()
354 if (entry && use_table(head)) in lookup_entry()
355 *phead = head; in lookup_entry()
377 struct ctl_table_header *head = NULL; in first_entry() local
385 head = ctl_node->header; in first_entry()
386 entry = &head->ctl_table[ctl_node - head->node]; in first_entry()
388 *phead = head; in first_entry()
394 struct ctl_table_header *head = *phead; in next_entry() local
396 struct ctl_node *ctl_node = &head->node[entry - head->ctl_table]; in next_entry()
399 unuse_table(head); in next_entry()
403 head = NULL; in next_entry()
405 head = ctl_node->header; in next_entry()
406 entry = &head->ctl_table[ctl_node - head->node]; in next_entry()
408 *phead = head; in next_entry()
428 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op) in sysctl_perm() argument
430 struct ctl_table_root *root = head->root; in sysctl_perm()
434 mode = root->permissions(head, table); in sysctl_perm()
442 struct ctl_table_header *head, struct ctl_table *table) in proc_sys_make_inode() argument
444 struct ctl_table_root *root = head->root; in proc_sys_make_inode()
457 if (unlikely(head->unregistering)) { in proc_sys_make_inode()
462 ei->sysctl = head; in proc_sys_make_inode()
464 hlist_add_head_rcu(&ei->sibling_inodes, &head->inodes); in proc_sys_make_inode()
465 head->count++; in proc_sys_make_inode()
478 if (sysctl_is_perm_empty_ctl_header(head)) in proc_sys_make_inode()
483 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
492 void proc_sys_evict_inode(struct inode *inode, struct ctl_table_header *head) in proc_sys_evict_inode() argument
496 if (!--head->count) in proc_sys_evict_inode()
497 kfree_rcu(head, rcu); in proc_sys_evict_inode()
503 struct ctl_table_header *head = PROC_I(inode)->sysctl; in grab_header() local
504 if (!head) in grab_header()
505 head = &sysctl_table_root.default_set.dir.header; in grab_header()
506 return sysctl_head_grab(head); in grab_header()
512 struct ctl_table_header *head = grab_header(dir); in proc_sys_lookup() local
521 if (IS_ERR(head)) in proc_sys_lookup()
522 return ERR_CAST(head); in proc_sys_lookup()
524 ctl_dir = container_of(head, struct ctl_dir, header); in proc_sys_lookup()
537 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); in proc_sys_lookup()
549 sysctl_head_finish(head); in proc_sys_lookup()
557 struct ctl_table_header *head = grab_header(inode); in proc_sys_call_handler() local
563 if (IS_ERR(head)) in proc_sys_call_handler()
564 return PTR_ERR(head); in proc_sys_call_handler()
571 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ)) in proc_sys_call_handler()
594 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, &kbuf, &count, in proc_sys_call_handler()
614 sysctl_head_finish(head); in proc_sys_call_handler()
631 struct ctl_table_header *head = grab_header(inode); in proc_sys_open() local
635 if (IS_ERR(head)) in proc_sys_open()
636 return PTR_ERR(head); in proc_sys_open()
641 sysctl_head_finish(head); in proc_sys_open()
649 struct ctl_table_header *head = grab_header(inode); in proc_sys_poll() local
655 if (IS_ERR(head)) in proc_sys_poll()
673 sysctl_head_finish(head); in proc_sys_poll()
680 struct ctl_table_header *head, in proc_sys_fill_cache() argument
701 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
729 struct ctl_table_header *head, in proc_sys_link_fill_cache() argument
734 head = sysctl_head_grab(head); in proc_sys_link_fill_cache()
735 if (IS_ERR(head)) in proc_sys_link_fill_cache()
739 if (sysctl_follow_link(&head, &table)) in proc_sys_link_fill_cache()
742 ret = proc_sys_fill_cache(file, ctx, head, table); in proc_sys_link_fill_cache()
744 sysctl_head_finish(head); in proc_sys_link_fill_cache()
748 static int scan(struct ctl_table_header *head, struct ctl_table *table, in scan() argument
758 res = proc_sys_link_fill_cache(file, ctx, head, table); in scan()
760 res = proc_sys_fill_cache(file, ctx, head, table); in scan()
770 struct ctl_table_header *head = grab_header(file_inode(file)); in proc_sys_readdir() local
776 if (IS_ERR(head)) in proc_sys_readdir()
777 return PTR_ERR(head); in proc_sys_readdir()
779 ctl_dir = container_of(head, struct ctl_dir, header); in proc_sys_readdir()
793 sysctl_head_finish(head); in proc_sys_readdir()
804 struct ctl_table_header *head; in proc_sys_permission() local
812 head = grab_header(inode); in proc_sys_permission()
813 if (IS_ERR(head)) in proc_sys_permission()
814 return PTR_ERR(head); in proc_sys_permission()
820 error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK); in proc_sys_permission()
822 sysctl_head_finish(head); in proc_sys_permission()
848 struct ctl_table_header *head = grab_header(inode); in proc_sys_getattr() local
851 if (IS_ERR(head)) in proc_sys_getattr()
852 return PTR_ERR(head); in proc_sys_getattr()
858 sysctl_head_finish(head); in proc_sys_getattr()
921 struct ctl_table_header *head; in proc_sys_compare() local
934 head = rcu_dereference(PROC_I(inode)->sysctl); in proc_sys_compare()
935 return !head || !sysctl_is_seen(head); in proc_sys_compare()
947 struct ctl_table_header *head; in find_subdir() local
950 entry = find_entry(&head, dir, name, namelen); in find_subdir()
955 return container_of(head, struct ctl_dir, header); in find_subdir()
1061 struct ctl_table_header *head; in sysctl_follow_link() local
1076 head = NULL; in sysctl_follow_link()
1077 entry = find_entry(&head, dir, procname, strlen(procname)); in sysctl_follow_link()
1079 if (entry && use_table(head)) { in sysctl_follow_link()
1081 *phead = head; in sysctl_follow_link()
1164 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_header *head) in new_links() argument
1174 list_for_each_table_entry(entry, head) { in new_links()
1193 list_for_each_table_entry(entry, head) { in new_links()
1198 link->data = head->root; in new_links()
1203 head->ctl_table_size); in new_links()
1238 static int insert_links(struct ctl_table_header *head) in insert_links() argument
1245 if (head->set == root_set) in insert_links()
1248 core_parent = xlate_dir(root_set, head->parent); in insert_links()
1252 if (get_links(core_parent, head, head->root)) in insert_links()
1258 links = new_links(core_parent, head); in insert_links()
1266 if (get_links(core_parent, head, head->root)) { in insert_links()