Skip to content

Commit

Permalink
sync to upstream sdparm svn rev 358
Browse files Browse the repository at this point in the history
See ChangeLog file for changes [20220109].
  • Loading branch information
doug-gilbert committed Jan 9, 2022
1 parent fb4757c commit efe045b
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 90 deletions.
9 changes: 7 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ The version number is hardcoded into sdparm.c (in a C string);
the rpm spec file: sdparm.spec ; the debian/changelog file;
and the configure.ac file (in the AC_INIT item).

ChangeLog for pre-release sdparm-1.13 [20210925] [svn: r355]
ChangeLog for pre-release sdparm-1.13 [20220109] [svn: r358]
- control extension mpage: add pwromact, hrdrmact, ssumact
and fmtmact fields
- format presets vpd: expand for schema type 4
- block device characteristics vpd: add MACT field
- point svn:externals to sg3_utils revision 914
- zoned block device characteristics vpd: add Zone
alignment method and Zone starting LBA granularity
fields [zbc2r11,zbc2r12]
- point svn:externals to sg3_utils revision 930

ChangeLog for released sdparm-1.12 [20210421] [svn: r347]
- add Command duration limits T2A and T2B mpages
Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sdparm (1.13-0.1) unstable; urgency=low

* see ChangeLog

-- Douglas Gilbert <[email protected]> Sat, 25 Sep 2021 22:00:00 -0400
-- Douglas Gilbert <[email protected]> Sun, 09 Jan 2022 13:00:00 -0500

sdparm (1.12-0.1) unstable; urgency=low

