linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* debug_flag added to st tape driver
@ 2014-06-10 20:57 Laurence Oberman
  2014-06-10 21:20 ` Bryn M. Reeves
  0 siblings, 1 reply; 2+ messages in thread
From: Laurence Oberman @ 2014-06-10 20:57 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org

Hello

I am tired of building modules to enable SCSI tape driver debug so I
am hoping this patch is acceptable.
Tested using kernel 3.14.6

Usage example:
modprobe st debug_flag=1

diff -Nur a/st.c b/st.c
--- a/st.c        2014-06-10 16:45:18.522354105 -0400
+++ b/st.c        2014-06-10 16:45:33.953765908 -0400
@@ -80,6 +80,7 @@
 static int try_direct_io = TRY_DIRECT_IO;
 static int try_rdio = 1;
 static int try_wdio = 1;
+static int debug_flag = 0;

 static struct class st_sysfs_class;
 static const struct attribute_group *st_dev_groups[];
@@ -100,6 +101,9 @@
 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_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 DEBUG 1
in source");
+

 /* Extra parameters for testing */
 module_param_named(try_rdio, try_rdio, int, 0);
@@ -124,6 +128,9 @@
         },
         {
                 "try_direct_io", &try_direct_io
+        },
+        {
+                "debug_flag", &debug_flag
         }
 };
 #endif
@@ -4277,7 +4284,9 @@
 static int __init init_st(void)
 {
         int err;
-
+        debugging = (debug_flag > 0) ? debug_flag : DEBUG;
+        if (debugging)
+                printk(KERN_INFO "st: Debugging enabled debug_flag =
%d\n",debugging);
         validate_options();

         printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n",

Thanks
Laurence

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: debug_flag added to st tape driver
  2014-06-10 20:57 debug_flag added to st tape driver Laurence Oberman
@ 2014-06-10 21:20 ` Bryn M. Reeves
  0 siblings, 0 replies; 2+ messages in thread
From: Bryn M. Reeves @ 2014-06-10 21:20 UTC (permalink / raw)
  To: Laurence Oberman; +Cc: linux-scsi@vger.kernel.org

On Tue, Jun 10, 2014 at 04:57:06PM -0400, Laurence Oberman wrote:
> I am tired of building modules to enable SCSI tape driver debug so I
> am hoping this patch is acceptable.
> Tested using kernel 3.14.6
> 
> Usage example:
> modprobe st debug_flag=1

Missing Signed-off-by :-)
 
> +module_param_named(debug_flag, debug_flag, int, 0);

It's probably not worth making this a sysfs knob as most distros
still compile st as a module although why not just set debugging
directly from the module parameter?

> +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting DEBUG 1
> in source");
> +

The description is a bit misleading as a bunch of stuff gets
compiled out when DEBUG is unset at compile time.

Maybe "same as setting debugging=1" instead?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-10 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 20:57 debug_flag added to st tape driver Laurence Oberman
2014-06-10 21:20 ` Bryn M. Reeves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).