iPXE
blockdev.h
Go to the documentation of this file.
1 #ifndef _IPXE_BLOCKDEV_H
2 #define _IPXE_BLOCKDEV_H
3 
4 /**
5  * @file
6  *
7  * Block devices
8  *
9  */
10 
11 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12 
13 #include <stdint.h>
14 #include <ipxe/interface.h>
15 
16 /** Block device capacity */
18  /** Total number of blocks */
20  /** Block size */
21  size_t blksize;
22  /** Maximum number of blocks per single transfer */
23  unsigned int max_count;
24 };
25 
26 extern int block_read ( struct interface *control, struct interface *data,
27  uint64_t lba, unsigned int count, void *buffer,
28  size_t len );
29 #define block_read_TYPE( object_type ) \
30  typeof ( int ( object_type, struct interface *data, \
31  uint64_t lba, unsigned int count, \
32  void *buffer, size_t len ) )
33 
34 extern int block_write ( struct interface *control, struct interface *data,
35  uint64_t lba, unsigned int count, void *buffer,
36  size_t len );
37 #define block_write_TYPE( object_type ) \
38  typeof ( int ( object_type, struct interface *data, \
39  uint64_t lba, unsigned int count, \
40  void *buffer, size_t len ) )
41 
42 extern int block_read_capacity ( struct interface *control,
43  struct interface *data );
44 #define block_read_capacity_TYPE( object_type ) \
45  typeof ( int ( object_type, struct interface *data ) )
46 
47 extern void block_capacity ( struct interface *intf,
48  struct block_device_capacity *capacity );
49 #define block_capacity_TYPE( object_type ) \
50  typeof ( void ( object_type, \
51  struct block_device_capacity *capacity ) )
52 
53 
54 #endif /* _IPXE_BLOCKDEV_H */
unsigned int max_count
Maximum number of blocks per single transfer.
Definition: blockdev.h:23
void block_capacity(struct interface *intf, struct block_device_capacity *capacity)
Report block device capacity.
Definition: blockdev.c:129
unsigned long long uint64_t
Definition: stdint.h:13
int block_read(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, void *buffer, size_t len)
Read from block device.
Definition: blockdev.c:47
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
An object interface.
Definition: interface.h:124
Object interfaces.
int block_write(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, void *buffer, size_t len)
Write to block device.
Definition: blockdev.c:78
ring len
Length.
Definition: dwmac.h:231
static unsigned int count
Number of entries.
Definition: dwmac.h:225
uint64_t blocks
Total number of blocks.
Definition: blockdev.h:19
uint32_t control
Control.
Definition: myson.h:14
uint64_t lba
Starting block number.
Definition: int13.h:22
int block_read_capacity(struct interface *control, struct interface *data)
Read block device capacity.
Definition: blockdev.c:105
Block device capacity.
Definition: blockdev.h:17
uint8_t data[48]
Additional event data.
Definition: ena.h:22
size_t blksize
Block size.
Definition: blockdev.h:21