aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-08-12 17:26:14 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-08-12 17:26:14 +0000
commit98b99ad2ab348bbba1676b95a8895f12ee48fd31 (patch)
tree8c250f6c63a9ada16b4c223056b5d27bf123fc57
parent5a1cdabc085bc9ccaedc5aff7c49a2d0ea5d6e12 (diff)
downloadsg3_utils-98b99ad2ab348bbba1676b95a8895f12ee48fd31.tar.gz
Prepare for removing /proc/scsi from the Linux kernel
From: Bart Van Assche <bvanassche@acm.org> The sg3_utils package is the only /proc/scsi user I know of. Although support for systems without /proc/scsi was added to rescan_scsi_bus.sh more than ten years ago, a few references to /proc/scsi remain. Convert these references into the recommended interfaces. Posted to linux-scsi@vger.kernel.org on 20220810 git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@968 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog6
-rw-r--r--doc/sg3_utils_json.84
-rw-r--r--doc/sg_dd.818
-rw-r--r--doc/sg_format.82
-rw-r--r--doc/sg_map.82
-rw-r--r--doc/sg_read.84
-rw-r--r--doc/sgp_dd.813
-rw-r--r--examples/sgq_dd.c6
-rw-r--r--src/sg_dd.c6
-rw-r--r--src/sg_read.c6
-rw-r--r--src/sgm_dd.c6
-rw-r--r--src/sgp_dd.c6
-rw-r--r--testing/sg_mrq_dd.cpp18
-rw-r--r--testing/sg_tst_bidi.c2
-rw-r--r--testing/sgh_dd.cpp18
-rw-r--r--testing/uapi_sg.h4
16 files changed, 62 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index ab1413b9..d844a7a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for pre-release sg3_utils-1.48 [20220811] [svn: r966]
+Changelog for pre-release sg3_utils-1.48 [20220812] [svn: r968]
- some utilities: add experimental --json[=JO] option
- sg_z_act_query: new utility for sending either a
Zone activate or Zone query command
@@ -71,6 +71,8 @@ Changelog for pre-release sg3_utils-1.48 [20220811] [svn: r966]
- add SG_C_CPP_ZERO_INIT to better handle aggregate stack
instance zeroing (C23 adding 'struct T t {};' will help)
- initialize all sense buffers to 0
+ - linux: replace references to /proc/scsi/sg with
+ /sys/module/sg/parameters/
- rework main README file
- rev 921+922 are bugfix revs on release 1.47 [r919,920]
- configure.ac: map msys to mingw
@@ -1829,7 +1831,7 @@ Changelog for sg3_utils-0.96 [20011221]
Changelog for sg3_utils-0.95 [20010915]
----------------------------
- make sg_dd, sgp_dd and archive/sgq_dd warn if dio selected but
- /proc/scsi/sg/allow_dio is '0'
+ /sys/module/sg/parameters/allow_dio is '0'
- sg_map can now do any INQUIRY (when '-i' argument given)
- expand example in scsi_inquiry
diff --git a/doc/sg3_utils_json.8 b/doc/sg3_utils_json.8
index 788f19c4..d24ebb06 100644
--- a/doc/sg3_utils_json.8
+++ b/doc/sg3_utils_json.8
@@ -211,7 +211,7 @@ termination of a utility (e.g. command line option syntax error).
.PP
When the \fI\-\-json\fR option is given and no errors are detected, then
only JSON is sent to stdout. If the 'o' control character is in the \fIJO\fR
-argument to the \fI\-\-json\fR option, then the former "human readable"
+argument to the \fI\-\-json\fR option, then the former "human readable"
output is placed in a JSON array named "output" within a JSON object
named "utility_invoked". Each line of the former "human readable" output
is placed in its own element of the JSON array named "output".
@@ -285,7 +285,7 @@ Report bugs to <dgilbert at interlog dot com>.
Copyright \(co 2022 Douglas Gilbert
.br
This software is distributed under the GPL version 2 or the BSD\-2\-Clause
-license. There is NO warranty; not even for MERCHANTABILITY or
+license. There is NO warranty; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B sg3_utils(sg3_utils), smartctl(smartmontools)
diff --git a/doc/sg_dd.8 b/doc/sg_dd.8
index ffe8f13f..df4e94c8 100644
--- a/doc/sg_dd.8
+++ b/doc/sg_dd.8
@@ -1,4 +1,4 @@
-.TH SG_DD "8" "May 2022" "sg3_utils\-1.48" SG3_UTILS
+.TH SG_DD "8" "August 2022" "sg3_utils\-1.48" SG3_UTILS
.SH NAME
sg_dd \- copy data to and from files and devices, especially SCSI
devices
@@ -139,9 +139,10 @@ issued and no copy takes place.
\fBdio\fR={0|1}
default is 0 which selects indirect (buffered) IO on sg devices. Value of 1
attempts direct IO which, if not available, falls back to indirect IO and
-notes this at completion. If direct IO is selected and /proc/scsi/sg/allow_dio
-has the value of 0 then a warning is issued (and indirect IO is performed).
-For finer grain control use 'iflag=dio' or 'oflag=dio'.
+notes this at completion. If direct IO is selected and
+/sys/module/sg/parameters/allow_dio has the value of 0 then a warning is
+issued (and indirect IO is performed). For finer grain control
+use 'iflag=dio' or 'oflag=dio'.
.TP
\fBibs\fR=\fIBS\fR
if given must be the same as \fIBS\fR given to 'bs=' option.
@@ -333,8 +334,8 @@ utility. See note about READ LONG below.
dio
request the sg device node associated with this flag does direct IO. If direct
IO is not available, falls back to indirect IO and notes this at completion.
-If direct IO is selected and /proc/scsi/sg/allow_dio has the value of 0 then a
-warning is issued (and indirect IO is performed).
+If direct IO is selected and /sys/module/sg/parameters/allow_dio has the
+value of 0 then a warning is issued (and indirect IO is performed).
.TP
direct
causes the O_DIRECT flag to be added to the open of \fIIFILE\fR and/or
@@ -470,7 +471,7 @@ This is called "indirect IO" and there is a 'dio' option to
select "direct IO" which will DMA directly into user memory. Due to some
issues "direct IO" is disabled in the sg driver and needs a
configuration change to activate it. This is typically done
-with 'echo 1 > /proc/scsi/sg/allow_dio'.
+with 'echo 1 > /sys/module/sg/parameters/allow_dio'.
.PP
All informative, warning and error output is sent to stderr so that
dd's output file can be stdout and remain unpolluted. If no options
@@ -484,8 +485,7 @@ A raw device must be bound to a block device prior to using sg_dd.
See
.B raw(8)
for more information about binding raw devices. To be safe, the sg device
-mapping to SCSI block devices should be checked with 'cat /proc/scsi/scsi',
-or sg_map before use.
+mapping to SCSI block devices should be checked with sg_map before use.
.PP
Disk partition information can often be found with
.B fdisk(8)
diff --git a/doc/sg_format.8 b/doc/sg_format.8
index 89f6d000..7c00cc50 100644
--- a/doc/sg_format.8
+++ b/doc/sg_format.8
@@ -707,7 +707,7 @@ Using sg_turs(8) and sg_readcap(8) after the format operation may be wise.
The Unix convention is that "no news is good news" but that can be a bit
unnerving after an operation like format, especially if it finishes
quickly (i.e. before the first progress poll is sent). Giving the
-\fI\-\-verbose\fR option once should supply enough additional output to
+\fI\-\-verbose\fR option once should supply enough additional output to
settle those nerves.
.SH AUTHORS
Written by Grant Grundler, James Bottomley and Douglas Gilbert.
diff --git a/doc/sg_map.8 b/doc/sg_map.8
index 5cbb4c2a..abe0935d 100644
--- a/doc/sg_map.8
+++ b/doc/sg_map.8
@@ -73,7 +73,7 @@ called devfsd whose default configuration adds back the
Linux device names in their traditional positions.
.PP
Quite often the mapping information can be derived by
-observing the output of the command: "cat /proc/scsi/scsi".
+observing the output of the command: "sg_map".
However if devices have been added since boot this can
be deceptive.
.PP
diff --git a/doc/sg_read.8 b/doc/sg_read.8
index c12dd57f..3f370a62 100644
--- a/doc/sg_read.8
+++ b/doc/sg_read.8
@@ -71,7 +71,7 @@ to be transferred. This option is mandatory.
default is 0 which selects indirect IO. Value of 1 attempts direct
IO which, if not available, falls back to indirect IO and notes this
at completion. This option is only active if \fIIFILE\fR is an sg device.
-If direct IO is selected and /proc/scsi/sg/allow_dio
+If direct IO is selected and /sys/module/sg/parameters/allow_dio
has the value of 0 then a warning is issued (and indirect IO is performed)
.TP
\fBdpo\fR=0 | 1
@@ -140,7 +140,7 @@ This is called "indirect IO" and there is a "dio" option to select
"direct IO" which will DMA directly into user memory. Due to some
issues "direct IO" is disabled in the sg driver and needs a
configuration change to activate it. This is typically done with
-"echo 1 > /proc/scsi/sg/allow_dio". An alternate way to avoid the
+"echo 1 > /sys/module/sg/parameters/allow_dio". An alternate way to avoid the
2 stage copy is to select memory mapped IO with 'mmap=1'.
.SH SIGNALS
The signal handling has been borrowed from dd: SIGINT, SIGQUIT and
diff --git a/doc/sgp_dd.8 b/doc/sgp_dd.8
index 7f6115da..b6184a03 100644
--- a/doc/sgp_dd.8
+++ b/doc/sgp_dd.8
@@ -1,4 +1,4 @@
-.TH SGP_DD "8" "October 2021" "sg3_utils\-1.47" SG3_UTILS
+.TH SGP_DD "8" "August 2022" "sg3_utils\-1.47" SG3_UTILS
.SH NAME
sgp_dd \- copy data to and from files and devices, especially SCSI
devices
@@ -77,7 +77,7 @@ of debug (max debug output when \fIVERB\fR is 9).
\fBdio\fR=0 | 1
default is 0 which selects indirect IO. Value of 1 attempts direct
IO which, if not available, falls back to indirect IO and notes this
-at completion. If direct IO is selected and /proc/scsi/sg/allow_dio
+at completion. If direct IO is selected and /sys/module/sg/parameters/allow_dio
has the value of 0 then a warning is issued (and indirect IO is performed)
For finer grain control use 'iflag=dio' or 'oflag=dio'.
.TP
@@ -184,8 +184,9 @@ reported to stderr and the copy continues (as if nothing went wrong).
dio
request the sg device node associated with this flag does direct IO.
If direct IO is not available, falls back to indirect IO and notes
-this at completion. If direct IO is selected and /proc/scsi/sg/allow_dio
-has the value of 0 then a warning is issued (and indirect IO is performed).
+this at completion. If direct IO is selected and
+/sys/module/sg/parameters/allow_dio has the value of 0 then a warning is
+issued (and indirect IO is performed).
.TP
direct
causes the O_DIRECT flag to be added to the open of \fIIFILE\fR and/or
@@ -246,7 +247,7 @@ A raw device must be bound to a block device prior to using sgp_dd.
See
.B raw(8)
for more information about binding raw devices. To be safe, the sg device
-mapping to SCSI block devices should be checked with 'cat /proc/scsi/scsi'
+mapping to SCSI block devices should be checked with 'sg_map'
before use.
.PP
Raw device partition information can often be found with
@@ -330,7 +331,7 @@ Written by Douglas Gilbert and Peter Allworth.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2000\-2021 Douglas Gilbert
+Copyright \(co 2000\-2022 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/examples/sgq_dd.c b/examples/sgq_dd.c
index 3f8ffa27..80e8817a 100644
--- a/examples/sgq_dd.c
+++ b/examples/sgq_dd.c
@@ -148,7 +148,7 @@ static struct pollfd in_pollfd_arr[MAX_NUM_THREADS];
static struct pollfd out_pollfd_arr[MAX_NUM_THREADS];
static int dd_count = -1;
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
static int sg_finish_io(int wr, Rq_elem * rep);
@@ -1214,11 +1214,11 @@ main(int argc, char * argv[])
fprintf(stderr, ">> Direct IO requested but incomplete %d times\n",
rcoll.dio_incomplete);
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
fprintf(stderr, ">>> %s set to '0' but should be set "
- "to '1' for direct IO\n", proc_allow_dio);
+ "to '1' for direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/src/sg_dd.c b/src/sg_dd.c
index cd8eb4b2..8392f31d 100644
--- a/src/sg_dd.c
+++ b/src/sg_dd.c
@@ -182,7 +182,7 @@ static long seed;
static struct drand48_data drand;/* opaque, used by srand48_r and mrand48_r */
#endif
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
struct flags_t {
bool append;
@@ -2733,11 +2733,11 @@ bypass_copy:
pr2serr(">> Direct IO requested but incomplete %d times\n",
dio_incomplete_count);
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/src/sg_read.c b/src/sg_read.c
index 4c48b474..abeb4774 100644
--- a/src/sg_read.c
+++ b/src/sg_read.c
@@ -98,7 +98,7 @@ static int in_partial = 0;
static int pack_id_count = 0;
static int verbose = 0;
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
static void
@@ -916,11 +916,11 @@ main(int argc, char * argv[])
pr2serr(">> Direct IO requested but incomplete %d times\n",
dio_incomplete);
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/src/sgm_dd.c b/src/sgm_dd.c
index d85a6fa2..8c9723a1 100644
--- a/src/sgm_dd.c
+++ b/src/sgm_dd.c
@@ -126,7 +126,7 @@ static struct timeval start_tm;
static int blk_sz = 0;
static uint32_t glob_pack_id = 0; /* pre-increment */
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
struct flags_t {
bool append;
@@ -1285,11 +1285,11 @@ main(int argc, char * argv[])
int fd;
char c;
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index e88f3330..6a039f43 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -214,7 +214,7 @@ typedef struct request_element
static sigset_t signal_set;
static pthread_t sig_listen_thread_id;
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
static void sg_in_operation(struct opts_t * clp, Rq_elem * rep);
static void sg_out_operation(struct opts_t * clp, Rq_elem * rep,
@@ -1991,11 +1991,11 @@ fini:
pr2serr(">> Direct IO requested but incomplete %d times\n",
clp->dio_incomplete_count);
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/testing/sg_mrq_dd.cpp b/testing/sg_mrq_dd.cpp
index 0706f1af..959a6848 100644
--- a/testing/sg_mrq_dd.cpp
+++ b/testing/sg_mrq_dd.cpp
@@ -396,7 +396,7 @@ static atomic<bool> vb_first_time(true);
static sigset_t signal_set;
static sigset_t orig_signal_set;
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
static int do_both_sg_segment(Rq_elem * rep, scat_gath_iter & i_sg_it,
scat_gath_iter & o_sg_it, int seg_blks,
@@ -632,12 +632,12 @@ page4:
"each issued\nSCSI command. When both IFILE and OFILE are sg "
"devices, then the READ in\neach read-write pair is issued an "
"even pack_id and its WRITE pair is\ngiven the pack_id one "
- "higher (i.e. an odd number). This enables a\n'cat '"
- "/proc/scsi/sg/debug' user to see that progress is being "
+ "higher (i.e. an odd number). This enables a\n'dmesg -w' "
+ "user to see that progress is being "
"made.\n\n");
pr2serr("Debugging:\n"
"Apart from using one or more '--verbose' options which gets a "
- "bit noisy\n'cat /proc/scsi/sg/debug' can give a good overview "
+ "bit noisy\n'dmesg -w' can give a good overview "
"of what is happening.\nThat does a sg driver object tree "
"traversal that does minimal locking\nto make sure that each "
"traversal is 'safe'. So it is important to note\nthe whole "
@@ -650,7 +650,7 @@ page4:
"request entered it while some other nodes were being "
"printed.\n\n");
pr2serr("Busy state:\n"
- "Busy state (abbreviated to 'bsy' in the /proc/scsi/sg/debug "
+ "Busy state (abbreviated to 'bsy' in the dmesg "
"output)\nis entered during request setup and completion. It "
"is intended to be\na temporary state. It should not block "
"but does sometimes (e.g. in\nblock_get_request()). Even so "
@@ -1255,7 +1255,7 @@ bypass:
}
if (clp->verbose) {
t = 1;
- /* more info in /proc/scsi/sg/debug */
+ /* more info in the kernel log */
res = ioctl(fd, SG_SET_DEBUG, &t);
if (res < 0)
perror("sg_mrq_dd: SG_SET_DEBUG error");
@@ -1507,7 +1507,7 @@ sig_listen_thread(struct global_collection * clp)
} else
pr2serr_lk("%s: subsequent stall at pack_id=%d\n",
__func__, pack_id);
- system_wrapper("/usr/bin/cat /proc/scsi/sg/debug\n");
+ system_wrapper("/usr/bin/dmesg\n");
} else
prev_pack_id = pack_id;
} else if (EAGAIN != err)
@@ -4614,11 +4614,11 @@ fini:
pr2serr(">> Direct IO requested but incomplete %d times\n",
clp->dio_incomplete_count.load());
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/testing/sg_tst_bidi.c b/testing/sg_tst_bidi.c
index c142f401..0b81e144 100644
--- a/testing/sg_tst_bidi.c
+++ b/testing/sg_tst_bidi.c
@@ -585,7 +585,7 @@ rep_async:
}
if (direct_io && (dirio_count < q_len)) {
pr2serr("Direct IO requested %d times, done %d times\nMaybe need "
- "'echo 1 > /proc/scsi/sg/allow_dio'\n", q_len, dirio_count);
+ "'echo 1 > /sys/module/sg/parameters/allow_dio'\n", q_len, dirio_count);
}
if (rep_count-- > 0)
goto rep_async;
diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp
index 6f8a3ecd..83b4e5bc 100644
--- a/testing/sgh_dd.cpp
+++ b/testing/sgh_dd.cpp
@@ -388,7 +388,7 @@ static sigset_t signal_set;
static sigset_t orig_signal_set;
static pthread_t sig_listen_thread_id;
-static const char * proc_allow_dio = "/proc/scsi/sg/allow_dio";
+static const char * sg_allow_dio = "/sys/module/sg/parameters/allow_dio";
static void sg_in_rd_cmd(struct global_collection * clp, Rq_elem * rep,
mrq_arr_t & def_arr);
@@ -661,12 +661,12 @@ page4:
"each issued\nSCSI command. When both IFILE and OFILE are sg "
"devices, then the READ in\neach read-write pair is issued an "
"even pack_id and its WRITE pair is\ngiven the pack_id one "
- "higher (i.e. an odd number). This enables a\n'cat '"
- "/proc/scsi/sg/debug' user to see that progress is being "
+ "higher (i.e. an odd number). This enables a\n'dmesg -w' "
+ "user to see that progress is being "
"made.\n\n");
pr2serr("Debugging:\n"
"Apart from using one or more '--verbose' options which gets a "
- "bit noisy\n'cat /proc/scsi/sg/debug' can give a good overview "
+ "bit noisy\n'dmesg -w' can give a good overview "
"of what is happening.\nThat does a sg driver object tree "
"traversal that does minimal locking\nto make sure that each "
"traversal is 'safe'. So it is important to note\nthe whole "
@@ -679,7 +679,7 @@ page4:
"request entered it while some other nodes were being "
"printed.\n\n");
pr2serr("Busy state:\n"
- "Busy state (abbreviated to 'bsy' in the /proc/scsi/sg/debug "
+ "Busy state (abbreviated to 'bsy' in the dmesg "
"output)\nis entered during request setup and completion. It "
"is intended to be\na temporary state. It should not block "
"but does sometimes (e.g. in\nblock_get_request()). Even so "
@@ -1259,7 +1259,7 @@ sig_listen_thread(void * v_clp)
} else
pr2serr_lk("%s: subsequent stall at pack_id=%d\n",
__func__, pack_id);
- system_wrapper("/usr/bin/cat /proc/scsi/sg/debug\n");
+ system_wrapper("/usr/bin/dmesg\n");
} else
prev_pack_id = pack_id;
} else if (EAGAIN != err)
@@ -3753,7 +3753,7 @@ bypass:
}
}
t = 1;
- res = ioctl(fd, SG_SET_DEBUG, &t); /* more info in /proc/scsi/sg/debug */
+ res = ioctl(fd, SG_SET_DEBUG, &t); /* more info in the kernel log */
if (res < 0)
perror("sgs_dd: SG_SET_DEBUG error");
return (res < 0) ? 0 : num;
@@ -5041,11 +5041,11 @@ fini:
pr2serr(">> Direct IO requested but incomplete %d times\n",
clp->dio_incomplete_count.load());
- if ((fd = open(proc_allow_dio, O_RDONLY)) >= 0) {
+ if ((fd = open(sg_allow_dio, O_RDONLY)) >= 0) {
if (1 == read(fd, &c, 1)) {
if ('0' == c)
pr2serr(">>> %s set to '0' but should be set to '1' for "
- "direct IO\n", proc_allow_dio);
+ "direct IO\n", sg_allow_dio);
}
close(fd);
}
diff --git a/testing/uapi_sg.h b/testing/uapi_sg.h
index 270ad468..9cc51dc0 100644
--- a/testing/uapi_sg.h
+++ b/testing/uapi_sg.h
@@ -442,8 +442,8 @@ struct sg_header {
#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */
/*
- * Turn on/off error sense trace (1 and 0 respectively, default is off).
- * Try using: "# cat /proc/scsi/sg/debug" instead in the v3 driver
+ * Turn on/off error sense trace in the kernel log (1 and 0 respectively, default is
+ * off).
*/
#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */