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

Re: [Xen-devel] [PATCH 5 of 9 RFC v2] blktap3/libblktapctl: Introduce functionality used by tapback to instruct tapdisk to connect to the sring



On Tue, 2012-12-04 at 18:19 +0000, Thanos Makatos wrote:

> +    err = tap_ctl_connect_send_and_receive(pid, &message, NULL);
> +    if (err)
> +        return err;
> +
> +    if (message.type == TAPDISK_MESSAGE_XENBLKIF_CONNECT_RSP)
> +        err = -message.u.response.error;
> +    else
> +        err = -EINVAL;
> +
> +    return err;
> +}
> +
> +int tap_ctl_disconnect_xenblkif(pid_t pid, int minor, domid_t domid,
> +        int devid, struct timeval *timeout)
> +{
> +    tapdisk_message_t message;
> +    int err;
> +
> +    memset(&message, 0, sizeof(message));
> +    message.type = TAPDISK_MESSAGE_XENBLKIF_DISCONNECT;
> +    message.cookie = minor;
> +    message.u.blkif.domid = domid;
> +    message.u.blkif.devid = devid;
> +
> +    err = tap_ctl_connect_send_and_receive(pid, &message, timeout);

In the code above you had an "if err return err" here. I'd expect them
to behave similarly, whichever is right.

If this is a common pattern it might be something to consider pushing
into tap_ctl_connect_send_and_receive.

> +    if (message.type == TAPDISK_MESSAGE_XENBLKIF_CONNECT_RSP)

CONNECT_RSP to a DISCONNECT message?

> +        err = -message.u.response.error;
> +    else
> +        err = -EINVAL;
> +
> +    return err;
> +}



_______________________________________________
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®.