[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC Patch v3 10/18] block-remus: pass uuid to the callback td_open



On Sep 5, 2014 5:15 AM, "Wen Congyang" <wency@xxxxxxxxxxxxxx> wrote:
>
> remus's callback td_open needs uuid, but it is hard coded as 0.
> After commit 4b1af8, the vbd's uuid is the minor of the blktap
> device, not 0.
>
> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
> Cc: Shriram Rajagopalan <rshriram@xxxxxxxxx>
> ---
> Âtools/blktap2/drivers/block-aio.c    Â| 3 ++-
> Âtools/blktap2/drivers/block-cache.c   Â| 3 ++-
> Âtools/blktap2/drivers/block-log.c    Â| 3 ++-
> Âtools/blktap2/drivers/block-qcow.c    | 3 ++-
> Âtools/blktap2/drivers/block-ram.c    Â| 3 ++-
> Âtools/blktap2/drivers/block-remus.c   Â| 8 ++------
> Âtools/blktap2/drivers/block-vhd.c    Â| 3 ++-
> Âtools/blktap2/drivers/tapdisk-interface.c | 4 +++-
> Âtools/blktap2/drivers/tapdisk.h     Â| 2 +-
> Â9 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/tools/blktap2/drivers/block-aio.c b/tools/blktap2/drivers/block-aio.c
> index 10ab20b..1b560e5 100644
> --- a/tools/blktap2/drivers/block-aio.c
> +++ b/tools/blktap2/drivers/block-aio.c
> @@ -111,7 +111,8 @@ static int tdaio_get_image_info(int fd, td_disk_info_t *info)
> Â}
>
> Â/* Open the disk file and initialize aio state. */
> -int tdaio_open(td_driver_t *driver, const char *name, td_flag_t flags)
> +int tdaio_open(td_driver_t *driver, const char *name, td_flag_t flags,
> +Â Â Â Â Â Â Â td_uuid_t uuid)
> Â{
> Â Â Â Â int i, fd, ret, o_flags;
> Â Â Â Â struct tdaio_state *prv;
> diff --git a/tools/blktap2/drivers/block-cache.c b/tools/blktap2/drivers/block-cache.c
> index 1d2f4eb..cd6ea6a 100644
> --- a/tools/blktap2/drivers/block-cache.c
> +++ b/tools/blktap2/drivers/block-cache.c
> @@ -517,7 +517,8 @@ block_cache_put_request(block_cache_t *cache, block_cache_request_t *breq)
> Â}
>
> Âstatic int
> -block_cache_open(td_driver_t *driver, const char *name, td_flag_t flags)
> +block_cache_open(td_driver_t *driver, const char *name, td_flag_t flags,
> +Â Â Â Â Â Â Â Â td_uuid_t uuid)
> Â{
> Â Â Â Â int i, err;
> Â Â Â Â radix_tree_t *tree;
> diff --git a/tools/blktap2/drivers/block-log.c b/tools/blktap2/drivers/block-log.c
> index 5330cdc..7b33b63 100644
> --- a/tools/blktap2/drivers/block-log.c
> +++ b/tools/blktap2/drivers/block-log.c
> @@ -585,7 +585,8 @@ static void ctl_request(event_id_t id, char mode, void *private)
>
> Âstatic int tdlog_close(td_driver_t*);
>
> -static int tdlog_open(td_driver_t* driver, const char* name, td_flag_t flags)
> +static int tdlog_open(td_driver_t* driver, const char* name, td_flag_t flags,
> +Â Â Â Â Â Â Â Â Â Â Âtd_uuid_t uuid)
> Â{
> Â Âstruct tdlog_state* s = (struct tdlog_state*)driver->data;
> Â Âint rc;
> diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
> index b45bcaa..64dfafc 100644
> --- a/tools/blktap2/drivers/block-qcow.c
> +++ b/tools/blktap2/drivers/block-qcow.c
> @@ -865,7 +865,8 @@ out:
> Â}
>
> Â/* Open the disk file and initialize qcow state. */
> -int tdqcow_open (td_driver_t *driver, const char *name, td_flag_t flags)
> +int tdqcow_open (td_driver_t *driver, const char *name, td_flag_t flags,
> +Â Â Â Â Â Â Â Â td_uuid_t uuid)
> Â{
> Â Â Â Â int fd, len, i, ret, size, o_flags;
> Â Â Â Â td_disk_info_t *bs = &(driver->info);
> diff --git a/tools/blktap2/drivers/block-ram.c b/tools/blktap2/drivers/block-ram.c
> index a859481..b64a194 100644
> --- a/tools/blktap2/drivers/block-ram.c
> +++ b/tools/blktap2/drivers/block-ram.c
> @@ -108,7 +108,8 @@ static int get_image_info(int fd, td_disk_info_t *info)
> Â}
>
> Â/* Open the disk file and initialize ram state. */
> -int tdram_open (td_driver_t *driver, const char *name, td_flag_t flags)
> +int tdram_open (td_driver_t *driver, const char *name, td_flag_t flags,
> +Â Â Â Â Â Â Â Âtd_uuid_t uuid)
> Â{
> Â Â Â Â char *p;
> Â Â Â Â uint64_t size;
> diff --git a/tools/blktap2/drivers/block-remus.c b/tools/blktap2/drivers/block-remus.c
> index 4ce9dbe..504f6b4 100644
> --- a/tools/blktap2/drivers/block-remus.c
> +++ b/tools/blktap2/drivers/block-remus.c
> @@ -1633,18 +1633,14 @@ static int ctl_register(struct tdremus_state *s)
> Â/* interface */
>
> Âstatic int tdremus_open(td_driver_t *driver, const char *name,
> -Â Â Â Â Â Â Â Â Â Â Â Âtd_flag_t flags)
> +Â Â Â Â Â Â Â Â Â Â Â Âtd_flag_t flags, td_uuid_t uuid)
> Â{
> Â Â Â Â struct tdremus_state *s = (struct tdremus_state *)driver->data;
> Â Â Â Â int rc;
>
> Â Â Â Â RPRINTF("opening %s\n", name);
>
> -Â Â Â Â/* first we need to get the underlying vbd for this driver stack. To do so we
> -Â Â Â Â * need to know the vbd's id. Fortunately, for tapdisk2 this is hard-coded as
> -Â Â Â Â * 0 (see tapdisk2.c)
> -Â Â Â Â */
> -Â Â Â Âdevice_vbd = tapdisk_server_get_vbd(0);
> +Â Â Â Âdevice_vbd = tapdisk_server_get_vbd(uuid);
>
> Â Â Â Â memset(s, 0, sizeof(*s));
> Â Â Â Â s->server_fd.fd = -1;
> diff --git a/tools/blktap2/drivers/block-vhd.c b/tools/blktap2/drivers/block-vhd.c
> index 76ea5bd..06e9c89 100644
> --- a/tools/blktap2/drivers/block-vhd.c
> +++ b/tools/blktap2/drivers/block-vhd.c
> @@ -675,7 +675,8 @@ __vhd_open(td_driver_t *driver, const char *name, vhd_flag_t flags)
> Â}
>
> Âstatic int
> -_vhd_open(td_driver_t *driver, const char *name, td_flag_t flags)
> +_vhd_open(td_driver_t *driver, const char *name, td_flag_t flags,
> +Â Â Â Â Âtd_uuid_t uuid)
> Â{
> Â Â Â Â vhd_flag_t vhd_flags = 0;
>
> diff --git a/tools/blktap2/drivers/tapdisk-interface.c b/tools/blktap2/drivers/tapdisk-interface.c
> index 2e51883..36b5393 100644
> --- a/tools/blktap2/drivers/tapdisk-interface.c
> +++ b/tools/blktap2/drivers/tapdisk-interface.c
> @@ -63,6 +63,7 @@ __td_open(td_image_t *image, td_disk_info_t *info)
> Â{
> Â Â Â Â int err;
> Â Â Â Â td_driver_t *driver;
> +Â Â Â Âtd_vbd_t *vbd = image->private;
>
> Â Â Â Â driver = image->driver;
> Â Â Â Â if (!driver) {
> @@ -78,7 +79,8 @@ __td_open(td_image_t *image, td_disk_info_t *info)
> Â Â Â Â }
>
> Â Â Â Â if (!td_flag_test(driver->state, TD_DRIVER_OPEN)) {
> -Â Â Â Â Â Â Â Âerr = driver->ops->td_open(driver, image->name, image->flags);
> +Â Â Â Â Â Â Â Âerr = driver->ops->td_open(driver, image->name, image->flags,
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â vbd->uuid);
> Â Â Â Â Â Â Â Â if (err) {
> Â Â Â Â Â Â Â Â Â Â Â Â if (!image->driver)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tapdisk_driver_free(driver);
> diff --git a/tools/blktap2/drivers/tapdisk.h b/tools/blktap2/drivers/tapdisk.h
> index 66d508e..459eaec 100644
> --- a/tools/blktap2/drivers/tapdisk.h
> +++ b/tools/blktap2/drivers/tapdisk.h
> @@ -157,7 +157,7 @@ struct tap_disk {
>     const char         *disk_type;
>     td_flag_t          flags;
>     int             private_data_size;
> -Â Â Â Âint (*td_open)Â Â Â Â Â Â Â Â(td_driver_t *, const char *, td_flag_t);
> +Â Â Â Âint (*td_open)Â Â Â Â Â Â Â Â(td_driver_t *, const char *, td_flag_t, td_uuid_t);
> Â Â Â Â int (*td_close)Â Â Â Â Â Â Â (td_driver_t *);
> Â Â Â Â int (*td_get_parent_id)Â Â Â (td_driver_t *, td_disk_id_t *);
> Â Â Â Â int (*td_validate_parent)Â Â (td_driver_t *, td_driver_t *, td_flag_t);
> --
> 1.9.3
>

Acked-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.