[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open().
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open(). |
Date: |
Wed, 8 Aug 2012 16:04:11 +0100 |
On Tue, Aug 7, 2012 at 2:44 PM, Benoît Canet <address@hidden> wrote:
> Signed-off-by: Benoit Canet <address@hidden>
> ---
> block/quorum.c | 62
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index e0405b6..de58ab8 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -47,11 +47,73 @@ struct QuorumAIOCB {
> int vote_ret;
> };
>
> +/* Valid quorum filenames look like
> + * quorum:path/to/a_image:path/to/b_image:path/to/c_image
> + */
> +static int quorum_open(BlockDriverState *bs, const char *filename, int flags)
> +{
> + BDRVQuorumState *s = bs->opaque;
> + int ret, i;
> + char *a, *b, *c, *filenames[3];
> +
> + /* Parse the quorum: prefix */
> + if (strncmp(filename, "quorum:", strlen("quorum:"))) {
> + return -EINVAL;
> + }
> + a = g_strdup(filename + strlen("quorum:"));
> +
> + /* Find separators */
> + b = strchr(a, ':');
> + if (b == NULL) {
> + return -EINVAL;
Leaks a. Same for returns below.
> static BlockDriver bdrv_quorum = {
> .format_name = "quorum",
> .protocol_name = "quorum",
>
> .instance_size = sizeof(BDRVQuorumState),
> +
> + .bdrv_file_open = quorum_open,
Please squash quorum_close() into this commit so the g_strdup()
filesnames[] aren't leaked on close.
- [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
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Blue Swirl, 2012/08/07
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Eric Blake, 2012/08/07
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Benoît Canet, 2012/08/10
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Kevin Wolf, 2012/08/13
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Benoît Canet, 2012/08/14
- Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Kevin Wolf, 2012/08/15
Re: [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open().,
Stefan Hajnoczi <=
[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, 2012/08/07
[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