Lines Matching full:table
183 struct ctl_node *node, struct ctl_table *table) in init_header() argument
185 head->ctl_table = table; in init_header()
186 head->ctl_table_arg = table; in init_header()
198 for (entry = table; entry->procname; entry++, node++) in init_header()
445 static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, int op) in sysctl_perm() argument
451 mode = root->permissions(head, table); in sysctl_perm()
453 mode = table->mode; in sysctl_perm()
459 struct ctl_table_header *head, struct ctl_table *table) in proc_sys_make_inode() argument
480 ei->sysctl_entry = table; in proc_sys_make_inode()
486 inode->i_mode = table->mode; in proc_sys_make_inode()
487 if (!S_ISDIR(table->mode)) { in proc_sys_make_inode()
500 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); in proc_sys_make_inode()
575 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_call_handler() local
587 if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ)) in proc_sys_call_handler()
592 if (!table->proc_handler) in proc_sys_call_handler()
597 error = table->proc_handler(table, write, buf, &res, ppos); in proc_sys_call_handler()
621 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_open() local
627 if (table->poll) in proc_sys_open()
628 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_open()
639 struct ctl_table *table = PROC_I(inode)->sysctl_entry; in proc_sys_poll() local
647 if (!table->proc_handler) in proc_sys_poll()
650 if (!table->poll) in proc_sys_poll()
654 poll_wait(filp, &table->poll->wait, wait); in proc_sys_poll()
656 if (event != atomic_read(&table->poll->event)) { in proc_sys_poll()
657 filp->private_data = proc_sys_poll_event(table->poll); in proc_sys_poll()
670 struct ctl_table *table) in proc_sys_fill_cache() argument
678 qname.name = table->procname; in proc_sys_fill_cache()
679 qname.len = strlen(table->procname); in proc_sys_fill_cache()
690 inode = proc_sys_make_inode(dir->d_sb, head, table); in proc_sys_fill_cache()
719 struct ctl_table *table) in proc_sys_link_fill_cache() argument
728 if (sysctl_follow_link(&head, &table)) in proc_sys_link_fill_cache()
731 ret = proc_sys_fill_cache(file, ctx, head, table); in proc_sys_link_fill_cache()
737 static int scan(struct ctl_table_header *head, struct ctl_table *table, in scan() argument
746 if (unlikely(S_ISLNK(table->mode))) in scan()
747 res = proc_sys_link_fill_cache(file, ctx, head, table); in scan()
749 res = proc_sys_fill_cache(file, ctx, head, table); in scan()
793 struct ctl_table *table; in proc_sys_permission() local
804 table = PROC_I(inode)->sysctl_entry; in proc_sys_permission()
805 if (!table) /* global root - r-xr-xr-x */ in proc_sys_permission()
807 else /* Use the permissions on the sysctl table entry */ in proc_sys_permission()
808 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()
946 struct ctl_table *table; in new_dir() local
958 table = (struct ctl_table *)(node + 1); in new_dir()
959 new_name = (char *)(table + 2); in new_dir()
962 table[0].procname = new_name; in new_dir()
963 table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO; in new_dir()
964 init_header(&new->header, set->dir.header.root, set, node, table); in new_dir()
1078 static int sysctl_err(const char *path, struct ctl_table *table, char *fmt, ...) in sysctl_err() argument
1087 pr_err("sysctl table check failed: %s/%s %pV\n", in sysctl_err()
1088 path, table->procname, &vaf); in sysctl_err()
1094 static int sysctl_check_table_array(const char *path, struct ctl_table *table) in sysctl_check_table_array() argument
1098 if ((table->proc_handler == proc_douintvec) || in sysctl_check_table_array()
1099 (table->proc_handler == proc_douintvec_minmax)) { in sysctl_check_table_array()
1100 if (table->maxlen != sizeof(unsigned int)) in sysctl_check_table_array()
1101 err |= sysctl_err(path, table, "array not allowed"); in sysctl_check_table_array()
1107 static int sysctl_check_table(const char *path, struct ctl_table *table) in sysctl_check_table() argument
1110 for (; table->procname; table++) { in sysctl_check_table()
1111 if (table->child) in sysctl_check_table()
1112 err |= sysctl_err(path, table, "Not a file"); in sysctl_check_table()
1114 if ((table->proc_handler == proc_dostring) || in sysctl_check_table()
1115 (table->proc_handler == proc_dointvec) || in sysctl_check_table()
1116 (table->proc_handler == proc_douintvec) || in sysctl_check_table()
1117 (table->proc_handler == proc_douintvec_minmax) || in sysctl_check_table()
1118 (table->proc_handler == proc_dointvec_minmax) || in sysctl_check_table()
1119 (table->proc_handler == proc_dointvec_jiffies) || in sysctl_check_table()
1120 (table->proc_handler == proc_dointvec_userhz_jiffies) || in sysctl_check_table()
1121 (table->proc_handler == proc_dointvec_ms_jiffies) || in sysctl_check_table()
1122 (table->proc_handler == proc_doulongvec_minmax) || in sysctl_check_table()
1123 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { in sysctl_check_table()
1124 if (!table->data) in sysctl_check_table()
1125 err |= sysctl_err(path, table, "No data"); in sysctl_check_table()
1126 if (!table->maxlen) in sysctl_check_table()
1127 err |= sysctl_err(path, table, "No maxlen"); in sysctl_check_table()
1129 err |= sysctl_check_table_array(path, table); in sysctl_check_table()
1131 if (!table->proc_handler) in sysctl_check_table()
1132 err |= sysctl_err(path, table, "No proc_handler"); in sysctl_check_table()
1134 if ((table->mode & (S_IRUGO|S_IWUGO)) != table->mode) in sysctl_check_table()
1135 err |= sysctl_err(path, table, "bogus .mode 0%o", in sysctl_check_table()
1136 table->mode); in sysctl_check_table()
1141 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table, in new_links() argument
1152 for (entry = table; entry->procname; entry++) { in new_links()
1170 for (link = link_table, entry = table; entry->procname; link++, entry++) { in new_links()
1185 struct ctl_table *table, struct ctl_table_root *link_root) in get_links() argument
1190 /* Are there links available for every entry in table? */ in get_links()
1191 for (entry = table; entry->procname; entry++) { in get_links()
1204 for (entry = table; entry->procname; entry++) { in get_links()
1254 * __register_sysctl_table - register a leaf sysctl table
1256 * @path: The path to the directory the sysctl table is in.
1257 * @table: the top-level table structure
1259 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1260 * array. A completely 0 filled entry terminates the table.
1293 * to the table header on success.
1297 const char *path, struct ctl_table *table) in __register_sysctl_table() argument
1307 for (entry = table; entry->procname; entry++) in __register_sysctl_table()
1316 init_header(header, root, set, node, table); in __register_sysctl_table()
1317 if (sysctl_check_table(path, table)) in __register_sysctl_table()
1363 * register_sysctl - register a sysctl table
1364 * @path: The path to the directory the sysctl table is in.
1365 * @table: the table structure
1367 * Register a sysctl table. @table should be a filled in ctl_table
1368 * array. A completely 0 filled entry terminates the table.
1372 struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table) in register_sysctl() argument
1375 path, table); in register_sysctl()
1392 static int count_subheaders(struct ctl_table *table) in count_subheaders() argument
1399 if (!table || !table->procname) in count_subheaders()
1402 for (entry = table; entry->procname; entry++) { in count_subheaders()
1413 struct ctl_table *table) in register_leaf_sysctl_tables() argument
1421 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1428 files = table; in register_leaf_sysctl_tables()
1429 /* If there are mixed files and directories we need a new table */ in register_leaf_sysctl_tables()
1438 for (new = files, entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1455 /* Remember if we need to free the file table */ in register_leaf_sysctl_tables()
1462 for (entry = table; entry->procname; entry++) { in register_leaf_sysctl_tables()
1486 * __register_sysctl_paths - register a sysctl table hierarchy
1488 * @path: The path to the directory the sysctl table is in.
1489 * @table: the top-level table structure
1491 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1492 * array. A completely 0 filled entry terminates the table.
1498 const struct ctl_path *path, struct ctl_table *table) in __register_sysctl_paths() argument
1500 struct ctl_table *ctl_table_arg = table; in __register_sysctl_paths()
1501 int nr_subheaders = count_subheaders(table); in __register_sysctl_paths()
1516 while (table->procname && table->child && !table[1].procname) { in __register_sysctl_paths()
1517 pos = append_path(new_path, pos, table->procname); in __register_sysctl_paths()
1520 table = table->child; in __register_sysctl_paths()
1523 header = __register_sysctl_table(set, new_path, table); in __register_sysctl_paths()
1537 set, table)) in __register_sysctl_paths()
1548 struct ctl_table *table = subh->ctl_table_arg; in __register_sysctl_paths() local
1550 kfree(table); in __register_sysctl_paths()
1558 * register_sysctl_table_path - register a sysctl table hierarchy
1559 * @path: The path to the directory the sysctl table is in.
1560 * @table: the top-level table structure
1562 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1563 * array. A completely 0 filled entry terminates the table.
1568 struct ctl_table *table) in register_sysctl_paths() argument
1571 path, table); in register_sysctl_paths()
1576 * register_sysctl_table - register a sysctl table hierarchy
1577 * @table: the top-level table structure
1579 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1580 * array. A completely 0 filled entry terminates the table.
1584 struct ctl_table_header *register_sysctl_table(struct ctl_table *table) in register_sysctl_table() argument
1588 return register_sysctl_paths(null_path, table); in register_sysctl_table()
1646 * unregister_sysctl_table - unregister a sysctl table hierarchy
1649 * Unregisters the sysctl table and all children. proc entries may not
1668 struct ctl_table *table = subh->ctl_table_arg; in unregister_sysctl_table() local
1670 kfree(table); in unregister_sysctl_table()