diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2018-12-13 18:50:10 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2018-12-13 18:50:10 +0000 |
commit | d906e8cb000e95d9260d1833d3692c1c763e489a (patch) | |
tree | 8c1c3a3fc6aebf2751670d64f8389ca0ca8aa4b3 /include | |
parent | 4445eeca7f024eb55a9d5eb5ee6a7183816f0c2e (diff) | |
download | sg3_utils-d906e8cb000e95d9260d1833d3692c1c763e489a.tar.gz |
sg_format: add --dcrt used twice (FOV=1 DCRT=0); sg_pt_linux: uses sg v4 interface if sg driver >= 4.0.0
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@798 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'include')
-rw-r--r-- | include/sg_io_linux.h | 10 | ||||
-rw-r--r-- | include/sg_pt_linux.h | 26 |
2 files changed, 32 insertions, 4 deletions
diff --git a/include/sg_io_linux.h b/include/sg_io_linux.h index afbd3657..4766e2ae 100644 --- a/include/sg_io_linux.h +++ b/include/sg_io_linux.h @@ -11,7 +11,7 @@ */ /* - * Version 1.06 [20180119] + * Version 1.07 [20181211] */ /* @@ -160,6 +160,14 @@ struct sg_io_hdr; int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp, bool raw_sinfo); +/* Returns 1 if no errors found and thus nothing printed; otherwise + * prints error/warning (prefix by 'leadin') to stderr (pr2ws) and + * returns 0. */ +int sg_linux_sense_print(const char * leadin, int scsi_status, + int host_status, int driver_status, + const uint8_t * sense_buffer, int sb_len, + bool raw_sinfo); + /* Calls sg_scsi_normalize_sense() after obtaining the sense buffer and its length from the struct sg_io_hdr pointer. If these cannot be obtained, false is returned. */ diff --git a/include/sg_pt_linux.h b/include/sg_pt_linux.h index bf1a1691..eb451e8d 100644 --- a/include/sg_pt_linux.h +++ b/include/sg_pt_linux.h @@ -42,6 +42,25 @@ extern "C" { #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ #define BSG_FLAG_Q_AT_HEAD 0x20 +#ifndef SGV4_FLAG_YIELD_TAG +#define SGV4_FLAG_YIELD_TAG 0x8 +#endif +#ifndef SGV4_FLAG_FIND_BY_TAG +#define SGV4_FLAG_FIND_BY_TAG 0x100 +#endif +#ifndef SGV4_FLAG_IMMED +#define SGV4_FLAG_IMMED 0x400 +#endif +#ifndef SGV4_FLAG_IMMED +#define SGV4_FLAG_IMMED 0x400 +#endif +#ifndef SGV4_FLAG_DEV_SCOPE +#define SGV4_FLAG_DEV_SCOPE 0x1000 +#endif +#ifndef SGV4_FLAG_SHARE +#define SGV4_FLAG_SHARE 0x2000 +#endif + struct sg_io_v4 { __s32 guard; /* [i] 'Q' to differentiate from v3 */ __u32 protocol; /* [i] 0 -> SCSI , .... */ @@ -50,10 +69,10 @@ struct sg_io_v4 { __u32 request_len; /* [i] in bytes */ __u64 request; /* [i], [*i] {SCSI: cdb} */ - __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ + __u64 request_tag; /* [i] {in sg 4.0+ this is out parameter} */ __u32 request_attr; /* [i] {SCSI: task attribute} */ __u32 request_priority; /* [i] {SCSI: task priority} */ - __u32 request_extra; /* [i] {spare, for padding} */ + __u32 request_extra; /* [i] {used for pack_id} */ __u32 max_response_len; /* [i] in bytes */ __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ @@ -106,6 +125,7 @@ struct sg_pt_linux_scsi { int dev_fd; /* -1 if not given (yet) */ int in_err; int os_err; + int sg_version; /* for deciding whether to use v3 or v4 interface */ uint32_t nvme_nsid; /* 1 to 0xfffffffe are possibly valid, 0 * implies dev_fd is not a NVMe device * (is_nvme=false) or it is a NVMe char @@ -159,6 +179,7 @@ extern long sg_lin_page_size; void sg_find_bsg_nvme_char_major(int verbose); int sg_do_nvme_pt(struct sg_pt_base * vp, int fd, int time_secs, int vb); +int sg_linux_get_sg_version(const struct sg_pt_base * vp); /* This trims given NVMe block device name in Linux (e.g. /dev/nvme0n1p5) * to the name of its associated char device (e.g. /dev/nvme0). If this @@ -167,7 +188,6 @@ int sg_do_nvme_pt(struct sg_pt_base * vp, int fd, int time_secs, int vb); bool sg_get_nvme_char_devname(const char * nvme_block_devname, uint32_t b_len, char * b); - #ifdef __cplusplus } #endif |