[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


  • To: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
  • From: Thanos Makatos <thanos.makatos@xxxxxxxxxx>
  • Date: Mon, 21 Jan 2013 18:16:44 +0000
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 21 Jan 2013 18:17:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac31g17+tTSAeVF9RT21XivJFgElqgCf3QLw
  • Thread-topic: [Xen-devel] [PATCH 5 of 9 RFC v2] blktap3/libblktapctl: Introduce functionality used by tapback to instruct tapdisk to connect to the sring

> > +    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.

An omission, I'll fix it.

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

I'll put it in tap_ctl_send_and_receive as it fits better there.

> 
> > +    if (message.type == TAPDISK_MESSAGE_XENBLKIF_CONNECT_RSP)
> 
> CONNECT_RSP to a DISCONNECT message?

An omission, I'll fix it.

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