aboutsummaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-08-12 02:12:48 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-08-12 02:12:48 +0000
commit048bd1272b7256331117b0e7b1ab5d22cf308067 (patch)
tree3f86090e36f01551afc2aa8132ce3660d878d57a /testing
parent4ea97e60c544ad44ee7396c815064d87f0d25874 (diff)
downloadsg3_utils-048bd1272b7256331117b0e7b1ab5d22cf308067.tar.gz
sg_inq+sg_vpd: more JSON work (add SG_C_CPP_ZERO_INIT)
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@966 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'testing')
-rw-r--r--testing/bsg_queue_tst.c2
-rw-r--r--testing/sg_iovec_tst.cpp4
-rw-r--r--testing/sg_queue_tst.c2
-rw-r--r--testing/sg_tst_async.cpp17
-rw-r--r--testing/sg_tst_bidi.c2
-rw-r--r--testing/sg_tst_context.cpp4
-rw-r--r--testing/sg_tst_excl.cpp6
-rw-r--r--testing/sg_tst_excl2.cpp4
-rw-r--r--testing/sg_tst_excl3.cpp4
-rw-r--r--testing/sg_tst_ioctl.c4
-rw-r--r--testing/sg_tst_nvme.c4
-rw-r--r--testing/tst_sg_lib.c2
12 files changed, 27 insertions, 28 deletions
diff --git a/testing/bsg_queue_tst.c b/testing/bsg_queue_tst.c
index 2761f8bb..06a35224 100644
--- a/testing/bsg_queue_tst.c
+++ b/testing/bsg_queue_tst.c
@@ -61,7 +61,7 @@ int main(int argc, char * argv[])
struct sg_io_v4 rio_hdr;
char * file_name = 0;
char ebuff[EBUFF_SZ];
- uint8_t sense_buffer[16][SENSE_BUFFER_LEN] = {0};
+ uint8_t sense_buffer[16][SENSE_BUFFER_LEN] SG_C_CPP_ZERO_INIT;
int q_at_tail = 0;
for (k = 1; k < argc; ++k) {
diff --git a/testing/sg_iovec_tst.cpp b/testing/sg_iovec_tst.cpp
index 0d28526b..7cc18935 100644
--- a/testing/sg_iovec_tst.cpp
+++ b/testing/sg_iovec_tst.cpp
@@ -147,7 +147,7 @@ sg_read(int sg_fd, uint8_t * buff, int num_blocks, int from_block, int bs,
int elem_size, int async)
{
uint8_t rdCmd[10] = {READ_10, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- uint8_t senseBuff[SENSE_BUFF_LEN] = {0};
+ uint8_t senseBuff[SENSE_BUFF_LEN] SG_C_CPP_ZERO_INIT;
struct sg_io_hdr io_hdr;
struct pollfd a_poll;
int dxfer_len = bs * num_blocks;
@@ -251,7 +251,7 @@ sg_read_v4(int sg_fd, uint8_t * buff, int num_blocks, int from_block, int bs,
int elem_size, int async)
{
uint8_t rdCmd[10] = {READ_10, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- uint8_t senseBuff[SENSE_BUFF_LEN] = {0};
+ uint8_t senseBuff[SENSE_BUFF_LEN] SG_C_CPP_ZERO_INIT;
struct sg_io_v4 io_hdr;
struct pollfd a_poll;
int dxfer_len = bs * num_blocks;
diff --git a/testing/sg_queue_tst.c b/testing/sg_queue_tst.c
index 79f9c28d..9f83fd3f 100644
--- a/testing/sg_queue_tst.c
+++ b/testing/sg_queue_tst.c
@@ -110,7 +110,7 @@ int main(int argc, char * argv[])
sg_io_hdr_t rio_hdr;
char * file_name = 0;
char ebuff[EBUFF_SZ];
- uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] = {0};
+ uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] SG_C_CPP_ZERO_INIT;
int q_len = DEF_Q_LEN;
for (k = 1; k < argc; ++k) {
diff --git a/testing/sg_tst_async.cpp b/testing/sg_tst_async.cpp
index f81a26dd..8904e379 100644
--- a/testing/sg_tst_async.cpp
+++ b/testing/sg_tst_async.cpp
@@ -467,7 +467,7 @@ start_sg3_cmd(int sg_fd, command2execute cmd2exe, int pack_id, uint64_t lba,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
uint8_t w16CmdBlk[WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- uint8_t sense_buffer[64] = {0};
+ uint8_t sense_buffer[64] SG_C_CPP_ZERO_INIT;
const char * np = NULL;
struct sg_io_hdr * ptp;
@@ -552,7 +552,7 @@ finish_sg3_cmd(int sg_fd, command2execute cmd2exe, int & pack_id,
{
bool ok;
int res, k;
- uint8_t sense_buffer[64] = {0};
+ uint8_t sense_buffer[64] SG_C_CPP_ZERO_INIT;
const char * np = NULL;
struct sg_io_hdr pt;
struct sg_io_hdr * ptp;
@@ -652,7 +652,7 @@ start_sg4_cmd(int sg_fd, command2execute cmd2exe, int pack_id, uint64_t lba,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
uint8_t w16CmdBlk[WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- uint8_t sense_buffer[64] = {0};
+ uint8_t sense_buffer[64] SG_C_CPP_ZERO_INIT;
const char * np = NULL;
struct sg_io_v4 * ptp;
@@ -730,7 +730,7 @@ finish_sg4_cmd(int sg_fd, command2execute cmd2exe, int & pack_id,
{
bool ok;
int res, k;
- uint8_t sense_buffer[64] = {0};
+ uint8_t sense_buffer[64] SG_C_CPP_ZERO_INIT;
const char * np = NULL;
struct sg_io_v4 * ptp;
struct sg_io_v4 p4t;
@@ -869,7 +869,7 @@ work_sync_thread(int id, const char * dev_name, unsigned int /* hi_lba */,
int thr_sync_starts = 0;
struct sg_pt_base * ptp = NULL;
uint8_t cdb[6];
- uint8_t sense_b[32] = {0};
+ uint8_t sense_b[32] SG_C_CPP_ZERO_INIT;
char b[120];
if (is_rw) {
@@ -1610,7 +1610,7 @@ do_inquiry_prod_id(const char * dev_name, int block, int & sg_ver_num,
uint8_t inqCmdBlk [INQ_CMD_LEN] =
{0x12, 0, 0, 0, INQ_REPLY_LEN, 0};
uint8_t inqBuff[INQ_REPLY_LEN];
- uint8_t sense_buffer[64] = {0};
+ uint8_t sense_buffer[64] SG_C_CPP_ZERO_INIT;
int open_flags = O_RDWR; /* O_EXCL | O_RDONLY fails with EPERM */
if (! block)
@@ -1689,8 +1689,8 @@ do_read_capacity(const char * dev_name, int block, unsigned int * last_lba,
int res, sg_fd;
uint8_t rcCmdBlk [10] = {0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t rcBuff[64];
- uint8_t sense_b[64] = {0};
- sg_io_hdr_t io_hdr;
+ uint8_t sense_b[64] SG_C_CPP_ZERO_INIT;
+ sg_io_hdr_t io_hdr SG_C_CPP_ZERO_INIT;
int open_flags = O_RDWR; /* O_EXCL | O_RDONLY fails with EPERM */
if (! block)
@@ -1701,7 +1701,6 @@ do_read_capacity(const char * dev_name, int block, unsigned int * last_lba,
return -1;
}
/* Prepare READ CAPACITY(10) command */
- memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof(rcCmdBlk);
io_hdr.mx_sb_len = sizeof(sense_b);
diff --git a/testing/sg_tst_bidi.c b/testing/sg_tst_bidi.c
index 6865e9a9..c142f401 100644
--- a/testing/sg_tst_bidi.c
+++ b/testing/sg_tst_bidi.c
@@ -182,7 +182,7 @@ main(int argc, char * argv[])
uint8_t * doutp;
uint8_t * free_doutp = NULL;
char ebuff[EBUFF_SZ];
- uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] = {0};
+ uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] SG_C_CPP_ZERO_INIT;
for (k = 1; k < argc; ++k) {
if (0 == memcmp("-b=", argv[k], 3)) {
diff --git a/testing/sg_tst_context.cpp b/testing/sg_tst_context.cpp
index fd0f68b6..f7cff2fb 100644
--- a/testing/sg_tst_context.cpp
+++ b/testing/sg_tst_context.cpp
@@ -183,7 +183,7 @@ do_tur(struct sg_pt_base * ptp, int id)
{
int slen, res, cat;
unsigned char turCmdBlk [TUR_CMD_LEN] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
clear_scsi_pt_obj(ptp);
set_scsi_pt_cdb(ptp, turCmdBlk, sizeof(turCmdBlk));
@@ -228,7 +228,7 @@ do_ssu(struct sg_pt_base * ptp, int id, bool start)
{
int slen, res, cat;
unsigned char ssuCmdBlk [SSU_CMD_LEN] = {0x1b, 0x0, 0x0, 0x0, 0x0, 0x0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
if (start)
ssuCmdBlk[4] |= 0x1;
diff --git a/testing/sg_tst_excl.cpp b/testing/sg_tst_excl.cpp
index eeba5545..0354de60 100644
--- a/testing/sg_tst_excl.cpp
+++ b/testing/sg_tst_excl.cpp
@@ -192,7 +192,7 @@ do_rd_inc_wr_twice_v3(const char * dev_name, unsigned int lba, int block,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
unsigned char w16CmdBlk [WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
unsigned char lb[READ16_REPLY_LEN];
int open_flags = O_RDWR;
@@ -437,7 +437,7 @@ do_rd_inc_wr_twice_v4(const char * dev_name, unsigned int lba, int block,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
unsigned char w16CmdBlk [WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
unsigned char lb[READ16_REPLY_LEN];
int open_flags = O_RDWR;
@@ -696,7 +696,7 @@ do_inquiry_prod_id(const char * dev_name, int block, int wait_ms,
unsigned char inqCmdBlk [INQ_CMD_LEN] =
{0x12, 0, 0, 0, INQ_REPLY_LEN, 0};
unsigned char inqBuff[INQ_REPLY_LEN];
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
int open_flags = O_RDWR; /* O_EXCL | O_RDONLY fails with EPERM */
if (! block)
diff --git a/testing/sg_tst_excl2.cpp b/testing/sg_tst_excl2.cpp
index f6bd617d..d198d713 100644
--- a/testing/sg_tst_excl2.cpp
+++ b/testing/sg_tst_excl2.cpp
@@ -198,7 +198,7 @@ do_rd_inc_wr_twice(const char * dev_name, unsigned int lba, int block,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
unsigned char w16CmdBlk [WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
unsigned char lb[READ16_REPLY_LEN];
char ebuff[EBUFF_SZ];
int open_flags = O_RDWR;
@@ -323,7 +323,7 @@ do_inquiry_prod_id(const char * dev_name, int block, int wait_ms,
unsigned char inqCmdBlk [INQ_CMD_LEN] =
{0x12, 0, 0, 0, INQ_REPLY_LEN, 0};
unsigned char inqBuff[INQ_REPLY_LEN];
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
char ebuff[EBUFF_SZ];
int open_flags = O_RDWR; /* since O_EXCL | O_RDONLY gives EPERM */
diff --git a/testing/sg_tst_excl3.cpp b/testing/sg_tst_excl3.cpp
index 685b33f6..b1cbf130 100644
--- a/testing/sg_tst_excl3.cpp
+++ b/testing/sg_tst_excl3.cpp
@@ -204,7 +204,7 @@ do_rd_inc_wr_twice(const char * dev_name, int read_only, unsigned int lba,
{0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
unsigned char w16CmdBlk [WRITE16_CMD_LEN] =
{0x8a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
unsigned char lb[READ16_REPLY_LEN];
char ebuff[EBUFF_SZ];
int open_flags = O_RDWR;
@@ -331,7 +331,7 @@ do_inquiry_prod_id(const char * dev_name, int block, int wait_ms,
unsigned char inqCmdBlk [INQ_CMD_LEN] =
{0x12, 0, 0, 0, INQ_REPLY_LEN, 0};
unsigned char inqBuff[INQ_REPLY_LEN];
- unsigned char sense_buffer[64] = {0};
+ unsigned char sense_buffer[64] SG_C_CPP_ZERO_INIT;
char ebuff[EBUFF_SZ];
int open_flags = O_RDWR; /* since O_EXCL | O_RDONLY gives EPERM */
diff --git a/testing/sg_tst_ioctl.c b/testing/sg_tst_ioctl.c
index 1d396eb0..ade56a1d 100644
--- a/testing/sg_tst_ioctl.c
+++ b/testing/sg_tst_ioctl.c
@@ -635,7 +635,7 @@ do_mrqs(int sg_fd, int sg_fd2, int mrqs)
struct sg_io_v4 * h4p;
struct sg_io_v4 * mrq_h4p;
struct sg_io_v4 mrq_h4;
- uint8_t sense_buffer[SENSE_BUFFER_LEN] = {0};
+ uint8_t sense_buffer[SENSE_BUFFER_LEN] SG_C_CPP_ZERO_INIT;
uint8_t inq_cdb[INQ_CMD_LEN] = /* Device Id VPD page */
{0x12, 0x1, 0x83, 0, INQ_REPLY_LEN, 0};
uint8_t sdiag_cdb[SDIAG_CMD_LEN] =
@@ -786,7 +786,7 @@ main(int argc, char * argv[])
sg_io_hdr_t rio_hdr;
char ebuff[EBUFF_SZ];
char dname[256];
- uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] = {0};
+ uint8_t sense_buffer[MAX_Q_LEN][SENSE_BUFFER_LEN] SG_C_CPP_ZERO_INIT;
const char * second_fname = NULL;
const char * cp;
char * chp;
diff --git a/testing/sg_tst_nvme.c b/testing/sg_tst_nvme.c
index d92d3b5d..4cc696aa 100644
--- a/testing/sg_tst_nvme.c
+++ b/testing/sg_tst_nvme.c
@@ -381,7 +381,7 @@ nvme_din_admin_cmd(struct sg_pt_base * ptvp, const uint8_t *cmdp,
int res, k;
uint16_t sct_sc = 0;
uint32_t result, clen;
- uint8_t sense_b[SENSE_BUFF_NVME_LEN] = {0};
+ uint8_t sense_b[SENSE_BUFF_NVME_LEN] SG_C_CPP_ZERO_INIT;
uint8_t ucmd[128];
char b[32];
@@ -514,7 +514,7 @@ sg_scsi_inquiry(struct sg_pt_base * ptvp, bool evpd, int pg_op, void * resp,
{
int res, ret, k, sense_cat, resid;
uint8_t inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
- uint8_t sense_b[SENSE_BUFF_LEN] = {0};
+ uint8_t sense_b[SENSE_BUFF_LEN] SG_C_CPP_ZERO_INIT;
uint8_t * up;
if (evpd)
diff --git a/testing/tst_sg_lib.c b/testing/tst_sg_lib.c
index b65bdef1..10cf3bbb 100644
--- a/testing/tst_sg_lib.c
+++ b/testing/tst_sg_lib.c
@@ -233,7 +233,7 @@ main(int argc, char * argv[])
int ret = 0;
sgj_opaque_p jop = NULL;
sgj_opaque_p jo2p;
- sgj_state json_st = {0};
+ sgj_state json_st SG_C_CPP_ZERO_INIT;
sgj_state * jsp = &json_st;
char b[2048];
char bb[256];