diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2022-11-04 04:22:18 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2022-11-04 04:22:18 +0000 |
commit | 44e90986b1aea4296ba69198130fd37a9ffca082 (patch) | |
tree | 15068ccf61fbd3490f3acd8b99bb7bb80c97bdf2 /src/sg_read_block_limits.c | |
parent | 6d3bd268768b83b2749c560517c18b88f222df63 (diff) | |
download | sg3_utils-44e90986b1aea4296ba69198130fd37a9ffca082.tar.gz |
remove archive directory (and its contents) [github.com/doug-gilbert/sg3_utils/pull/31]; more sg_logs JSON work
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@979 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_read_block_limits.c')
-rw-r--r-- | src/sg_read_block_limits.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/sg_read_block_limits.c b/src/sg_read_block_limits.c index 3ffa1dc2..4fc1fae6 100644 --- a/src/sg_read_block_limits.c +++ b/src/sg_read_block_limits.c @@ -37,7 +37,9 @@ static const char * version_str = "1.09 20221101"; -#define MAX_READ_BLOCK_LIMITS_LEN 20 +#define DEF_READ_BLOCK_LIMITS_LEN 6 +#define MLIO_READ_BLOCK_LIMITS_LEN 20 +#define MAX_READ_BLOCK_LIMITS_LEN MLIO_READ_BLOCK_LIMITS_LEN static uint8_t readBlkLmtBuff[MAX_READ_BLOCK_LIMITS_LEN]; @@ -191,7 +193,8 @@ main(int argc, char * argv[]) goto the_end2; } - max_resp_len = do_mloi ? 20 : 6; + max_resp_len = do_mloi ? MLIO_READ_BLOCK_LIMITS_LEN : + DEF_READ_BLOCK_LIMITS_LEN; memset(readBlkLmtBuff, 0x0, sizeof(readBlkLmtBuff)); res = sg_ll_read_block_limits_v2(sg_fd, do_mloi, readBlkLmtBuff, max_resp_len, &resid, true, verbose); @@ -213,9 +216,9 @@ main(int argc, char * argv[]) } if (do_mloi) { - if (actual_len < 20) { - pr2serr("Expected at least 20 bytes in response but only " - "%d bytes\n", actual_len); + if (actual_len < MLIO_READ_BLOCK_LIMITS_LEN) { + pr2serr("Expected at least %d bytes in response but only " + "%d bytes\n", MLIO_READ_BLOCK_LIMITS_LEN, actual_len); goto the_end; } printf("Read Block Limits (MLOI=1) results:\n"); @@ -223,9 +226,9 @@ main(int argc, char * argv[]) printf(" Maximum logical block identifier: %" PRIu64 "\n", mloi); } else { /* MLOI=0 (only case before ssc4r02.pdf) */ - if (actual_len < 6) { - pr2serr("Expected at least 6 bytes in response but only " - "%d bytes\n", actual_len); + if (actual_len < DEF_READ_BLOCK_LIMITS_LEN) { + pr2serr("Expected at least %d bytes in response but only " + "%d bytes\n", DEF_READ_BLOCK_LIMITS_LEN, actual_len); goto the_end; } max_block_size = sg_get_unaligned_be32(readBlkLmtBuff + 0); |