summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/blocktrans.h
diff options
context:
space:
mode:
authorMichael Brown2015-08-04 16:33:11 +0200
committerMichael Brown2015-08-16 01:48:34 +0200
commit09236e603055b1833c85a6a5a99de401e32df7fc (patch)
treed38613f1b2b7030a84a441c0d3eb73366a2a5bd1 /src/include/ipxe/blocktrans.h
parent[prefix] Use correct register for KEEP_IT_REAL physical address conversion (diff)
downloadipxe-09236e603055b1833c85a6a5a99de401e32df7fc.tar.gz
ipxe-09236e603055b1833c85a6a5a99de401e32df7fc.tar.xz
ipxe-09236e603055b1833c85a6a5a99de401e32df7fc.zip
[block] Add generic block device translator
Add a generic mechanism for providing block devices on top of a data transfer interface (such as HTTP). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/blocktrans.h')
-rw-r--r--src/include/ipxe/blocktrans.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/include/ipxe/blocktrans.h b/src/include/ipxe/blocktrans.h
new file mode 100644
index 000000000..fee71b96c
--- /dev/null
+++ b/src/include/ipxe/blocktrans.h
@@ -0,0 +1,38 @@
+#ifndef _IPXE_BLOCKTRANS_H
+#define _IPXE_BLOCKTRANS_H
+
+/** @file
+ *
+ * Block device translator
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <stdint.h>
+#include <ipxe/refcnt.h>
+#include <ipxe/interface.h>
+#include <ipxe/xferbuf.h>
+#include <ipxe/uaccess.h>
+
+/** A block device translator */
+struct block_translator {
+ /** Reference count */
+ struct refcnt refcnt;
+ /** Block device interface */
+ struct interface block;
+ /** Data transfer interface */
+ struct interface xfer;
+
+ /** Data transfer buffer */
+ struct xfer_buffer xferbuf;
+ /** Data buffer */
+ userptr_t buffer;
+ /** Block size */
+ size_t blksize;
+};
+
+extern int block_translate ( struct interface *block,
+ userptr_t buffer, size_t size );
+
+#endif /* _IPXE_BLOCKTRANS_H */