Skip to content

Commit 4617c2b

Browse files
committed
Load sg3_utils-1.19 into trunk/.
git-svn-id: svn://localhost/trunk@65 6180dd3e-e324-4e3e-922d-17de1ae2f315
1 parent c28b406 commit 4617c2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+7750
-3891
lines changed

CHANGELOG

+37
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@ Each utility has its own version number, date of last change and
22
some description at the top of its ".c" file. All utilities in the main
33
directory have their own "man" pages.
44

5+
Changelog for sg3_utils-1.19 [20060127]
6+
- sg_start: accept '--' options (e.g. 'sg_start --stop')
7+
- add '--fl=<n>' option for jump to format layer (mmc5)
8+
- sg_logs: background scan log page, resync with sbc3r03
9+
- add '-scum' and '-sthr' for setting defaults
10+
- add device statistics log page (ssc + adc)
11+
- fix "last n" deferred errors/error events incrementing
12+
- partial addition of log subpages (spc4r03)
13+
- sg_get_config: sync features with mmc5 rev 02b
14+
- sg_wr_mode: mask out dpofua bit in mode select header
15+
- sg_inq: try harder with '-A' to identify ATA device
16+
- broaden meaning of '-d' option to decode ...
17+
- decode software interface id VPD page ('-p=84 -d')
18+
- decode device capabilities (ssc) VPD page ('-p=b0 -d')
19+
- sginfo: correct defect list handling ('-d' and '-G')
20+
- sg_verify: improve error processing (e.g. medium errors)
21+
- sg_ses: scsi target_initiator port additional element
22+
status (06-036r0)
23+
- many: arguments that currently accept '0x' or '0X' to
24+
indicate a hex number may alternatively take a trailing
25+
'h' or 'H' to indicate hex
26+
- sg_lib: update asc/ascq strings (spc4r03)
27+
- sg_lib+sg_cmds: make independent of linux via
28+
sg_pt.h function based interface.
29+
- linux pass through code placed in sg_pt_linux.c
30+
- rename sg_include.h to sg_linux_inc.h
31+
- linux specific code in sg_lib.[hc] moved to
32+
sg_io_linux.[hc]
33+
- port to FreeBSD: using sg_pt_freebsd.c
34+
- port to Tru64: using sg_pt_osf1.c
35+
- sg_cmds: add sg_ll_get_config(), sg_ll_format_unit(),
36+
sg_ll_reassign_blocks(), sg_ll_persistent_reserve_in+out(),
37+
sg_ll_read_long10(), sg_ll_verify10(), sg_ll_write_long10()
38+
- sg_persist: add "allow commands" to report capabilities
39+
- sg_persist_tst: (examples) takes device node as argument
40+
- sg_luns: add "security protocol" wlun
41+
542
Changelog for sg3_utils-1.18 [20051118]
643
- sg_map26: new utility to map sg devices in lk 2.6
744
- sg_luns: luns > 16,384 (sam-4 rev 4)

COVERAGE

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on the right. The second table lists supported ATA commands.
66

77
SCSI command sg3_utils utilities that use this SCSI command
88
------------ -------------------------------------------------
9-
GET CONFIGURATION sg_get_config
9+
GET CONFIGURATION sg_get_config, ++
1010
INQUIRY sg_dd, sg_format, sg_inq, sginfo,
1111
sg_logs, sg_map('-i'), sg_modes, sg_opcodes,
1212
sg_persist, sg_scan, sg_ses, ++
13-
FORMAT UNIT sg_format
14-
LOG SELECT sg_logs('-r'), ++
13+
FORMAT UNIT sg_format, ++
14+
LOG SELECT sg_logs('-r', '-scum' or '-sthr'), ++
1515
LOG SENSE sg_logs, ++
1616
MODE SELECT(6) sg_wr_mode, sginfo, sg_format,
1717
sg_emc_trespass, ++
@@ -21,9 +21,9 @@ MODE SENSE(6) sg_modes, sg_wr_mode, sginfo, sg_format,
2121
sg_senddiag('-e'), ++
2222
MODE SENSE(10) sg_modes, sg_wr_mode, sginfo, sg_format,
2323
sg_senddiag('-e'), ++
24-
PERSISTENT IN sg_persist
25-
PERSISTENT OUT sg_persist
26-
PREVENT ALLOW MEDIUM REMOVAL sg_prevent, ++
24+
PERSISTENT IN sg_persist ++
25+
PERSISTENT OUT sg_persist ++
26+
PREVENT ALLOW MEDIUM REMOVAL sg_prevent, ++
2727
READ(6) sg_dd, sgm_dd, sgp_dd, sg_read
2828
READ(10) sg_dd, sgm_dd, sgp_dd, sg_read
2929
READ(12) sg_dd, sgm_dd, sgp_dd, sg_read
@@ -34,8 +34,8 @@ READ CAPACITY(16) sg_readcap, sg_dd, sgm_dd, sgp_dd, sg_format, ++
3434
READ DEFECT(10) sginfo, sg_reassign, ++
3535
READ DEFECT(12) sginfo
3636
READ LONG (10) sg_read_long, sg_dd
37-
READ MEDIA SERIAL NUMBER sg_rmsn, ++
38-
REASSIGN BLOCKS sg_reassign
37+
READ MEDIA SERIAL NUMBER sg_rmsn, ++
38+
REASSIGN BLOCKS sg_reassign, ++
3939
RECEIVE DIAGNOSTIC sg_senddiag, sg_ses, ++
4040
REPORT DEVICE IDENTIFIER sg_ident, ++
4141
REPORT LUNS sg_luns, ++
@@ -44,7 +44,7 @@ REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS sg_opcodes
4444
REPORT TARGET PORT GROUPS sg_rtpg, ++
4545
REQUEST SENSE sg_requests, ++
4646
SEND DIAGNOSTIC sg_senddiag, sg_ses, ++
47-
SET DEVICE IDENTIFIER sg_ident, ++
47+
SET DEVICE IDENTIFIER sg_ident, ++
4848
START STOP sg_start, ++
4949
SYNCHRONIZE CACHE(10) sg_sync, sg_dd, sgm_dd, sgp_dd, ++
5050
TEST UNIT READY sg_turs, sg_format, ++
@@ -66,4 +66,4 @@ IDENTIFY PACKET DEVICE sg_inq
6666
++ command wrapper found in sg_cmds.c for this command
6767