Expand Down
24 changes: 22 additions & 2 deletions doc/sdparm.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH SDPARM "8" "September 2021" "sdparm\-1.13" SDPARM
.TH SDPARM "8" "January 2022" "sdparm\-1.13" SDPARM
.SH NAME
sdparm \- access SCSI modes pages; read VPD pages; send simple SCSI commands.
.SH SYNOPSIS
Expand Down Expand Up @@ -926,11 +926,31 @@ the \fIDEVICE\fR reports a SCSI status of "task aborted". SAM\-5 says:
management function on another I_T nexus and the Control mode page TAS bit
is set to one".
.TP
.B 31
error involving two or more command line options. They may be contradicting,
select an unsupported mode, or a required option (given the context) is
missing.
.TP
.B 32
there is a logic error in the utility. It corresponds to code comments
like "shouldn't/can't get here". Perhaps the author should be informed.
.TP
.B 33
the command sent to \fIDEVICE\fR has timed out. This occurs in Linux
only; in other ports a command timeout will appear as a transport (or OS)
error.
.TP
.B 34
this is a Windows only exit status and indicates that the Windows error
number (32 bits) cannot meaningfully be mapped to an equivalent Unix error
number returned as the exit status (7 bits).
.TP
.B 35
a transport error has occurred. This will either be in the driver (e.g. HBA
driver) or in the interconnect between the host (initiator) and the
device (target). For example in SAS an expander can run out of paths and
thus be unable to return the user data from a READ command.
.TP
.B 40
the command sent to \fIDEVICE\fR has received an "aborted command" sense
key with an additional sense code of 0x10. This value is related to
Expand Down Expand Up @@ -995,7 +1015,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2005\-2021 Douglas Gilbert
Copyright \(co 2005\-2022 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expand Down
10 changes: 5 additions & 5 deletions include/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Expand Down Expand Up @@ -176,8 +176,6 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
Expand All @@ -193,6 +191,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand All @@ -203,6 +203,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GETOPT_O_FILES = @GETOPT_O_FILES@
Expand Down Expand Up @@ -444,7 +445,6 @@ cscopelist-am: $(am__tagged_files)

distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

Expand Down
9 changes: 8 additions & 1 deletion include/sg_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ char * safe_strerror(int errnum);
/* Print (to stdout) 'str' of bytes in hex, 16 bytes per line optionally
* followed at the right hand side of the line with an ASCII interpretation.
* Each line is prefixed with an address, starting at 0 for str[0]..str[15].
* All output numbers are in hex. 'no_ascii' allows for 3 output types:
* All output numbers are in hex.
* 'no_ascii' selects on of 3 output format types:
* > 0 each line has address then up to 16 ASCII-hex bytes
* = 0 in addition, the bytes are listed in ASCII to the right
* < 0 only the ASCII-hex bytes are listed (i.e. without address)
Expand All @@ -579,6 +580,12 @@ void dStrHex(const char * str, int len, int no_ascii);
* logic as dStrHex() with different output stream (i.e. stderr). */
void dStrHexErr(const char * str, int len, int no_ascii);

/* Read binary starting at 'str' for 'len' bytes and output as ASCII
* hexadecinal into file pointer (fp). 16 bytes per line are output with an
* additional space between 8th and 9th byte on each line (for readability).
* 'no_ascii' selects one of 3 output format types as shown in dStrHex() . */
void dStrHexFp(const char* str, int len, int no_ascii, FILE * fp);

/* Read 'len' bytes from 'str' and output as ASCII-Hex bytes (space
* separated) to 'b' not to exceed 'b_len' characters. Each line
* starts with 'leadin' (NULL for no leadin) and there are 16 bytes
Expand Down
4 changes: 3 additions & 1 deletion include/sg_lib_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SG_LIB_DATA_H

/*
* Copyright (c) 2007-2019 Douglas Gilbert.
* Copyright (c) 2007-2021 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
Expand Down Expand Up @@ -46,7 +46,9 @@ extern "C" {
#define SG_VARIABLE_LENGTH_CMD 0x7f
#define SG_WRITE_BUFFER 0x3b
#define SG_ZONING_OUT 0x94
#define SG_ZBC_OUT SG_ZONING_OUT /* as SPC calls them */
#define SG_ZONING_IN 0x95
#define SG_ZBC_IN SG_ZONING_IN /* as SPC calls them */



Expand Down
10 changes: 5 additions & 5 deletions lib/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Expand Down Expand Up @@ -247,8 +247,6 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
Expand All @@ -264,6 +262,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand All @@ -274,6 +274,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GETOPT_O_FILES = @GETOPT_O_FILES@
Expand Down Expand Up @@ -584,7 +585,6 @@ cscopelist-am: $(am__tagged_files)

distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

Expand Down
6 changes: 3 additions & 3 deletions lib/sg_cmds_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ sg_ll_inquiry_com(struct sg_pt_base * ptvp, int sg_fd, bool cmddt, bool evpd,
bool local_cdb = true;
int res, ret, sense_cat, resid;
uint8_t inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
uint8_t * up;

if (resp == NULL) {
Expand Down Expand Up @@ -738,7 +738,7 @@ sg_ll_request_sense_com(struct sg_pt_base * ptvp, int sg_fd, bool desc,
static const char * const rq_s = "request sense";
uint8_t rs_cdb[REQUEST_SENSE_CMDLEN] =
{REQUEST_SENSE_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};

if (desc)
rs_cdb[1] |= 0x1;
Expand Down Expand Up @@ -837,7 +837,7 @@ sg_ll_report_luns_com(struct sg_pt_base * ptvp, int sg_fd, int select_report,
int ret, res, sense_cat;
uint8_t rl_cdb[REPORT_LUNS_CMDLEN] =
{REPORT_LUNS_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};

rl_cdb[2] = select_report & 0xff;
sg_put_unaligned_be32((uint32_t)mx_resp_len, rl_cdb + 6);
Expand Down
22 changes: 11 additions & 11 deletions lib/sg_cmds_basic2.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sg_ll_sync_cache_10(int sg_fd, bool sync_nv, bool immed, int group,
int res, ret, sense_cat;
uint8_t sc_cdb[SYNCHRONIZE_CACHE_CMDLEN] =
{SYNCHRONIZE_CACHE_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if (sync_nv)
Expand Down Expand Up @@ -154,7 +154,7 @@ sg_ll_readcap_16(int sg_fd, bool pmi, uint64_t llba, void * resp,
uint8_t rc_cdb[SERVICE_ACTION_IN_16_CMDLEN] =
{SERVICE_ACTION_IN_16_CMD, READ_CAPACITY_16_SA,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if (pmi) { /* lbs only valid when pmi set */
Expand Down Expand Up @@ -209,7 +209,7 @@ sg_ll_readcap_10(int sg_fd, bool pmi, unsigned int lba, void * resp,
int ret, res, sense_cat;
uint8_t rc_cdb[READ_CAPACITY_10_CMDLEN] =
{READ_CAPACITY_10_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if (pmi) { /* lbs only valid when pmi set */
Expand Down Expand Up @@ -262,7 +262,7 @@ sg_ll_mode_sense6(int sg_fd, bool dbd, int pc, int pg_code, int sub_pg_code,
int res, ret, sense_cat, resid;
uint8_t modes_cdb[MODE_SENSE6_CMDLEN] =
{MODE_SENSE6_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

modes_cdb[1] = (uint8_t)(dbd ? 0x8 : 0);
Expand Down Expand Up @@ -361,7 +361,7 @@ sg_ll_mode_sense10_v2(int sg_fd, bool llbaa, bool dbd, int pc, int pg_code,
struct sg_pt_base * ptvp;
uint8_t modes_cdb[MODE_SENSE10_CMDLEN] =
{MODE_SENSE10_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};

modes_cdb[1] = (uint8_t)((dbd ? 0x8 : 0) | (llbaa ? 0x10 : 0));
modes_cdb[2] = (uint8_t)(((pc << 6) & 0xc0) | (pg_code & 0x3f));
Expand Down Expand Up @@ -448,7 +448,7 @@ sg_ll_mode_select6_v2(int sg_fd, bool pf, bool rtd, bool sp, void * paramp,
int res, ret, sense_cat;
uint8_t modes_cdb[MODE_SELECT6_CMDLEN] =
{MODE_SELECT6_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

modes_cdb[1] = (uint8_t)((pf ? 0x10 : 0x0) | (sp ? 0x1 : 0x0));
Expand Down Expand Up @@ -519,7 +519,7 @@ sg_ll_mode_select10_v2(int sg_fd, bool pf, bool rtd, bool sp, void * paramp,
int res, ret, sense_cat;
uint8_t modes_cdb[MODE_SELECT10_CMDLEN] =
{MODE_SELECT10_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

modes_cdb[1] = (uint8_t)((pf ? 0x10 : 0x0) | (sp ? 0x1 : 0x0));
Expand Down Expand Up @@ -818,7 +818,7 @@ sg_ll_log_sense_v2(int sg_fd, bool ppc, bool sp, int pc, int pg_code,
int res, ret, sense_cat, resid;
uint8_t logs_cdb[LOG_SENSE_CMDLEN] =
{LOG_SENSE_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if (mx_resp_len > 0xffff) {
Expand Down Expand Up @@ -902,7 +902,7 @@ sg_ll_log_select(int sg_fd, bool pcr, bool sp, int pc, int pg_code,
int res, ret, sense_cat;
uint8_t logs_cdb[LOG_SELECT_CMDLEN] =
{LOG_SELECT_CMD, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if (param_len > 0xffff) {
Expand Down Expand Up @@ -973,7 +973,7 @@ sg_ll_start_stop_unit_com(struct sg_pt_base * ptvp, int sg_fd, bool immed,
bool local_cdb = true;
int res, ret, sense_cat;
uint8_t ssuBlk[START_STOP_CMDLEN] = {START_STOP_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};

if (immed)
ssuBlk[1] = 0x1;
Expand Down Expand Up @@ -1073,7 +1073,7 @@ sg_ll_prevent_allow(int sg_fd, int prevent, bool noisy, int verbose)
int res, ret, sense_cat;
uint8_t p_cdb[PREVENT_ALLOW_CMDLEN] =
{PREVENT_ALLOW_CMD, 0, 0, 0, 0, 0};
uint8_t sense_b[SENSE_BUFF_LEN];
uint8_t sense_b[SENSE_BUFF_LEN] = {0};
struct sg_pt_base * ptvp;

if ((prevent < 0) || (prevent > 3)) {
Expand Down
Loading

0 comments on commit efe045b

Please sign in to comment.