"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sg_sync.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_sync.c  (sg3_utils-1.47r908.tgz):sg_sync.c  (sg3_utils-1.47r915.tar.xz)
/* /*
* Copyright (c) 2004-2019 Douglas Gilbert. * Copyright (c) 2004-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 40 skipping to change at line 40
#include "sg_pr2serr.h" #include "sg_pr2serr.h"
/* A utility program for the Linux OS SCSI subsystem. /* A utility program for the Linux OS SCSI subsystem.
* *
* *
* This program issues the SCSI command SYNCHRONIZE CACHE(10 or 16) to the * This program issues the SCSI command SYNCHRONIZE CACHE(10 or 16) to the
* given device. This command is defined for SCSI "direct access" devices * given device. This command is defined for SCSI "direct access" devices
* (e.g. disks). * (e.g. disks).
*/ */
static const char * version_str = "1.25 20191220"; static const char * version_str = "1.26 20210830";
#define SYNCHRONIZE_CACHE16_CMD 0x91 #define SYNCHRONIZE_CACHE16_CMD 0x91
#define SYNCHRONIZE_CACHE16_CMDLEN 16 #define SYNCHRONIZE_CACHE16_CMDLEN 16
#define SENSE_BUFF_LEN 64 #define SENSE_BUFF_LEN 64
#define DEF_PT_TIMEOUT 60 /* 60 seconds */ #define DEF_PT_TIMEOUT 60 /* 60 seconds */
static struct option long_options[] = { static struct option long_options[] = {
{"16", no_argument, 0, 'S'}, {"16", no_argument, 0, 'S'},
{"count", required_argument, 0, 'c'}, {"count", required_argument, 0, 'c'},
{"group", required_argument, 0, 'g'}, {"group", required_argument, 0, 'g'},
skipping to change at line 131 skipping to change at line 131
ptvp = construct_scsi_pt_obj(); ptvp = construct_scsi_pt_obj();
if (NULL == ptvp) { if (NULL == ptvp) {
pr2serr("synchronize cache(16): out of memory\n"); pr2serr("synchronize cache(16): out of memory\n");
return -1; return -1;
} }
set_scsi_pt_cdb(ptvp, sc_cdb, sizeof(sc_cdb)); set_scsi_pt_cdb(ptvp, sc_cdb, sizeof(sc_cdb));
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
res = do_scsi_pt(ptvp, sg_fd, to_secs, verbose); res = do_scsi_pt(ptvp, sg_fd, to_secs, verbose);
ret = sg_cmds_process_resp(ptvp, "synchronize cache(16)", res, ret = sg_cmds_process_resp(ptvp, "synchronize cache(16)", res,
noisy, verbose, &sense_cat); noisy, 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;
default: default:
ret = sense_cat; ret = sense_cat;
break; break;
} }
} else } else
 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)