diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2019-09-17 21:53:05 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2019-09-17 21:53:05 +0000 |
commit | bcdf18e4dd92f592617c35edbc9ffbb2817bd36c (patch) | |
tree | d408e019b135df92eb3f6860333865b9c9064b5c /testing | |
parent | eaa9d929aba1cc812418582c779731bcde2adf68 (diff) | |
download | sg3_utils-bcdf18e4dd92f592617c35edbc9ffbb2817bd36c.tar.gz |
sync with fixes from Redhat, via github; remove testing/Makefile.cplus and testing/Makefile.cplus_fb
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@832 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Makefile | 4 | ||||
-rw-r--r-- | testing/Makefile.cplus | 94 | ||||
-rw-r--r-- | testing/Makefile.cplus_fb | 79 | ||||
-rw-r--r-- | testing/README | 9 | ||||
-rw-r--r-- | testing/sg_tst_async.cpp | 18 | ||||
-rw-r--r-- | testing/sg_tst_context.cpp | 12 | ||||
-rw-r--r-- | testing/sg_tst_excl.cpp | 79 | ||||
-rw-r--r-- | testing/sg_tst_excl2.cpp | 17 | ||||
-rw-r--r-- | testing/sg_tst_excl3.cpp | 20 |
9 files changed, 67 insertions, 265 deletions
diff --git a/testing/Makefile b/testing/Makefile index 266a960f..34c746c2 100644 --- a/testing/Makefile +++ b/testing/Makefile @@ -23,9 +23,9 @@ LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ## CXX = g++ ## CC = clang ## CXX = clang++ -CXXLD = $(CXX) -LD = $(CC) +LD = $(CXX) +CXXLD = $(CXX) CPPFLAGS = -iquote ../include -iquote .. -D_REENTRANT $(LARGE_FILE_FLAGS) -DHAVE_CONFIG_H -DHAVE_NVME CXXFLAGS = -std=c++17 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) diff --git a/testing/Makefile.cplus b/testing/Makefile.cplus deleted file mode 100644 index 871136ff..00000000 --- a/testing/Makefile.cplus +++ /dev/null @@ -1,94 +0,0 @@ -SHELL = /bin/sh - -PREFIX=/usr/local -INSTDIR=$(DESTDIR)/$(PREFIX)/bin -MANDIR=$(DESTDIR)/$(PREFIX)/man - -## CXX = g++ -## CXX = clang++ -## CXX = clang++-7 -CXXLD = $(CXX) - -EXECS = sg_tst_excl sg_tst_excl2 sg_tst_excl3 sg_tst_context sg_tst_async \ - sgh_dd - -EXTRAS = - -BSG_EXTRAS = - - -MAN_PGS = -MAN_PREF = man8 - -LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - -CXXFLAGS = -std=c++17 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -# CXXFLAGS = -std=c++11 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -# CXXFLAGS = -std=c++11 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -DDEBUG -## CXXFLAGS = -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -# CXXFLAGS = -g -O2 -Wall -iquote ../include -D_REENTRANT -DSG_KERNEL_INCLUDES $(LARGE_FILE_FLAGS) -# CXXFLAGS = -g -O2 -Wall -pedantic -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) - -LDFLAGS = -std=c++17 -pthread -# LDFLAGS = -std=c++11 -pthread -# LDFLAGS = -pthread - -LIBFILESOLD = ../lib/sg_lib.o ../lib/sg_lib_data.o ../lib/sg_io_linux.o -LIBFILESNEW = ../lib/sg_pt_linux_nvme.o ../lib/sg_lib.o ../lib/sg_lib_data.o \ - ../lib/sg_pt_linux.o ../lib/sg_io_linux.o \ - ../lib/sg_pt_common.o ../lib/sg_cmds_basic.o \ - ../lib/sg_cmds_basic2.o - -all: $(EXECS) - -extras: $(EXTRAS) - - -depend dep: - for i in *.c; do $(CC) $(INCLUDES) $(CFLAGS) -M $$i; \ - done > .depend - -clean: - /bin/rm -f *.o $(EXECS) $(EXTRAS) $(BSG_EXTRAS) core .depend - -sg_tst_excl: sg_tst_excl.o $(LIBFILESOLD) - $(CXXLD) -o $@ $(LDFLAGS) $^ - -sg_tst_excl2: sg_tst_excl2.o $(LIBFILESNEW) - $(CXXLD) -o $@ $(LDFLAGS) $^ - -sg_tst_excl3: sg_tst_excl3.o $(LIBFILESNEW) - $(CXXLD) -o $@ $(LDFLAGS) $^ - -sg_tst_context: sg_tst_context.o $(LIBFILESNEW) - $(CXXLD) -o $@ $(LDFLAGS) $^ - -sg_tst_async: sg_tst_async.o $(LIBFILESNEW) - $(CXXLD) -o $@ $(LDFLAGS) $^ - -sgh_dd: sgh_dd.o $(LIBFILESNEW) - $(CXXLD) -o $@ $(LDFLAGS) -pthread -latomic $^ - -install: $(EXECS) - install -d $(INSTDIR) - for name in $^; \ - do install -s -o root -g root -m 755 $$name $(INSTDIR); \ - done - install -d $(MANDIR)/$(MAN_PREF) - for mp in $(MAN_PGS); \ - do install -o root -g root -m 644 $$mp $(MANDIR)/$(MAN_PREF); \ - gzip -9f $(MANDIR)/$(MAN_PREF)/$$mp; \ - done - -uninstall: - dists="$(EXECS)"; \ - for name in $$dists; do \ - rm -f $(INSTDIR)/$$name; \ - done - for mp in $(MAN_PGS); do \ - rm -f $(MANDIR)/$(MAN_PREF)/$$mp.gz; \ - done - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/testing/Makefile.cplus_fb b/testing/Makefile.cplus_fb deleted file mode 100644 index a41c2346..00000000 --- a/testing/Makefile.cplus_fb +++ /dev/null @@ -1,79 +0,0 @@ -SHELL = /bin/sh - -PREFIX=/usr/local -INSTDIR=$(DESTDIR)/$(PREFIX)/bin -MANDIR=$(DESTDIR)/$(PREFIX)/man - -## CC = g++ -## LD = g++ -## CC = clang++ -## LD = clang++ - -## This is just an example FreeBSD Makefile for how to build for clang++ -## All .cpp execs in this directory are Linux specific so there is -## nothing to do for FreeBSD. -## Not optimum but it works around 20180715 [dpg] - -# EXECS = sg_tst_context -EXECS = - -EXTRAS = - -BSG_EXTRAS = - - -MAN_PGS = -MAN_PREF = man8 - -LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - -CXXFLAGS = -std=c++11 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -# CPPFLAGS = -std=c++11 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -DDEBUG -## CFLAGS = -g -O2 -W -Wall -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -# CFLAGS = -g -O2 -Wall -iquote ../include -D_REENTRANT -DSG_KERNEL_INCLUDES $(LARGE_FILE_FLAGS) -# CFLAGS = -g -O2 -Wall -pedantic -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) - -LDFLAGS = -std=c++11 -pthread - -LIBFILESOLD = ../lib/sg_lib.o ../lib/sg_lib_data.o -LIBFILESNEW = ../lib/sg_lib.o ../lib/sg_lib_data.o ../lib/sg_pt_freebsd.o ../lib/sg_pt_common.o \ - ../lib/sg_cmds_basic.o - -all: $(EXECS) - -extras: $(EXTRAS) - - -depend dep: - for i in $(EXECS).cpp; do $(CXX) $(INCLUDES) $(CXXFLAGS) -M $$i; \ - done > .depend - -clean: - /bin/rm -f *.o $(EXECS) $(EXTRAS) $(BSG_EXTRAS) core .depend - -sg_tst_context: sg_tst_async.o $(LIBFILESNEW) - $(CXX) -o $@ $(LDFLAGS) $^ - -install: $(EXECS) - install -d $(INSTDIR) - for name in $^; \ - do install -s -o root -g root -m 755 $$name $(INSTDIR); \ - done - install -d $(MANDIR)/$(MAN_PREF) - for mp in $(MAN_PGS); \ - do install -o root -g root -m 644 $$mp $(MANDIR)/$(MAN_PREF); \ - gzip -9f $(MANDIR)/$(MAN_PREF)/$$mp; \ - done - -uninstall: - dists="$(EXECS)"; \ - for name in $$dists; do \ - rm -f $(INSTDIR)/$$name; \ - done - for mp in $(MAN_PGS); do \ - rm -f $(MANDIR)/$(MAN_PREF)/$$mp.gz; \ - done - -## ifeq (.depend,$(wildcard .depend)) -## include .depend -## endif diff --git a/testing/README b/testing/README index 5a485576..68f82244 100644 --- a/testing/README +++ b/testing/README @@ -4,7 +4,7 @@ The utilities in this directory are _not_ built automatically. So: cd <root_of_sg3_utils_src> ./configure ; make ; make install will _not_ build and install them. The make command (or some variant -of it) needs to be run in this directory as outlined before. +of it) needs to be run in this directory as outlined below. Building files in this directory depends on several files being already built in the ../lib directory. So to build files here, the ./configure @@ -35,14 +35,13 @@ to get more information. There are both C and C++ files in this directory, they have extensions '.c' and '.cpp' respectively. Now both are built with rules in Makefile -(at least in Linux). Formerly the C++ in Linux required: -'make -f Makefile.cplus'. A gcc/g++ compiler of 4.7.3 vintage or later +(at least in Linux). A gcc/g++ compiler of 4.7.3 vintage or later (or a recent clang compiler) will be required. To make them in FreeBSD -use 'make -f Makefile.cplus_fb'. +use 'make -f Makefile.freebsd'. The sgh_dd utility (C++) uses 'libatomic' which may not be installed on some systems. On Debian based systems 'apt install libatomic1' fixes this. Douglas Gilbert -2nd September 2019 +17th September 2019 diff --git a/testing/sg_tst_async.cpp b/testing/sg_tst_async.cpp index af7eed87..e8203a10 100644 --- a/testing/sg_tst_async.cpp +++ b/testing/sg_tst_async.cpp @@ -89,7 +89,7 @@ #include "sg_pt.h" #include "sg_cmds.h" -static const char * version_str = "1.39 20190902"; +static const char * version_str = "1.40 20190917"; static const char * util_name = "sg_tst_async"; /* This is a test program for checking the async usage of the Linux sg @@ -110,21 +110,17 @@ static const char * util_name = "sg_tst_async"; * which is assumed to be a sibling of this examples directory. Those * object files in the lib directory can be built with: * cd <sg3_utils_package_root> ; ./configure ; cd lib; make - * cd ../examples - * Then to build sg_tst_async concatenate the next 3 lines: - * g++ -Wall -std=c++11 -pthread -I ../include ../lib/sg_lib.o - * ../lib/sg_lib_data.o ../lib/sg_io_linux.o -o sg_tst_async - * sg_tst_async.cpp - * or use the C++ Makefile in that directory: - * make -f Makefile.cplus sg_tst_async + * cd ../testing + * make sg_tst_async * * Currently this utility is Linux only and uses the sg driver. The bsg * driver is known to be broken (it doesn't match responses to the - * correct file descriptor that requested them) so this utility won't - * be extended to bsg until that is fixed. + * correct file descriptor that requested them). Around Linux kernel 4.15 + * the async capability of the bsg driver was removed. So this test code + * no longer appiles to the bsg driver. * * BEWARE: >>> This utility will modify a logical block (default LBA 1000) - * on the given device when the '-W' option is given. + * on the given device _when_ the '-W' option is given. * */ diff --git a/testing/sg_tst_context.cpp b/testing/sg_tst_context.cpp index 89b7a7d2..a6948c0e 100644 --- a/testing/sg_tst_context.cpp +++ b/testing/sg_tst_context.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 Douglas Gilbert. + * Copyright (c) 2013-2019 Douglas Gilbert. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ #include "sg_lib.h" #include "sg_pt.h" -static const char * version_str = "1.04 20181207"; +static const char * version_str = "1.05 20190917"; static const char * util_name = "sg_tst_context"; /* This is a test program for checking that file handles keep their @@ -68,11 +68,9 @@ static const char * util_name = "sg_tst_context"; * which is assumed to be a sibling of this examples directory. Those * object files in the lib directory can be built with: * cd <sg3_utils> ; ./configure ; cd lib; make - * Then to build sg_tst_context concatenate the next 3 lines: - * g++ -Wall -std=c++11 -pthread -I ../include ../lib/sg_lib.o - * ../lib/sg_lib_data.o ../lib/sg_pt_linux.o -o sg_tst_context - * sg_tst_context.cpp - * Alternatively use 'make -f Makefile.cplus sg_tst_context' + * Then: + * cd ../testing + * make sg_tst_context * */ diff --git a/testing/sg_tst_excl.cpp b/testing/sg_tst_excl.cpp index 84f83892..b5a344d6 100644 --- a/testing/sg_tst_excl.cpp +++ b/testing/sg_tst_excl.cpp @@ -73,7 +73,7 @@ #include "sg_io_linux.h" #include "sg_unaligned.h" -static const char * version_str = "1.11 20190121"; +static const char * version_str = "1.12 20190917"; static const char * util_name = "sg_tst_excl"; /* This is a test program for checking O_EXCL on open() works. It uses @@ -95,12 +95,9 @@ static const char * util_name = "sg_tst_excl"; * which is assumed to be a sibling of this examples directory. Those * object files in the lib directory can be built with: * cd <sg3_utils> ; ./configure ; cd lib; make - * Then to build sg_tst_excl concatenate the next 3 lines: - * g++ -Wall -std=c++11 -pthread -I ../include ../lib/sg_lib.o - * ../lib/sg_lib_data.o ../lib/sg_io_linux.o -o sg_tst_excl - * sg_tst_excl.cpp - * or use the C++ Makefile in that directory: - * make -f Makefile.cplus sg_tst_excl + * Then: + * cd ../testing + * make sg_tst_excl * * Currently this utility is Linux only and assumes the SG_IO v3 interface * which is supported by sg and block devices (but not bsg devices which @@ -220,7 +217,7 @@ do_rd_inc_wr_twice_v3(const char * dev_name, unsigned int lba, int block, } if (sg_fd < 0) { snprintf(ebuff, EBUFF_SZ, "%s: error opening file: %s", __func__, - dev_name); + dev_name); perror(ebuff); return -1; } @@ -333,7 +330,7 @@ do_rd_inc_wr_twice_v3(const char * dev_name, unsigned int lba, int block, lock_guard<mutex> lg(console_mutex); fprintf(stderr, "%s: Recovered error on READ_16, " - "continuing 2\n", __func__); + "continuing 2\n", __func__); } ok = 1; break; @@ -398,7 +395,7 @@ do_rd_inc_wr_twice_v3(const char * dev_name, unsigned int lba, int block, lock_guard<mutex> lg(console_mutex); fprintf(stderr, "%s: Recovered error on WRITE_16, " - "continuing\n", __func__); + "continuing\n", __func__); } ok = 1; break; @@ -462,7 +459,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, } if (sg_fd < 0) { snprintf(ebuff, EBUFF_SZ, "%s: error opening file: %s", __func__, - dev_name); + dev_name); perror(ebuff); return -1; } @@ -479,7 +476,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, pt.request = (uint64_t)(sg_uintptr_t)r16CmdBlk; pt.response = (uint64_t)(sg_uintptr_t)sense_buffer; pt.timeout = 20000; /* 20000 millisecs == 20 seconds */ - pt.request_extra = id; /* pack_id field */ + pt.request_extra = id; /* pack_id field */ // queue up two READ_16s to same LBA if (ioctl(sg_fd, SG_IOSUBMIT, &pt) < 0) { @@ -523,8 +520,8 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, } /* now for the error processing */ ok = 0; - switch (sg_err_category_new(pt.device_status, pt.transport_status, - pt.driver_status, sense_buffer, pt.response_len)) { + switch (sg_err_category_new(pt.device_status, pt.transport_status, + pt.driver_status, sense_buffer, pt.response_len)) { case SG_LIB_CAT_CLEAN: ok = 1; break; @@ -540,10 +537,10 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, { lock_guard<mutex> lg(console_mutex); - sg_linux_sense_print("READ_16 command error", - pt.device_status, pt.transport_status, - pt.driver_status, sense_buffer, - pt.response_len, true); + sg_linux_sense_print("READ_16 command error", + pt.device_status, pt.transport_status, + pt.driver_status, sense_buffer, + pt.response_len, true); // sg_chk_n_print3("READ_16 command error", &pt, 1); } break; @@ -571,8 +568,8 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, pt = pt2; /* now for the error processing */ ok = 0; - switch (sg_err_category_new(pt.device_status, pt.transport_status, - pt.driver_status, sense_buffer, pt.response_len)) { + switch (sg_err_category_new(pt.device_status, pt.transport_status, + pt.driver_status, sense_buffer, pt.response_len)) { case SG_LIB_CAT_CLEAN: ok = 1; break; @@ -581,7 +578,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, lock_guard<mutex> lg(console_mutex); fprintf(stderr, "%s: Recovered error on READ_16, " - "continuing 2\n", __func__); + "continuing 2\n", __func__); } ok = 1; break; @@ -589,11 +586,11 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, { lock_guard<mutex> lg(console_mutex); - sg_linux_sense_print("READ_16 command error 2", - pt.device_status, - pt.transport_status, - pt.driver_status, sense_buffer, - pt.response_len, true); + sg_linux_sense_print("READ_16 command error 2", + pt.device_status, + pt.transport_status, + pt.driver_status, sense_buffer, + pt.response_len, true); // sg_chk_n_print3("READ_16 command error 2", &pt, 1); } break; @@ -629,7 +626,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, pt.request = (uint64_t)(sg_uintptr_t)w16CmdBlk; pt.response = (uint64_t)(sg_uintptr_t)sense_buffer; pt.timeout = 20000; /* 20000 millisecs == 20 seconds */ - pt.request_extra = id; /* pack_id field */ + pt.request_extra = id; /* pack_id field */ if (ioctl(sg_fd, SG_IO, &pt) < 0) { { @@ -652,7 +649,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, lock_guard<mutex> lg(console_mutex); fprintf(stderr, "%s: Recovered error on WRITE_16, " - "continuing\n", __func__); + "continuing\n", __func__); } ok = 1; break; @@ -660,10 +657,10 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block, { lock_guard<mutex> lg(console_mutex); - sg_linux_sense_print("WRITE_16 command error", - pt.device_status, pt.transport_status, - pt.driver_status, sense_buffer, - pt.response_len, true); + sg_linux_sense_print("WRITE_16 command error", + pt.device_status, pt.transport_status, + pt.driver_status, sense_buffer, + pt.response_len, true); } break; } @@ -785,18 +782,18 @@ work_thread(const char * dev_name, unsigned int lba, int id, int block, << block << endl; } for (k = 0; k < num; ++k) { - if (sg_ifc_ver == 3) + if (sg_ifc_ver == 3) res = do_rd_inc_wr_twice_v3(dev_name, lba, block, excl, wait_ms, - k, thr_ebusy_count, thr_eagain_count); - else if (sg_ifc_ver == 4) + k, thr_ebusy_count, thr_eagain_count); + else if (sg_ifc_ver == 4) res = do_rd_inc_wr_twice_v4(dev_name, lba, block, excl, wait_ms, - k, thr_ebusy_count, thr_eagain_count); - else { - lock_guard<mutex> lg(console_mutex); + k, thr_ebusy_count, thr_eagain_count); + else { + lock_guard<mutex> lg(console_mutex); - cerr << "sg_ifc_ver=" << sg_ifc_ver << " not supported" << endl; - res = -1; - } + cerr << "sg_ifc_ver=" << sg_ifc_ver << " not supported" << endl; + res = -1; + } if (res < 0) break; if (res) diff --git a/testing/sg_tst_excl2.cpp b/testing/sg_tst_excl2.cpp index 491d7fc6..b4ae9582 100644 --- a/testing/sg_tst_excl2.cpp +++ b/testing/sg_tst_excl2.cpp @@ -47,7 +47,7 @@ #include "sg_pt.h" #include "sg_unaligned.h" -static const char * version_str = "1.09 20190321"; +static const char * version_str = "1.10 20190917"; static const char * util_name = "sg_tst_excl2"; /* This is a test program for checking O_EXCL on open() works. It uses @@ -69,20 +69,13 @@ static const char * util_name = "sg_tst_excl2"; * which is assumed to be a sibling of this examples directory. Those * object files in the lib directory can be built with: * cd <sg3_utils> ; ./configure ; cd lib; make - * Then to build sg_tst_excl2 concatenate the next 3 lines: - * g++ -Wall -std=c++11 -pthread -I ../include ../lib/sg_lib.o - * ../lib/sg_lib_data.o ../lib/sg_pt_linux.o -o sg_tst_excl2 - * sg_tst_excl2.cpp - * Alternatively use 'make -f Makefile.cplus sg_tst_excl2' + * Then: + * cd ../testing + * make sg_tst_excl2 * * BEWARE: this utility modifies a logical block (default LBA 1000) on the * given device. * - * Test breaks sg driver in lk 3.10.4 but works with proposed fix so should - * work soon thereafter. Works on standard block driver (e.g. /dev/sdc) in - * lk 3.10.4 . Fails on bsg driver in lk 3.10.4 because it ignores the - * O_EXCL flag (and that is unlikely to change). - * */ using namespace std; @@ -271,7 +264,7 @@ do_rd_inc_wr_twice(const char * dev_name, unsigned int lba, int block, if (0 == k) odd = (1 == (u % 2)); ++u; - sg_put_unaligned_be32(u, lb); + sg_put_unaligned_be32(u, lb); if (wait_ms > 0) /* allow daylight for bad things ... */ this_thread::sleep_for(milliseconds{wait_ms}); diff --git a/testing/sg_tst_excl3.cpp b/testing/sg_tst_excl3.cpp index 6d32a4fb..f511dd66 100644 --- a/testing/sg_tst_excl3.cpp +++ b/testing/sg_tst_excl3.cpp @@ -48,7 +48,7 @@ #include "sg_pt.h" #include "sg_unaligned.h" -static const char * version_str = "1.07 20190321"; +static const char * version_str = "1.10 20190917"; static const char * util_name = "sg_tst_excl3"; /* This is a test program for checking O_EXCL on open() works. It uses @@ -71,21 +71,13 @@ static const char * util_name = "sg_tst_excl3"; * which is assumed to be a sibling of this examples directory. Those * object files in the lib directory can be built with: * cd <sg3_utils> ; ./configure ; cd lib; make - * Then to build sg_tst_excl3 concatenate the next 3 lines: - * g++ -Wall -std=c++11 -pthread -I ../include ../lib/sg_lib.o - * ../lib/sg_lib_data.o ../lib/sg_pt_linux.o -o sg_tst_excl3 - * sg_tst_excl3.cpp - * Alternatively use 'make -f Makefile.cplus sg_tst_excl3' + * Then: + * cd ../testing + * make sg_tst_excl3 * * BEWARE: this utility modifies a logical block (default LBA 1000) on the * given device. * - * Test breaks sg driver in lk 3.10.4 but works with proposed fix so should - * work soon thereafter. It works on standard block driver (e.g. /dev/sdc) - * in lk 3.10.4 (most of the time). It fails on bsg driver in lk 3.10.4 - * because it ignores the O_EXCL flag (and that is unlikely to change in - * the short term). - * */ using namespace std; @@ -273,7 +265,7 @@ do_rd_inc_wr_twice(const char * dev_name, int read_only, unsigned int lba, goto err; } - u = sg_get_unaligned_be32(lb); + u = sg_get_unaligned_be32(lb); // Assuming u starts test as even (probably 0), expect it to stay even if (0 == k) odd = (1 == (u % 2)); @@ -288,7 +280,7 @@ do_rd_inc_wr_twice(const char * dev_name, int read_only, unsigned int lba, if (read_only) break; ++u; - sg_put_unaligned_be32(u, lb); + sg_put_unaligned_be32(u, lb); /* Prepare WRITE_16 command */ clear_scsi_pt_obj(ptp); |