patch-2.3.48 linux/kernel/sysctl.c
Next file: linux/mm/bootmem.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index
- Lines: 146
- Date:
Sat Feb 26 20:33:09 2000
- Orig file:
v2.3.47/linux/kernel/sysctl.c
- Orig date:
Thu Feb 10 17:11:23 2000
diff -u --recursive --new-file v2.3.47/linux/kernel/sysctl.c linux/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 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 @@
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 @@
{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 @@
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 @@
newval, newlen, context);
return error;
}
- };
+ }
return -ENOTDIR;
}
@@ -495,14 +484,15 @@
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 @@
*/
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 @@
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)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)