|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V3] libxl: write IO ABI for disk frontends
On Thu, 2013-04-25 at 22:36 +0100, Wei Liu wrote:
> @@ -2156,6 +2166,24 @@ static void device_disk_add(libxl__egc *egc, uint32_t
> domid,
> flexarray_append(front, "device-type");
> flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
>
> + /*
> + * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
> + * write disk native protocol to frontend node. Xend does this, port
> + * this behaviour to xl.
> + *
> + * New kernels write this node themselves. In that case it just
> + * overwrites an existing node which is OK.
> + */
> + if (type == LIBXL_DOMAIN_TYPE_PV) {
> + protocol = xc_domain_get_native_protocol(ctx->xch, domid);
You can declare protocol here instead of globally in the function. The =
NULL is also redundant.
> + if (protocol) {
> + strncpy(p, protocol, strlen(protocol));
> + p[strlen(protocol)] = 0;
> + flexarray_append(front, "protocol");
> + flexarray_append(front, p);
GCSPRINTF would be the right way to do this, but actually you can pass
protocol directly to flexarray_append, that is fine since the flexarray
never frees the values which it contains so they either need to be gc'd,
string constants or managed manually.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |