[Devel] [PATCH 1/8] Add missing linux headers
Kir Kolyshkin
kir at openvz.org
Tue Jun 2 15:50:19 PDT 2015
Fix compilation by adding the missing vzlinux headers.
The files are taken from vzkernel sources at
https://src.openvz.org/projects/OVZ/repos/vzkernel
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
lib/include/linux/vzctl_venet.h | 53 ++++++++++++++++++++++++++++
lib/include/linux/vzctl_veth.h | 41 ++++++++++++++++++++++
lib/include/linux/vziptable_defs.h | 71 ++++++++++++++++++++++++++++++++++++++
lib/include/linux/vzlist.h | 46 ++++++++++++++++++++++++
4 files changed, 211 insertions(+)
create mode 100644 lib/include/linux/vzctl_venet.h
create mode 100644 lib/include/linux/vzctl_veth.h
create mode 100644 lib/include/linux/vziptable_defs.h
create mode 100644 lib/include/linux/vzlist.h
diff --git a/lib/include/linux/vzctl_venet.h b/lib/include/linux/vzctl_venet.h
new file mode 100644
index 0000000..2c1650b
--- /dev/null
+++ b/lib/include/linux/vzctl_venet.h
@@ -0,0 +1,53 @@
+/*
+ * include/linux/vzctl_venet.h
+ *
+ * Copyright (C) 2005 SWsoft
+ * All rights reserved.
+ *
+ * Licensing governed by "linux/COPYING.SWsoft" file.
+ *
+ */
+
+#ifndef _UAPI_VZCTL_VENET_H
+#define _UAPI_VZCTL_VENET_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#ifndef __ENVID_T_DEFINED__
+#define __ENVID_T_DEFINED__
+typedef unsigned envid_t;
+#endif
+
+#define VE_IP_ADD 1
+#define VE_IP_DEL 2
+#define VE_IP_EXT_ADD 3
+#define VE_IP_EXT_DEL 4
+
+struct vzctl_ve_ip_map {
+ envid_t veid;
+ int op;
+ struct sockaddr *addr;
+ int addrlen;
+};
+
+#define VENETCTLTYPE '('
+#define VENETCTL_VE_IP_MAP _IOW(VENETCTLTYPE, 3, struct vzctl_ve_ip_map)
+
+#ifdef __KERNEL__
+#ifdef CONFIG_COMPAT
+#include <linux/compat.h>
+
+struct compat_vzctl_ve_ip_map {
+ envid_t veid;
+ int op;
+ compat_uptr_t addr;
+ int addrlen;
+};
+
+#define VENETCTL_COMPAT_VE_IP_MAP _IOW(VENETCTLTYPE, 3, struct compat_vzctl_ve_ip_map)
+
+#endif /* CONFIG_COMPAT */
+#endif /* __KERNEL__ */
+
+#endif /* _UAPI_VZCTL_VENET_H */
diff --git a/lib/include/linux/vzctl_veth.h b/lib/include/linux/vzctl_veth.h
new file mode 100644
index 0000000..106497a
--- /dev/null
+++ b/lib/include/linux/vzctl_veth.h
@@ -0,0 +1,41 @@
+/*
+ * include/linux/vzctl_veth.h
+ *
+ * Copyright (C) 2006 SWsoft
+ * All rights reserved.
+ *
+ * Licensing governed by "linux/COPYING.SWsoft" file.
+ *
+ */
+
+#ifndef _UAPI_VZCTL_VETH_H
+#define _UAPI_VZCTL_VETH_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#ifndef __ENVID_T_DEFINED__
+#define __ENVID_T_DEFINED__
+typedef unsigned envid_t;
+#endif
+
+#define VE_ETH_ADD 1
+#define VE_ETH_DEL 2
+#define VE_ETH_ALLOW_MAC_CHANGE 3
+#define VE_ETH_DENY_MAC_CHANGE 4
+
+struct vzctl_ve_hwaddr {
+ envid_t veid;
+ int op;
+ unsigned char dev_addr[6];
+ int addrlen;
+ char dev_name[16];
+ unsigned char dev_addr_ve[6];
+ int addrlen_ve;
+ char dev_name_ve[16];
+};
+
+#define VETHCTLTYPE '['
+#define VETHCTL_VE_HWADDR _IOW(VETHCTLTYPE, 3, struct vzctl_ve_hwaddr)
+
+#endif /* _UAPI_VZCTL_VETH_H */
diff --git a/lib/include/linux/vziptable_defs.h b/lib/include/linux/vziptable_defs.h
new file mode 100644
index 0000000..4ac920a
--- /dev/null
+++ b/lib/include/linux/vziptable_defs.h
@@ -0,0 +1,71 @@
+#ifndef _UAPI_LINUX_VZIPTABLE_DEFS_H
+#define _UAPI_LINUX_VZIPTABLE_DEFS_H
+
+/*
+ * This masks represent modules
+ *
+ * Strictly speaking we use only a small subset
+ * of this bits novadays but we MUST RESERVE all
+ * the bits were ever used in a sake of ABI compatibility
+ * (ie compatibility with vzctl user-space utility)
+ *
+ * DON'T EVER DELETE/MODIFY THIS BITS
+ */
+#define VE_IPT_GENERATE(name, shift) name = (1U << shift)
+
+enum ve_ipt_mods {
+ VE_IPT_GENERATE(VE_IP_IPTABLES_MOD, 0),
+ VE_IPT_GENERATE(VE_IP_FILTER_MOD, 1),
+ VE_IPT_GENERATE(VE_IP_MANGLE_MOD, 2),
+ VE_IPT_GENERATE(VE_IP_MATCH_LIMIT_MOD, 3),
+ VE_IPT_GENERATE(VE_IP_MATCH_MULTIPORT_MOD, 4),
+ VE_IPT_GENERATE(VE_IP_MATCH_TOS_MOD, 5),
+ VE_IPT_GENERATE(VE_IP_TARGET_TOS_MOD, 6),
+ VE_IPT_GENERATE(VE_IP_TARGET_REJECT_MOD, 7),
+ VE_IPT_GENERATE(VE_IP_TARGET_TCPMSS_MOD, 8),
+ VE_IPT_GENERATE(VE_IP_MATCH_TCPMSS_MOD, 9),
+ VE_IPT_GENERATE(VE_IP_MATCH_TTL_MOD, 10),
+ VE_IPT_GENERATE(VE_IP_TARGET_LOG_MOD, 11),
+ VE_IPT_GENERATE(VE_IP_MATCH_LENGTH_MOD, 12),
+ VE_IPT_GENERATE(VE_IP_CONNTRACK_MOD, 14),
+ VE_IPT_GENERATE(VE_IP_CONNTRACK_FTP_MOD, 15),
+ VE_IPT_GENERATE(VE_IP_CONNTRACK_IRC_MOD, 16),
+ VE_IPT_GENERATE(VE_IP_MATCH_CONNTRACK_MOD, 17),
+ VE_IPT_GENERATE(VE_IP_MATCH_STATE_MOD, 18),
+ VE_IPT_GENERATE(VE_IP_MATCH_HELPER_MOD, 19),
+ VE_IPT_GENERATE(VE_IP_NAT_MOD, 20),
+ VE_IPT_GENERATE(VE_IP_NAT_FTP_MOD, 21),
+ VE_IPT_GENERATE(VE_IP_NAT_IRC_MOD, 22),
+ VE_IPT_GENERATE(VE_IP_TARGET_REDIRECT_MOD, 23),
+ VE_IPT_GENERATE(VE_IP_MATCH_OWNER_MOD, 24),
+ VE_IPT_GENERATE(VE_IP_MATCH_MAC_MOD, 25),
+ VE_IPT_GENERATE(VE_IP_IPTABLES6_MOD, 26),
+ VE_IPT_GENERATE(VE_IP_FILTER6_MOD, 27),
+ VE_IPT_GENERATE(VE_IP_MANGLE6_MOD, 28),
+ VE_IPT_GENERATE(VE_IP_IPTABLE_NAT_MOD, 29),
+ VE_IPT_GENERATE(VE_NF_CONNTRACK_MOD, 30),
+};
+
+/* these masks represent modules with their dependences */
+#define VE_IP_IPTABLES (VE_IP_IPTABLES_MOD)
+#define VE_IP_FILTER (VE_IP_FILTER_MOD | VE_IP_IPTABLES)
+#define VE_IP_MANGLE (VE_IP_MANGLE_MOD | VE_IP_IPTABLES)
+#define VE_IP_IPTABLES6 (VE_IP_IPTABLES6_MOD)
+#define VE_IP_FILTER6 (VE_IP_FILTER6_MOD | VE_IP_IPTABLES6)
+#define VE_IP_MANGLE6 (VE_IP_MANGLE6_MOD | VE_IP_IPTABLES6)
+#define VE_NF_CONNTRACK (VE_NF_CONNTRACK_MOD | VE_IP_IPTABLES)
+#define VE_IP_CONNTRACK (VE_IP_CONNTRACK_MOD | VE_IP_IPTABLES)
+#define VE_IP_CONNTRACK_FTP (VE_IP_CONNTRACK_FTP_MOD | VE_IP_CONNTRACK)
+#define VE_IP_CONNTRACK_IRC (VE_IP_CONNTRACK_IRC_MOD | VE_IP_CONNTRACK)
+#define VE_IP_NAT (VE_IP_NAT_MOD | VE_IP_CONNTRACK)
+#define VE_IP_NAT_FTP (VE_IP_NAT_FTP_MOD | VE_IP_NAT | VE_IP_CONNTRACK_FTP)
+#define VE_IP_NAT_IRC (VE_IP_NAT_IRC_MOD | VE_IP_NAT | VE_IP_CONNTRACK_IRC)
+#define VE_IP_IPTABLE_NAT (VE_IP_IPTABLE_NAT_MOD | VE_IP_CONNTRACK)
+
+/* safe iptables mask to be used by default */
+#define VE_IP_DEFAULT (VE_IP_IPTABLES | VE_IP_FILTER | VE_IP_MANGLE)
+
+#define VE_IP_NONE (0ull)
+#define VE_IP_ALL (~VE_IP_NONE)
+
+#endif /* _UAPI_LINUX_VZIPTABLE_DEFS_H */
diff --git a/lib/include/linux/vzlist.h b/lib/include/linux/vzlist.h
new file mode 100644
index 0000000..e69680e
--- /dev/null
+++ b/lib/include/linux/vzlist.h
@@ -0,0 +1,46 @@
+/*
+ * include/linux/vzlist.h
+ *
+ * Copyright (c) 2015 Parallels IP Holdings GmbH
+ *
+ */
+
+#ifndef _UAPI_LINUX_VZLIST_H
+#define _UAPI_LINUX_VZLIST_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#ifndef __KERNEL__
+#define __user
+#endif
+
+#ifndef __ENVID_T_DEFINED__
+#define __ENVID_T_DEFINED__
+typedef unsigned int envid_t;
+#endif
+
+struct vzlist_veidctl {
+ unsigned int num;
+ envid_t __user *id;
+};
+
+struct vzlist_vepidctl {
+ envid_t veid;
+ unsigned int num;
+ pid_t __user *pid;
+};
+
+struct vzlist_veipctl {
+ envid_t veid;
+ unsigned int num;
+ void __user *ip;
+};
+
+#define VZLISTTYPE 'x'
+#define VZCTL_GET_VEIDS _IOR(VZLISTTYPE, 1, struct vzlist_veidctl)
+#define VZCTL_GET_VEPIDS _IOR(VZLISTTYPE, 2, struct vzlist_vepidctl)
+#define VZCTL_GET_VEIPS _IOR(VZLISTTYPE, 3, struct vzlist_veipctl)
+#define VZCTL_GET_VEIP6S _IOR(VZLISTTYPE, 4, struct vzlist_veipctl)
+
+#endif /* _UAPI_LINUX_VZLIST_H */
--
1.9.3
More information about the Devel
mailing list