[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1 of 9 RFC v2] blktap3: Introduce blktap3 headers
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. + * + * 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? + */ +#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 +#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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |