Skip to content

Commit

Permalink
sg_inq: update version descriptors to spc5r21; scripts/scsi-sg3_id: u…
Browse files Browse the repository at this point in the history
…pdate rules; testing folder work

git-svn-id: svn://localhost/trunk@814 6180dd3e-e324-4e3e-922d-17de1ae2f315
  • Loading branch information
doug-gilbert authored and hreinecke committed Sep 11, 2019
1 parent cd9c5a0 commit c4c6af0
Show file tree
Hide file tree
Showing 17 changed files with 3,776 additions and 120 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Expand Up @@ -2,12 +2,13 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.

Changelog for sg3_utils-1.45 [20190303] [svn: r813]
Changelog for sg3_utils-1.45 [20190325] [svn: r814]
- sg_ses: bug: --page= being overridden when --control
and --data= also given; fix
- sg_opcodes: expand MLU (spc5r20)
- sg_write_buffer: allow comma and period separated
lists when input from stdin
- sg_inq: update version descriptors to spc5r21
- sg_format: add --dcrt used twice (FOV=1 DCRT=0)
- sg_raw: fix --send bug when using stdin
- sg_vpd: 3pc VPD page add copy group descriptor
Expand All @@ -18,6 +19,7 @@ Changelog for sg3_utils-1.45 [20190303] [svn: r813]
- tweak sg_pt interface to better handle bidi
- sg_cmds_process_resp(): two arguments removed
- sg_pt_freebsd: fixes for FreeBSD 12.0 release
- scripts/scsi-sg3_id: update rules
- linux: add nanosecond durations when
SG3_UTILS_LINUX_NANO environment variable given
- rescan-scsi-bus: widen LUN 0 only scanning
Expand Down
4 changes: 2 additions & 2 deletions doc/sgp_dd.8
@@ -1,4 +1,4 @@
.TH SGP_DD "8" "February 2019" "sg3_utils\-1.45" SG3_UTILS
.TH SGP_DD "8" "March 2019" "sg3_utils\-1.45" SG3_UTILS
.SH NAME
sgp_dd \- copy data to and from files and devices, especially SCSI
devices
Expand Down Expand Up @@ -123,7 +123,7 @@ transfer. Only active when \fIOFILE\fR is a sg device file name.
.TP
\fBthr\fR=\fITHR\fR
where \fITHR\fR is the number or worker threads (default 4) that attempt to
copy in parallel. Minimum is 1 and maximum is 16.
copy in parallel. Minimum is 1 and maximum is 1024.
.TP
\fBtime\fR=0 | 1
when 1, the transfer is timed and throughput calculation is
Expand Down
8 changes: 4 additions & 4 deletions examples/sgq_dd.c
@@ -1,6 +1,6 @@
/*
* A utility program for the Linux OS SCSI generic ("sg") device driver.
* Copyright (C) 1999-2018 D. Gilbert and P. Allworth
* Copyright (C) 1999-2010 D. Gilbert and P. Allworth
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
Expand Down Expand Up @@ -53,7 +53,7 @@ typedef uint8_t u_char; /* horrible, for scsi.h */
#include "sg_unaligned.h"


static char * version_str = "0.62 20181207";
static char * version_str = "0.63 20190324";
/* resurrected from "0.55 20020509" */

#define DEF_BLOCK_SIZE 512
Expand All @@ -67,7 +67,7 @@ static char * version_str = "0.62 20181207";
#define SGP_READ10 0x28
#define SGP_WRITE10 0x2a
#define DEF_NUM_THREADS 4 /* actually degree of concurrency */
#define MAX_NUM_THREADS 32
#define MAX_NUM_THREADS 1024

