Lines Matching refs:head

92 static int insert_links(struct ctl_table_header *head);
116 struct ctl_table_header *head;
127 head = ctl_node->header;
128 entry = &head->ctl_table[ctl_node - head->node];
137 *phead = head;
144 static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry)
146 struct rb_node *node = &head->node[entry - head->ctl_table].node;
147 struct rb_node **p = &head->parent->root.rb_node;
172 sysctl_print_dir(head->parent);
179 rb_insert_color(node, &head->parent->root);
183 static void erase_entry(struct ctl_table_header *head, struct ctl_table *entry)
185 struct rb_node *node = &head->node[entry - head->ctl_table].node;
187 rb_erase(node, &head->parent->root);
190 static void init_header(struct ctl_table_header *head,
194 head->ctl_table = table;
195 head->ctl_table_size = table_size;
196 head->ctl_table_arg = table;
197 head->used = 0;
198 head->count = 1;
199 head->nreg = 1;
200 head->unregistering = NULL;
201 head->root = root;
202 head->set = set;
203 head->parent = NULL;
204 head->node = node;
205 INIT_HLIST_HEAD(&head->inodes);
209 list_for_each_table_entry(entry, head) {
210 node->header = head;
216 static void erase_header(struct ctl_table_header *head)
220 list_for_each_table_entry(entry, head)
221 erase_entry(head, entry);
282 static void proc_sys_invalidate_dcache(struct ctl_table_header *head)
284 proc_invalidate_siblings_dcache(&head->inodes, &sysctl_lock);
318 static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
320 BUG_ON(!head);
322 if (!use_table(head))
323 head = ERR_PTR(-ENOENT);
325 return head;
328 static void sysctl_head_finish(struct ctl_table_header *head)
330 if (!head)
333 unuse_table(head);
350 struct ctl_table_header *head;
354 entry = find_entry(&head, dir, name, namelen);
355 if (entry && use_table(head))
356 *phead = head;
378 struct ctl_table_header *head = NULL;
386 head = ctl_node->header;
387 entry = &head->ctl_table[ctl_node - head->node];
389 *phead = head;
395 struct ctl_table_header *head = *phead;
397 struct ctl_node *ctl_node = &head->node[entry - head->ctl_table];
400 unuse_table(head);
404 head = NULL;
406 head = ctl_node->header;
407 entry = &head->ctl_table[ctl_node - head->node];
409 *phead = head;
429 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op)
431 struct ctl_table_root *root = head->root;
435 mode = root->permissions(head, table);
443 struct ctl_table_header *head, struct ctl_table *table)
445 struct ctl_table_root *root = head->root;
458 if (unlikely(head->unregistering)) {
463 ei->sysctl = head;
465 hlist_add_head_rcu(&ei->sibling_inodes, &head->inodes);
466 head->count++;
479 if (sysctl_is_perm_empty_ctl_header(head))
484 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
493 void proc_sys_evict_inode(struct inode *inode, struct ctl_table_header *head)
497 if (!--head->count)
498 kfree_rcu(head, rcu);
504 struct ctl_table_header *head = PROC_I(inode)->sysctl;
505 if (!head)
506 head = &sysctl_table_root.default_set.dir.header;
507 return sysctl_head_grab(head);
513 struct ctl_table_header *head = grab_header(dir);
522 if (IS_ERR(head))
523 return ERR_CAST(head);
525 ctl_dir = container_of(head, struct ctl_dir, header);
538 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
550 sysctl_head_finish(head);
558 struct ctl_table_header *head = grab_header(inode);
564 if (IS_ERR(head))
565 return PTR_ERR(head);
572 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ))
595 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, &kbuf, &count,
615 sysctl_head_finish(head);
632 struct ctl_table_header *head = grab_header(inode);
636 if (IS_ERR(head))
637 return PTR_ERR(head);
642 sysctl_head_finish(head);
650 struct ctl_table_header *head = grab_header(inode);
656 if (IS_ERR(head))
674 sysctl_head_finish(head);
681 struct ctl_table_header *head,
702 inode = proc_sys_make_inode(dir->d_sb, head, table);
730 struct ctl_table_header *head,
735 head = sysctl_head_grab(head);
736 if (IS_ERR(head))
740 if (sysctl_follow_link(&head, &table))
743 ret = proc_sys_fill_cache(file, ctx, head, table);
745 sysctl_head_finish(head);
749 static int scan(struct ctl_table_header *head, struct ctl_table *table,
759 res = proc_sys_link_fill_cache(file, ctx, head, table);
761 res = proc_sys_fill_cache(file, ctx, head, table);
771 struct ctl_table_header *head = grab_header(file_inode(file));
777 if (IS_ERR(head))
778 return PTR_ERR(head);
780 ctl_dir = container_of(head, struct ctl_dir, header);
794 sysctl_head_finish(head);
805 struct ctl_table_header *head;
813 head = grab_header(inode);
814 if (IS_ERR(head))
815 return PTR_ERR(head);
821 error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK);
823 sysctl_head_finish(head);
849 struct ctl_table_header *head = grab_header(inode);
852 if (IS_ERR(head))
853 return PTR_ERR(head);
859 sysctl_head_finish(head);
922 struct ctl_table_header *head;
935 head = rcu_dereference(PROC_I(inode)->sysctl);
936 return !head || !sysctl_is_seen(head);
948 struct ctl_table_header *head;
951 entry = find_entry(&head, dir, name, namelen);
956 return container_of(head, struct ctl_dir, header);
1062 struct ctl_table_header *head;
1077 head = NULL;
1078 entry = find_entry(&head, dir, procname, strlen(procname));
1080 if (entry && use_table(head)) {
1082 *phead = head;
1165 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_header *head)
1175 list_for_each_table_entry(entry, head) {
1194 list_for_each_table_entry(entry, head) {
1199 link->data = head->root;
1204 head->ctl_table_size);
1243 static int insert_links(struct ctl_table_header *head)
1250 if (head->set == root_set)
1253 core_parent = xlate_dir(root_set, head->parent);
1257 if (get_links(core_parent, head, head->root))
1263 links = new_links(core_parent, head);
1271 if (get_links(core_parent, head, head->root)) {