Go to the source code of this file.
Data Structures | |||||||||||||
struct | BlockDeviceInfo | ||||||||||||
Structure of information about a block device. More... | |||||||||||||
struct | BlockMediumInfo | ||||||||||||
Structure of information about a block device medium. More... | |||||||||||||
struct | BlockOperations | ||||||||||||
Structure of operations for block devices. More... | |||||||||||||
Error reporting | |||||||||||||
Block device facilities shall return a negative error value in case of failure. The error values are formed as follows:
| |||||||||||||
#define | BLOCK_ERROR_CATEGORY 0x80800000 | ||||||||||||
Error category code for block devices. | |||||||||||||
#define | BLOCK_ERROR(sense, code) ((int) (BLOCK_ERROR_CATEGORY | (sense) | ((code) & 0xFFFF))) | ||||||||||||
Formats a block device error value. | |||||||||||||
#define | BLOCK_GET_SENSE(value) ((value) & 0x003F0000) | ||||||||||||
Gets the sense key from a block device error value. | |||||||||||||
#define | BLOCK_IS_ERROR(value) (((value) & 0xFFC00000) == BLOCK_ERROR_CATEGORY) | ||||||||||||
Checks if an error value belongs to the block devices category. | |||||||||||||
enum | BlockSenseKeys { BLOCK_SENSE_NONE = 0 << 16, BLOCK_SENSE_RECOVERED = 1 << 16, BLOCK_SENSE_NOTREADY = 2 << 16, BLOCK_SENSE_MEDIUM = 3 << 16, BLOCK_SENSE_HW = 4 << 16, BLOCK_SENSE_ILLREQ = 5 << 16, BLOCK_SENSE_ATTENTION = 6 << 16, BLOCK_SENSE_DATAPROT = 7 << 16, BLOCK_SENSE_BLANK = 8 << 16, BLOCK_SENSE_ABORTED = 11 << 16, BLOCK_SENSE_MISCOMPARE = 14 << 16 } | ||||||||||||
Sense key values for block device error values. More... | |||||||||||||
Block device operations | |||||||||||||
#define | BLOCK_OPERATIONS_TYPE 1 | ||||||||||||
Operations type for struct BlockOperations. | |||||||||||||
enum | BlockDeviceInfoFlags { BLOCK_DEVICE_INFO_PARTID = 0xFF, BLOCK_DEVICE_INFO_TYPEMASK = 15 << 8, BLOCK_DEVICE_INFO_TGENERIC = 0 << 8, BLOCK_DEVICE_INFO_TACTIVE = 1 << 8, BLOCK_DEVICE_INFO_TLOGICAL = 2 << 8, BLOCK_DEVICE_INFO_TPRIMARY = 3 << 8, BLOCK_DEVICE_INFO_TFLOPPY = 4 << 8, BLOCK_DEVICE_INFO_TCDDVD = 5 << 8, BLOCK_DEVICE_INFO_REMOVABLE = 1 << 12, BLOCK_DEVICE_INFO_MEDIACHG = 1 << 13, BLOCK_DEVICE_INFO_WRITABLE = 1 << 14 } | ||||||||||||
Block device information flags. More... | |||||||||||||
enum | BlockReadWriteFlags { BLOCK_RW_NOCACHE = 1 << 0 } | ||||||||||||
Flags for the read and write block device operations. More... | |||||||||||||
typedef struct BlockDeviceInfo | BlockDeviceInfo | ||||||||||||
Typedef shortcut for the struct BlockDeviceInfo. | |||||||||||||
typedef struct BlockMediumInfo | BlockMediumInfo | ||||||||||||
Typedef shortcut for the struct BlockMediumInfo. | |||||||||||||
typedef struct BlockOperations | BlockOperations | ||||||||||||
Typedef shortcut for the struct BlockOperations. | |||||||||||||
Defines | |||||||||||||
#define | REQ_GET_OPERATIONS 0 | ||||||||||||
Request to get a structure of operations. | |||||||||||||
#define | REQ_GET_REFERENCES 1 | ||||||||||||
Request to get the reference count of an object. | |||||||||||||
#define | REQ_RELEASE 2 | ||||||||||||
Request to release an object. | |||||||||||||
Typedefs | |||||||||||||
typedef unsigned long | ssize_t | ||||||||||||
Functions | |||||||||||||
Block device manager functions | |||||||||||||
static int | req_get_operations (int(*r)(int function,...), int type, void **operations) | ||||||||||||
Shortcut to perform a REQ_GET_OPERATIONS request. | |||||||||||||
static int | req_get_references (int(*r)(int function,...)) | ||||||||||||
Shortcut to perform a REQ_GET_REFERENCES request. | |||||||||||||
static int | req_release (int(*r)(int function,...), void *handle) | ||||||||||||
Shortcut to perform a REQ_RELEASE request. | |||||||||||||
const char * | block_enumerate (void **iterator) | ||||||||||||
Enumerates the registered block devices. | |||||||||||||
int | block_get (const char *name, int type, void **operations, void **handle) | ||||||||||||
Gets operations for a block device. | |||||||||||||
int | block_register (const char *name, int(*request)(int function,...), void *handle) | ||||||||||||
Registers a device to the Block Device Manager. | |||||||||||||
int | block_unregister (const char *name) | ||||||||||||
Unregisters a device from the Block Device Manager. |