Lines Matching full:table
185 struct ctl_node *node, struct ctl_table *table) in init_header() argument
187 head->ctl_table = table; in init_header()
188 head->ctl_table_arg = table; in init_header()
200 for (entry = table; entry->procname; entry++, node++) in init_header()
414 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op) in sysctl_perm() argument
420 mode = root->permissions(head, table); in sysctl_perm()
422 mode = table->mode; in sysctl_perm()
428 struct ctl_table_header *head, struct ctl_table *table) in proc_sys_make_inode() argument
449 ei->sysctl_entry = table; in proc_sys_make_inode()
455 inode->i_mode = table->mode; in proc_sys_make_inode()
456 if (!S_ISDIR(table->mode)) { in proc_sys_make_inode()
469 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
544 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_call_handler() local
557 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ)) in proc_sys_call_handler()
562 if (!table->proc_handler) in proc_sys_call_handler()
580 error = BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, &kbuf, &count, in proc_sys_call_handler()
586 error = table->proc_handler(table, write, kbuf, &count, &iocb->ki_pos); in proc_sys_call_handler()
618 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_open() local
624 if (table->poll) in proc_sys_open()
625 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_open()
636 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_poll() local
644 if (!table->proc_handler) in proc_sys_poll()
647 if (!table->poll) in proc_sys_poll()
651 poll_wait(filp, &table->poll->wait, wait); in proc_sys_poll()
653 if (event != atomic_read(&table->poll->event)) { in proc_sys_poll()
654 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_poll()
667 struct ctl_table *table) in proc_sys_fill_cache() argument
675 qname.name = table->procname; in proc_sys_fill_cache()
676 qname.len = strlen(table->procname); in proc_sys_fill_cache()
687 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
716 struct ctl_table *table) in proc_sys_link_fill_cache() argument
725 if (sysctl_follow_link(&head, &table)) in proc_sys_link_fill_cache()
728 ret = proc_sys_fill_cache(file, ctx, head, table); in proc_sys_link_fill_cache()
734 static int scan(struct ctl_table_header *head, struct ctl_table *table, in scan() argument
743 if (unlikely(S_ISLNK(table->mode))) in scan()
744 res = proc_sys_link_fill_cache(file, ctx, head, table); in scan()
746 res = proc_sys_fill_cache(file, ctx, head, table); in scan()
791 struct ctl_table *table; in proc_sys_permission() local
802 table = PROC_I(inode)->sysctl_entry; in proc_sys_permission()
803 if (!table) /* global root - r-xr-xr-x */ in proc_sys_permission()
805 else /* Use the permissions on the sysctl table entry */ in proc_sys_permission()
806 error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK); in proc_sys_permission()
836 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_getattr() local
842 if (table) in proc_sys_getattr()
843 stat->mode = (stat->mode & S_IFMT) | table->mode; in proc_sys_getattr()
948 struct ctl_table *table; in new_dir() local
960 table = (struct ctl_table *)(node + 1); in new_dir()
961 new_name = (char *)(table + 2); in new_dir()
964 table[0].procname = new_name; in new_dir()
965 table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO; in new_dir()
966 init_header(&new->header, set->dir.header.root, set, node, table); in new_dir()
1080 static int sysctl_err(const char *path, struct ctl_table *table, char *fmt, ...) in sysctl_err() argument
1089 pr_err("sysctl table check failed: %s/%s %pV\n", in sysctl_err()
1090 path, table->procname, &vaf); in sysctl_err()
1096 static int sysctl_check_table_array(const char *path, struct ctl_table *table) in sysctl_check_table_array() argument
1100 if ((table->proc_handler == proc_douintvec) || in sysctl_check_table_array()
1101 (table->proc_handler == proc_douintvec_minmax)) { in sysctl_check_table_array()
1102 if (table->maxlen != sizeof(unsigned int)) in sysctl_check_table_array()
1103 err |= sysctl_err(path, table, "array not allowed"); in sysctl_check_table_array()
1106 if (table->proc_handler == proc_dou8vec_minmax) { in sysctl_check_table_array()
1107 if (table->maxlen != sizeof(u8)) in sysctl_check_table_array()
1108 err |= sysctl_err(path, table, "array not allowed"); in sysctl_check_table_array()
1114 static int sysctl_check_table(const char *path, struct ctl_table *table) in sysctl_check_table() argument
1117 for (; table->procname; table++) { in sysctl_check_table()
1118 if (table->child) in sysctl_check_table()
1119 err |= sysctl_err(path, table, "Not a file"); in sysctl_check_table()
1121 if ((table->proc_handler == proc_dostring) || in sysctl_check_table()
1122 (table->proc_handler == proc_dointvec) || in sysctl_check_table()
1123 (table->proc_handler == proc_douintvec) || in sysctl_check_table()
1124 (table->proc_handler == proc_douintvec_minmax) || in sysctl_check_table()
1125 (table->proc_handler == proc_dointvec_minmax) || in sysctl_check_table()
1126 (table->proc_handler == proc_dou8vec_minmax) || in sysctl_check_table()
1127 (table->proc_handler == proc_dointvec_jiffies) || in sysctl_check_table()
1128 (table->proc_handler == proc_dointvec_userhz_jiffies) || in sysctl_check_table()
1129 (table->proc_handler == proc_dointvec_ms_jiffies) || in sysctl_check_table()
1130 (table->proc_handler == proc_doulongvec_minmax) || in sysctl_check_table()
1131 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { in sysctl_check_table()
1132 if (!table->data) in sysctl_check_table()
1133 err |= sysctl_err(path, table, "No data"); in sysctl_check_table()
1134 if (!table->maxlen) in sysctl_check_table()
1135 err |= sysctl_err(path, table, "No maxlen"); in sysctl_check_table()
1137 err |= sysctl_check_table_array(path, table); in sysctl_check_table()
1139 if (!table->proc_handler) in sysctl_check_table()
1140 err |= sysctl_err(path, table, "No proc_handler"); in sysctl_check_table()
1142 if ((table->mode & (S_IRUGO|S_IWUGO)) != table->mode) in sysctl_check_table()
1143 err |= sysctl_err(path, table, "bogus .mode 0%o", in sysctl_check_table()
1144 table->mode); in sysctl_check_table()
1149 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table, in new_links() argument
1160 for (entry = table; entry->procname; entry++) { in new_links()
1178 for (link = link_table, entry = table; entry->procname; link++, entry++) { in new_links()
1193 struct ctl_table *table, struct ctl_table_root *link_root) in get_links() argument
1198 /* Are there links available for every entry in table? */ in get_links()
1199 for (entry = table; entry->procname; entry++) { in get_links()
1212 for (entry = table; entry->procname; entry++) { in get_links()
1262 * __register_sysctl_table - register a leaf sysctl table
1264 * @path: The path to the directory the sysctl table is in.
1265 * @table: the top-level table structure
1267 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1268 * array. A completely 0 filled entry terminates the table.
1301 * to the table header on success.
1305 const char *path, struct ctl_table *table) in __register_sysctl_table() argument
1315 for (entry = table; entry->procname; entry++) in __register_sysctl_table()
1324 init_header(header, root, set, node, table); in __register_sysctl_table()
1325 if (sysctl_check_table(path, table)) in __register_sysctl_table()
1371 * register_sysctl - register a sysctl table
1372 * @path: The path to the directory the sysctl table is in.
1373 * @table: the table structure
1375 * Register a sysctl table. @table should be a filled in ctl_table
1376 * array. A completely 0 filled entry terminates the table.
1380 struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table) in register_sysctl() argument
1383 path, table); in register_sysctl()
1400 static int count_subheaders(struct ctl_table *table) in count_subheaders() argument
1407 if (!table || !table->procname) in count_subheaders()
1410 for (entry = table; entry->procname; entry++) { in count_subheaders()
1421 struct ctl_table *table) in register_leaf_sysctl_tables() argument
1429 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1436 files = table; in register_leaf_sysctl_tables()
1437 /* If there are mixed files and directories we need a new table */ in register_leaf_sysctl_tables()
1446 for (new = files, entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1463 /* Remember if we need to free the file table */ in register_leaf_sysctl_tables()
1470 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1494 * __register_sysctl_paths - register a sysctl table hierarchy
1496 * @path: The path to the directory the sysctl table is in.
1497 * @table: the top-level table structure
1499 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1500 * array. A completely 0 filled entry terminates the table.
1506 const struct ctl_path *path, struct ctl_table *table) in __register_sysctl_paths() argument
1508 struct ctl_table *ctl_table_arg = table; in __register_sysctl_paths()
1509 int nr_subheaders = count_subheaders(table); in __register_sysctl_paths()
1524 while (table->procname && table->child && !table[1].procname) { in __register_sysctl_paths()
1525 pos = append_path(new_path, pos, table->procname); in __register_sysctl_paths()
1528 table = table->child; in __register_sysctl_paths()
1531 header = __register_sysctl_table(set, new_path, table); in __register_sysctl_paths()
1545 set, table)) in __register_sysctl_paths()
1556 struct ctl_table *table = subh->ctl_table_arg; in __register_sysctl_paths() local
1558 kfree(table); in __register_sysctl_paths()
1566 * register_sysctl_paths - register a sysctl table hierarchy
1567 * @path: The path to the directory the sysctl table is in.
1568 * @table: the top-level table structure
1570 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1571 * array. A completely 0 filled entry terminates the table.
1576 struct ctl_table *table) in register_sysctl_paths() argument
1579 path, table); in register_sysctl_paths()
1584 * register_sysctl_table - register a sysctl table hierarchy
1585 * @table: the top-level table structure
1587 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1588 * array. A completely 0 filled entry terminates the table.
1592 struct ctl_table_header *register_sysctl_table(struct ctl_table *table) in register_sysctl_table() argument
1596 return register_sysctl_paths(null_path, table); in register_sysctl_table()
1654 * unregister_sysctl_table - unregister a sysctl table hierarchy
1657 * Unregisters the sysctl table and all children. proc entries may not
1676 struct ctl_table *table = subh->ctl_table_arg; in unregister_sysctl_table() local
1678 kfree(table); in unregister_sysctl_table()