6868
Doug Gilbert
69-
14th November 2005
69+
27th December 2005

CREDITS

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Christophe Varoqui <christophe dot varoqui at free dot fr> original sg_rtpg
1111

1212
Clayton Weaver <cgweav at email dot com> contributed safe_strerror().
1313

14+
Dave Johnson <ddj at ccv dot brown dot edu> improved disk defect list
15+
handling [20051218]
16+
1417
Eric Schwartz <emschwar at debian dot org> who wrote these man pages:
1518
sg_readcap, sg_reset, sg_scan, sg_start, sg_test_rwbuf,
1619
sg_turs and sginfo
@@ -63,4 +66,4 @@ Trent Piepho <xyzzy at speakeasy dot org> print out some "sense key specific"
6366

6467

6568
Doug Gilbert
66-
26th April 2005
69+
20th December 2005

INSTALL

+46-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1+
Unless otherwise noted, these install instructions are for the
2+
Linux operating system.
3+
4+
By default, the Makefile will build for Linux with a shared library.
5+
The invocation sequence is:
6+
17
make
2-
make install
8+
make install [may need root permission]
39

410
Unless overridden or edited in the Makefile, INSTDIR places the executables
511
in the /usr/local/bin directory, LIBDIR places libraries in the
612
/usr/local/lib directory, MANDIR places the man pages in the
7-
/usr/local/man directory and INCLUDEDIR places header files in the
8-
/usr/local/include/scsi directory.
13+
/usr/local/share/man directory and INCLUDEDIR places header files in the
14+
/usr/local/include/scsi directory. For FreeBSD the default MANDIR is
15+
/usr/local/man .
916

1017
Other Makefile targets that might be useful:
1118
make clean # remove .o, executables, core and .depend file
1219
make depend # generate dependency hierarchy in .depend file
1320
make dep # same as 'make depend'
1421
make sg_inq # build a specific executable (e.g. 'sg_inq')
1522
make uninstall # removes executables, libraries and build remnants
16-
make -f lib_no_lib/Makefile.no_lib # build without a library
23+
make -f no_lib/Makefile.linux # build without a library
1724

1825
./make_no_lib.sh sg_inq # is a simple script; in this case it expands to:
19-
# make -f lib_no_lib/Makefile.no_lib sg_inq
26+
# make -f no_lib/Makefile.linux sg_inq
2027

2128
Note that the main Makefile does _not_ call the Makefiles in the
2229
subdirectories (i.e. archive, examples and utils directories).
@@ -36,19 +43,18 @@ directory. If an executable cannot find the libsgutils shared library
3643
to the /etc/ld.so.conf file may be required in some distributions.
3744

