diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-02 22:02:05 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-02 22:02:05 +0000 |
commit | a59b767b38f08c0dafc011a58e8791aa06d4feb0 (patch) | |
tree | 8be0500cec5edb562779bc41f0ef7ad46b8c86fc /src/sg_write_long.c | |
parent | f65566c3934a9e22335dee20401cc1cc50865d56 (diff) | |
download | sg3_utils-a59b767b38f08c0dafc011a58e8791aa06d4feb0.tar.gz |
sg_lib: add sg_ll_inquiry_pt(), sg_ll_test_unit_ready_progress_pt(), sg_ll_request_sense_pt(), sg_ll_send_diag_pt(), sg_ll_receive_diag_pt(); sg_timestamp: add --elapsed, --hex and --no-timestamp options; sg_ses: check for NVMe enclosure bits
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@769 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_write_long.c')
-rw-r--r-- | src/sg_write_long.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sg_write_long.c b/src/sg_write_long.c index 8b01c1a7..b6f9e694 100644 --- a/src/sg_write_long.c +++ b/src/sg_write_long.c @@ -35,20 +35,21 @@ #include "sg_cmds_extra.h" #include "sg_pr2serr.h" -static const char * version_str = "1.16 20180219"; +static const char * version_str = "1.17 20180502"; -#define MAX_XFER_LEN 10000 +#define MAX_XFER_LEN (15 * 1024) /* #define SG_DEBUG */ #define ME "sg_write_long: " -#define EBUFF_SZ 256 +#define EBUFF_SZ 512 static struct option long_options[] = { {"16", no_argument, 0, 'S'}, {"cor_dis", no_argument, 0, 'c'}, + {"cor-dis", no_argument, 0, 'c'}, {"help", no_argument, 0, 'h'}, {"in", required_argument, 0, 'i'}, {"lba", required_argument, 0, 'l'}, @@ -56,7 +57,9 @@ static struct option long_options[] = { {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"wr_uncor", no_argument, 0, 'w'}, + {"wr-uncor", no_argument, 0, 'w'}, {"xfer_len", required_argument, 0, 'x'}, + {"xfer-len", required_argument, 0, 'x'}, {0, 0, 0, 0}, }; @@ -111,6 +114,7 @@ main(int argc, char * argv[]) const char * device_name = NULL; uint8_t * writeLongBuff = NULL; void * rawp = NULL; + uint8_t * free_rawp = NULL; const char * ten_or; char file_name[256]; char b[80]; @@ -209,9 +213,9 @@ main(int argc, char * argv[]) pr2serr(">>> warning: when '--wr_uncor' given '-in=' is " "ignored\n"); } else { - if (NULL == (rawp = malloc(MAX_XFER_LEN))) { + if (NULL == (rawp = sg_memalign(MAX_XFER_LEN, 0, &free_rawp, false))) { pr2serr(ME "out of memory\n"); - ret = SG_LIB_FILE_ERROR; + ret = sg_convert_errno(ENOMEM); goto err_out; } writeLongBuff = (uint8_t *)rawp; @@ -279,8 +283,8 @@ main(int argc, char * argv[]) } err_out: - if (rawp) - free(rawp); + if (free_rawp) + free(free_rawp); res = sg_cmds_close_device(sg_fd); if (res < 0) { pr2serr("close error: %s\n", safe_strerror(-res)); |