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

Re: [Xen-devel] [PATCH RFC 13/20] libxc/migration: add try_read_record()



On Mon, Mar 27, 2017 at 05:06:25AM -0400, Joshua Otto wrote:
[...]
>  
> +int try_read_record(struct xc_sr_read_record_context *rrctx, int fd,
> +                    struct xc_sr_record *rec)
> +{
> +    int rc;
> +    xc_interface *xch = rrctx->ctx->xch;
> +    size_t offset_out, dataoff, datasz;
> +
> +    /* If the header isn't yet complete, attempt to finish it first. */
> +    if ( rrctx->offset < sizeof(rrctx->rhdr) )
> +    {
> +        rc = try_read_exact(fd, (char *)&rrctx->rhdr + rrctx->offset,
> +                            sizeof(rrctx->rhdr) - rrctx->offset, 
> &offset_out);
> +        rrctx->offset += offset_out;
> +
> +        if ( rc )
> +            return rc;
> +        else
> +            assert(rrctx->offset == sizeof(rrctx->rhdr));

No need to have the "else" branch.

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

 


Rackspace

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