Commit 2bec708a authored by Laurence Oberman's avatar Laurence Oberman Committed by Christoph Hellwig

st: add a debug_flag module parameter request

This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile.
Note that now DEBUG 1 is the default with this patch.

Usage: modprobe st debug_flag=1
Signed-off-by: default avatarLaurence Oberman <loberman@redhat.com>
Acked-by: default avatarKai M??kisara <kai.makisara@kolumbus.fi>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 26cf591e
...@@ -506,9 +506,11 @@ user does not request data that far.) ...@@ -506,9 +506,11 @@ user does not request data that far.)
DEBUGGING HINTS DEBUGGING HINTS
To enable debugging messages, edit st.c and #define DEBUG 1. As seen Debugging code is now compiled in by default but debugging is turned off
above, debugging can be switched off with an ioctl if debugging is with the kernel module parameter debug_flag defaulting to 0. Debugging
compiled into the driver. The debugging output is not voluminous. can still be switched on and off with an ioctl. To enable debug at
module load time add debug_flag=1 to the module load options, the
debugging output is not voluminous.
If the tape seems to hang, I would be very interested to hear where If the tape seems to hang, I would be very interested to hear where
the driver is waiting. With the command 'ps -l' you can see the state the driver is waiting. With the command 'ps -l' you can see the state
......
...@@ -56,7 +56,8 @@ static const char *verstr = "20101219"; ...@@ -56,7 +56,8 @@ static const char *verstr = "20101219";
/* The driver prints some debugging information on the console if DEBUG /* The driver prints some debugging information on the console if DEBUG
is defined and non-zero. */ is defined and non-zero. */
#define DEBUG 0 #define DEBUG 1
#define NO_DEBUG 0
#define ST_DEB_MSG KERN_NOTICE #define ST_DEB_MSG KERN_NOTICE
#if DEBUG #if DEBUG
...@@ -80,6 +81,7 @@ static int max_sg_segs; ...@@ -80,6 +81,7 @@ static int max_sg_segs;
static int try_direct_io = TRY_DIRECT_IO; static int try_direct_io = TRY_DIRECT_IO;
static int try_rdio = 1; static int try_rdio = 1;
static int try_wdio = 1; static int try_wdio = 1;
static int debug_flag;
static struct class st_sysfs_class; static struct class st_sysfs_class;
static const struct attribute_group *st_dev_groups[]; static const struct attribute_group *st_dev_groups[];
...@@ -100,6 +102,9 @@ module_param_named(max_sg_segs, max_sg_segs, int, 0); ...@@ -100,6 +102,9 @@ module_param_named(max_sg_segs, max_sg_segs, int, 0);
MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)");
module_param_named(try_direct_io, try_direct_io, int, 0); module_param_named(try_direct_io, try_direct_io, int, 0);
MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)");
module_param_named(debug_flag, debug_flag, int, 0);
MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1");
/* Extra parameters for testing */ /* Extra parameters for testing */
module_param_named(try_rdio, try_rdio, int, 0); module_param_named(try_rdio, try_rdio, int, 0);
...@@ -124,6 +129,9 @@ static struct st_dev_parm { ...@@ -124,6 +129,9 @@ static struct st_dev_parm {
}, },
{ {
"try_direct_io", &try_direct_io "try_direct_io", &try_direct_io
},
{
"debug_flag", &debug_flag
} }
}; };
#endif #endif
...@@ -4309,6 +4317,12 @@ static int __init init_st(void) ...@@ -4309,6 +4317,12 @@ static int __init init_st(void)
printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n",
verstr, st_fixed_buffer_size, st_max_sg_segs); verstr, st_fixed_buffer_size, st_max_sg_segs);
debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG;
if (debugging) {
printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",
debugging);
}
err = class_register(&st_sysfs_class); err = class_register(&st_sysfs_class);
if (err) { if (err) {
pr_err("Unable register sysfs class for SCSI tapes\n"); pr_err("Unable register sysfs class for SCSI tapes\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment