aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_pt_solaris.c
diff options
context:
space:
mode:
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;
+}