[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength().
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength(). |
Date: |
Tue, 7 Aug 2012 15:44:28 +0200 |
Signed-off-by: Benoit Canet <address@hidden>
---
block/quorum.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/block/quorum.c b/block/quorum.c
index 9da0432..5cd7083 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -118,12 +118,29 @@ static void quorum_close(BlockDriverState *bs)
}
}
+static int64_t quorum_getlength(BlockDriverState *bs)
+{
+ BDRVQuorumState *s = bs->opaque;
+ int i;
+ int64_t ret;
+
+ /* return the length of the first available quorum file */
+ for (i = 0, ret = bdrv_getlength(s->bs[i]);
+ ret == -ENOMEDIUM && i <= 2;
+ i++, ret = bdrv_getlength(s->bs[i])) {
+ }
+
+ return ret;
+}
+
static BlockDriver bdrv_quorum = {
.format_name = "quorum",
.protocol_name = "quorum",
.instance_size = sizeof(BDRVQuorumState),
+ .bdrv_getlength = quorum_getlength,
+
.bdrv_file_open = quorum_open,
.bdrv_close = quorum_close,
};
--
1.7.9.5
- [Qemu-devel] [RFC V2 02/10] quorum: Create BDRVQuorumState and BlkDriver and do init., (continued)
- [Qemu-devel] [RFC V2 02/10] quorum: Create BDRVQuorumState and BlkDriver and do init., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 01/10] quorum: Create quorum .c, add QuorumSingleAIOCB and QuorumAIOCB., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 04/10] quorum: Add quorum_close()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength().,
Benoît Canet <=
- [Qemu-devel] [RFC V2 08/10] quorum: Add quorum_co_flush()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 06/10] quorum: Add quorum_aio_writev and its dependencies., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv., Benoît Canet, 2012/08/07