3845
A "spec" file is included for building rpm packages. It is called
39-
sg3_utils.spec and is in the "rpm" subdirectory. To build binary and
40-
source rpms place a copy of the gzipped tarball in the "SOURCES" directory
41-
and place a copy of sg3_utils.spec in the "SPEC" directory. These
42-
directories are found under /usr/src/redhat on redhat distributions. Then
43-
from the "SPEC" directory execute "rpmbuild -ba sg3_utils.spec". If all
44-
goes well a source rpm should be found in the SRPMS directory and binary
45-
rpms in the RPMS/i386 directory (for i386 architecture). Note the spec
46-
file will only build those utilities in the main directory. When the
47-
sg3_utils binary rpm is installed the executables and their associated man
48-
pages should be placed in appropriate places. The sg3_utils.spec file also
49-
builds a libsgutils shared object (shared library) and a libsgutils-*-devel
50-
shared object with a static library and the sg_lib.h and sg_cmds.h header
51-
files.
46+
sg3_utils.spec . To build binary and source rpms place a copy of the
47+
gzipped tarball in the "SOURCES" directory and place a copy of
48+
sg3_utils.spec in the "SPEC" directory. These directories are found under
49+
/usr/src/redhat on redhat/fedora distributions. Then from the "SPEC"
50+
directory execute "rpmbuild -ba sg3_utils.spec". If all goes well a source
51+
rpm should be found in the SRPMS directory and binary rpms in the RPMS/i386
52+
directory (for i386 architecture). Note the spec file will only build those
53+
utilities found in the main directory. When the sg3_utils binary rpm is
54+
installed the executables and their associated man pages should be placed in
55+
appropriate places. The sg3_utils.spec file also builds a libsgutils shared
56+
object (shared library) and a libsgutils-*-devel shared object with a static
57+
library and the sg_lib.h, sg_cmds.h and sg_pt.h header files.
5258

5359
Binary rpms (at least in the RedHat distribution) tend to install
5460
executables in /usr/bin and libraries in /usr/lib .
@@ -62,7 +68,27 @@ the sg3_utils source directory) if all goes well.
6268

6369
If the shared object (library) is troublesome or unwanted then
6470
a "no_lib" version of the Makefile and the sg3_utils.spec file
65-
can be found in the "lib_no_lib" subdirectory.
71+
can be found in the "no_lib" subdirectory.
72+
73+
74+
In FreeBSD, the utilities can be built with "make -f Makefile.freebsd".
75+
This will build a shared object (i.e. libsgutils.so and friends) that
76+
the utilities depend on. To install use "make -f Makefile.freebsd install".
77+
These makes depend on libtool. To build without reliance on a shared
78+
library (and thus libtool) use "make -f no_lib/Makefile.freebsd" (or
79+
execute the "make_no_lib_freebsd.sh" script which does the same thing).
80+
Utilities that are linux specific (e.g. sg_map) are not built for
81+
FreeBSD.
82+
83+
84+
In Tru64, the utilities can be built with "make -f Makefile.osf1".
85+
This will build a shared object (i.e. libsgutils.so and friends) that
86+
the utilities depend on. To install use "make -f Makefile.osf1 install".
87+
These makes depend on libtool. To build without reliance on a shared
88+
library (and thus libtool) use "make -f no_lib/Makefile.osf1" (or
89+
execute the "make_no_lib_osf1.sh" script which does the same thing).
90+
Utilities that are linux specific (e.g. sg_map) are not built for
91+
Tru64.
6692

6793

68-
28th August 2005
94+
24th January 2006

Makefile

+28-20
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ MAN_PGS = sg_dd.8 sgp_dd.8 sgm_dd.8 sg_read.8 sg_map.8 sg_scan.8 sg_rbuf.8 \
2727
sg_map26.8
2828
MAN_PREF = man8
2929

30-
HEADERS = sg_lib.h sg_cmds.h
31-
30+
HEADERS = sg_lib.h sg_cmds.h sg_pt.h
3231

32+
OS_FLAGS = -DSG3_UTILS_LINUX
3333
LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
34+
# S_CFLAGS = $(OS_FLAGS) $(LARGE_FILE_FLAGS) -DSG_KERNEL_INCLUDES
35+
S_CFLAGS = $(OS_FLAGS) $(LARGE_FILE_FLAGS)
3436

35-
# CFLAGS = -O2 -Wall -W $(LARGE_FILE_FLAGS)
36-
CFLAGS = -g -O2 -Wall -W $(LARGE_FILE_FLAGS)
37-
# CFLAGS = -g -O2 -W -DSG_KERNEL_INCLUDES $(LARGE_FILE_FLAGS)
38-
# CFLAGS = -g -O2 -Wall -W -pedantic -std=c99 $(LARGE_FILE_FLAGS)
37+
# CFLAGS = -O2 -Wall -W
38+
CFLAGS = -g -O2 -Wall -W
39+
# CFLAGS = -g -O2 -Wall -W -pedantic -std=c99
3940

4041
CFLAGS_PTHREADS = -D_REENTRANT
4142

@@ -49,23 +50,29 @@ LIB_VINFO = 1:0:0
4950
all: $(EXECS)
5051

