iPXE
blockdev.h
Go to the documentation of this file.
00001 #ifndef _IPXE_BLOCKDEV_H
00002 #define _IPXE_BLOCKDEV_H
00003 
00004 /**
00005  * @file
00006  *
00007  * Block devices
00008  *
00009  */
00010 
00011 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00012 
00013 #include <stdint.h>
00014 #include <ipxe/uaccess.h>
00015 #include <ipxe/interface.h>
00016 
00017 /** Block device capacity */
00018 struct block_device_capacity {
00019         /** Total number of blocks */
00020         uint64_t blocks;
00021         /** Block size */
00022         size_t blksize;
00023         /** Maximum number of blocks per single transfer */
00024         unsigned int max_count;
00025 };
00026 
00027 extern int block_read ( struct interface *control, struct interface *data,
00028                         uint64_t lba, unsigned int count,
00029                         userptr_t buffer, size_t len );
00030 #define block_read_TYPE( object_type )                                  \
00031         typeof ( int ( object_type, struct interface *data,             \
00032                        uint64_t lba, unsigned int count,                \
00033                        userptr_t buffer, size_t len ) )
00034 
00035 extern int block_write ( struct interface *control, struct interface *data,
00036                          uint64_t lba, unsigned int count,
00037                          userptr_t buffer, size_t len );
00038 #define block_write_TYPE( object_type )                                 \
00039         typeof ( int ( object_type, struct interface *data,             \
00040                        uint64_t lba, unsigned int count,                \
00041                        userptr_t buffer, size_t len ) )
00042 
00043 extern int block_read_capacity ( struct interface *control,
00044                                  struct interface *data );
00045 #define block_read_capacity_TYPE( object_type )                         \
00046         typeof ( int ( object_type, struct interface *data ) )
00047 
00048 extern void block_capacity ( struct interface *intf,
00049                              struct block_device_capacity *capacity );
00050 #define block_capacity_TYPE( object_type )                              \
00051         typeof ( void ( object_type,                                    \
00052                         struct block_device_capacity *capacity ) )
00053 
00054 
00055 #endif /* _IPXE_BLOCKDEV_H */