#ifndef RAW_MAJOR
#define RAW_MAJOR 255 /*unlikey value */
Expand Down Expand Up @@ -244,7 +244,7 @@ usage()
" usually either 'if' or 'of' is a sg or raw device\n"
" 'bpt' is blocks_per_transfer (default is 128)\n"
" 'dio' is direct IO, 1->attempt, 0->indirect IO (def)\n"
" 'thr' is number of queues, must be > 0, default 4, max 32\n");
" 'thr' is number of queues, must be > 0, default 4, max 1024\n");
fprintf(stderr, " 'coe' continue on sg error, 0->exit (def), "
"1->zero + continue\n"
" 'time' 0->no timing(def), 1->time plus calculate throughput\n"
Expand Down
56 changes: 56 additions & 0 deletions scripts/54-before-scsi-sg3_id.rules
@@ -0,0 +1,56 @@
PROPS-END
# do not edit this file, it will be overwritten on update

# persistent storage links: /dev/disk/{by-id,by-path}
# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>

# This file contains rules for setting udev environment variables based on
# hardware properties (serial numbers etc), which can be obtained without
# actually reading from the device.
#
# Hopefully this will be integrated into systemd/udev soon (as 54-storage-hardware.rules).
# Until then, we ship it here in sg3-utils.
# It's important that rules dealing with low-level hardware attributes run
# before the generic SCSI rules in 55-scsi-sg3_utils.rules.

ACTION=="remove", GOTO="storage_hardware_end"
SUBSYSTEM!="block", GOTO="block_storage_end"
KERNEL!="sd*|sr*|cciss*", GOTO="block_storage_end"

# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="block_storage_end"

# for partitions import parent information
ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}!="?*", IMPORT{parent}="ID_*"

# ATA
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"

# ATAPI devices (SPC-3 or later)
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode"

# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures)
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode"

# Fall back usb_id for USB devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"

# FireWire
ENV{ID_IEEE1394}!="?*", KERNEL=="sd*|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_IEEE1394}="$attr{ieee1394_id}"

# by-path
ENV{ID_PATH}!="?*", ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"

LABEL="block_storage_end"

# SCSI tape devices
SUBSYSTEM!="scsi_tape", GOTO="storage_hardware_end"
KERNEL!="st*[0-9]|nst*[0-9]", GOTO="storage_hardware_end"

ENV{ID_SERIAL}!="?*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", ATTRS{serial}=="?*", IMPORT{builtin}="usb_id"

# by-path
ENV{ID_PATH}!="?*", IMPORT{builtin}="path_id"

LABEL="storage_hardware_end"
104 changes: 82 additions & 22 deletions scripts/55-scsi-sg3_id.rules
Expand Up @@ -2,10 +2,35 @@

ACTION=="remove", GOTO="sg3_utils_id_end"

SUBSYSTEM!="block", GOTO="sg3_utils_id_end"
SUBSYSTEM=="block", GOTO="block_dev"

# SCSI devices other than "block"
# This code used to live in 60-persistent-storage-tape.rules.

# type 8 devices are "Medium Changers"
SUBSYSTEM=="scsi_generic", KERNEL=="sg*[0-9]", ATTRS{type}=="8", \
GOTO="scsi_inquiry"
SUBSYSTEM=="scsi_changer", KERNEL=="sch*[0-9]", ATTRS{type}=="8", \
ENV{.INQUIRY_DEV}="$root/bsg/$id", GOTO="scsi_inquiry"

# tapes need to be accessed through their bsg device
KERNEL=="st*[0-9]|nst*[0-9]", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \
ENV{.INQUIRY_DEV}="$root/bsg/$id", GOTO="scsi_inquiry"

GOTO="sg3_utils_id_end"

LABEL="block_dev"

# Import values for partitions
ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_*", ENV{ID_SCSI}="1"
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_SCSI", IMPORT{parent}="SCSI_*"
ENV{DEVTYPE}=="partition", ENV{ID_SCSI}=="1", GOTO="compat"

# Handle non-SCSI devices that implement SCSI inquiry
KERNEL=="cciss*", ENV{DEVTYPE}=="disk", GOTO="sg_inquiry"

# Ignore everything else except sd/sr
KERNEL!="sd*[!0-9]|sr*", GOTO="sg3_utils_id_end"

# SCSI INQUIRY values
# If the 'inquiry' sysfs attribute is present the kernel will already
# have scanned for VPD pages, so if the vpd page attribute is not
Expand All @@ -14,42 +39,77 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_*", ENV{ID_SCSI}="1"
# Set 'ID_SCSI_INQUIRY=0' in an earlier udev rule if the kernel
# fails to scan VPD pages correctly; the rules will then fall
# back to calling sg_vpd directly.
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI_INQUIRY}!="?*", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/inquiry --raw", ENV{ID_SCSI}="1", ENV{ID_SCSI_INQUIRY}="1"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}!="1", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
LABEL="scsi_inquiry"
ENV{ID_SCSI_INQUIRY}=="0", GOTO="sg_inquiry"

