"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sg_write_same.c" between
sg3_utils-1.47r908.tgz and sg3_utils-1.47r915.tar.xz

About: sg3_utils contains utilities that send SCSI commands to devices. Beta version.

sg_write_same.c  (sg3_utils-1.47r908.tgz):sg_write_same.c  (sg3_utils-1.47r915.tar.xz)
/* /*
* Copyright (c) 2009-2020 Douglas Gilbert. * Copyright (c) 2009-2021 Douglas Gilbert.
* All rights reserved. * All rights reserved.
* Use of this source code is governed by a BSD-style * Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file. * license that can be found in the BSD_LICENSE file.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
skipping to change at line 36 skipping to change at line 36
#include "config.h" #include "config.h"
#endif #endif
#include "sg_lib.h" #include "sg_lib.h"
#include "sg_pt.h" #include "sg_pt.h"
#include "sg_cmds_basic.h" #include "sg_cmds_basic.h"
#include "sg_cmds_extra.h" #include "sg_cmds_extra.h"
#include "sg_unaligned.h" #include "sg_unaligned.h"
#include "sg_pr2serr.h" #include "sg_pr2serr.h"
static const char * version_str = "1.32 20210630"; static const char * version_str = "1.33 20210830";
#define ME "sg_write_same: " #define ME "sg_write_same: "
#define WRITE_SAME10_OP 0x41 #define WRITE_SAME10_OP 0x41
#define WRITE_SAME16_OP 0x93 #define WRITE_SAME16_OP 0x93
#define VARIABLE_LEN_OP 0x7f #define VARIABLE_LEN_OP 0x7f
#define WRITE_SAME32_SA 0xd #define WRITE_SAME32_SA 0xd
#define WRITE_SAME32_ADD 0x18 #define WRITE_SAME32_ADD 0x18
#define WRITE_SAME10_LEN 10 #define WRITE_SAME10_LEN 10
#define WRITE_SAME16_LEN 16 #define WRITE_SAME16_LEN 16
skipping to change at line 277 skipping to change at line 277
if (NULL == ptvp) { if (NULL == ptvp) {
pr2serr("Write same(%d): out of memory\n", cdb_len); pr2serr("Write same(%d): out of memory\n", cdb_len);
return -1; return -1;
} }
set_scsi_pt_cdb(ptvp, ws_cdb, cdb_len); set_scsi_pt_cdb(ptvp, ws_cdb, cdb_len);
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
set_scsi_pt_data_out(ptvp, (uint8_t *)dataoutp, op->xfer_len); set_scsi_pt_data_out(ptvp, (uint8_t *)dataoutp, op->xfer_len);
res = do_scsi_pt(ptvp, sg_fd, op->timeout, op->verbose); res = do_scsi_pt(ptvp, sg_fd, op->timeout, op->verbose);
ret = sg_cmds_process_resp(ptvp, "Write same", res, true /*noisy */, ret = sg_cmds_process_resp(ptvp, "Write same", res, true /*noisy */,
op->verbose, &sense_cat); op->verbose, &sense_cat);
if (-1 == ret) if (-1 == ret) {
ret = get_scsi_pt_os_err(ptvp); if (get_scsi_pt_transport_err(ptvp))
else if (-2 == ret) { ret = SG_LIB_TRANSPORT_ERROR;
else
ret = sg_convert_errno(get_scsi_pt_os_err(ptvp));
} else if (-2 == ret) {
switch (sense_cat) { switch (sense_cat) {
case SG_LIB_CAT_RECOVERED: case SG_LIB_CAT_RECOVERED:
case SG_LIB_CAT_NO_SENSE: case SG_LIB_CAT_NO_SENSE:
ret = 0; ret = 0;
break; break;
case SG_LIB_CAT_MEDIUM_HARD: case SG_LIB_CAT_MEDIUM_HARD:
{ {
bool valid; bool valid;
int slen; int slen;
uint64_t ull = 0; uint64_t ull = 0;
 End of changes. 3 change blocks. 
5 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)