xref: /linux/drivers/scsi/scsi_sysctl.c (revision f3d9478b2ce468c3115b02ecae7e975990697f15)
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"
12 
13 
14 static ctl_table scsi_table[] = {
15 	{ .ctl_name	= DEV_SCSI_LOGGING_LEVEL,
16 	  .procname	= "logging_level",
17 	  .data		= &scsi_logging_level,
18 	  .maxlen	= sizeof(scsi_logging_level),
19 	  .mode		= 0644,
20 	  .proc_handler	= &proc_dointvec },
21 	{ }
22 };
23 
24 static ctl_table scsi_dir_table[] = {
25 	{ .ctl_name	= DEV_SCSI,
26 	  .procname	= "scsi",
27 	  .mode		= 0555,
28 	  .child	= scsi_table },
29 	{ }
30 };
31 
32 static ctl_table scsi_root_table[] = {
33 	{ .ctl_name	= CTL_DEV,
34 	  .procname	= "dev",
35 	  .mode		= 0555,
36 	  .child	= scsi_dir_table },
37 	{ }
38 };
39 
40 static struct ctl_table_header *scsi_table_header;
41 
42 int __init scsi_init_sysctl(void)
43 {
44 	scsi_table_header = register_sysctl_table(scsi_root_table, 1);
45 	if (!scsi_table_header)
46 		return -ENOMEM;
47 	return 0;
48 }
49 
50 void scsi_exit_sysctl(void)
51 {
52 	unregister_sysctl_table(scsi_table_header);
53 }
54