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

Re: [Xen-devel] [Problem] about src/xen/include/public/io/ring.h



On Mon, Apr 08, 2013 at 04:10:49PM +0800, éç wrote:
> Hi,
>     there is a macro in io/ring.h as follows:
> 
> 211#define RING_HAS_UNCONSUMED_REQUESTS(_r) ({
> \                                         |
> 212    unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;
>  \
> 213    unsigned int rsp = RING_SIZE(_r) -
>  \
> 214        ((_r)->req_cons - (_r)->rsp_prod_pvt);
>  \
> 215    req < rsp ? req : rsp;
>  \
> 216})
> 
> Anyone could explain this?

Which part are you unclear about?

I might be easier if you deconstruct the macro and write out
inthe code. That should give you an idea of what it does.
<hint: Figure out first what RING_SIZE comes out to>

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


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