@@ -119,12 +119,29 @@ static void qorum_close(BlockDriverState *bs)
}
}
+static int64_t qorum_getlength(BlockDriverState *bs)
+{
+ BDRVQorumState *s = bs->opaque;
+ int i;
+ int64_t ret;
+
+ /* return the length of the first available qorum 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_qorum = {
.format_name = "qorum",
.protocol_name = "qorum",
.instance_size = sizeof(BDRVQorumState),
+ .bdrv_getlength = qorum_getlength,
+
.bdrv_file_open = qorum_open,
.bdrv_close = qorum_close,
};
Signed-off-by: Benoit Canet <benoit@irqsave.net> --- block/qorum.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)