summaryrefslogtreecommitdiffstats
path: root/include/block.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-04-04 13:59:21 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-05-31 09:34:48 +0200
commite82e40523f8df1c10b6646798065115119aea9a8 (patch)
tree2fa821d7e68a6ff78233277ae5980ab7c7ce7381 /include/block.h
parentb5c4e238d38adf76c4648494ae6eeb62345bd086 (diff)
downloadbarebox-e82e40523f8df1c10b6646798065115119aea9a8.tar.gz
barebox-e82e40523f8df1c10b6646798065115119aea9a8.tar.xz
block: implement block_read/block_write functions
Some drivers use blk->ops->read/write. This bypasses the caching block layer and was never intended like this. The upper API to the block layer is the cdev layer. This patch adds block_read and block_write functions and uses them where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/block.h')
-rw-r--r--include/block.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/block.h b/include/block.h
index ef36f585f1..eb31aca4db 100644
--- a/include/block.h
+++ b/include/block.h
@@ -29,4 +29,12 @@ struct block_device {
int blockdevice_register(struct block_device *blk);
int blockdevice_unregister(struct block_device *blk);
+int block_read(struct block_device *blk, void *buf, int block, int num_blocks);
+int block_write(struct block_device *blk, void *buf, int block, int num_blocks);
+
+static inline int block_flush(struct block_device *blk)
+{
+ return cdev_flush(&blk->cdev);
+}
+
#endif /* __BLOCK_H */