# As of 2018/4.15, the kernel doesn't provide VPD pages for "SPC" devices
# (SCSI version 0x03, ANSI INCITS 301-1997) in sysfs.
# It's usually safe to try though (no counter-example is known),
# and for scsi_id compatibility, we have to try.
SUBSYSTEMS=="scsi", ATTRS{scsi_level}=="4", GOTO="sg_inquiry"

# "inquiry" is an attribute of the scsi_device in sysfs,
# we obtain it by using $id after an ATTRS match.
SUBSYSTEMS=="scsi", ATTRS{inquiry}=="*", KERNELS=="[0-9]*:*[0-9]", \
ENV{.SYSFS_PATH}="$sys/class/scsi_device/$id/device"
ENV{.SYSFS_PATH}=="", GOTO="sg_inquiry"

IMPORT{program}="/usr/bin/sg_inq --export --inhex=$env{.SYSFS_PATH}/inquiry --raw", \
ENV{ID_SCSI}="1", ENV{ID_SCSI_INQUIRY}="1"
# If inquiry sysfs attribute reading it failed, fallback to sg
ENV{ID_SCSI}!="1", GOTO="sg_inquiry"
# Read VPD pages 80 (sn) and 83 (di)
IMPORT{program}="/usr/bin/sg_inq --export --inhex=$env{.SYSFS_PATH}/vpd_pg80 --raw"
IMPORT{program}="/usr/bin/sg_inq --export --inhex=$env{.SYSFS_PATH}/vpd_pg83 --raw"
GOTO="compat"

LABEL="sg_inquiry"
# Handle devices that have no inquiry attributes in sysfs
ENV{.INQUIRY_DEV}=="", ENV{.INQUIRY_DEV}="$tempnode"

IMPORT{program}="/usr/bin/sg_inq --export $env{.INQUIRY_DEV}", ENV{ID_SCSI}="1"
# Give up if this fails, too
ENV{ID_SCSI}!="1", GOTO="sg3_utils_id_end"
IMPORT{program}="/usr/bin/sg_inq --export --page=sn $env{.INQUIRY_DEV}"
IMPORT{program}="/usr/bin/sg_inq --export --page=di $env{.INQUIRY_DEV}"

LABEL="compat"

# scsi_id compat mappings
ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
ENV{SCSI_VENDOR_ENC}=="?*", ENV{ID_VENDOR_ENC}="$env{SCSI_VENDOR_ENC}"
ENV{SCSI_MODEL}=="?*", ENV{ID_MODEL}="$env{SCSI_MODEL}"
ENV{SCSI_MODEL_ENC}=="?*", ENV{ID_MODEL_ENC}="$env{SCSI_MODEL_ENC}"
ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
# SCSI EVPD page 0x80 values
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg80 --raw"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
# SCSI EVPD page 0x83 values
KERNEL=="sd*[!0-9]", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg83 --raw"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
ENV{ID_VENDOR}!="?*", ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
ENV{ID_VENDOR_ENC}!="?*", ENV{SCSI_VENDOR_ENC}=="?*", ENV{ID_VENDOR_ENC}="$env{SCSI_VENDOR_ENC}"
ENV{ID_MODEL}!="?*", ENV{SCSI_MODEL}=="?*", ENV{ID_MODEL}="$env{SCSI_MODEL}"
ENV{ID_MODEL_ENC}!="?*", ENV{SCSI_MODEL_ENC}=="?*", ENV{ID_MODEL_ENC}="$env{SCSI_MODEL_ENC}"
ENV{ID_REVISION}!="?*", ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
ENV{ID_TYPE}!="?*", ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
ENV{ID_TARGET_PORT}!="?*", ENV{SCSI_IDENT_PORT_TARGET_PORT_GROUP}=="?*", \
PROGRAM="/bin/sh -c 'echo $env{SCSI_IDENT_PORT_TARGET_PORT_GROUP} | /bin/sed s/^0x//'", \
ENV{ID_TARGET_PORT}="$result"

