aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-06-11 03:57:05 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-06-11 03:57:05 +0000
commitbee57c535c29a01cadfaa660d8c0182288960c33 (patch)
tree2a9355f53953526dc12f101d6bf6b26962f5dbbe /lib
parent30363466e3580cae5f428c9bf35caa934cef469b (diff)
downloadsg3_utils-bee57c535c29a01cadfaa660d8c0182288960c33.tar.gz
sg_read_buffer: fix --length= problem; pt: new configure option --enable-pt_dummy builds the library with sg_pt_dummy.c instead of OS specific code
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@904 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am16
-rw-r--r--lib/Makefile.in66
-rw-r--r--lib/sg_pt_dummy.c362
-rw-r--r--lib/sg_pt_osf1.c26
-rw-r--r--lib/sg_pt_solaris.c19
-rw-r--r--lib/sg_pt_win32.c4
6 files changed, 466 insertions, 27 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9f39d4a5..f04c7778 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -8,11 +8,15 @@ libsgutils2_la_SOURCES = \
sg_pt_common.c
if OS_LINUX
+if PT_DUMMY
+libsgutils2_la_SOURCES += sg_pt_dummy.c
+else
libsgutils2_la_SOURCES += \
sg_pt_linux.c \
sg_io_linux.c \
sg_pt_linux_nvme.c
endif
+endif
if OS_WIN32_MINGW
libsgutils2_la_SOURCES += sg_pt_win32.c
@@ -23,8 +27,12 @@ libsgutils2_la_SOURCES += sg_pt_win32.c
endif
if OS_FREEBSD
+if PT_DUMMY
+libsgutils2_la_SOURCES += sg_pt_dummy.c
+else
libsgutils2_la_SOURCES += sg_pt_freebsd.c
endif
+endif
if OS_SOLARIS
libsgutils2_la_SOURCES += sg_pt_solaris.c
@@ -34,6 +42,14 @@ if OS_OSF
libsgutils2_la_SOURCES += sg_pt_osf1.c
endif
+if OS_NETBSD
+libsgutils2_la_SOURCES += sg_pt_dummy.c
+endif
+
+if OS_OPENBSD
+libsgutils2_la_SOURCES += sg_pt_dummy.c
+endif
+
if DEBUG
# This is active if --enable-debug given to ./configure
# removed -Wduplicated-branches because needs gcc-8
diff --git a/lib/Makefile.in b/lib/Makefile.in
index c20d06f4..4e12ff91 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -88,16 +88,20 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@OS_LINUX_TRUE@am__append_1 = \
-@OS_LINUX_TRUE@ sg_pt_linux.c \
-@OS_LINUX_TRUE@ sg_io_linux.c \
-@OS_LINUX_TRUE@ sg_pt_linux_nvme.c
-
-@OS_WIN32_MINGW_TRUE@am__append_2 = sg_pt_win32.c
-@OS_WIN32_CYGWIN_TRUE@am__append_3 = sg_pt_win32.c
-@OS_FREEBSD_TRUE@am__append_4 = sg_pt_freebsd.c
-@OS_SOLARIS_TRUE@am__append_5 = sg_pt_solaris.c
-@OS_OSF_TRUE@am__append_6 = sg_pt_osf1.c
+@OS_LINUX_TRUE@@PT_DUMMY_TRUE@am__append_1 = sg_pt_dummy.c
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@am__append_2 = \
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@ sg_pt_linux.c \
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@ sg_io_linux.c \
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@ sg_pt_linux_nvme.c
+
+@OS_WIN32_MINGW_TRUE@am__append_3 = sg_pt_win32.c
+@OS_WIN32_CYGWIN_TRUE@am__append_4 = sg_pt_win32.c
+@OS_FREEBSD_TRUE@@PT_DUMMY_TRUE@am__append_5 = sg_pt_dummy.c
+@OS_FREEBSD_TRUE@@PT_DUMMY_FALSE@am__append_6 = sg_pt_freebsd.c
+@OS_SOLARIS_TRUE@am__append_7 = sg_pt_solaris.c
+@OS_OSF_TRUE@am__append_8 = sg_pt_osf1.c
+@OS_NETBSD_TRUE@am__append_9 = sg_pt_dummy.c
+@OS_OPENBSD_TRUE@am__append_10 = sg_pt_dummy.c
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -139,20 +143,27 @@ am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__libsgutils2_la_SOURCES_DIST = sg_lib.c sg_lib_data.c \
sg_cmds_basic.c sg_cmds_basic2.c sg_cmds_extra.c sg_cmds_mmc.c \
- sg_pt_common.c sg_pt_linux.c sg_io_linux.c sg_pt_linux_nvme.c \
- sg_pt_win32.c sg_pt_freebsd.c sg_pt_solaris.c sg_pt_osf1.c
-@OS_LINUX_TRUE@am__objects_1 = sg_pt_linux.lo sg_io_linux.lo \
-@OS_LINUX_TRUE@ sg_pt_linux_nvme.lo
-@OS_WIN32_MINGW_TRUE@am__objects_2 = sg_pt_win32.lo
-@OS_WIN32_CYGWIN_TRUE@am__objects_3 = sg_pt_win32.lo
-@OS_FREEBSD_TRUE@am__objects_4 = sg_pt_freebsd.lo
-@OS_SOLARIS_TRUE@am__objects_5 = sg_pt_solaris.lo
-@OS_OSF_TRUE@am__objects_6 = sg_pt_osf1.lo
+ sg_pt_common.c sg_pt_dummy.c sg_pt_linux.c sg_io_linux.c \
+ sg_pt_linux_nvme.c sg_pt_win32.c sg_pt_freebsd.c \
+ sg_pt_solaris.c sg_pt_osf1.c
+@OS_LINUX_TRUE@@PT_DUMMY_TRUE@am__objects_1 = sg_pt_dummy.lo
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@am__objects_2 = sg_pt_linux.lo \
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@ sg_io_linux.lo \
+@OS_LINUX_TRUE@@PT_DUMMY_FALSE@ sg_pt_linux_nvme.lo
+@OS_WIN32_MINGW_TRUE@am__objects_3 = sg_pt_win32.lo
+@OS_WIN32_CYGWIN_TRUE@am__objects_4 = sg_pt_win32.lo
+@OS_FREEBSD_TRUE@@PT_DUMMY_TRUE@am__objects_5 = sg_pt_dummy.lo
+@OS_FREEBSD_TRUE@@PT_DUMMY_FALSE@am__objects_6 = sg_pt_freebsd.lo
+@OS_SOLARIS_TRUE@am__objects_7 = sg_pt_solaris.lo
+@OS_OSF_TRUE@am__objects_8 = sg_pt_osf1.lo
+@OS_NETBSD_TRUE@am__objects_9 = sg_pt_dummy.lo
+@OS_OPENBSD_TRUE@am__objects_10 = sg_pt_dummy.lo
am_libsgutils2_la_OBJECTS = sg_lib.lo sg_lib_data.lo sg_cmds_basic.lo \
sg_cmds_basic2.lo sg_cmds_extra.lo sg_cmds_mmc.lo \
sg_pt_common.lo $(am__objects_1) $(am__objects_2) \
$(am__objects_3) $(am__objects_4) $(am__objects_5) \
- $(am__objects_6)
+ $(am__objects_6) $(am__objects_7) $(am__objects_8) \
+ $(am__objects_9) $(am__objects_10)
libsgutils2_la_OBJECTS = $(am_libsgutils2_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -181,10 +192,10 @@ am__depfiles_remade = ./$(DEPDIR)/sg_cmds_basic.Plo \
./$(DEPDIR)/sg_cmds_basic2.Plo ./$(DEPDIR)/sg_cmds_extra.Plo \
./$(DEPDIR)/sg_cmds_mmc.Plo ./$(DEPDIR)/sg_io_linux.Plo \
./$(DEPDIR)/sg_lib.Plo ./$(DEPDIR)/sg_lib_data.Plo \
- ./$(DEPDIR)/sg_pt_common.Plo ./$(DEPDIR)/sg_pt_freebsd.Plo \
- ./$(DEPDIR)/sg_pt_linux.Plo ./$(DEPDIR)/sg_pt_linux_nvme.Plo \
- ./$(DEPDIR)/sg_pt_osf1.Plo ./$(DEPDIR)/sg_pt_solaris.Plo \
- ./$(DEPDIR)/sg_pt_win32.Plo
+ ./$(DEPDIR)/sg_pt_common.Plo ./$(DEPDIR)/sg_pt_dummy.Plo \
+ ./$(DEPDIR)/sg_pt_freebsd.Plo ./$(DEPDIR)/sg_pt_linux.Plo \
+ ./$(DEPDIR)/sg_pt_linux_nvme.Plo ./$(DEPDIR)/sg_pt_osf1.Plo \
+ ./$(DEPDIR)/sg_pt_solaris.Plo ./$(DEPDIR)/sg_pt_win32.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -355,7 +366,9 @@ top_srcdir = @top_srcdir@
libsgutils2_la_SOURCES = sg_lib.c sg_lib_data.c sg_cmds_basic.c \
sg_cmds_basic2.c sg_cmds_extra.c sg_cmds_mmc.c sg_pt_common.c \
$(am__append_1) $(am__append_2) $(am__append_3) \
- $(am__append_4) $(am__append_5) $(am__append_6)
+ $(am__append_4) $(am__append_5) $(am__append_6) \
+ $(am__append_7) $(am__append_8) $(am__append_9) \
+ $(am__append_10)
@DEBUG_FALSE@DBG_CFLAGS =
# This is active if --enable-debug given to ./configure
@@ -466,6 +479,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_lib.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_lib_data.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_pt_common.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_pt_dummy.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_pt_freebsd.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_pt_linux.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_pt_linux_nvme.Plo@am__quote@ # am--include-marker
@@ -642,6 +656,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/sg_lib.Plo
-rm -f ./$(DEPDIR)/sg_lib_data.Plo
-rm -f ./$(DEPDIR)/sg_pt_common.Plo
+ -rm -f ./$(DEPDIR)/sg_pt_dummy.Plo
-rm -f ./$(DEPDIR)/sg_pt_freebsd.Plo
-rm -f ./$(DEPDIR)/sg_pt_linux.Plo
-rm -f ./$(DEPDIR)/sg_pt_linux_nvme.Plo
@@ -701,6 +716,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/sg_lib.Plo
-rm -f ./$(DEPDIR)/sg_lib_data.Plo
-rm -f ./$(DEPDIR)/sg_pt_common.Plo
+ -rm -f ./$(DEPDIR)/sg_pt_dummy.Plo
-rm -f ./$(DEPDIR)/sg_pt_freebsd.Plo
-rm -f ./$(DEPDIR)/sg_pt_linux.Plo
-rm -f ./$(DEPDIR)/sg_pt_linux_nvme.Plo
diff --git a/lib/sg_pt_dummy.c b/lib/sg_pt_dummy.c
new file mode 100644
index 00000000..be84b503
--- /dev/null
+++ b/lib/sg_pt_dummy.c
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 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.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+
+#include "sg_pt.h"
+#include "sg_lib.h"
+#include "sg_pr2serr.h"
+
+/* Version 1.01 20210609 */
+
+/* Simply defines all the functions needed by the pt interface (see sg_pt.h).
+ * They do nothing. This allows decoding of hex files (e.g. with the --in=
+ * or --inhex= option) with utilities like sg_vpd and sg_logs. */
+
+struct sg_pt_dummy {
+ int dummy;
+};
+
+struct sg_pt_base {
+ struct sg_pt_dummy impl;
+};
+
+
+/* Returns >= 0 if successful. If error in Unix returns negated errno. */
+int
+scsi_pt_open_device(const char * device_name, bool read_only, int verbose)
+{
+ int oflags = 0 /* O_NONBLOCK*/ ;
+
+ oflags |= (read_only ? O_RDONLY : O_RDWR);
+ return scsi_pt_open_flags(device_name, oflags, verbose);
+}
+
+/* Similar to scsi_pt_open_device() but takes Unix style open flags OR-ed
+ * together. The 'flags' argument is ignored in OSF-1.
+ * Returns >= 0 if successful, otherwise returns negated errno. */
+int
+scsi_pt_open_flags(const char * device_name, int flags, int verbose)
+{
+ if (device_name) {}
+ if (flags) {}
+ if (verbose) {}
+ errno = EINVAL;
+ return -1;
+}
+
+/* Returns 0 if successful. If error in Unix returns negated errno. */
+int
+scsi_pt_close_device(int device_fd)
+{
+ if (device_fd) {}
+ return 0;
+}
+
+struct sg_pt_base *
+construct_scsi_pt_obj_with_fd(int device_fd, int verbose)
+{
+ struct sg_pt_dummy * ptp;
+
+ if (device_fd) {}
+ ptp = (struct sg_pt_dummy *)malloc(sizeof(struct sg_pt_dummy));
+ if (ptp) {
+ memset(ptp, 0, sizeof(struct sg_pt_dummy));
+ } else if (verbose)
+ pr2ws("%s: malloc() out of memory\n", __func__);
+ return (struct sg_pt_base *)ptp;
+}
+
+struct sg_pt_base *
+construct_scsi_pt_obj(void)
+{
+ return construct_scsi_pt_obj_with_fd(-1, 0);
+}
+
+void
+destruct_scsi_pt_obj(struct sg_pt_base * vp)
+{
+ struct sg_pt_dummy * ptp = &vp->impl;
+
+ if (ptp)
+ free(ptp);
+}
+
+void
+clear_scsi_pt_obj(struct sg_pt_base * vp)
+{
+ struct sg_pt_dummy * ptp = &vp->impl;
+
+ if (ptp) {
+ ptp->dummy = 0;
+ }
+}
+
+void
+partial_clear_scsi_pt_obj(struct sg_pt_base * vp)
+{
+ struct sg_pt_dummy * ptp = &vp->impl;
+
+ if (NULL == ptp)
+ return;
+ ptp->dummy = 0;
+}
+
+void
+set_scsi_pt_cdb(struct sg_pt_base * vp, const uint8_t * cdb,
+ int cdb_len)
+{
+ if (vp) {}
+ if (cdb) {}
+ if (cdb_len) {}
+}
+
+int
+get_scsi_pt_cdb_len(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 6;
+}
+
+uint8_t *
+get_scsi_pt_cdb_buf(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return NULL;
+}
+
+void
+set_scsi_pt_sense(struct sg_pt_base * vp, uint8_t * sense,
+ int max_sense_len)
+{
+ if (vp) {}
+ if (sense) {}
+ if (max_sense_len) {}
+}
+
+/* from device */
+void
+set_scsi_pt_data_in(struct sg_pt_base * vp, uint8_t * dxferp,
+ int dxfer_len)
+{
+ if (vp) {}
+ if (dxferp) {}
+ if (dxfer_len) {}
+}
+
+/* to device */
+void
+set_scsi_pt_data_out(struct sg_pt_base * vp, const uint8_t * dxferp,
+ int dxfer_len)
+{
+ if (vp) {}
+ if (dxferp) {}
+ if (dxfer_len) {}
+}
+
+void
+set_scsi_pt_packet_id(struct sg_pt_base * vp, int pack_id)
+{
+ if (vp) {}
+ if (pack_id) {}
+}
+
+void
+set_scsi_pt_tag(struct sg_pt_base * vp, uint64_t tag)
+{
+ if (vp) {}
+ if (tag) {}
+}
+
+void
+set_scsi_pt_task_management(struct sg_pt_base * vp, int tmf_code)
+{
+ if (vp) {}
+ if (tmf_code) {}
+}
+
+void
+set_scsi_pt_task_attr(struct sg_pt_base * vp, int attrib, int priority)
+{
+ if (vp) {}
+ if (attrib) {}
+ if (priority) {}
+}
+
+void
+set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
+{
+ if (vp) {}
+ if (flags) {}
+}
+
+int
+do_scsi_pt(struct sg_pt_base * vp, int device_fd, int time_secs, int verbose)
+{
+ if (vp) {}
+ if (device_fd) {}
+ if (time_secs) {}
+ if (verbose) {}
+ return 0;
+}
+
+int
+get_scsi_pt_result_category(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+int
+get_scsi_pt_resid(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+void
+get_pt_req_lengths(const struct sg_pt_base * vp, int * req_dinp,
+ int * req_doutp)
+{
+ if (vp) {}
+ if (req_dinp) {}
+ if (req_doutp) {}
+}
+
+void
+get_pt_actual_lengths(const struct sg_pt_base * vp, int * act_dinp,
+ int * act_doutp)
+{
+ if (vp) {}
+ if (act_dinp) {}
+ if (act_doutp) {}
+}
+
+
+int
+get_scsi_pt_status_response(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+int
+get_scsi_pt_sense_len(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+uint8_t *
+get_scsi_pt_sense_buf(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return NULL;
+}
+
+int
+get_scsi_pt_duration_ms(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+/* If not available return 0 otherwise return number of nanoseconds that the
+ * lower layers (and hardware) took to execute the command just completed. */
+uint64_t
+get_pt_duration_ns(const struct sg_pt_base * vp __attribute__ ((unused)))
+{
+ return 0;
+}
+
+int
+get_scsi_pt_transport_err(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+int
+get_scsi_pt_os_err(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return 0;
+}
+
+bool
+pt_device_is_nvme(const struct sg_pt_base * vp)
+{
+ if (vp) {}
+ return false;
+}
+
+char *
+get_scsi_pt_transport_err_str(const struct sg_pt_base * vp, int max_b_len,
+ char * b)
+{
+ if (vp) {}
+ if (max_b_len) {}
+ if (b) {}
+ return NULL;
+}
+
+char *
+get_scsi_pt_os_err_str(const struct sg_pt_base * vp, int max_b_len, char * b)
+{
+ if (vp) {}
+ if (max_b_len) {}
+ if (b) {}
+ return NULL;
+}
+
+int
+do_nvm_pt(struct sg_pt_base * vp, int submq, int timeout_secs, int verbose)
+{
+ if (vp) { }
+ if (submq) { }
+ if (timeout_secs) { }
+ if (verbose) { }
+ return SCSI_PT_DO_NOT_SUPPORTED;
+}
+
+int
+check_pt_file_handle(int device_fd, const char * device_name, int vb)
+{
+ if (device_fd) {}
+ if (device_name) {}
+ if (vb) {}
+ return 0;
+}
+
+/* If a NVMe block device (which includes the NSID) handle is associated
+ * with 'vp', then its NSID is returned (values range from 0x1 to
+ * 0xffffffe). Otherwise 0 is returned. */
+uint32_t
+get_pt_nvme_nsid(const struct sg_pt_base * vp)
+{
+ if (vp) { }
+ return 0;
+}
+
+uint32_t
+get_pt_result(const struct sg_pt_base * vp)
+{
+ if (vp) { }
+ return 0;
+}
diff --git a/lib/sg_pt_osf1.c b/lib/sg_pt_osf1.c
index 99900fd3..3296e18b 100644
--- a/lib/sg_pt_osf1.c
+++ b/lib/sg_pt_osf1.c
@@ -650,3 +650,29 @@ do_nvm_pt(struct sg_pt_base * vp, int submq, int timeout_secs, int verbose)
if (verbose) { }
return SCSI_PT_DO_NOT_SUPPORTED;
}
+
+int
+check_pt_file_handle(int device_fd, const char * device_name, int vb)
+{
+ if (device_fd) {}
+ if (device_name) {}
+ if (vb) {}
+ return 0;
+}
+
+/* If a NVMe block device (which includes the NSID) handle is associated
+ * with 'vp', then its NSID is returned (values range from 0x1 to
+ * 0xffffffe). Otherwise 0 is returned. */
+uint32_t
+get_pt_nvme_nsid(const struct sg_pt_base * vp)
+{
+ if (vp) { }
+ return 0;
+}
+
+uint32_t
+get_pt_result(const struct sg_pt_base * vp)
+{
+ if (vp) { }
+ return 0;
+}
diff --git a/lib/sg_pt_solaris.c b/lib/sg_pt_solaris.c
index ec346ab4..2e5b430d 100644
--- a/lib/sg_pt_solaris.c
+++ b/lib/sg_pt_solaris.c
@@ -529,3 +529,22 @@ do_nvm_pt(struct sg_pt_base * vp, int submq, int timeout_secs, int verbose)
if (verbose) { }
return SCSI_PT_DO_NOT_SUPPORTED;
}
+
+int
+check_pt_file_handle(int device_fd, const char * device_name, int vb)
+{
+ if (device_fd) {}
+ if (device_name) {}
+ if (vb) {}
+ return 0;
+}
+
+/* If a NVMe block device (which includes the NSID) handle is associated
+ * with 'vp', then its NSID is returned (values range from 0x1 to
+ * 0xffffffe). Otherwise 0 is returned. */
+uint32_t
+get_pt_nvme_nsid(const struct sg_pt_base * vp)
+{
+ if (vp) { }
+ return 0;
+}
diff --git a/lib/sg_pt_win32.c b/lib/sg_pt_win32.c
index 62a69309..dab66cb0 100644
--- a/lib/sg_pt_win32.c
+++ b/lib/sg_pt_win32.c
@@ -1445,8 +1445,8 @@ pt_device_is_nvme(const struct sg_pt_base * vp)
}
/* If a NVMe block device (which includes the NSID) handle is associated
- * * with 'vp', then its NSID is returned (values range from 0x1 to
- * * 0xffffffe). Otherwise 0 is returned. */
+ * with 'vp', then its NSID is returned (values range from 0x1 to
+ * 0xffffffe). Otherwise 0 is returned. */
uint32_t
get_pt_nvme_nsid(const struct sg_pt_base * vp)
{