26#ifndef _ULTIBO_STORAGE_H
27#define _ULTIBO_STORAGE_H
39#define STORAGE_NAME_PREFIX "Storage"
41#define STORAGE_STATUS_TIMER_INTERVAL 1000
44#define STORAGE_TYPE_NONE 0
45#define STORAGE_TYPE_HDD 1
46#define STORAGE_TYPE_FDD 2
47#define STORAGE_TYPE_CDROM 3
48#define STORAGE_TYPE_OPTICAL 4
49#define STORAGE_TYPE_TAPE 5
50#define STORAGE_TYPE_REMOVABLE 6
53#define STORAGE_STATE_EJECTED 0
54#define STORAGE_STATE_EJECTING 1
55#define STORAGE_STATE_INSERTING 2
56#define STORAGE_STATE_INSERTED 3
59#define STORAGE_FLAG_NONE 0x00000000
60#define STORAGE_FLAG_REMOVABLE 0x00000001
61#define STORAGE_FLAG_LBA48 0x00000002
62#define STORAGE_FLAG_NOT_READY 0x00000004
63#define STORAGE_FLAG_NO_MEDIA 0x00000008
64#define STORAGE_FLAG_READ_ONLY 0x00000010
65#define STORAGE_FLAG_WRITE_ONLY 0x00000020
66#define STORAGE_FLAG_ERASEABLE 0x00000040
67#define STORAGE_FLAG_LOCKABLE 0x00000080
68#define STORAGE_FLAG_LOCKED 0x00000100
69#define STORAGE_FLAG_EJECTABLE 0x00000200
70#define STORAGE_FLAG_CHANGABLE 0x00000400
73#define STORAGE_CONTROL_TEST_READY 1
74#define STORAGE_CONTROL_RESET 2
75#define STORAGE_CONTROL_TEST_MEDIA 3
76#define STORAGE_CONTROL_LOCK 4
77#define STORAGE_CONTROL_UNLOCK 5
78#define STORAGE_CONTROL_EJECT 6
79#define STORAGE_CONTROL_TEST_LOCKED 7
80#define STORAGE_CONTROL_TEST_CHANGED 8
81#define STORAGE_CONTROL_GET_VENDORID 9
82#define STORAGE_CONTROL_GET_PRODUCTID 10
83#define STORAGE_CONTROL_GET_SERIAL 11
84#define STORAGE_CONTROL_GET_REVISION 12
85#define STORAGE_CONTROL_GET_PRODUCT 13
86#define STORAGE_CONTROL_GET_MANUFACTURER 14
struct _DEVICE DEVICE
Definition devices.h:373
#define STDCALL
Definition globaltypes.h:45
HANDLE TIMER_HANDLE
Definition globaltypes.h:119
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
uint32_t STDCALL storage_device_write(STORAGE_DEVICE *storage, int64_t start, int64_t count, void *buffer)
uint32_t STDCALL(* storage_device_read_proc)(STORAGE_DEVICE *storage, int64_t start, int64_t count, void *buffer)
Definition storage.h:98
uint32_t STDCALL storage_device_read(STORAGE_DEVICE *storage, int64_t start, int64_t count, void *buffer)
uint32_t STDCALL storage_device_set_state(STORAGE_DEVICE *storage, uint32_t state)
Set the state of the specified storage and send a notification.
uint32_t STDCALL storage_device_start_status(STORAGE_DEVICE *storage, uint32_t interval)
Start status monitoring on the specified storage for insert/eject notifications.
uint32_t STDCALL storage_device_register(STORAGE_DEVICE *storage)
Register a new Storage in the Storage table.
STORAGE_DEVICE *STDCALL storage_device_create_ex(uint32_t size)
Create a new Storage entry.
uint32_t STDCALL(* storage_device_erase_proc)(STORAGE_DEVICE *storage, int64_t start, int64_t count)
Definition storage.h:100
uint32_t STDCALL(* storage_device_write_proc)(STORAGE_DEVICE *storage, int64_t start, int64_t count, void *buffer)
Definition storage.h:99
STORAGE_DEVICE *STDCALL storage_device_find(uint32_t storageid)
uint32_t STDCALL storage_device_notification(STORAGE_DEVICE *storage, storage_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL storage_device_stop_status(STORAGE_DEVICE *storage)
Stop status monitoring on the specified storage for insert/eject notifications.
STORAGE_DEVICE *STDCALL storage_device_create(void)
Create a new Storage entry.
uint32_t STDCALL storage_device_state_to_string(uint32_t storagestate, char *string, uint32_t len)
uint32_t STDCALL(* storage_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition storage.h:95
uint32_t STDCALL storage_device_state_to_notification(uint32_t state)
Convert a Storage state value into the notification code for device notifications.
uint32_t STDCALL storage_device_deregister(STORAGE_DEVICE *storage)
Deregister a Storage from the Storage table.
uint32_t STDCALL storage_device_type_to_string(uint32_t storagetype, char *string, uint32_t len)
STORAGE_DEVICE *STDCALL storage_device_check(STORAGE_DEVICE *storage)
Check if the supplied Storage is in the storage table.
STORAGE_DEVICE *STDCALL storage_device_find_by_name(const char *name)
uint32_t STDCALL storage_device_erase(STORAGE_DEVICE *storage, int64_t start, int64_t count)
uint32_t STDCALL(* storage_device_control_proc)(STORAGE_DEVICE *storage, int request, size_t argument1, size_t *argument2)
Definition storage.h:101
uint32_t STDCALL storage_device_enumerate(storage_enumerate_cb callback, void *data)
STORAGE_DEVICE *STDCALL storage_device_find_by_device(DEVICE *device)
Find a Storage device by the matching DeviceData property.
uint32_t STDCALL storage_device_destroy(STORAGE_DEVICE *storage)
Destroy an existing Storage entry.
uint32_t STDCALL storage_device_control(STORAGE_DEVICE *storage, int request, size_t argument1, size_t *argument2)
STORAGE_DEVICE *STDCALL storage_device_find_by_description(const char *description)
uint32_t STDCALL(* storage_enumerate_cb)(STORAGE_DEVICE *storage, void *data)
Definition storage.h:93
uint32_t STDCALL storage_get_count(void)
Get the current storage count.
struct _STORAGE_DEVICE STORAGE_DEVICE
Definition storage.h:90
uint64_t erasecount
Definition storage.h:130
storage_device_erase_proc deviceerase
A Device specific DeviceErase method implementing a standard Storage device interface.
Definition storage.h:112
MUTEX_HANDLE lock
Storage lock.
Definition storage.h:115
uint64_t readerrors
Definition storage.h:127
uint32_t blockshift
Shift Count for Blocks to Bytes conversion (eg 9 for 512 byte blocks).
Definition storage.h:120
uint64_t readcount
Definition storage.h:126
STORAGE_DEVICE * prev
Previous entry in Storage table.
Definition storage.h:133
char * product
ATA Serial No, SCSI Product.
Definition storage.h:122
uint32_t targetid
SCSI ID.
Definition storage.h:116
uint64_t writeerrors
Definition storage.h:129
uint32_t storageid
Unique Id of this Storage in the Storage table.
Definition storage.h:108
STORAGE_DEVICE * next
Next entry in Storage table.
Definition storage.h:134
DEVICE device
The Device entry for this Storage.
Definition storage.h:106
TIMER_HANDLE statustimer
Timer for status change detection.
Definition storage.h:124
int64_t blockcount
Number of Blocks.
Definition storage.h:119
uint32_t blocksize
Block Size.
Definition storage.h:118
storage_device_read_proc deviceread
A Device specific DeviceRead method implementing a standard Storage device interface.
Definition storage.h:110
storage_device_write_proc devicewrite
A Device specific DeviceWrite method implementing a standard Storage device interface.
Definition storage.h:111
uint32_t storagestate
Storage state (eg STORAGE_STATE_INSERTED).
Definition storage.h:109
storage_device_control_proc devicecontrol
A Device specific DeviceControl method implementing a standard Storage device interface.
Definition storage.h:113
uint64_t eraseerrors
Definition storage.h:131
uint32_t targetlun
LUN.
Definition storage.h:117
char * revision
Firmware Revision.
Definition storage.h:123
uint64_t writecount
Definition storage.h:128
char * vendor
ATA Model, SCSI Vendor.
Definition storage.h:121