# ID_WWN compat mapping
ENV{SCSI_IDENT_LUN_NAA_REGEXT}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_REGEXT}"
ENV{SCSI_IDENT_LUN_NAA_REG}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_REG}"
ENV{SCSI_IDENT_LUN_NAA_EXT}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_EXT}"
ENV{SCSI_IDENT_LUN_NAA_LOCAL}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_LOCAL}"
ENV{SCSI_IDENT_LUN_NAA_REGEXT}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA_REGEXT}"
ENV{SCSI_IDENT_LUN_NAA_REG}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA_REG}"
ENV{SCSI_IDENT_LUN_NAA_EXT}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA_EXT}"
ENV{ID_WWN}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="$env{ID_WWN}"
ENV{SCSI_IDENT_LUN_NAA_LOCAL}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA_LOCAL}"
# ID_WWN has max 16 characters
ENV{ID_WWN_WITH_EXTENSION}=="?*", ENV{ID_WWN}!="?*", \
PROGRAM="/bin/sh -c 'echo $env{ID_WWN_WITH_EXTENSION} | /bin/sed s/^\\\(0x.\\\{1,16\\\}\\\).*/\\1/'", \
ENV{ID_WWN}="$result"

# ata_id compability
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_ATA}=="?*", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_IDENT_LUN_ATA}"
ENV{ID_SERIAL_SHORT}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
# Compat ID_SERIAL setting
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_REGEXT}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA_REGEXT}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_REGEXT}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_REG}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA_REG}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_REG}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_EXT}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_EXT}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_EXT}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA_EXT}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_EXT}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="8$env{SCSI_IDENT_LUN_NAME}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAME}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="1$env{SCSI_IDENT_LUN_T10}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_T10}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_LOCAL}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA_LOCAL}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_LOCAL}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_SERIAL}"

# Compat ID_SCSI_SERIAL setting
ENV{ID_SCSI_SERIAL}!="?*", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{ID_SCSI_SERIAL}="$env{SCSI_IDENT_SERIAL}"
LABEL="sg3_utils_id_end"
2 changes: 1 addition & 1 deletion src/sg_inq.c
Expand Up @@ -51,7 +51,7 @@
#include "sg_pt_nvme.h"
#endif

static const char * version_str = "1.99 20190109"; /* SPC-5 rev 20 */
static const char * version_str = "2.00 20190313"; /* SPC-5 rev 21 */

/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
Expand Down
7 changes: 5 additions & 2 deletions src/sg_inq_data.c
Expand Up @@ -47,7 +47,7 @@ const char * sg_ansi_version_arr[16] =

/* table from SPC-5 revision 16 [sorted numerically (from Annex E.9)] */
/* Can also be obtained from : http://www.t10.org/lists/stds.txt 20170114 */
/* Corrected against spc5r18 on 20180201 */
/* Corrected against spc5r21 on 20190312 */

#ifdef SG_SCSI_STRINGS

