From e01248efcd622211c0451e6dc4ed47cc4b758cfa Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Fri, 30 Nov 2018 15:14:30 +0100 Subject: rbscsi: add experimental API to list connected SCSI devices For now it is only implemented on linux using /sys scanning Change-Id: Ifdfe7564e6e8d0307ae6ddc53e49bb9aaf5a8268 --- utils/scsi/rbscsi.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'utils/scsi/rbscsi.h') diff --git a/utils/scsi/rbscsi.h b/utils/scsi/rbscsi.h index c7345a6cdf..322d94ec53 100644 --- a/utils/scsi/rbscsi.h +++ b/utils/scsi/rbscsi.h @@ -89,6 +89,31 @@ void rb_scsi_decode_sense(rb_scsi_device_t dev, void *sense, int sense_len); /* close a device */ void rb_scsi_close(rb_scsi_device_t dev); +/* SCSI device reported by rb_scsi_list() */ +struct rb_scsi_devent_t +{ + /* device path to the raw SCSI device, typically: + * - Linux: /dev/sgX + * - Windows: TODO + * This path can be used directly with scsi_rb_open(), and is guaranteed to + * be valid. */ + char *scsi_path; + /* device path to the corresponding block device, if it exists, typically: + * - Linux: /dev/sdX + * - Windows: TODO + * If this path is not-NULL, then it can used directly with scsi_rb_open() */ + char *block_path; + /* various information about the device, can be NULL on error */ + char *vendor; + char *model; + char *rev; +}; +/* try to list all SCSI devices, returns a list of devices or NULL on error + * the list is terminated by an entry with scsi_path=NULL */ +struct rb_scsi_devent_t *rb_scsi_list(void); +/* free the list returned by rb_scsi_list */ +void rb_scsi_free_list(struct rb_scsi_devent_t *list); + #ifdef __cplusplus } #endif -- cgit v1.2.3