aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-05-02 01:09:24 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-05-02 01:09:24 +0000
commit0791cf6b3cd25a054d12c42425cbb8ffee7e598a (patch)
treee50a551f783363a35d07893dd9db836d60080e0b /include
parent28400776770cf5453f196690fcd24e353c5826e0 (diff)
downloadsg3_utils-0791cf6b3cd25a054d12c42425cbb8ffee7e598a.tar.gz
major rework of lib/sg_pt_freebsd.c; sg_raw: fix prints of NVMe NVM command names
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@896 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'include')
-rw-r--r--include/sg_lib.h6
-rw-r--r--include/sg_pt.h8
2 files changed, 10 insertions, 4 deletions
diff --git a/include/sg_lib.h b/include/sg_lib.h
index 006c566c..ae228bcc 100644
--- a/include/sg_lib.h
+++ b/include/sg_lib.h
@@ -67,7 +67,7 @@ extern "C" {
/* The SCSI status codes as found in SAM-4 at www.t10.org */
#define SAM_STAT_GOOD 0x0
#define SAM_STAT_CHECK_CONDITION 0x2
-#define SAM_STAT_CONDITION_MET 0x4
+#define SAM_STAT_CONDITION_MET 0x4 /* this is not an error */
#define SAM_STAT_BUSY 0x8
#define SAM_STAT_INTERMEDIATE 0x10 /* obsolete in SAM-4 */
#define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14 /* obsolete in SAM-4 */
@@ -189,6 +189,10 @@ struct sg_scsi_sense_hdr {
uint8_t additional_length; /* zero for fixed format sense data */
};
+/* Returns true when status is SAM_STAT_GOOD or SAM_STAT_CONDITION_MET,
+ * returns false otherwise. Ignores bit 0. */
+bool sg_scsi_status_is_good(int sstatus);
+
/* Maps the salient data from a sense buffer which is in either fixed or
* descriptor format into a structure mimicking a descriptor format
* header (i.e. the first 8 bytes of sense descriptor format).
diff --git a/include/sg_pt.h b/include/sg_pt.h
index ab077f31..ba92cb02 100644
--- a/include/sg_pt.h
+++ b/include/sg_pt.h
@@ -2,7 +2,7 @@
#define SG_PT_H
/*
- * Copyright (c) 2005-2020 Douglas Gilbert.
+ * Copyright (c) 2005-2021 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -21,7 +21,7 @@ extern "C" {
* structure "derived" (using a C++ term) from this one. It compiles
* because 'struct sg_pt_base' is only referenced (by pointer: 'objp')
* in this interface. An instance of this structure represents the
- * context of one SCSI command.
+ * context of one SCSI (or NVME) command.
* If an instance of sg_pt_base is shared across several threads then
* it is up to the application to take care of multi-threaded issues
* with that instance. */
@@ -57,7 +57,9 @@ int scsi_pt_close_device(int device_fd);
* device_name. Returns 1 if SCSI generic pass-though device, returns 2 if
* secondary SCSI pass-through device (in Linux a bsg device); returns 3 is
* char NVMe device (i.e. no NSID); returns 4 if block NVMe device (includes
- * NSID), or 0 if something else (e.g. ATA block device) or dev_fd < 0.
+ * NSID), 5 is also a NVMe device (FreeBSD CAM NVMe (e.g. /dev/nda0)) or 0
+ * if something else (e.g. ATA block device) or dev_fd < 0.
+ * The return value differs somewhat by OS.
* If error, returns negated errno (operating system) value. */
int check_pt_file_handle(int dev_fd, const char * device_name, int verbose);