aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COVERAGE5
-rw-r--r--ChangeLog4
-rw-r--r--doc/sg_rep_zones.818
-rw-r--r--doc/sg_reset_wp.84
-rw-r--r--doc/sg_ses.828
-rw-r--r--src/sg_rep_zones.c57
-rw-r--r--src/sg_reset_wp.c15
-rw-r--r--src/sg_ses.c82
8 files changed, 120 insertions, 93 deletions
diff --git a/COVERAGE b/COVERAGE
index b32abd9f..ead906ae 100644
--- a/COVERAGE
+++ b/COVERAGE
@@ -112,6 +112,9 @@ SMART READ DATA examples/sg_sat_smart_rd_data
(2) this command was known as REPORT DEVICE IDENTIFIER prior to spc4r07
(3) this command was known as SET DEVICE IDENTIFIER prior to spc4r07
+Note that any SCSI command, including bi-directional and variable length
+commands (whose cdb size is > 16 bytes) can be issued by the sg_raw utility.
+
The RECEIVE COPY * commands in SPC-4 were grouped as one command name
with 4 service actions in SPC-3 and earlier. The single SPC-3 command
name is RECEIVE COPY RESULTS. The two opcodes associated with all
@@ -120,4 +123,4 @@ THIRD PARTY COPY IN (0x83).
Douglas Gilbert
-29th September 2014
+25th October 2014
diff --git a/ChangeLog b/ChangeLog
index 65b2e3ed..e59fd98c 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 sg3_utils-1.40 [20141024] [svn: r617]
+Changelog for sg3_utils-1.40 [20141028] [svn: r618]
- sg_write_verify: new utility for WRITE AND VERIFY
- sg_ses_microcode: new utility
- sg_senddiag: add --maxlen= option
@@ -17,6 +17,7 @@ Changelog for sg3_utils-1.40 [20141024] [svn: r617]
- more TPC VPD page decoding
- sg_ses: fix problem with --index=sse (and ssc)
- mask status element before using as control
+ - defeat previous item with --mask (ignore) option
- SAS connector status element: add overcurrent bit
- handle element descriptor names that count a
trailing NULL
@@ -24,6 +25,7 @@ Changelog for sg3_utils-1.40 [20141024] [svn: r617]
- add optional descriptions to -ee output
- sg_sanitize: add --desc and --zero options
- output unit serial number and LU name prior to
+ - sg_rep_zones: corrections, sync with zbc-r01c
- sg_persist: split help into two pages, '-hh' for 2nd
- sg_logs: refine tape drive output
- sg_raw: with -vvv decode T10 CDB name
diff --git a/doc/sg_rep_zones.8 b/doc/sg_rep_zones.8
index 6adce7b5..fb9d3f2c 100644
--- a/doc/sg_rep_zones.8
+++ b/doc/sg_rep_zones.8
@@ -1,4 +1,4 @@
-.TH SG_REP_ZONES "8" "June 2014" "sg3_utils\-1.39" SG3_UTILS
+.TH SG_REP_ZONES "8" "October 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_rep_zones \- send SCSI REPORT ZONES command
.SH SYNOPSIS
@@ -10,8 +10,8 @@ sg_rep_zones \- send SCSI REPORT ZONES command
.\" Add any additional description here
.PP
Sends a SCSI REPORT ZONES command to \fIDEVICE\fR and outputs the data
-returned. This command is found in the ZBC draft standard whose most
-recent revision is 1a.
+returned. This command is found in the ZBC draft standard, revision
+1c (zbc\-r01c.pdf).
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
.TP
@@ -42,14 +42,14 @@ where \fIOPT\fR will become the contents of the REPORTING OPTION field
in the cdb. The default value is 0 which means report a list or all zones.
Some other values are 1 for list full zones; 2 for list all open zones; 3
for list all empty zones; 4 for list all read only zones; 5 for list all
-offline zones; and 6 for list all zones with the RESET bit set.
+offline zones; 6 for list all zones with the RESET bit set; and 7 for list
+all zones with the NON_SEQ bit set.
.TP
\fB\-s\fR, \fB\-\-start\fR=\fILBA\fR
-where \fILBA\fR is a zone start logical block address (LBA) of the first
-zone to be reported. The default value is 0. \fILBA\fR must be a zone
-start LBA otherwise an ILLEGAL REQUEST sense key is returned. Assumed to be
-in decimal unless prefixed with '0x' or has a trailing 'h' which indicate
-hexadecimal.
+where \fILBA\fR is at the start or within the first zone to be reported. The
+default value is 0. If \fILBA\fR is not a zone start LBA then the preceding
+zone start LBA is used for reporting. Assumed to be in decimal unless
+prefixed with '0x' or has a trailing 'h' which indicate hexadecimal.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
increase the level of verbosity, (i.e. debug output).
diff --git a/doc/sg_reset_wp.8 b/doc/sg_reset_wp.8
index ef20be67..d44c16a7 100644
--- a/doc/sg_reset_wp.8
+++ b/doc/sg_reset_wp.8
@@ -1,4 +1,4 @@
-.TH SG_RESET_WP "8" "June 2014" "sg3_utils\-1.39" SG3_UTILS
+.TH SG_RESET_WP "8" "October 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_reset_wp \- send SCSI RESET WRITE POINTER command
.SH SYNOPSIS
@@ -9,7 +9,7 @@ sg_reset_wp \- send SCSI RESET WRITE POINTER command
.\" Add any additional description here
.PP
Sends a SCSI RESET WRITE POINTER command to the \fIDEVICE\fR. This command
-is found in the ZBC draft standard whose most recent revision is 1a.
+is found in the ZBC draft standard revision 1c (zbc\-r01c.pdf).
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
.TP
diff --git a/doc/sg_ses.8 b/doc/sg_ses.8
index 829dfdbb..1ba9c529 100644
--- a/doc/sg_ses.8
+++ b/doc/sg_ses.8
@@ -8,11 +8,11 @@ sg_ses \- access a SCSI Enclosure Services (SES) device
[\fI\-\-dev\-slot\-num=SN\fR] [\fI\-\-eiioe=A_F\fR] [\fI\-\-enumerate\fR]
[\fI\-\-filter\fR] [\fI\-\-get=STR\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR]
[\fI\-\-index=IIA\fR | \fI\-\-index=TIA,II\fR] [\fI\-\-inner\-hex\fR]
-[\fI\-\-join\fR] [\fI\-\-list\fR] [\fI\-\-nickname=SEN\fR]
-[\fI\-\-nickid=SEID\fR] [\fI\-\-page=PG\fR] [\fI\-\-raw\fR]
-[\fI\-\-readonly\fR] [\fI\-\-sas\-addr=SA\fR] [\fI\-\-set=STR\fR]
-[\fI\-\-status\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR] [\fI\-\-warn\fR]
-\fIDEVICE\fR
+[\fI\-\-join\fR] [\fI\-\-list\fR] [\fI\-\-mask\fR] [\fI\-\-maxlen=LEN\fR]
+[\fI\-\-nickname=SEN\fR] [\fI\-\-nickid=SEID\fR] [\fI\-\-page=PG\fR]
+[\fI\-\-raw\fR] [\fI\-\-readonly\fR] [\fI\-\-sas\-addr=SA\fR]
+[\fI\-\-set=STR\fR] [\fI\-\-status\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
+[\fI\-\-warn\fR] \fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -195,6 +195,24 @@ NUMBER AND SAS ADDRESS sections below.
\fB\-l\fR, \fB\-\-list\fR
This option is equivalent to \fI\-\-enumerate\fR. See that option.
.TP
+\fB\-M\fR, \fB\-\-mask\fR
+When modifying elements, the default action is a read (status element),
+mask, modify (based on \fI\-\-clear=STR\fR or \fI\-\-set=STR\fR) then write
+back as the control element. The mask step is new in sg_ses version 1.98
+and is based on what is allowable (and in the same location) in draft SES\-3
+revision 6. Those masks may evolve, as they have in the past. This option
+re\-instates the previous logic which was to ignore the mask step. The
+default action (i.e. without this option) is to perform the mask step in
+the read\-mask\-modify\-write sequence.
+.TP
+\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
+\fILEN\fR is placed in the ALLOCATION LENGTH field of the SCSI RECEIVE
+DIAGNOSTIC RESULTS commands sent by the utility. It represents the maximum
+size of data the SES device can return (in bytes). It cannot exceed 65535
+and defaults to 65532 (bytes). Some systems may not permit such large sizes
+hence the need for this option. If \fILEN\fR is set to 0 then the default
+size is used.
+.TP
\fB\-n\fR, \fB\-\-nickname\fR=\fISEN\fR
where \fISEN\fR is the new Subenclosure Nickname. Only the first 32
characters (bytes) of \fISEN\fR are used, if more are given they are
diff --git a/src/sg_rep_zones.c b/src/sg_rep_zones.c
index 0494e759..a182afd7 100644
--- a/src/sg_rep_zones.c
+++ b/src/sg_rep_zones.c
@@ -22,15 +22,16 @@
#include "sg_lib.h"
#include "sg_pt.h"
#include "sg_cmds_basic.h"
+#include "sg_unaligned.h"
/* A utility program originally written for the Linux OS SCSI subsystem.
*
*
* This program issues the SCSI REPORT ZONES command to the given SCSI device
- * and decodes the response.
+ * and decodes the response. Based on zbc-r01c.pdf
*/
-static const char * version_str = "1.02 20140604";
+static const char * version_str = "1.03 20141028";
#define MAX_RZONES_BUFF_LEN (1024 * 1024)
#define DEF_RZONES_BUFF_LEN (1024 * 8)
@@ -97,7 +98,7 @@ usage()
" --readonly|-R open DEVICE read-only (def: read-write)\n"
" --report=OPT|-o OP reporting option (def: 0)\n"
" --start=LBA|-s LBA report zones from the LBA (def: 0)\n"
- " must be a zone starting LBA\n"
+ " need not be a zone starting LBA\n"
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"
"Performs a SCSI REPORT ZONES command.\n");
@@ -116,19 +117,8 @@ sg_ll_report_zones(int sg_fd, uint64_t zs_lba, int report_opts, void * resp,
unsigned char sense_b[SENSE_BUFF_LEN];
struct sg_pt_base * ptvp;
- /* assume zbc-r01a is wrong and that ZS LBA is an 8 byte field */
- rzCmdBlk[2] = (zs_lba >> 56) & 0xff;
- rzCmdBlk[3] = (zs_lba >> 48) & 0xff;
- rzCmdBlk[4] = (zs_lba >> 40) & 0xff;
- rzCmdBlk[5] = (zs_lba >> 32) & 0xff;
- rzCmdBlk[6] = (zs_lba >> 24) & 0xff;
- rzCmdBlk[7] = (zs_lba >> 16) & 0xff;
- rzCmdBlk[8] = (zs_lba >> 8) & 0xff;
- rzCmdBlk[9] = zs_lba & 0xff;
- rzCmdBlk[10] = (mx_resp_len >> 24) & 0xff;
- rzCmdBlk[11] = (mx_resp_len >> 16) & 0xff;
- rzCmdBlk[12] = (mx_resp_len >> 8) & 0xff;
- rzCmdBlk[13] = mx_resp_len & 0xff;
+ sg_put_unaligned_be64(zs_lba, rzCmdBlk + 2);
+ sg_put_unaligned_be32((uint32_t)mx_resp_len, rzCmdBlk + 10);
rzCmdBlk[14] = report_opts & 0xf;
if (verbose) {
pr2serr(" Report zones cdb: ");
@@ -216,6 +206,9 @@ zone_condition_str(int zc, char * b, int blen, int vb)
if (NULL == b)
return "zone_condition_str: NULL ptr)";
switch (zc) {
+ case 0:
+ cp = "No write pointer";
+ break;
case 1:
cp = "Empty";
break;
@@ -245,11 +238,18 @@ zone_condition_str(int zc, char * b, int blen, int vb)
return b;
}
+static const char * same_desc_arr[4] = {
+ "zone type and length may differ in each descriptor",
+ "zone type and length same in each descriptor",
+ "zone type and length same apart from length in last descriptor",
+ "Reserved",
+};
+
int
main(int argc, char * argv[])
{
- int sg_fd, k, m, res, c, zl_len, len, zones, resid, rlen, zt, zc;
+ int sg_fd, k, res, c, zl_len, len, zones, resid, rlen, zt, zc, same;
int do_hex = 0;
int maxlen = 0;
int do_raw = 0;
@@ -374,8 +374,7 @@ main(int argc, char * argv[])
ret = SG_LIB_CAT_MALFORMED;
goto the_end;
}
- zl_len = (reportZonesBuff[0] << 24) + (reportZonesBuff[1] << 16) +
- (reportZonesBuff[2] << 8) + reportZonesBuff[3] + 64;
+ zl_len = sg_get_unaligned_be32(reportZonesBuff + 0) + 64;
if (zl_len > rlen) {
if (verbose)
pr2serr("zl_len available is %d, response length is %d\n",
@@ -399,7 +398,8 @@ main(int argc, char * argv[])
ret = SG_LIB_CAT_MALFORMED;
goto the_end;
}
- printf(" Same=%d\n\n", reportZonesBuff[4] & 1);
+ same = reportZonesBuff[4] & 3;
+ printf(" Same=%d: %s\n\n", same, same_desc_arr[same]);
zones = (len - 64) / 64;
for (k = 0, ucp = reportZonesBuff + 64; k < zones; ++k, ucp += 64) {
printf(" Zone descriptor: %d\n", k);
@@ -413,17 +413,14 @@ main(int argc, char * argv[])
verbose));
printf(" Zone condition: %s\n", zone_condition_str(zc, b,
sizeof(b), verbose));
+ printf(" Non_seq: %d\n", !!(ucp[1] & 0x2));
printf(" Reset: %d\n", ucp[1] & 0x1);
- printf(" Zone Length: 0x");
- for (m = 0; m < 8; ++m)
- printf("%02x", ucp[8 + m]);
- printf("\n Zone start LBA: 0x");
- for (m = 0; m < 8; ++m)
- printf("%02x", ucp[64 + m]);
- printf("\n Write pointer LBA: 0x");
- for (m = 0; m < 8; ++m)
- printf("%02x", ucp[64 + m]);
- printf("\n");
+ printf(" Zone Length: 0x%" PRIx64 "\n",
+ sg_get_unaligned_be64(ucp + 8));
+ printf(" Zone start LBA: 0x%" PRIx64 "\n",
+ sg_get_unaligned_be64(ucp + 16));
+ printf(" Write pointer LBA: 0x%" PRIx64 "\n",
+ sg_get_unaligned_be64(ucp + 24));
}
if ((64 + (64 * zones)) < zl_len)
printf("\n>>> Beware: Zone list truncated, may need another "
diff --git a/src/sg_reset_wp.c b/src/sg_reset_wp.c
index 6ca532ce..ed3fd7bf 100644
--- a/src/sg_reset_wp.c
+++ b/src/sg_reset_wp.c
@@ -22,15 +22,16 @@
#include "sg_lib.h"
#include "sg_pt.h"
#include "sg_cmds_basic.h"
+#include "sg_unaligned.h"
/* A utility program originally written for the Linux OS SCSI subsystem.
*
*
* This program issues the SCSI RESET WRITE POINTER command to the given SCSI
- * device.
+ * device. Based on zbc-r01c.pdf .
*/
-static const char * version_str = "1.01 20140604";
+static const char * version_str = "1.02 20141028";
#define SERVICE_ACTION_OUT_16_CMD 0x9f
#define SERVICE_ACTION_OUT_16_CMDLEN 16
@@ -103,15 +104,7 @@ sg_ll_reset_write_pointer(int sg_fd, uint64_t zid, int reset_all, int noisy,
unsigned char sense_b[SENSE_BUFF_LEN];
struct sg_pt_base * ptvp;
- /* assume zbc-r01a is wrong and that ZS LBA is an 8 byte field */
- rwpCmdBlk[2] = (zid >> 56) & 0xff;
- rwpCmdBlk[3] = (zid >> 48) & 0xff;
- rwpCmdBlk[4] = (zid >> 40) & 0xff;
- rwpCmdBlk[5] = (zid >> 32) & 0xff;
- rwpCmdBlk[6] = (zid >> 24) & 0xff;
- rwpCmdBlk[7] = (zid >> 16) & 0xff;
- rwpCmdBlk[8] = (zid >> 8) & 0xff;
- rwpCmdBlk[9] = zid & 0xff;
+ sg_put_unaligned_be64(zid, rwpCmdBlk + 2);
if (reset_all)
rwpCmdBlk[14] = 0x1;
if (verbose) {
diff --git a/src/sg_ses.c b/src/sg_ses.c
index 85cb4dc1..e79a8156 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -29,7 +29,7 @@
* commands tailored for SES (enclosure) devices.
*/
-static const char * version_str = "1.98 20141023"; /* ses3r06 */
+static const char * version_str = "1.98 20141027"; /* ses3r06 */
#define MX_ALLOC_LEN ((64 * 1024) - 4) /* max allowable for big enclosures */
#define MX_ELEM_HDR 1024
@@ -117,6 +117,7 @@ struct opts_t {
int inner_hex;
int do_join;
int do_list;
+ int mask_ign; /* element read-mask-modify-write actions */
int maxlen;
int seid;
int seid_given;
@@ -506,6 +507,7 @@ static struct option long_options[] = {
{"list", no_argument, 0, 'l'},
{"nickid", required_argument, 0, 'N'},
{"nickname", required_argument, 0, 'n'},
+ {"mask", required_argument, 0, 'M'},
{"maxlen", required_argument, 0, 'm'},
{"page", required_argument, 0, 'p'},
{"raw", no_argument, 0, 'r'},
@@ -521,32 +523,33 @@ static struct option long_options[] = {
/* For overzealous SES device servers that don't like some status elements
* sent back as control elements. This table is as per ses3r06. */
static uint8_t ses3_element_cmask_arr[NUM_ETC][4] = {
- {0x40, 0xff, 0xff, 0xff}, /* [0] */
- {0x40, 0, 0xde, 0x3c}, /* DEVICE_ETC */
- {0x40, 0x80, 0, 0x60}, /* POWER_SUPPLY_ETC */
- {0x40, 0x80, 0, 0x67}, /* COOLING_ETC */
- {0x40, 0xc0, 0, 0}, /* TEMPERATURE_ETC */
- {0x40, 0xc0, 0, 0x1}, /* DOOR_ETC */
- {0x40, 0xc0, 0, 0x5f}, /* AUD_ALARM_ETC */
- {0x40, 0xc0, 0x1, 0}, /* ENC_ELECTRONICS_ETC */
- {0x40, 0xc0, 0, 0}, /* SCC_CELECTR_ETC */
- {0x40, 0xc0, 0, 0}, /* NV_CACHE_ETC */
- {0x40, 0, 0, 0}, /* [10] INV_OP_REASON_ETC */
- {0x40, 0, 0, 0xc0}, /* UI_POWER_SUPPLY_ETC */
- {0x40, 0xc3, 0xff, 0xff}, /* DISPLAY_ETC */
- {0x40, 0xc3, 0, 0}, /* KEY_PAD_ETC */
- {0x40, 0x80, 0, 0xff}, /* ENCLOSURE_ETC */
- {0x40, 0xc0, 0, 0x1}, /* SCSI_PORT_TRAN_ETC */
- {0x40, 0x80, 0xff, 0xff}, /* LANGUAGE_ETC */
- {0x40, 0xc0, 0, 0x1}, /* COMM_PORT_ETC */
- {0x40, 0xc0, 0, 0}, /* VOLT_SENSOR_ETC */
- {0x40, 0xc0, 0, 0}, /* CURR_SENSOR_ETC */
- {0x40, 0xc0, 0, 0x1}, /* [20] SCSI_TPORT_ETC */
- {0x40, 0xc0, 0, 0x1}, /* SCSI_IPORT_ETC */
- {0x40, 0xc0, 0, 0}, /* SIMPLE_SUBENC_ETC */
- {0x40, 0xff, 0xbe, 0x3c}, /* ARRAY_ETC */
- {0x40, 0xc0, 0, 0}, /* SAS_EXPANDER_ETC */
- {0x40, 0x80, 0, 0xc0}, /* SAS_CONNECTOR_ETC */
+ /* Element type code (ETC) names; comment */
+ {0x40, 0xff, 0xff, 0xff}, /* [0] unspecified */
+ {0x40, 0, 0x4e, 0x3c}, /* DEVICE */
+ {0x40, 0x80, 0, 0x60}, /* POWER_SUPPLY */
+ {0x40, 0x80, 0, 0x60}, /* COOLING; requested speed as is unless */
+ {0x40, 0xc0, 0, 0}, /* TEMPERATURE */
+ {0x40, 0xc0, 0, 0x1}, /* DOOR */
+ {0x40, 0xc0, 0, 0x5f}, /* AUD_ALARM */
+ {0x40, 0xc0, 0x1, 0}, /* ENC_ELECTRONICS */
+ {0x40, 0xc0, 0, 0}, /* SCC_CELECTR */
+ {0x40, 0xc0, 0, 0}, /* NV_CACHE */
+ {0x40, 0, 0, 0}, /* [10] INV_OP_REASON */
+ {0x40, 0, 0, 0xc0}, /* UI_POWER_SUPPLY */
+ {0x40, 0xc0, 0xff, 0xff}, /* DISPLAY */
+ {0x40, 0xc3, 0, 0}, /* KEY_PAD */
+ {0x40, 0x80, 0, 0xff}, /* ENCLOSURE */
+ {0x40, 0xc0, 0, 0x10}, /* SCSI_PORT_TRAN */
+ {0x40, 0x80, 0xff, 0xff}, /* LANGUAGE */
+ {0x40, 0xc0, 0, 0x1}, /* COMM_PORT */
+ {0x40, 0xc0, 0, 0}, /* VOLT_SENSOR */
+ {0x40, 0xc0, 0, 0}, /* CURR_SENSOR */
+ {0x40, 0xc0, 0, 0x1}, /* [20] SCSI_TPORT */
+ {0x40, 0xc0, 0, 0x1}, /* SCSI_IPORT */
+ {0x40, 0xc0, 0, 0}, /* SIMPLE_SUBENC */
+ {0x40, 0xff, 0x4e, 0x3c}, /* ARRAY */
+ {0x40, 0xc0, 0, 0}, /* SAS_EXPANDER */
+ {0x40, 0x80, 0, 0x40}, /* SAS_CONNECTOR */
};
@@ -589,11 +592,11 @@ usage(int help_num)
"[--hex]\n"
" [--index=IIA | =TIA,II] [--inner-hex] "
"[--join] [--list]\n"
- " [--maxlen=LEN] [--nickname=SEN] [--nickid=SEID] "
- "[--page=PG]\n"
- " [--raw] [--sas-addr=SA] [--set=STR] [--status] "
- "[--verbose]\n"
- " [--version] [--warn] DEVICE\n"
+ " [--mask] [--maxlen=LEN] [--nickname=SEN] "
+ "[--nickid=SEID]\n"
+ " [--page=PG] [--raw] [--sas-addr=SA] [--set=STR] "
+ "[--status]\n"
+ " [--verbose] [--version] [--warn] DEVICE\n"
" where the main options are:\n"
" --clear=STR|-C STR clear field by acronym or position\n"
" --descriptor=DN|-D DN descriptor name (for indexing)\n"
@@ -657,6 +660,10 @@ usage(int help_num)
" --inner-hex|-i print innermost level of a"
" status page in hex\n"
" --list|-l same as '--enumerate' option\n"
+ " --mask|-M ignore status element mask in modify "
+ "actions\n"
+ " (e.g.--set= and --clear=) (def: apply "
+ "mask)\n"
" --maxlen=LEN|-m LEN max response length (allocation "
"length in cdb)\n"
" --nickname=SEN|-n SEN SEN is new subenclosure nickname\n"
@@ -831,7 +838,7 @@ cl_process(struct opts_t *op, int argc, char *argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "A:b:cC:d:D:eE:fG:hHiI:jln:N:m:p:rRsS:v"
+ c = getopt_long(argc, argv, "A:b:cC:d:D:eE:fG:hHiI:jln:N:m:Mp:rRsS:v"
"Vwx:", long_options, &option_index);
if (c == -1)
break;
@@ -937,6 +944,9 @@ cl_process(struct opts_t *op, int argc, char *argv[])
return SG_LIB_SYNTAX_ERROR;
}
break;
+ case 'M':
+ ++op->mask_ign;
+ break;
case 'p':
if (isdigit(optarg[0])) {
op->page_code = sg_get_num(optarg);
@@ -3722,11 +3732,15 @@ cgs_enc_ctl_stat(int sg_fd, const struct join_row_t * jrp,
else
printf("%" PRId64 "\n", (int64_t)ui);
} else { /* --set or --clear */
- if (jrp->etype < NUM_ETC) {
+ if ((0 == op->mask_ign) && (jrp->etype < NUM_ETC)) {
+ if (op->verbose > 2)
+ pr2serr("Applying mask to element status [etc=%d] prior to "
+ "modify then write\n", jrp->etype);
for (k = 0; k < 4; ++k)
jrp->enc_statp[k] &= ses3_element_cmask_arr[jrp->etype][k];
} else
jrp->enc_statp[0] &= 0x40; /* keep PRDFAIL is set in byte 0 */
+ /* next we modify requested bit(s) */
set_big_endian((uint64_t)tavp->val,
jrp->enc_statp + s_byte, s_bit, n_bits);
jrp->enc_statp[0] |= 0x80; /* set SELECT bit */