Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2003 Christoph Hellwig. |
| 3 | * Released under GPL v2. |
| 4 | */ |
| 5 | |
| 6 | #include <linux/errno.h> |
| 7 | #include <linux/init.h> |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/sysctl.h> |
| 10 | |
| 11 | #include "scsi_logging.h" |
Adrian Bunk | 44818ef | 2007-07-09 11:59:59 -0700 | [diff] [blame^] | 12 | #include "scsi_priv.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| 14 | |
| 15 | static ctl_table scsi_table[] = { |
| 16 | { .ctl_name = DEV_SCSI_LOGGING_LEVEL, |
| 17 | .procname = "logging_level", |
| 18 | .data = &scsi_logging_level, |
| 19 | .maxlen = sizeof(scsi_logging_level), |
| 20 | .mode = 0644, |
| 21 | .proc_handler = &proc_dointvec }, |
| 22 | { } |
| 23 | }; |
| 24 | |
| 25 | static ctl_table scsi_dir_table[] = { |
| 26 | { .ctl_name = DEV_SCSI, |
| 27 | .procname = "scsi", |
| 28 | .mode = 0555, |
| 29 | .child = scsi_table }, |
| 30 | { } |
| 31 | }; |
| 32 | |
| 33 | static ctl_table scsi_root_table[] = { |
| 34 | { .ctl_name = CTL_DEV, |
| 35 | .procname = "dev", |
| 36 | .mode = 0555, |
| 37 | .child = scsi_dir_table }, |
| 38 | { } |
| 39 | }; |
| 40 | |
| 41 | static struct ctl_table_header *scsi_table_header; |
| 42 | |
| 43 | int __init scsi_init_sysctl(void) |
| 44 | { |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 45 | scsi_table_header = register_sysctl_table(scsi_root_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | if (!scsi_table_header) |
| 47 | return -ENOMEM; |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | void scsi_exit_sysctl(void) |
| 52 | { |
| 53 | unregister_sysctl_table(scsi_table_header); |
| 54 | } |