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

Re: [Xen-devel] [PATCH 1 of 9 RFC v2] blktap3: Introduce blktap3 headers



> -----Original Message-----
> From: Ian Campbell
> Sent: 18 January 2013 13:46
> To: Thanos Makatos
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Xen-devel] [PATCH 1 of 9 RFC v2] blktap3: Introduce
> blktap3 headers
> 
> On Tue, 2012-12-04 at 18:19 +0000, Thanos Makatos wrote:
> > This patch introduces basic blktap3 header files.
> >
> > diff --git a/tools/blktap3/include/blktap3.h
> b/tools/blktap3/include/blktap3.h
> > new file mode 100644
> > --- /dev/null
> > +++ b/tools/blktap3/include/blktap3.h
> > @@ -0,0 +1,47 @@
> > +/*
> > + * Copyright (C) 2012      Citrix Ltd.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version 2
> > + * of the License, or (at your option) any later version.
> 
> I see a mix of GPL and LGPL in this patch (compile.h is LGPL, this is
> GPL). That's fine if that is what you meant but it will mean the result
> is GPL.

That was accidental, I'll make compiler.h's license GPL.

> 
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301,
> > + * USA.
> > + *
> > + * Commonly used headers and definitions.
> > + */
> > +
> > +#ifndef __BLKTAP_3_H__
> > +#define __BLKTAP_3_H__
> > +
> > +#include "compiler.h"
> > +
> > +/* TODO remove from other files */
> > +#include <xen-external/bsd-sys-queue.h>
> > +
> > +#define BLKTAP3_CONTROL_NAME        "blktap-control"
> > +#define BLKTAP3_CONTROL_DIR         "/var/run/"BLKTAP3_CONTROL_NAME
> > +#define BLKTAP3_CONTROL_SOCKET      "ctl"
> > +
> > +#define BLKTAP3_ENOSPC_SIGNAL_FILE  "/var/run/tapdisk3-enospc"
> > +
> > +/*
> > + * TODO They may have to change due to macro namespacing.
> > + */
> > +#define TAILQ_MOVE_HEAD(node, src, dst, entry)     \
> > +   TAILQ_REMOVE(src, node, entry);                         \
> > +   TAILQ_INSERT_HEAD(dst, node, entry);
> > +
> > +#define TAILQ_MOVE_TAIL(node, src, dst, entry)     \
> > +   TAILQ_REMOVE(src, node, entry);                         \
> > +   TAILQ_INSERT_TAIL(dst, node, entry);
> > +
> > +#endif /* __BLKTAP_3_H__ */
> > diff --git a/tools/blktap3/include/compiler.h
> b/tools/blktap3/include/compiler.h
> > new file mode 100644
> > --- /dev/null
> > +++ b/tools/blktap3/include/compiler.h
> > @@ -0,0 +1,42 @@
> > +/*
> > + * Copyright (C) 2012      Citrix Ltd.
> > + *
> > + * This library is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later
> version.
> > + *
> > + * This library is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with this library; if not, write to the Free
> Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301
> > + * USA
> > + */
> > +
> > +#ifndef __COMPILER_H__
> > +#define __COMPILER_H__
> > +
> > +#define likely(_cond)      __builtin_expect(!!(_cond), 1)
> > +#define unlikely(_cond)    __builtin_expect(!!(_cond), 0)
> > +
> > +/*
> > + * FIXME taken from list.h, do we need to mention anything about the
> license?
> 
> In general a good idea to. I assume it is GPL which is not the license
> at the head of this file (which is LGPL).
> 
> You could use the LGPL tools/libxl/libxl_internal.h:CONTAINER_OF
> instead, you could even change the name to containerof...

That would work, should I include tools/libxl/libxl_internal.h or just copy 
CONTAINER_OF's definition?

> 
> > + */
> > +#define containerof(_ptr, _type, _memb) \
> > +   ((_type*)((void*)(_ptr) - offsetof(_type, _memb)))
> > +
> > +#define __printf(a, b)     __attribute__((format(printf, a, b)))
> > +#define __scanf(_f, _a) __attribute__((format (scanf, _f, _a)))
> > +
> > +#ifndef ARRAY_SIZE
> 
> Is someone leaking this into your scope? Can we fix them?

Ok.

> 
> > +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> > +#endif /* ARRAY_SIZE */
> > +
> > +#define UNUSED_PARAMETER(x) \
> > +    (void)(x);
> > +
> > +#endif /* __COMPILER_H__ */
> >
> > _______________________________________________
> > 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®.