"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sg_sanitize.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_sanitize.c  (sg3_utils-1.47r908.tgz):sg_sanitize.c  (sg3_utils-1.47r915.tar.xz)
/* /*
* Copyright (c) 2011-2020 Douglas Gilbert. * Copyright (c) 2011-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.15 20201223"; static const char * version_str = "1.16 20210830";
/* Not all environments support the Unix sleep() */ /* Not all environments support the Unix sleep() */
#if defined(MSC_VER) || defined(__MINGW32__) #if defined(MSC_VER) || defined(__MINGW32__)
#define HAVE_MS_SLEEP #define HAVE_MS_SLEEP
#endif #endif
#ifdef HAVE_MS_SLEEP #ifdef HAVE_MS_SLEEP
#include <windows.h> #include <windows.h>
#define sleep_for(seconds) Sleep( (seconds) * 1000) #define sleep_for(seconds) Sleep( (seconds) * 1000)
#else #else
#define sleep_for(seconds) sleep(seconds) #define sleep_for(seconds) sleep(seconds)
skipping to change at line 245 skipping to change at line 245
if (NULL == ptvp) { if (NULL == ptvp) {
pr2serr("Sanitize: out of memory\n"); pr2serr("Sanitize: out of memory\n");
return -1; return -1;
} }
set_scsi_pt_cdb(ptvp, san_cdb, sizeof(san_cdb)); set_scsi_pt_cdb(ptvp, san_cdb, sizeof(san_cdb));
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 *)param_lstp, param_lst_len); set_scsi_pt_data_out(ptvp, (uint8_t *)param_lstp, param_lst_len);
res = do_scsi_pt(ptvp, sg_fd, timeout, op->verbose); res = do_scsi_pt(ptvp, sg_fd, timeout, op->verbose);
ret = sg_cmds_process_resp(ptvp, "Sanitize", res, true /*noisy */, ret = sg_cmds_process_resp(ptvp, "Sanitize", res, true /*noisy */,
op->verbose, &sense_cat); op->verbose, &sense_cat);
if (-1 == ret) if (-1 == ret) {
ret = sg_convert_errno(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)