5152
depend dep:
52-
for i in *.c; do $(CC) $(INCLUDES) $(CFLAGS) -M $$i; \
53+
for i in *.c; do $(CC) $(INCLUDES) $(CFLAGS) $(S_CFLAGS) -M $$i; \
5354
done > .depend
5455

5556
clean:
5657
/bin/rm -f *.o $(EXECS) core* .depend *.a *.la *.lo
5758
/bin/rm -rf .libs
5859

5960

61+
.c.o:
62+
$(CC) $(INCLUDES) $(CFLAGS) $(S_CFLAGS) -c -o $@ $<
63+
6064
sg_lib.lo: sg_lib.o
6165
libtool --mode=compile $(CC) -c sg_lib.c
6266

6367
sg_cmds.lo: sg_cmds.o
6468
libtool --mode=compile $(CC) -c sg_cmds.c
6569

66-
libsgutils.la: sg_lib.lo sg_cmds.lo
70+
sg_pt_linux.lo: sg_pt_linux.o
71+
libtool --mode=compile $(CC) -c sg_pt_linux.c
72+
73+
libsgutils.la: sg_lib.lo sg_cmds.lo sg_pt_linux.lo
6774
libtool --mode=link $(LD) -o libsgutils.la sg_lib.lo sg_cmds.lo \
68-
-rpath $(LIBDIR) -version-info $(LIB_VINFO)
75+
sg_pt_linux.lo -rpath $(LIBDIR) -version-info $(LIB_VINFO)
6976

7077
# libsgutils.la: sg_lib.lo sg_cmds.lo
7178
# libtool --mode=link $(LD) -o libsgutils.la sg_lib.lo sg_cmds.lo \
@@ -74,43 +81,44 @@ libsgutils.la: sg_lib.lo sg_cmds.lo
7481
sg_inq: sg_inq.o libsgutils.la
7582
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
7683

77-
sg_dd: sg_dd.o llseek.o libsgutils.la
84+
sg_dd: sg_dd.o llseek.o sg_io_linux.o libsgutils.la
7885
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
7986

80-
sg_scan: sg_scan.o libsgutils.la
87+
sg_scan: sg_scan.o sg_io_linux.o libsgutils.la
8188
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
8289

83-
sginfo: sginfo.o libsgutils.la
90+
sginfo: sginfo.o sg_io_linux.o libsgutils.la
8491
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
8592

8693
sg_start: sg_start.o libsgutils.la
8794
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
8895

89-
sg_rbuf: sg_rbuf.o libsgutils.la
96+
sg_rbuf: sg_rbuf.o sg_io_linux.o libsgutils.la
9097
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
9198

9299
sg_readcap: sg_readcap.o libsgutils.la
93100
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
94101

95102
sgp_dd.o: sgp_dd.c
96-
$(CC) $(INCLUDES) $(CFLAGS) $(CFLAGS_PTHREADS) -c $<
103+
$(CC) $(INCLUDES) $(CFLAGS) $(S_CFLAGS) $(CFLAGS_PTHREADS) \
104+
-c -o sgp_dd.o $<
97105

98-
sgp_dd: sgp_dd.o llseek.o libsgutils.la
106+
sgp_dd: sgp_dd.o llseek.o sg_io_linux.o libsgutils.la
99107
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^ -lpthread
100108

101-
sgm_dd: sgm_dd.o llseek.o libsgutils.la
109+
sgm_dd: sgm_dd.o llseek.o sg_io_linux.o libsgutils.la
102110
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
103111

104-
sg_map: sg_map.o libsgutils.la
112+
sg_map: sg_map.o sg_io_linux.o libsgutils.la
105113
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
106114

107115
sg_turs: sg_turs.o libsgutils.la
108116
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
109117

110-
sg_test_rwbuf: sg_test_rwbuf.o libsgutils.la
118+
sg_test_rwbuf: sg_test_rwbuf.o sg_io_linux.o libsgutils.la
111119
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
112120

113-
sg_read: sg_read.o llseek.o libsgutils.la
121+
sg_read: sg_read.o llseek.o sg_io_linux.o libsgutils.la
114122
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
115123

116124
sg_reset: sg_reset.o
@@ -125,7 +133,7 @@ sg_logs: sg_logs.o libsgutils.la
125133
sg_senddiag: sg_senddiag.o libsgutils.la
126134
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
127135

128-
sg_opcodes: sg_opcodes.o libsgutils.la
136+
sg_opcodes: sg_opcodes.o sg_io_linux.o libsgutils.la
129137
libtool --mode=link $(LD) -o $@ $(LDFLAGS) $^
130138

131139
sg_persist: sg_persist.o libsgutils.la

0 commit comments

Comments
 (0)