Expand Down Expand Up @@ -487,7 +487,8 @@ struct sg_lib_simple_value_name_t sg_version_descriptor_arr[] = {
{0x1749, "UAS ISO/IEC 14776-251:2014"},
{0x1761, "ACS-2 (no version claimed)"},
{0x1762, "ACS-2 ANSI INCITS 482-2013"},
{0x1765, "ACS-3 (no version claimed)"},
{0x1765, "ACS-3 INCITS 522-2014"},
{0x1767, "ACS-4 INCITS 529-2018"},
{0x1780, "UAS-2 (no version claimed)"},
{0x1ea0, "SAT (no version claimed)"},
{0x1ea7, "SAT T10/1711-D rev 8"},
Expand Down Expand Up @@ -538,6 +539,8 @@ struct sg_lib_simple_value_name_t sg_version_descriptor_arr[] = {
{0xffc0, "IEEE 1667 (no version claimed)"},
{0xffc1, "IEEE 1667-2006"},
{0xffc2, "IEEE 1667-2009"},
{0xffc3, "IEEE 1667-2015"},
{0xffc4, "IEEE 1667-2018"},
{0xffff, NULL}, /* sentinel, leave at end */
};

Expand Down
11 changes: 6 additions & 5 deletions src/sgp_dd.c
@@ -1,7 +1,7 @@
/* A utility program for copying files. Specialised for "files" that
* represent devices that understand the SCSI command set.
*
* Copyright (C) 1999 - 2018 D. Gilbert and P. Allworth
* Copyright (C) 1999 - 2019 D. Gilbert and P. Allworth
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
Expand Down Expand Up @@ -68,7 +68,7 @@
#include "sg_pr2serr.h"


static const char * version_str = "5.71 20181227";
static const char * version_str = "5.72 20190324";

#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
Expand All @@ -86,7 +86,7 @@ static const char * version_str = "5.71 20181227";
#define SGP_READ10 0x28
#define SGP_WRITE10 0x2a
#define DEF_NUM_THREADS 4
#define MAX_NUM_THREADS SG_MAX_QUEUE
#define MAX_NUM_THREADS 1024 /* was SG_MAX_QUEUE (16) but no longer applies */

#ifndef RAW_MAJOR
#define RAW_MAJOR 255 /*unlikely value */
Expand Down Expand Up @@ -187,6 +187,8 @@ static int sg_finish_io(bool wr, Rq_elem * rep, pthread_mutex_t * a_mutp);

static pthread_mutex_t strerr_mut = PTHREAD_MUTEX_INITIALIZER;

static pthread_t threads[MAX_NUM_THREADS];

static bool shutting_down = false;
static bool do_sync = false;
static bool do_time = false;
Expand Down Expand Up @@ -383,7 +385,7 @@ usage()
" sync 0->no sync(def), 1->SYNCHRONIZE CACHE on OFILE "
"after copy\n"
" thr is number of threads, must be > 0, default 4, "
"max 16\n"
"max 1024\n"
" time 0->no timing(def), 1->time plus calculate "
"throughput\n"
" verbose same as 'deb=VERB': increase verbosity\n"
Expand Down Expand Up @@ -1177,7 +1179,6 @@ main(int argc, char * argv[])
int res, k, err, keylen;
int64_t in_num_sect = 0;
int64_t out_num_sect = 0;
pthread_t threads[MAX_NUM_THREADS];
int in_sect_sz, out_sect_sz, status, n, flags;
void * vp;
Rq_coll * clp = &rcoll;
Expand Down
2 changes: 1 addition & 1 deletion testing/Makefile
Expand Up @@ -5,7 +5,7 @@ INSTDIR=$(DESTDIR)/$(PREFIX)/bin
MANDIR=$(DESTDIR)/$(PREFIX)/man

EXECS = sg_iovec_tst sg_sense_test sg_queue_tst bsg_queue_tst sg_chk_asc \
sg_tst_nvme sg_tst_ioctl sg_tst_bidi tst_sg_lib sgh_dd sgs_dd
sg_tst_nvme sg_tst_ioctl sg_tst_bidi tst_sg_lib sgs_dd

EXTRAS =

Expand Down
12 changes: 9 additions & 3 deletions testing/Makefile.cplus
Expand Up @@ -9,7 +9,8 @@ LD = g++
## CC = clang++
## LD = clang++

EXECS = sg_tst_excl sg_tst_excl2 sg_tst_excl3 sg_tst_context sg_tst_async
EXECS = sg_tst_excl sg_tst_excl2 sg_tst_excl3 sg_tst_context sg_tst_async \
sgh_dd

EXTRAS =

Expand All @@ -30,8 +31,10 @@ CPPFLAGS = -std=c++11 -pthread -g -O2 -W -Wall -iquote ../include -D_REENTRANT $
LDFLAGS = -std=c++11 -pthread

LIBFILESOLD = ../lib/sg_lib.o ../lib/sg_lib_data.o ../lib/sg_io_linux.o
LIBFILESNEW = ../lib/sg_lib.o ../lib/sg_lib_data.o ../lib/sg_pt_linux.o ../lib/sg_pt_common.o \
../lib/sg_pt_linux_nvme.o ../lib/sg_io_linux.o ../lib/sg_cmds_basic.o
LIBFILESNEW = ../lib/sg_pt_linux_nvme.o ../lib/sg_lib.o ../lib/sg_lib_data.o \
../lib/sg_pt_linux.o ../lib/sg_io_linux.o \
../lib/sg_pt_common.o ../lib/sg_cmds_basic.o \
../lib/sg_cmds_basic2.o

all: $(EXECS)

Expand Down Expand Up @@ -60,6 +63,9 @@ sg_tst_context: sg_tst_context.o $(LIBFILESNEW)
sg_tst_async: sg_tst_async.o $(LIBFILESNEW)
$(LD) -o $@ $(LDFLAGS) $^

sgh_dd: sgh_dd.o $(LIBFILESNEW)
$(LD) -o $@ $(LDFLAGS) -pthread $^

install: $(EXECS)
install -d $(INSTDIR)
for name in $^; \
Expand Down

0 comments on commit c4c6af0

Please sign in to comment.