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 | |
Joe Perches | 592749e | 2014-06-06 14:37:59 -0700 | [diff] [blame] | 15 | static struct ctl_table scsi_table[] = { |
Eric W. Biederman | 894d249 | 2009-11-05 14:34:02 -0800 | [diff] [blame] | 16 | { .procname = "logging_level", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | .data = &scsi_logging_level, |
| 18 | .maxlen = sizeof(scsi_logging_level), |
| 19 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 20 | .proc_handler = proc_dointvec }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | { } |
| 22 | }; |
| 23 | |
Joe Perches | 592749e | 2014-06-06 14:37:59 -0700 | [diff] [blame] | 24 | static struct ctl_table scsi_dir_table[] = { |
Eric W. Biederman | 894d249 | 2009-11-05 14:34:02 -0800 | [diff] [blame] | 25 | { .procname = "scsi", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | .mode = 0555, |
| 27 | .child = scsi_table }, |
| 28 | { } |
| 29 | }; |
| 30 | |
Joe Perches | 592749e | 2014-06-06 14:37:59 -0700 | [diff] [blame] | 31 | static struct ctl_table scsi_root_table[] = { |
Eric W. Biederman | 894d249 | 2009-11-05 14:34:02 -0800 | [diff] [blame] | 32 | { .procname = "dev", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | .mode = 0555, |
| 34 | .child = scsi_dir_table }, |
| 35 | { } |
| 36 | }; |
| 37 | |
| 38 | static struct ctl_table_header *scsi_table_header; |
| 39 | |
| 40 | int __init scsi_init_sysctl(void) |
| 41 | { |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 42 | scsi_table_header = register_sysctl_table(scsi_root_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | if (!scsi_table_header) |
| 44 | return -ENOMEM; |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | void scsi_exit_sysctl(void) |
| 49 | { |
| 50 | unregister_sysctl_table(scsi_table_header); |
| 51 | } |