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

Re: [Xen-devel] [PATCH 1 of 7 v2] blktap3/tapback: Introduce core defines and structure definitions



On Fri, 2013-01-04 at 12:14 +0000, Thanos Makatos wrote:
> +#define BUG_ON(_cond)       \
> +    if (unlikely(_cond)) {  \
> +        assert(0);          \

This is basically a fancy way to write "assert(!_cond)" I think? I don't
imagine that the unlikely will make a measurable difference for you but
the downside is that a clever assert will print out the condition, so
you get
        assertion failed: 0
instead of 
        assertion failed: <_cond>

So you might almost as well use either abort() or       
        if (unlikely(_cond))
                assert(!_cond)

(evaluating cond twice won't hurt much under the circumstances, and the
compiler will probably optimise that anyway)

> +    }
> +
> +/*
> + * XenStore path components.
> + *
> + * To avoid confusion with blktap2, we'll use a new kind of device for libxl
> + * defining it in tools/libxl/libxl_types_internal.idl. This will be done by
> + * the patch that adds libxl support for blktap3. TODO When that patch is 
> sent,
> + * use the definition from there instead of hard-coding it here.
> + */
> +#define XENSTORE_BACKEND        "backend"
> +#define BLKTAP3_BACKEND_NAME    "xenio"

tapback?

> +#define BLKTAP3_BACKEND_PATH    XENSTORE_BACKEND"/"BLKTAP3_BACKEND_NAME
> +#define BLKTAP3_BACKEND_TOKEN   XENSTORE_BACKEND"-"BLKTAP3_BACKEND_NAME
> +#define BLKTAP3_FRONTEND_TOKEN  "otherend-state"
> +#define BLKTAP3_SERIAL          BLKTAP3_BACKEND_NAME"-serial"

I'm not sure all of these are worth a #define, but I'm not yet sure what
they are used for.

> + * TODO Put the rest of the front-end nodes defined in blkif.h here and group
> + * them. e.g. FRONTEND_NODE_xxx.
> + */
> +#define RING_REF                "ring-ref"
> +#define FEAT_PERSIST            "feature-persistent"
> +/**
> + * Iterates over all devices and returns the one for which the condition is
> + * true.
> + */
> +#define tapback_backend_find_device(_device, _cond)          \
> +do {                                                                         
>                         \
> +     vbd_t *__next;                                                          
>         \
> +     int found = 0;                                                          
>                 \
> +     tapback_backend_for_each_device(_device, __next) {      \
> +             if (_cond) {                                                    
>                 \
> +                     found = 1;                                              
>                         \
> +                     break;                                                  
>                         \
> +             }                                                               
>                                 \
> +     }                                                                       
>                                 \
> +     if (!found)                                                             
>                         \
> +             _device = NULL;                                                 
>                 \
> +} while (0)

Whitespace...



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