aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_pt_solaris.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-06-23 18:09:48 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-06-23 18:09:48 +0000
commit303f8c98ee28150285d69bd213970144fe224da3 (patch)
tree3cdbf0cc482229b65481fe30049c92fa3c2f1faa /lib/sg_pt_solaris.c
parentbee57c535c29a01cadfaa660d8c0182288960c33 (diff)
downloadsg3_utils-303f8c98ee28150285d69bd213970144fe224da3.tar.gz
Haiku OS support, add pt function list in sg_pt_dummy.c; add slices to sg_mrq_dd
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@905 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_pt_solaris.c')
-rw-r--r--lib/sg_pt_solaris.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/sg_pt_solaris.c b/lib/sg_pt_solaris.c
index 2e5b430d..e6cfa575 100644
--- a/lib/sg_pt_solaris.c
+++ b/lib/sg_pt_solaris.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2020 Douglas Gilbert.
+ * Copyright (c) 2007-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.
@@ -7,7 +7,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-/* sg_pt_solaris version 1.14 20200724 */
+/* sg_pt_solaris version 1.15 20210617 */
#include <stdio.h>
#include <stdlib.h>
@@ -539,6 +539,17 @@ check_pt_file_handle(int device_fd, const char * device_name, int vb)
return 0;
}
+/* Valid file handles (which is the return value) are >= 0 . Returns -1
+ * if there is no valid file handle. */
+int
+get_pt_file_handle(const struct sg_pt_base * vp)
+{
+ const struct sg_pt_solaris_scsi * ptp = &vp->impl;
+
+ return ptp->dev_fd;
+}
+
+
/* 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. */
@@ -548,3 +559,20 @@ get_pt_nvme_nsid(const struct sg_pt_base * vp)
if (vp) { }
return 0;
}
+
+/* Forget any previous dev_han and install the one given. May attempt to
+ * find file type (e.g. if pass-though) from OS so there could be an error.
+ * Returns 0 for success or the same value as get_scsi_pt_os_err()
+ * will return. dev_han should be >= 0 for a valid file handle or -1 . */
+int
+set_pt_file_handle(struct sg_pt_base * vp, int dev_han, int vb)
+{
+ struct sg_pt_solaris_scsi * ptp = &vp->impl;
+
+ if (vb) {}
+ ptp->dev_fd = (dev_han < 0) ? -1 : dev_han;
+ ptp->in_err = 0;
+ ptp->os_err = 0;
+ ptp->is_nvme = false;
+ return 0;
+}