Some block devices need an explicit callback for flushing written
blocks. Add this callback.

Signed-off-by: Sascha Hauer <[email protected]>
---
 common/block.c  | 3 +++
 include/block.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/common/block.c b/common/block.c
index e522ee4..0edc861 100644
--- a/common/block.c
+++ b/common/block.c
@@ -55,6 +55,9 @@ static int writebuffer_flush(struct block_device *blk)
                }
        }
 
+       if (blk->ops->flush)
+               return blk->ops->flush(blk);
+
        return 0;
 }
 
diff --git a/include/block.h b/include/block.h
index 872a4c1..9137767 100644
--- a/include/block.h
+++ b/include/block.h
@@ -9,6 +9,7 @@ struct block_device;
 struct block_device_ops {
        int (*read)(struct block_device *, void *buf, int block, int 
num_blocks);
        int (*write)(struct block_device *, const void *buf, int block, int 
num_blocks);
+       int (*flush)(struct block_device *);
 };
 
 struct chunk;
-- 
2.0.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to