From 2433a22138f1b508c2765aa8499456cd6138a200 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Fri, 11 Jan 2019 06:11:25 +0000 Subject: spc5r20 updates; fixes for FreeBSD 12.0 release git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@804 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- include/freebsd_nvme_ioctl.h | 11 +++++++++-- include/sg_lib.h | 14 +++++++++++++- include/sg_linux_inc.h | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/freebsd_nvme_ioctl.h b/include/freebsd_nvme_ioctl.h index a7c970b9..0b79d851 100644 --- a/include/freebsd_nvme_ioctl.h +++ b/include/freebsd_nvme_ioctl.h @@ -39,6 +39,11 @@ extern "C" { #define NVME_PASSTHROUGH_CMD _IOWR('n', 0, struct nvme_pt_command) #if __FreeBSD_version < 1100110 + +#define NVME_STATUS_GET_SC(st) (st.sc) +#define NVME_STATUS_GET_SCT(st) (st.sct) + + struct nvme_command { /* dword 0 */ @@ -151,12 +156,14 @@ struct nvme_pt_command { */ struct mtx * driver_lock; }; -#else +#else /* not __FreeBSD_version < 1100110 */ #include -#endif +#endif /* __FreeBSD_version < 1100110 */ +#ifndef nvme_completion_is_error #define nvme_completion_is_error(cpl) \ ((cpl)->status.sc != 0 || (cpl)->status.sct != 0) +#endif #define NVME_CTRLR_PREFIX "/dev/nvme" #define NVME_NS_PREFIX "ns" diff --git a/include/sg_lib.h b/include/sg_lib.h index a5f8a3d5..9688991d 100644 --- a/include/sg_lib.h +++ b/include/sg_lib.h @@ -2,7 +2,7 @@ #define SG_LIB_H /* - * Copyright (c) 2004-2018 Douglas Gilbert. + * Copyright (c) 2004-2019 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. @@ -271,6 +271,18 @@ int sg_get_designation_descriptor_str(const char * leadin, bool print_assoc, bool do_long, int blen, char * b); +/* Expects a T10 UUID designator (as found in the Device Identification VPD + * page) pointed to by 'dp'. To not produce an error string in 'b', c_set + * should be 1 (binary) and dlen should be 18. Currently T10 only supports + * locally assigned UUIDs. Writes output to string 'b' of no more than blen + * bytes and returns the number of bytes actually written to 'b' but doesn't + * count the trailing null character it always appends (if blen > 0). 'lip' + * is lead-in string (on each line) than may be NULL. skip_prefix avoids + * outputing ' Locally assigned UUID: ' before the UUID. */ +int sg_t10_uuid_desig2str(const uint8_t * dp, int dlen, int c_set, + bool do_long, bool skip_prefix, + const char * lip, int blen, char * b); + /* Yield string associated with peripheral device type (pdt). Returns * 'buff'. If 'pdt' out of range yields "bad pdt" string. */ char * sg_get_pdt_str(int pdt, int buff_len, char * buff); diff --git a/include/sg_linux_inc.h b/include/sg_linux_inc.h index 1f760185..e6f6b523 100644 --- a/include/sg_linux_inc.h +++ b/include/sg_linux_inc.h @@ -12,6 +12,7 @@ #include #include #else + #define __user #include #include #endif -- cgit v1.2.3