[block] Add generic block device translator
[ipxe.git] / src / include / ipxe / blocktrans.h
1 #ifndef _IPXE_BLOCKTRANS_H
2 #define _IPXE_BLOCKTRANS_H
3
4 /** @file
5 *
6 * Block device translator
7 *
8 */
9
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12 #include <stdint.h>
13 #include <ipxe/refcnt.h>
14 #include <ipxe/interface.h>
15 #include <ipxe/xferbuf.h>
16 #include <ipxe/uaccess.h>
17
18 /** A block device translator */
19 struct block_translator {
20 /** Reference count */
21 struct refcnt refcnt;
22 /** Block device interface */
23 struct interface block;
24 /** Data transfer interface */
25 struct interface xfer;
26
27 /** Data transfer buffer */
28 struct xfer_buffer xferbuf;
29 /** Data buffer */
30 userptr_t buffer;
31 /** Block size */
32 size_t blksize;
33 };
34
35 extern int block_translate ( struct interface *block,
36 userptr_t buffer, size_t size );
37
38 #endif /* _IPXE_BLOCKTRANS_H */