Lines Matching +full:entry +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0
17 #include <linux/bpf-cgroup.h>
22 #define list_for_each_table_entry(entry, table) \ argument
23 for ((entry) = (table); (entry)->procname; (entry)++)
38 * register_sysctl_mount_point() - registers a sysctl mount point
53 return head->ctl_table[0].child == sysctl_mount_point; in is_empty_dir()
58 dir->header.ctl_table[0].child = sysctl_mount_point; in set_empty_dir()
64 dir->header.ctl_table[0].child = NULL; in clear_empty_dir()
72 atomic_inc(&poll->event); in proc_sys_poll_notify()
73 wake_up_interruptible(&poll->wait); in proc_sys_poll_notify()
104 if (dir->header.parent) in sysctl_print_dir()
105 sysctl_print_dir(dir->header.parent); in sysctl_print_dir()
106 pr_cont("%s/", dir->header.ctl_table[0].procname); in sysctl_print_dir()
115 cmp = len1 - len2; in namecmp()
121 struct ctl_dir *dir, const char *name, int namelen) in find_entry() argument
124 struct ctl_table *entry; in find_entry() local
125 struct rb_node *node = dir->root.rb_node; in find_entry()
134 head = ctl_node->header; in find_entry()
135 entry = &head->ctl_table[ctl_node - head->node]; in find_entry()
136 procname = entry->procname; in find_entry()
138 cmp = namecmp(name, namelen, procname, strlen(procname)); in find_entry()
140 node = node->rb_left; in find_entry()
142 node = node->rb_right; in find_entry()
145 return entry; in find_entry()
151 static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry) in insert_entry() argument
153 struct rb_node *node = &head->node[entry - head->ctl_table].node; in insert_entry()
154 struct rb_node **p = &head->parent->root.rb_node; in insert_entry()
156 const char *name = entry->procname; in insert_entry() local
157 int namelen = strlen(name); in insert_entry()
168 parent_head = parent_node->header; in insert_entry()
169 parent_entry = &parent_head->ctl_table[parent_node - parent_head->node]; in insert_entry()
170 parent_name = parent_entry->procname; in insert_entry()
172 cmp = namecmp(name, namelen, parent_name, strlen(parent_name)); in insert_entry()
174 p = &(*p)->rb_left; in insert_entry()
176 p = &(*p)->rb_right; in insert_entry()
178 pr_err("sysctl duplicate entry: "); in insert_entry()
179 sysctl_print_dir(head->parent); in insert_entry()
180 pr_cont("%s\n", entry->procname); in insert_entry()
181 return -EEXIST; in insert_entry()
186 rb_insert_color(node, &head->parent->root); in insert_entry()
190 static void erase_entry(struct ctl_table_header *head, struct ctl_table *entry) in erase_entry() argument
192 struct rb_node *node = &head->node[entry - head->ctl_table].node; in erase_entry()
194 rb_erase(node, &head->parent->root); in erase_entry()
201 head->ctl_table = table; in init_header()
202 head->ctl_table_arg = table; in init_header()
203 head->used = 0; in init_header()
204 head->count = 1; in init_header()
205 head->nreg = 1; in init_header()
206 head->unregistering = NULL; in init_header()
207 head->root = root; in init_header()
208 head->set = set; in init_header()
209 head->parent = NULL; in init_header()
210 head->node = node; in init_header()
211 INIT_HLIST_HEAD(&head->inodes); in init_header()
213 struct ctl_table *entry; in init_header() local
215 list_for_each_table_entry(entry, table) { in init_header()
216 node->header = head; in init_header()
224 struct ctl_table *entry; in erase_header() local
226 list_for_each_table_entry(entry, head->ctl_table) in erase_header()
227 erase_entry(head, entry); in erase_header()
232 struct ctl_table *entry; in insert_header() local
236 if (is_empty_dir(&dir->header)) in insert_header()
237 return -EROFS; in insert_header()
240 if (header->ctl_table == sysctl_mount_point) { in insert_header()
241 if (!RB_EMPTY_ROOT(&dir->root)) in insert_header()
242 return -EINVAL; in insert_header()
246 dir->header.nreg++; in insert_header()
247 header->parent = dir; in insert_header()
251 list_for_each_table_entry(entry, header->ctl_table) { in insert_header()
252 err = insert_entry(header, entry); in insert_header()
261 if (header->ctl_table == sysctl_mount_point) in insert_header()
263 header->parent = NULL; in insert_header()
264 drop_sysctl_table(&dir->header); in insert_header()
271 if (unlikely(p->unregistering)) in use_table()
273 p->used++; in use_table()
280 if (!--p->used) in unuse_table()
281 if (unlikely(p->unregistering)) in unuse_table()
282 complete(p->unregistering); in unuse_table()
287 proc_invalidate_siblings_dcache(&head->inodes, &sysctl_lock); in proc_sys_invalidate_dcache()
294 * if p->used is 0, nobody will ever touch that entry again; in start_unregistering()
297 if (unlikely(p->used)) { in start_unregistering()
300 p->unregistering = &wait; in start_unregistering()
304 /* anything non-NULL; we'll never dereference it */ in start_unregistering()
305 p->unregistering = ERR_PTR(-EINVAL); in start_unregistering()
326 head = ERR_PTR(-ENOENT); in sysctl_head_grab()
343 struct ctl_table_set *set = &root->default_set; in lookup_header_set()
344 if (root->lookup) in lookup_header_set()
345 set = root->lookup(root); in lookup_header_set()
351 const char *name, int namelen) in lookup_entry() argument
354 struct ctl_table *entry; in lookup_entry() local
357 entry = find_entry(&head, dir, name, namelen); in lookup_entry()
358 if (entry && use_table(head)) in lookup_entry()
361 entry = NULL; in lookup_entry()
363 return entry; in lookup_entry()
372 if (use_table(ctl_node->header)) in first_usable_entry()
382 struct ctl_table *entry = NULL; in first_entry() local
386 ctl_node = first_usable_entry(rb_first(&dir->root)); in first_entry()
389 head = ctl_node->header; in first_entry()
390 entry = &head->ctl_table[ctl_node - head->node]; in first_entry()
393 *pentry = entry; in first_entry()
399 struct ctl_table *entry = *pentry; in next_entry() local
400 struct ctl_node *ctl_node = &head->node[entry - head->ctl_table]; in next_entry()
405 ctl_node = first_usable_entry(rb_next(&ctl_node->node)); in next_entry()
409 head = ctl_node->header; in next_entry()
410 entry = &head->ctl_table[ctl_node - head->node]; in next_entry()
413 *pentry = entry; in next_entry()
429 return -EACCES; in test_perm()
434 struct ctl_table_root *root = head->root; in sysctl_perm()
437 if (root->permissions) in sysctl_perm()
438 mode = root->permissions(head, table); in sysctl_perm()
440 mode = table->mode; in sysctl_perm()
448 struct ctl_table_root *root = head->root; in proc_sys_make_inode()
454 return ERR_PTR(-ENOMEM); in proc_sys_make_inode()
456 inode->i_ino = get_next_ino(); in proc_sys_make_inode()
461 if (unlikely(head->unregistering)) { in proc_sys_make_inode()
464 return ERR_PTR(-ENOENT); in proc_sys_make_inode()
466 ei->sysctl = head; in proc_sys_make_inode()
467 ei->sysctl_entry = table; in proc_sys_make_inode()
468 hlist_add_head_rcu(&ei->sibling_inodes, &head->inodes); in proc_sys_make_inode()
469 head->count++; in proc_sys_make_inode()
472 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); in proc_sys_make_inode()
473 inode->i_mode = table->mode; in proc_sys_make_inode()
474 if (!S_ISDIR(table->mode)) { in proc_sys_make_inode()
475 inode->i_mode |= S_IFREG; in proc_sys_make_inode()
476 inode->i_op = &proc_sys_inode_operations; in proc_sys_make_inode()
477 inode->i_fop = &proc_sys_file_operations; in proc_sys_make_inode()
479 inode->i_mode |= S_IFDIR; in proc_sys_make_inode()
480 inode->i_op = &proc_sys_dir_operations; in proc_sys_make_inode()
481 inode->i_fop = &proc_sys_dir_file_operations; in proc_sys_make_inode()
486 if (root->set_ownership) in proc_sys_make_inode()
487 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
489 inode->i_uid = GLOBAL_ROOT_UID; in proc_sys_make_inode()
490 inode->i_gid = GLOBAL_ROOT_GID; in proc_sys_make_inode()
499 hlist_del_init_rcu(&PROC_I(inode)->sibling_inodes); in proc_sys_evict_inode()
500 if (!--head->count) in proc_sys_evict_inode()
507 struct ctl_table_header *head = PROC_I(inode)->sysctl; in grab_header()
518 const struct qstr *name = &dentry->d_name; in proc_sys_lookup() local
521 struct dentry *err = ERR_PTR(-ENOENT); in proc_sys_lookup()
530 p = lookup_entry(&h, ctl_dir, name->name, name->len); in proc_sys_lookup()
534 if (S_ISLNK(p->mode)) { in proc_sys_lookup()
541 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); in proc_sys_lookup()
560 struct inode *inode = file_inode(iocb->ki_filp); in proc_sys_call_handler()
562 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_call_handler()
574 error = -EPERM; in proc_sys_call_handler()
578 /* if that can happen at all, it should be -EINVAL, not -EISDIR */ in proc_sys_call_handler()
579 error = -EINVAL; in proc_sys_call_handler()
580 if (!table->proc_handler) in proc_sys_call_handler()
584 error = -ENOMEM; in proc_sys_call_handler()
592 error = -EFAULT; in proc_sys_call_handler()
599 &iocb->ki_pos); in proc_sys_call_handler()
604 error = table->proc_handler(table, write, kbuf, &count, &iocb->ki_pos); in proc_sys_call_handler()
609 error = -EFAULT; in proc_sys_call_handler()
636 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_open()
642 if (table->poll) in proc_sys_open()
643 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_open()
654 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_poll()
662 if (!table->proc_handler) in proc_sys_poll()
665 if (!table->poll) in proc_sys_poll()
668 event = (unsigned long)filp->private_data; in proc_sys_poll()
669 poll_wait(filp, &table->poll->wait, wait); in proc_sys_poll()
671 if (event != atomic_read(&table->poll->event)) { in proc_sys_poll()
672 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_poll()
687 struct dentry *child, *dir = file->f_path.dentry; in proc_sys_fill_cache()
693 qname.name = table->procname; in proc_sys_fill_cache()
694 qname.len = strlen(table->procname); in proc_sys_fill_cache()
695 qname.hash = full_name_hash(dir, qname.name, qname.len); in proc_sys_fill_cache()
705 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
725 ino = inode->i_ino; in proc_sys_fill_cache()
726 type = inode->i_mode >> 12; in proc_sys_fill_cache()
728 return dir_emit(ctx, qname.name, qname.len, ino, type); in proc_sys_fill_cache()
758 if ((*pos)++ < ctx->pos) in scan()
761 if (unlikely(S_ISLNK(table->mode))) in scan()
767 ctx->pos = *pos; in scan()
776 struct ctl_table *entry; in proc_sys_readdir() local
790 for (first_entry(ctl_dir, &h, &entry); h; next_entry(&h, &entry)) { in proc_sys_readdir()
791 if (!scan(h, entry, &pos, file, ctx)) { in proc_sys_readdir()
813 if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) in proc_sys_permission()
814 return -EACCES; in proc_sys_permission()
820 table = PROC_I(inode)->sysctl_entry; in proc_sys_permission()
821 if (!table) /* global root - r-xr-xr-x */ in proc_sys_permission()
822 error = mask & MAY_WRITE ? -EACCES : 0; in proc_sys_permission()
823 else /* Use the permissions on the sysctl table entry */ in proc_sys_permission()
836 if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) in proc_sys_setattr()
837 return -EPERM; in proc_sys_setattr()
852 struct inode *inode = d_inode(path->dentry); in proc_sys_getattr()
854 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_getattr()
861 stat->mode = (stat->mode & S_IFMT) | table->mode; in proc_sys_getattr()
899 return -ECHILD; in proc_sys_revalidate()
900 return !PROC_I(d_inode(dentry))->sysctl->unregistering; in proc_sys_revalidate()
905 return !!PROC_I(d_inode(dentry))->sysctl->unregistering; in proc_sys_delete()
910 struct ctl_table_set *set = p->set; in sysctl_is_seen()
913 if (p->unregistering) in sysctl_is_seen()
915 else if (!set->is_seen) in sysctl_is_seen()
918 res = set->is_seen(set); in sysctl_is_seen()
924 unsigned int len, const char *str, const struct qstr *name) in proc_sys_compare() argument
929 /* Although proc doesn't have negative dentries, rcu-walk means in proc_sys_compare()
935 if (name->len != len) in proc_sys_compare()
937 if (memcmp(name->name, str, len)) in proc_sys_compare()
939 head = rcu_dereference(PROC_I(inode)->sysctl); in proc_sys_compare()
950 const char *name, int namelen) in find_subdir() argument
953 struct ctl_table *entry; in find_subdir() local
955 entry = find_entry(&head, dir, name, namelen); in find_subdir()
956 if (!entry) in find_subdir()
957 return ERR_PTR(-ENOENT); in find_subdir()
958 if (!S_ISDIR(entry->mode)) in find_subdir()
959 return ERR_PTR(-ENOTDIR); in find_subdir()
964 const char *name, int namelen) in new_dir() argument
980 memcpy(new_name, name, namelen); in new_dir()
983 init_header(&new->header, set->dir.header.root, set, node, table); in new_dir()
989 * get_subdir - find or create a subdir with the specified name.
991 * @name: The name of the subdirectory to find or create
992 * @namelen: The length of name
1001 const char *name, int namelen) in get_subdir() argument
1003 struct ctl_table_set *set = dir->header.set; in get_subdir()
1008 subdir = find_subdir(dir, name, namelen); in get_subdir()
1011 if (PTR_ERR(subdir) != -ENOENT) in get_subdir()
1015 new = new_dir(set, name, namelen); in get_subdir()
1017 subdir = ERR_PTR(-ENOMEM); in get_subdir()
1022 subdir = find_subdir(dir, name, namelen); in get_subdir()
1025 if (PTR_ERR(subdir) != -ENOENT) in get_subdir()
1028 /* Nope. Use the our freshly made directory entry. */ in get_subdir()
1029 err = insert_header(dir, &new->header); in get_subdir()
1035 subdir->header.nreg++; in get_subdir()
1040 pr_cont("%*.*s %ld\n", namelen, namelen, name, in get_subdir()
1043 drop_sysctl_table(&dir->header); in get_subdir()
1045 drop_sysctl_table(&new->header); in get_subdir()
1054 if (!dir->header.parent) in xlate_dir()
1055 return &set->dir; in xlate_dir()
1056 parent = xlate_dir(set, dir->header.parent); in xlate_dir()
1059 procname = dir->header.ctl_table[0].procname; in xlate_dir()
1069 struct ctl_table *entry; in sysctl_follow_link() local
1074 root = (*pentry)->data; in sysctl_follow_link()
1076 dir = xlate_dir(set, (*phead)->parent); in sysctl_follow_link()
1080 const char *procname = (*pentry)->procname; in sysctl_follow_link()
1082 entry = find_entry(&head, dir, procname, strlen(procname)); in sysctl_follow_link()
1083 ret = -ENOENT; in sysctl_follow_link()
1084 if (entry && use_table(head)) { in sysctl_follow_link()
1087 *pentry = entry; in sysctl_follow_link()
1106 path, table->procname, &vaf); in sysctl_err()
1109 return -EINVAL; in sysctl_err()
1116 if ((table->proc_handler == proc_douintvec) || in sysctl_check_table_array()
1117 (table->proc_handler == proc_douintvec_minmax)) { in sysctl_check_table_array()
1118 if (table->maxlen != sizeof(unsigned int)) in sysctl_check_table_array()
1122 if (table->proc_handler == proc_dou8vec_minmax) { in sysctl_check_table_array()
1123 if (table->maxlen != sizeof(u8)) in sysctl_check_table_array()
1132 struct ctl_table *entry; in sysctl_check_table() local
1134 list_for_each_table_entry(entry, table) { in sysctl_check_table()
1135 if (entry->child) in sysctl_check_table()
1136 err |= sysctl_err(path, entry, "Not a file"); in sysctl_check_table()
1138 if ((entry->proc_handler == proc_dostring) || in sysctl_check_table()
1139 (entry->proc_handler == proc_dointvec) || in sysctl_check_table()
1140 (entry->proc_handler == proc_douintvec) || in sysctl_check_table()
1141 (entry->proc_handler == proc_douintvec_minmax) || in sysctl_check_table()
1142 (entry->proc_handler == proc_dointvec_minmax) || in sysctl_check_table()
1143 (entry->proc_handler == proc_dou8vec_minmax) || in sysctl_check_table()
1144 (entry->proc_handler == proc_dointvec_jiffies) || in sysctl_check_table()
1145 (entry->proc_handler == proc_dointvec_userhz_jiffies) || in sysctl_check_table()
1146 (entry->proc_handler == proc_dointvec_ms_jiffies) || in sysctl_check_table()
1147 (entry->proc_handler == proc_doulongvec_minmax) || in sysctl_check_table()
1148 (entry->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { in sysctl_check_table()
1149 if (!entry->data) in sysctl_check_table()
1150 err |= sysctl_err(path, entry, "No data"); in sysctl_check_table()
1151 if (!entry->maxlen) in sysctl_check_table()
1152 err |= sysctl_err(path, entry, "No maxlen"); in sysctl_check_table()
1154 err |= sysctl_check_table_array(path, entry); in sysctl_check_table()
1156 if (!entry->proc_handler) in sysctl_check_table()
1157 err |= sysctl_err(path, entry, "No proc_handler"); in sysctl_check_table()
1159 if ((entry->mode & (S_IRUGO|S_IWUGO)) != entry->mode) in sysctl_check_table()
1160 err |= sysctl_err(path, entry, "bogus .mode 0%o", in sysctl_check_table()
1161 entry->mode); in sysctl_check_table()
1169 struct ctl_table *link_table, *entry, *link; in new_links() local
1177 list_for_each_table_entry(entry, table) { in new_links()
1179 name_bytes += strlen(entry->procname) + 1; in new_links()
1196 list_for_each_table_entry(entry, table) { in new_links()
1197 int len = strlen(entry->procname) + 1; in new_links()
1198 memcpy(link_name, entry->procname, len); in new_links()
1199 link->procname = link_name; in new_links()
1200 link->mode = S_IFLNK|S_IRWXUGO; in new_links()
1201 link->data = link_root; in new_links()
1205 init_header(links, dir->header.root, dir->header.set, node, link_table); in new_links()
1206 links->nreg = nr_entries; in new_links()
1215 struct ctl_table *entry, *link; in get_links() local
1217 /* Are there links available for every entry in table? */ in get_links()
1218 list_for_each_table_entry(entry, table) { in get_links()
1219 const char *procname = entry->procname; in get_links()
1223 if (S_ISDIR(link->mode) && S_ISDIR(entry->mode)) in get_links()
1225 if (S_ISLNK(link->mode) && (link->data == link_root)) in get_links()
1231 list_for_each_table_entry(entry, table) { in get_links()
1232 const char *procname = entry->procname; in get_links()
1234 head->nreg++; in get_links()
1246 if (head->set == root_set) in insert_links()
1249 core_parent = xlate_dir(root_set, head->parent); in insert_links()
1253 if (get_links(core_parent, head->ctl_table, head->root)) in insert_links()
1256 core_parent->header.nreg++; in insert_links()
1259 links = new_links(core_parent, head->ctl_table, head->root); in insert_links()
1262 err = -ENOMEM; in insert_links()
1267 if (get_links(core_parent, head->ctl_table, head->root)) { in insert_links()
1276 drop_sysctl_table(&core_parent->header); in insert_links()
1281 * __register_sysctl_table - register a leaf sysctl table
1284 * @table: the top-level table structure
1287 * array. A completely 0 filled entry terminates the table.
1291 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1294 * data - a pointer to data for use by proc_handler
1296 * maxlen - the maximum size in bytes of the data
1298 * mode - the file permissions for the /proc/sys file
1300 * child - must be %NULL.
1302 * proc_handler - the text handler routine (described below)
1304 * extra1, extra2 - extra pointers usable by the proc handler routines
1307 * under /proc; non-leaf nodes will be represented by directories.
1310 * Several default handlers are available to cover common cases -
1326 struct ctl_table_root *root = set->dir.header.root; in __register_sysctl_table()
1328 const char *name, *nextname; in __register_sysctl_table() local
1330 struct ctl_table *entry; in __register_sysctl_table() local
1334 list_for_each_table_entry(entry, table) in __register_sysctl_table()
1348 dir = &set->dir; in __register_sysctl_table()
1350 dir->header.nreg++; in __register_sysctl_table()
1354 for (name = path; name; name = nextname) { in __register_sysctl_table()
1356 nextname = strchr(name, '/'); in __register_sysctl_table()
1358 namelen = nextname - name; in __register_sysctl_table()
1361 namelen = strlen(name); in __register_sysctl_table()
1366 dir = get_subdir(dir, name, namelen); in __register_sysctl_table()
1375 drop_sysctl_table(&dir->header); in __register_sysctl_table()
1381 drop_sysctl_table(&dir->header); in __register_sysctl_table()
1390 * register_sysctl - register a sysctl table
1395 * array. A completely 0 filled entry terminates the table.
1407 * __register_sysctl_init() - register sysctl table to path
1408 * @path: path name for sysctl base
1410 * @table_name: The name of sysctl table, only used for log printing when
1415 * values pre-set. Code which depends on these variables will always work even
1438 static char *append_path(const char *path, char *pos, const char *name) in append_path() argument
1441 namelen = strlen(name); in append_path()
1442 if (((pos - path) + namelen + 2) >= PATH_MAX) in append_path()
1444 memcpy(pos, name, namelen); in append_path()
1455 struct ctl_table *entry; in count_subheaders() local
1458 if (!table || !table->procname) in count_subheaders()
1461 list_for_each_table_entry(entry, table) { in count_subheaders()
1462 if (entry->child) in count_subheaders()
1463 nr_subheaders += count_subheaders(entry->child); in count_subheaders()
1475 struct ctl_table *entry, *files; in register_leaf_sysctl_tables() local
1478 int err = -ENOMEM; in register_leaf_sysctl_tables()
1480 list_for_each_table_entry(entry, table) { in register_leaf_sysctl_tables()
1481 if (entry->child) in register_leaf_sysctl_tables()
1499 list_for_each_table_entry(entry, table) { in register_leaf_sysctl_tables()
1500 if (entry->child) in register_leaf_sysctl_tables()
1502 *new = *entry; in register_leaf_sysctl_tables()
1517 header->ctl_table_arg = ctl_table_arg; in register_leaf_sysctl_tables()
1523 list_for_each_table_entry(entry, table) { in register_leaf_sysctl_tables()
1526 if (!entry->child) in register_leaf_sysctl_tables()
1529 err = -ENAMETOOLONG; in register_leaf_sysctl_tables()
1530 child_pos = append_path(path, pos, entry->procname); in register_leaf_sysctl_tables()
1535 set, entry->child); in register_leaf_sysctl_tables()
1547 * __register_sysctl_paths - register a sysctl table hierarchy
1550 * @table: the top-level table structure
1553 * array. A completely 0 filled entry terminates the table.
1572 for (component = path; component->procname; component++) { in __register_sysctl_paths()
1573 pos = append_path(new_path, pos, component->procname); in __register_sysctl_paths()
1577 while (table->procname && table->child && !table[1].procname) { in __register_sysctl_paths()
1578 pos = append_path(new_path, pos, table->procname); in __register_sysctl_paths()
1581 table = table->child; in __register_sysctl_paths()
1586 header->ctl_table_arg = ctl_table_arg; in __register_sysctl_paths()
1595 header->ctl_table_arg = ctl_table_arg; in __register_sysctl_paths()
1608 struct ctl_table_header *subh = *(--subheader); in __register_sysctl_paths()
1609 struct ctl_table *table = subh->ctl_table_arg; in __register_sysctl_paths()
1619 * register_sysctl_paths - register a sysctl table hierarchy
1621 * @table: the top-level table structure
1624 * array. A completely 0 filled entry terminates the table.
1637 * register_sysctl_table - register a sysctl table hierarchy
1638 * @table: the top-level table structure
1641 * array. A completely 0 filled entry terminates the table.
1665 struct ctl_table_root *root = header->root; in put_links()
1666 struct ctl_dir *parent = header->parent; in put_links()
1668 struct ctl_table *entry; in put_links() local
1670 if (header->set == root_set) in put_links()
1677 list_for_each_table_entry(entry, header->ctl_table) { in put_links()
1680 const char *name = entry->procname; in put_links() local
1682 link = find_entry(&link_head, core_parent, name, strlen(name)); in put_links()
1684 ((S_ISDIR(link->mode) && S_ISDIR(entry->mode)) || in put_links()
1685 (S_ISLNK(link->mode) && (link->data == root)))) { in put_links()
1691 pr_cont("%s\n", name); in put_links()
1698 struct ctl_dir *parent = header->parent; in drop_sysctl_table()
1700 if (--header->nreg) in drop_sysctl_table()
1708 if (!--header->count) in drop_sysctl_table()
1712 drop_sysctl_table(&parent->header); in drop_sysctl_table()
1716 * unregister_sysctl_table - unregister a sysctl table hierarchy
1730 nr_subheaders = count_subheaders(header->ctl_table_arg); in unregister_sysctl_table()
1736 for (i = nr_subheaders -1; i >= 0; i--) { in unregister_sysctl_table()
1738 struct ctl_table *table = subh->ctl_table_arg; in unregister_sysctl_table()
1757 set->is_seen = is_seen; in setup_sysctl_set()
1758 init_header(&set->dir.header, root, set, NULL, root_table); in setup_sysctl_set()
1763 WARN_ON(!RB_EMPTY_ROOT(&set->dir.root)); in retire_sysctl_set()
1771 proc_sys_root->proc_iops = &proc_sys_dir_operations; in proc_sys_init()
1772 proc_sys_root->proc_dir_ops = &proc_sys_dir_file_operations; in proc_sys_init()
1773 proc_sys_root->nlink = 0; in proc_sys_init()
1786 * place and only keep the historical name for compatibility. This is not meant
1805 for (alias = &sysctl_aliases[0]; alias->kernel_param != NULL; alias++) { in sysctl_find_alias()
1806 if (strcmp(alias->kernel_param, param) == 0) in sysctl_find_alias()
1807 return alias->sysctl_param; in sysctl_find_alias()
1826 if (strncmp(param, "sysctl", sizeof("sysctl") - 1) == 0) { in process_sysctl_arg()
1827 param += sizeof("sysctl") - 1; in process_sysctl_arg()
1840 return -EINVAL; in process_sysctl_arg()
1843 return -EINVAL; in process_sysctl_arg()
1875 if (err == -ENOENT) in process_sysctl_arg()
1878 else if (err == -EACCES) in process_sysctl_arg()
1879 pr_err("Failed to set sysctl parameter '%s=%s': permission denied (read-only?)\n", in process_sysctl_arg()
1889 if (err == -EINVAL) in process_sysctl_arg()
1919 NULL, 0, -1, -1, &proc_mnt, process_sysctl_arg); in do_sysctl_args()