summaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 9a6a7a74d..efcda3de4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -12,6 +12,8 @@
* Horn.
* Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
* Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
+ * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
+ * Wendling.
*/
#include <linux/config.h>
@@ -86,8 +88,7 @@ static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
static ctl_table root_table[];
-static struct ctl_table_header root_table_header =
- {root_table, DNODE_SINGLE(&root_table_header)};
+static LIST_HEAD(root_table_header);
static ctl_table kern_table[];
static ctl_table vm_table[];
@@ -115,23 +116,9 @@ struct file_operations proc_sys_file_operations =
write: proc_writesys,
};
-struct inode_operations proc_sys_inode_operations =
+static struct inode_operations proc_sys_inode_operations =
{
- &proc_sys_file_operations,
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* truncate */
- proc_sys_permission, /* permission */
- NULL /* revalidate */
+ permission: proc_sys_permission,
};
extern struct proc_dir_entry *proc_sys_root;
@@ -305,21 +292,23 @@ static ctl_table dev_table[] = {
{0}
};
+extern void init_irq_proc (void);
void __init sysctl_init(void)
{
#ifdef CONFIG_PROC_FS
register_proc_table(root_table, proc_sys_root);
+ init_irq_proc();
#endif
-}
+}
int do_sysctl (int *name, int nlen,
void *oldval, size_t *oldlenp,
void *newval, size_t newlen)
{
int error;
- struct ctl_table_header *tmp;
+ struct list_head *tmp;
void *context;
if (nlen == 0 || nlen >= CTL_MAXNAME)
@@ -333,17 +322,17 @@ int do_sysctl (int *name, int nlen,
if(get_user(old_len, oldlenp))
return -EFAULT;
}
- tmp = &root_table_header;
- do {
+ list_for_each(tmp, &root_table_header) {
+ struct ctl_table_header *head =
+ list_entry(tmp, struct ctl_table_header, ctl_entry);
context = NULL;
error = parse_table(name, nlen, oldval, oldlenp,
- newval, newlen, tmp->ctl_table, &context);
+ newval, newlen, head->ctl_table, &context);
if (context)
kfree(context);
if (error != -ENOTDIR)
return error;
- tmp = tmp->DLIST_NEXT(ctl_entry);
- } while (tmp != &root_table_header);
+ }
return -ENOTDIR;
}
@@ -438,7 +427,7 @@ repeat:
newval, newlen, context);
return error;
}
- };
+ }
return -ENOTDIR;
}
@@ -495,14 +484,15 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table,
int insert_at_head)
{
struct ctl_table_header *tmp;
- tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
+ tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
if (!tmp)
return 0;
- *tmp = ((struct ctl_table_header) {table, DNODE_NULL});
+ tmp->ctl_table = table;
+ INIT_LIST_HEAD(&tmp->ctl_entry);
if (insert_at_head)
- DLIST_INSERT_AFTER(&root_table_header, tmp, ctl_entry);
+ list_add(&tmp->ctl_entry, &root_table_header);
else
- DLIST_INSERT_BEFORE(&root_table_header, tmp, ctl_entry);
+ list_add_tail(&tmp->ctl_entry, &root_table_header);
#ifdef CONFIG_PROC_FS
register_proc_table(table, proc_sys_root);
#endif
@@ -514,7 +504,7 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table,
*/
void unregister_sysctl_table(struct ctl_table_header * header)
{
- DLIST_DELETE(header, ctl_entry);
+ list_del(&header->ctl_entry);
#ifdef CONFIG_PROC_FS
unregister_proc_table(header->ctl_table, proc_sys_root);
#endif
@@ -565,9 +555,10 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root)
if (!de)
continue;
de->data = (void *) table;
- if (table->proc_handler)
- de->ops = &proc_sys_inode_operations;
-
+ if (table->proc_handler) {
+ de->proc_fops = &proc_sys_file_operations;
+ de->proc_iops = &proc_sys_inode_operations;
+ }
}
table->de = de;
if (de->mode & S_IFDIR)