Lines Matching full:table
188 struct ctl_node *node, struct ctl_table *table) in init_header() argument
190 head->ctl_table = table; in init_header()
191 head->ctl_table_arg = table; in init_header()
203 for (entry = table; entry->procname; entry++, node++) in init_header()
450 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op) in sysctl_perm() argument
456 mode = root->permissions(head, table); in sysctl_perm()
458 mode = table->mode; in sysctl_perm()
464 struct ctl_table_header *head, struct ctl_table *table) in proc_sys_make_inode() argument
485 ei->sysctl_entry = table; in proc_sys_make_inode()
491 inode->i_mode = table->mode; in proc_sys_make_inode()
492 if (!S_ISDIR(table->mode)) { in proc_sys_make_inode()
505 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
580 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_call_handler() local
592 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ)) in proc_sys_call_handler()
597 if (!table->proc_handler) in proc_sys_call_handler()
600 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, &count, in proc_sys_call_handler()
611 error = table->proc_handler(table, write, (void __user *)new_buf, in proc_sys_call_handler()
616 error = table->proc_handler(table, write, buf, &count, ppos); in proc_sys_call_handler()
642 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_open() local
648 if (table->poll) in proc_sys_open()
649 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_open()
660 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_poll() local
668 if (!table->proc_handler) in proc_sys_poll()
671 if (!table->poll) in proc_sys_poll()
675 poll_wait(filp, &table->poll->wait, wait); in proc_sys_poll()
677 if (event != atomic_read(&table->poll->event)) { in proc_sys_poll()
678 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_poll()
691 struct ctl_table *table) in proc_sys_fill_cache() argument
699 qname.name = table->procname; in proc_sys_fill_cache()
700 qname.len = strlen(table->procname); in proc_sys_fill_cache()
711 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
740 struct ctl_table *table) in proc_sys_link_fill_cache() argument
749 if (sysctl_follow_link(&head, &table)) in proc_sys_link_fill_cache()
752 ret = proc_sys_fill_cache(file, ctx, head, table); in proc_sys_link_fill_cache()
758 static int scan(struct ctl_table_header *head, struct ctl_table *table, in scan() argument
767 if (unlikely(S_ISLNK(table->mode))) in scan()
768 res = proc_sys_link_fill_cache(file, ctx, head, table); in scan()
770 res = proc_sys_fill_cache(file, ctx, head, table); in scan()
814 struct ctl_table *table; in proc_sys_permission() local
825 table = PROC_I(inode)->sysctl_entry; in proc_sys_permission()
826 if (!table) /* global root - r-xr-xr-x */ in proc_sys_permission()
828 else /* Use the permissions on the sysctl table entry */ in proc_sys_permission()
829 error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK); in proc_sys_permission()
857 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_getattr() local
863 if (table) in proc_sys_getattr()
864 stat->mode = (stat->mode & S_IFMT) | table->mode; in proc_sys_getattr()
967 struct ctl_table *table; in new_dir() local
979 table = (struct ctl_table *)(node + 1); in new_dir()
980 new_name = (char *)(table + 2); in new_dir()
983 table[0].procname = new_name; in new_dir()
984 table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO; in new_dir()
985 init_header(&new->header, set->dir.header.root, set, node, table); in new_dir()
1099 static int sysctl_err(const char *path, struct ctl_table *table, char *fmt, ...) in sysctl_err() argument
1108 pr_err("sysctl table check failed: %s/%s %pV\n", in sysctl_err()
1109 path, table->procname, &vaf); in sysctl_err()
1115 static int sysctl_check_table_array(const char *path, struct ctl_table *table) in sysctl_check_table_array() argument
1119 if ((table->proc_handler == proc_douintvec) || in sysctl_check_table_array()
1120 (table->proc_handler == proc_douintvec_minmax)) { in sysctl_check_table_array()
1121 if (table->maxlen != sizeof(unsigned int)) in sysctl_check_table_array()
1122 err |= sysctl_err(path, table, "array not allowed"); in sysctl_check_table_array()
1128 static int sysctl_check_table(const char *path, struct ctl_table *table) in sysctl_check_table() argument
1131 for (; table->procname; table++) { in sysctl_check_table()
1132 if (table->child) in sysctl_check_table()
1133 err |= sysctl_err(path, table, "Not a file"); in sysctl_check_table()
1135 if ((table->proc_handler == proc_dostring) || in sysctl_check_table()
1136 (table->proc_handler == proc_dointvec) || in sysctl_check_table()
1137 (table->proc_handler == proc_douintvec) || in sysctl_check_table()
1138 (table->proc_handler == proc_douintvec_minmax) || in sysctl_check_table()
1139 (table->proc_handler == proc_dointvec_minmax) || in sysctl_check_table()
1140 (table->proc_handler == proc_dointvec_jiffies) || in sysctl_check_table()
1141 (table->proc_handler == proc_dointvec_userhz_jiffies) || in sysctl_check_table()
1142 (table->proc_handler == proc_dointvec_ms_jiffies) || in sysctl_check_table()
1143 (table->proc_handler == proc_doulongvec_minmax) || in sysctl_check_table()
1144 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { in sysctl_check_table()
1145 if (!table->data) in sysctl_check_table()
1146 err |= sysctl_err(path, table, "No data"); in sysctl_check_table()
1147 if (!table->maxlen) in sysctl_check_table()
1148 err |= sysctl_err(path, table, "No maxlen"); in sysctl_check_table()
1150 err |= sysctl_check_table_array(path, table); in sysctl_check_table()
1152 if (!table->proc_handler) in sysctl_check_table()
1153 err |= sysctl_err(path, table, "No proc_handler"); in sysctl_check_table()
1155 if ((table->mode & (S_IRUGO|S_IWUGO)) != table->mode) in sysctl_check_table()
1156 err |= sysctl_err(path, table, "bogus .mode 0%o", in sysctl_check_table()
1157 table->mode); in sysctl_check_table()
1162 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table, in new_links() argument
1173 for (entry = table; entry->procname; entry++) { in new_links()
1191 for (link = link_table, entry = table; entry->procname; link++, entry++) { in new_links()
1206 struct ctl_table *table, struct ctl_table_root *link_root) in get_links() argument
1211 /* Are there links available for every entry in table? */ in get_links()
1212 for (entry = table; entry->procname; entry++) { in get_links()
1225 for (entry = table; entry->procname; entry++) { in get_links()
1275 * __register_sysctl_table - register a leaf sysctl table
1277 * @path: The path to the directory the sysctl table is in.
1278 * @table: the top-level table structure
1280 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1281 * array. A completely 0 filled entry terminates the table.
1314 * to the table header on success.
1318 const char *path, struct ctl_table *table) in __register_sysctl_table() argument
1328 for (entry = table; entry->procname; entry++) in __register_sysctl_table()
1337 init_header(header, root, set, node, table); in __register_sysctl_table()
1338 if (sysctl_check_table(path, table)) in __register_sysctl_table()
1384 * register_sysctl - register a sysctl table
1385 * @path: The path to the directory the sysctl table is in.
1386 * @table: the table structure
1388 * Register a sysctl table. @table should be a filled in ctl_table
1389 * array. A completely 0 filled entry terminates the table.
1393 struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table) in register_sysctl() argument
1396 path, table); in register_sysctl()
1413 static int count_subheaders(struct ctl_table *table) in count_subheaders() argument
1420 if (!table || !table->procname) in count_subheaders()
1423 for (entry = table; entry->procname; entry++) { in count_subheaders()
1434 struct ctl_table *table) in register_leaf_sysctl_tables() argument
1442 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1449 files = table; in register_leaf_sysctl_tables()
1450 /* If there are mixed files and directories we need a new table */ in register_leaf_sysctl_tables()
1459 for (new = files, entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1476 /* Remember if we need to free the file table */ in register_leaf_sysctl_tables()
1483 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1507 * __register_sysctl_paths - register a sysctl table hierarchy
1509 * @path: The path to the directory the sysctl table is in.
1510 * @table: the top-level table structure
1512 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1513 * array. A completely 0 filled entry terminates the table.
1519 const struct ctl_path *path, struct ctl_table *table) in __register_sysctl_paths() argument
1521 struct ctl_table *ctl_table_arg = table; in __register_sysctl_paths()
1522 int nr_subheaders = count_subheaders(table); in __register_sysctl_paths()
1537 while (table->procname && table->child && !table[1].procname) { in __register_sysctl_paths()
1538 pos = append_path(new_path, pos, table->procname); in __register_sysctl_paths()
1541 table = table->child; in __register_sysctl_paths()
1544 header = __register_sysctl_table(set, new_path, table); in __register_sysctl_paths()
1558 set, table)) in __register_sysctl_paths()
1569 struct ctl_table *table = subh->ctl_table_arg; in __register_sysctl_paths() local
1571 kfree(table); in __register_sysctl_paths()
1579 * register_sysctl_table_path - register a sysctl table hierarchy
1580 * @path: The path to the directory the sysctl table is in.
1581 * @table: the top-level table structure
1583 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1584 * array. A completely 0 filled entry terminates the table.
1589 struct ctl_table *table) in register_sysctl_paths() argument
1592 path, table); in register_sysctl_paths()
1597 * register_sysctl_table - register a sysctl table hierarchy
1598 * @table: the top-level table structure
1600 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1601 * array. A completely 0 filled entry terminates the table.
1605 struct ctl_table_header *register_sysctl_table(struct ctl_table *table) in register_sysctl_table() argument
1609 return register_sysctl_paths(null_path, table); in register_sysctl_table()
1667 * unregister_sysctl_table - unregister a sysctl table hierarchy
1670 * Unregisters the sysctl table and all children. proc entries may not
1689 struct ctl_table *table = subh->ctl_table_arg; in unregister_sysctl_table() local
1691 kfree(table); in unregister_sysctl_table()