From: Arkadiusz Miƛkiewicz Date: Fri, 14 Dec 2012 07:59:47 +0000 (+0100) Subject: - builds now but we'll wait for 3.7.1 (this 3.7.0 vserver patch contains unneded... X-Git-Tag: auto/th/kernel-3.7.1-1~3 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=2ba6f0dd4134d77f76372300a8aee24efb751004;p=packages%2Fkernel.git - builds now but we'll wait for 3.7.1 (this 3.7.0 vserver patch contains unneded/unwanted test patches) --- diff --git a/kernel-vserver-2.3.patch b/kernel-vserver-2.3.patch index 9bf1d63a..057765da 100644 --- a/kernel-vserver-2.3.patch +++ b/kernel-vserver-2.3.patch @@ -26154,3 +26154,2979 @@ diff -NurpP linux-3.7-vs2.3.5.1/kernel/vserver/network.c linux-3.7-vs2.3.5.1.1/k return NF_DROP; nfct_nat(ct)->masq_index = par->out->ifindex; +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/Kbuild linux-3.7-vs2.3.5.1.3-uapi/include/linux/Kbuild +--- linux-3.7-vs2.3.5.1.3/include/linux/Kbuild 2012-12-11 16:09:38.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/Kbuild 2012-12-13 22:09:10.000000000 +0000 +@@ -3,4 +3,3 @@ header-y += hdlc/ + header-y += hsi/ + header-y += raid/ + header-y += usb/ +-header-y += vserver/ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/Kbuild linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/Kbuild +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/Kbuild 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/Kbuild 1970-01-01 00:00:00.000000000 +0000 +@@ -1,8 +0,0 @@ +- +-header-y += context_cmd.h network_cmd.h space_cmd.h \ +- cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \ +- inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \ +- debug_cmd.h device_cmd.h +- +-header-y += switch.h network.h monitor.h inode.h device.h +- +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/base.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/base.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/base.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/base.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_BASE_H +-#define _VX_BASE_H ++#ifndef _VSERVER_BASE_H ++#define _VSERVER_BASE_H + + + /* context state changes */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_CACCT_H +-#define _VX_CACCT_H ++#ifndef _VSERVER_CACCT_H ++#define _VSERVER_CACCT_H + + + enum sock_acc_field { +@@ -12,4 +12,4 @@ enum sock_acc_field { + VXA_SOCK_SIZE /* array size */ + }; + +-#endif /* _VX_CACCT_H */ ++#endif /* _VSERVER_CACCT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,23 +1,10 @@ +-#ifndef _VX_CACCT_CMD_H +-#define _VX_CACCT_CMD_H +- +- +-/* virtual host info name commands */ +- +-#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0) +- +-struct vcmd_sock_stat_v0 { +- uint32_t field; +- uint32_t count[3]; +- uint64_t total[3]; +-}; +- ++#ifndef _VSERVER_CACCT_CMD_H ++#define _VSERVER_CACCT_CMD_H + +-#ifdef __KERNEL__ + + #include ++#include + + extern int vc_sock_stat(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CACCT_CMD_H */ ++#endif /* _VSERVER_CACCT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_def.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_def.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_def.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_def.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_CACCT_DEF_H +-#define _VX_CACCT_DEF_H ++#ifndef _VSERVER_CACCT_DEF_H ++#define _VSERVER_CACCT_DEF_H + + #include + #include +@@ -40,4 +40,4 @@ static inline void __dump_vx_cacct(struc + + #endif + +-#endif /* _VX_CACCT_DEF_H */ ++#endif /* _VSERVER_CACCT_DEF_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_int.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_int.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cacct_int.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cacct_int.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,8 +1,5 @@ +-#ifndef _VX_CACCT_INT_H +-#define _VX_CACCT_INT_H +- +- +-#ifdef __KERNEL__ ++#ifndef _VSERVER_CACCT_INT_H ++#define _VSERVER_CACCT_INT_H + + static inline + unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos) +@@ -17,5 +14,4 @@ unsigned long vx_sock_total(struct _vx_c + return atomic_long_read(&cacct->sock[type][pos].total); + } + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CACCT_INT_H */ ++#endif /* _VSERVER_CACCT_INT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/check.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/check.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/check.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/check.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VS_CHECK_H +-#define _VS_CHECK_H ++#ifndef _VSERVER_CHECK_H ++#define _VSERVER_CHECK_H + + + #define MAX_S_CONTEXT 65535 /* Arbitrary limit */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/context.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/context.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/context.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/context.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,88 +1,11 @@ +-#ifndef _VX_CONTEXT_H +-#define _VX_CONTEXT_H +- +-#include +-#include +- +- +-/* context flags */ +- +-#define VXF_INFO_SCHED 0x00000002 +-#define VXF_INFO_NPROC 0x00000004 +-#define VXF_INFO_PRIVATE 0x00000008 +- +-#define VXF_INFO_INIT 0x00000010 +-#define VXF_INFO_HIDE 0x00000020 +-#define VXF_INFO_ULIMIT 0x00000040 +-#define VXF_INFO_NSPACE 0x00000080 +- +-#define VXF_SCHED_HARD 0x00000100 +-#define VXF_SCHED_PRIO 0x00000200 +-#define VXF_SCHED_PAUSE 0x00000400 +- +-#define VXF_VIRT_MEM 0x00010000 +-#define VXF_VIRT_UPTIME 0x00020000 +-#define VXF_VIRT_CPU 0x00040000 +-#define VXF_VIRT_LOAD 0x00080000 +-#define VXF_VIRT_TIME 0x00100000 +- +-#define VXF_HIDE_MOUNT 0x01000000 +-/* was VXF_HIDE_NETIF 0x02000000 */ +-#define VXF_HIDE_VINFO 0x04000000 +- +-#define VXF_STATE_SETUP (1ULL << 32) +-#define VXF_STATE_INIT (1ULL << 33) +-#define VXF_STATE_ADMIN (1ULL << 34) +- +-#define VXF_SC_HELPER (1ULL << 36) +-#define VXF_REBOOT_KILL (1ULL << 37) +-#define VXF_PERSISTENT (1ULL << 38) +- +-#define VXF_FORK_RSS (1ULL << 48) +-#define VXF_PROLIFIC (1ULL << 49) +- +-#define VXF_IGNEG_NICE (1ULL << 52) +- +-#define VXF_ONE_TIME (0x0007ULL << 32) +- +-#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN) +- +- +-/* context migration */ +- +-#define VXM_SET_INIT 0x00000001 +-#define VXM_SET_REAPER 0x00000002 +- +-/* context caps */ +- +-#define VXC_SET_UTSNAME 0x00000001 +-#define VXC_SET_RLIMIT 0x00000002 +-#define VXC_FS_SECURITY 0x00000004 +-#define VXC_FS_TRUSTED 0x00000008 +-#define VXC_TIOCSTI 0x00000010 +- +-/* was VXC_RAW_ICMP 0x00000100 */ +-#define VXC_SYSLOG 0x00001000 +-#define VXC_OOM_ADJUST 0x00002000 +-#define VXC_AUDIT_CONTROL 0x00004000 +- +-#define VXC_SECURE_MOUNT 0x00010000 +-#define VXC_SECURE_REMOUNT 0x00020000 +-#define VXC_BINARY_MOUNT 0x00040000 +- +-#define VXC_QUOTA_CTL 0x00100000 +-#define VXC_ADMIN_MAPPER 0x00200000 +-#define VXC_ADMIN_CLOOP 0x00400000 +- +-#define VXC_KTHREAD 0x01000000 +-#define VXC_NAMESPACE 0x02000000 +- ++#ifndef _VSERVER_CONTEXT_H ++#define _VSERVER_CONTEXT_H + +-#ifdef __KERNEL__ + + #include + #include + #include ++#include + + #include "limit_def.h" + #include "sched_def.h" +@@ -184,5 +107,4 @@ extern int vx_migrate_task(struct task_s + extern long vs_state_change(struct vx_info *, unsigned int); + + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CONTEXT_H */ ++#endif /* _VSERVER_CONTEXT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/context_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/context_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/context_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/context_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,162 +1,33 @@ +-#ifndef _VX_CONTEXT_CMD_H +-#define _VX_CONTEXT_CMD_H +- +- +-/* vinfo commands */ ++#ifndef _VSERVER_CONTEXT_CMD_H ++#define _VSERVER_CONTEXT_CMD_H + +-#define VCMD_task_xid VC_CMD(VINFO, 1, 0) ++#include + +-#ifdef __KERNEL__ + extern int vc_task_xid(uint32_t); + +-#endif /* __KERNEL__ */ +- +-#define VCMD_vx_info VC_CMD(VINFO, 5, 0) +- +-struct vcmd_vx_info_v0 { +- uint32_t xid; +- uint32_t initpid; +- /* more to come */ +-}; +- +-#ifdef __KERNEL__ + extern int vc_vx_info(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +-#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0) +- +-struct vcmd_ctx_stat_v0 { +- uint32_t usecnt; +- uint32_t tasks; +- /* more to come */ +-}; +- +-#ifdef __KERNEL__ + extern int vc_ctx_stat(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +-/* context commands */ +- +-#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0) +-#define VCMD_ctx_create VC_CMD(VPROC, 1, 1) +- +-struct vcmd_ctx_create { +- uint64_t flagword; +-}; +- +-#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0) +-#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1) +- +-struct vcmd_ctx_migrate { +- uint64_t flagword; +-}; +- +-#ifdef __KERNEL__ + extern int vc_ctx_create(uint32_t, void __user *); + extern int vc_ctx_migrate(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* flag commands */ +- +-#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0) +-#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0) +- +-struct vcmd_ctx_flags_v0 { +- uint64_t flagword; +- uint64_t mask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_cflags(struct vx_info *, void __user *); + extern int vc_set_cflags(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* context caps commands */ +- +-#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1) +-#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1) +- +-struct vcmd_ctx_caps_v1 { +- uint64_t ccaps; +- uint64_t cmask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_ccaps(struct vx_info *, void __user *); + extern int vc_set_ccaps(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* bcaps commands */ +- +-#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0) +-#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0) +- +-struct vcmd_bcaps { +- uint64_t bcaps; +- uint64_t bmask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_bcaps(struct vx_info *, void __user *); + extern int vc_set_bcaps(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* umask commands */ +- +-#define VCMD_get_umask VC_CMD(FLAGS, 13, 0) +-#define VCMD_set_umask VC_CMD(FLAGS, 14, 0) +- +-struct vcmd_umask { +- uint64_t umask; +- uint64_t mask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_umask(struct vx_info *, void __user *); + extern int vc_set_umask(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* wmask commands */ +- +-#define VCMD_get_wmask VC_CMD(FLAGS, 15, 0) +-#define VCMD_set_wmask VC_CMD(FLAGS, 16, 0) +- +-struct vcmd_wmask { +- uint64_t wmask; +- uint64_t mask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_wmask(struct vx_info *, void __user *); + extern int vc_set_wmask(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* OOM badness */ +- +-#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0) +-#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0) +- +-struct vcmd_badness_v0 { +- int64_t bias; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_badness(struct vx_info *, void __user *); + extern int vc_set_badness(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CONTEXT_CMD_H */ ++#endif /* _VSERVER_CONTEXT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,8 +1,5 @@ +-#ifndef _VX_CVIRT_H +-#define _VX_CVIRT_H +- +- +-#ifdef __KERNEL__ ++#ifndef _VSERVER_CVIRT_H ++#define _VSERVER_CVIRT_H + + struct timespec; + +@@ -18,5 +15,4 @@ void vx_update_load(struct vx_info *); + + int vx_do_syslog(int, char __user *, int); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CVIRT_H */ ++#endif /* _VSERVER_CVIRT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,53 +1,13 @@ +-#ifndef _VX_CVIRT_CMD_H +-#define _VX_CVIRT_CMD_H +- +- +-/* virtual host info name commands */ +- +-#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0) +-#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0) +- +-struct vcmd_vhi_name_v0 { +- uint32_t field; +- char name[65]; +-}; +- +- +-enum vhi_name_field { +- VHIN_CONTEXT = 0, +- VHIN_SYSNAME, +- VHIN_NODENAME, +- VHIN_RELEASE, +- VHIN_VERSION, +- VHIN_MACHINE, +- VHIN_DOMAINNAME, +-}; +- ++#ifndef _VSERVER_CVIRT_CMD_H ++#define _VSERVER_CVIRT_CMD_H + +-#ifdef __KERNEL__ + + #include ++#include + + extern int vc_set_vhi_name(struct vx_info *, void __user *); + extern int vc_get_vhi_name(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +-#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0) +- +-struct vcmd_virt_stat_v0 { +- uint64_t offset; +- uint64_t uptime; +- uint32_t nr_threads; +- uint32_t nr_running; +- uint32_t nr_uninterruptible; +- uint32_t nr_onhold; +- uint32_t nr_forks; +- uint32_t load[3]; +-}; +- +-#ifdef __KERNEL__ + extern int vc_virt_stat(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CVIRT_CMD_H */ ++#endif /* _VSERVER_CVIRT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt_def.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt_def.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/cvirt_def.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/cvirt_def.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_CVIRT_DEF_H +-#define _VX_CVIRT_DEF_H ++#ifndef _VSERVER_CVIRT_DEF_H ++#define _VSERVER_CVIRT_DEF_H + + #include + #include +@@ -77,4 +77,4 @@ static inline void __dump_vx_cvirt(struc + + #endif + +-#endif /* _VX_CVIRT_DEF_H */ ++#endif /* _VSERVER_CVIRT_DEF_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/debug.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/debug.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/debug.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/debug.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_DEBUG_H +-#define _VX_DEBUG_H ++#ifndef _VSERVER_DEBUG_H ++#define _VSERVER_DEBUG_H + + + #define VXD_CBIT(n, m) (vs_debug_ ## n & (1 << (m))) +@@ -142,4 +142,4 @@ void dump_vx_info_inactive(int); + #endif + + +-#endif /* _VX_DEBUG_H */ ++#endif /* _VSERVER_DEBUG_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/debug_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/debug_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/debug_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/debug_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,28 +1,8 @@ +-#ifndef _VX_DEBUG_CMD_H +-#define _VX_DEBUG_CMD_H +- +- +-/* debug commands */ +- +-#define VCMD_dump_history VC_CMD(DEBUG, 1, 0) +- +-#define VCMD_read_history VC_CMD(DEBUG, 5, 0) +-#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0) +- +-struct vcmd_read_history_v0 { +- uint32_t index; +- uint32_t count; +- char __user *data; +-}; +- +-struct vcmd_read_monitor_v0 { +- uint32_t index; +- uint32_t count; +- char __user *data; +-}; ++#ifndef _VSERVER_DEBUG_CMD_H ++#define _VSERVER_DEBUG_CMD_H + ++#include + +-#ifdef __KERNEL__ + + #ifdef CONFIG_COMPAT + +@@ -54,5 +34,4 @@ extern int vc_read_monitor_x32(uint32_t, + + #endif /* CONFIG_COMPAT */ + +-#endif /* __KERNEL__ */ +-#endif /* _VX_DEBUG_CMD_H */ ++#endif /* _VSERVER_DEBUG_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/device.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/device.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,15 +1,9 @@ +-#ifndef _VX_DEVICE_H +-#define _VX_DEVICE_H +- +- +-#define DATTR_CREATE 0x00000001 +-#define DATTR_OPEN 0x00000002 +- +-#define DATTR_REMAP 0x00000010 ++#ifndef _VSERVER_DEVICE_H ++#define _VSERVER_DEVICE_H + +-#define DATTR_MASK 0x00000013 + ++#include + +-#else /* _VX_DEVICE_H */ ++#else /* _VSERVER_DEVICE_H */ + #warning duplicate inclusion +-#endif /* _VX_DEVICE_H */ ++#endif /* _VSERVER_DEVICE_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/device_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/device_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,20 +1,8 @@ +-#ifndef _VX_DEVICE_CMD_H +-#define _VX_DEVICE_CMD_H +- +- +-/* device vserver commands */ +- +-#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0) +-#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0) +- +-struct vcmd_set_mapping_v0 { +- const char __user *device; +- const char __user *target; +- uint32_t flags; +-}; ++#ifndef _VSERVER_DEVICE_CMD_H ++#define _VSERVER_DEVICE_CMD_H + ++#include + +-#ifdef __KERNEL__ + + #ifdef CONFIG_COMPAT + +@@ -40,5 +28,4 @@ extern int vc_unset_mapping_x32(struct v + + #endif /* CONFIG_COMPAT */ + +-#endif /* __KERNEL__ */ +-#endif /* _VX_DEVICE_CMD_H */ ++#endif /* _VSERVER_DEVICE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/device_def.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device_def.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/device_def.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/device_def.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_DEVICE_DEF_H +-#define _VX_DEVICE_DEF_H ++#ifndef _VSERVER_DEVICE_DEF_H ++#define _VSERVER_DEVICE_DEF_H + + #include + +@@ -14,4 +14,4 @@ struct _vx_device { + #endif + }; + +-#endif /* _VX_DEVICE_DEF_H */ ++#endif /* _VSERVER_DEVICE_DEF_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/dlimit.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/dlimit.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/dlimit.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/dlimit.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_DLIMIT_H +-#define _VX_DLIMIT_H ++#ifndef _VSERVER_DLIMIT_H ++#define _VSERVER_DLIMIT_H + + #include "switch.h" + +@@ -49,6 +49,6 @@ extern void vx_vsi_statfs(struct super_b + typedef uint64_t dlsize_t; + + #endif /* __KERNEL__ */ +-#else /* _VX_DLIMIT_H */ ++#else /* _VSERVER_DLIMIT_H */ + #warning duplicate inclusion +-#endif /* _VX_DLIMIT_H */ ++#endif /* _VSERVER_DLIMIT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/dlimit_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/dlimit_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/dlimit_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/dlimit_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,70 +1,8 @@ +-#ifndef _VX_DLIMIT_CMD_H +-#define _VX_DLIMIT_CMD_H +- +- +-/* dlimit vserver commands */ +- +-#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0) +-#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0) +- +-#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0) +-#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0) +- +-struct vcmd_ctx_dlimit_base_v0 { +- const char __user *name; +- uint32_t flags; +-}; +- +-struct vcmd_ctx_dlimit_v0 { +- const char __user *name; +- uint32_t space_used; /* used space in kbytes */ +- uint32_t space_total; /* maximum space in kbytes */ +- uint32_t inodes_used; /* used inodes */ +- uint32_t inodes_total; /* maximum inodes */ +- uint32_t reserved; /* reserved for root in % */ +- uint32_t flags; +-}; +- +-#define CDLIM_UNSET ((uint32_t)0UL) +-#define CDLIM_INFINITY ((uint32_t)~0UL) +-#define CDLIM_KEEP ((uint32_t)~1UL) +- +-#define DLIME_UNIT 0 +-#define DLIME_KILO 1 +-#define DLIME_MEGA 2 +-#define DLIME_GIGA 3 +- +-#define DLIMF_SHIFT 0x10 +- +-#define DLIMS_USED 0 +-#define DLIMS_TOTAL 2 +- +-static inline +-uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift) +-{ +- int exp = (flags & DLIMF_SHIFT) ? +- (flags >> shift) & DLIME_GIGA : DLIME_KILO; +- return ((uint64_t)val) << (10 * exp); +-} +- +-static inline +-uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift) +-{ +- int exp = 0; ++#ifndef _VSERVER_DLIMIT_CMD_H ++#define _VSERVER_DLIMIT_CMD_H + +- if (*flags & DLIMF_SHIFT) { +- while (val > (1LL << 32) && (exp < 3)) { +- val >>= 10; +- exp++; +- } +- *flags &= ~(DLIME_GIGA << shift); +- *flags |= exp << shift; +- } else +- val >>= 10; +- return val; +-} ++#include + +-#ifdef __KERNEL__ + + #ifdef CONFIG_COMPAT + +@@ -105,5 +43,4 @@ extern int vc_get_dlimit_x32(uint32_t, v + + #endif /* CONFIG_COMPAT */ + +-#endif /* __KERNEL__ */ +-#endif /* _VX_DLIMIT_CMD_H */ ++#endif /* _VSERVER_DLIMIT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/global.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/global.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/global.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/global.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_GLOBAL_H +-#define _VX_GLOBAL_H ++#ifndef _VSERVER_GLOBAL_H ++#define _VSERVER_GLOBAL_H + + + extern atomic_t vx_global_ctotal; +@@ -16,4 +16,4 @@ extern atomic_t vs_global_user_ns; + extern atomic_t vs_global_pid_ns; + + +-#endif /* _VX_GLOBAL_H */ ++#endif /* _VSERVER_GLOBAL_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/history.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/history.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/history.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/history.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_HISTORY_H +-#define _VX_HISTORY_H ++#ifndef _VSERVER_HISTORY_H ++#define _VSERVER_HISTORY_H + + + enum { +@@ -194,4 +194,4 @@ extern void vxh_dump_history(void); + + #endif /* CONFIG_VSERVER_HISTORY */ + +-#endif /* _VX_HISTORY_H */ ++#endif /* _VSERVER_HISTORY_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/inode.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/inode.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/inode.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/inode.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,20 +1,7 @@ +-#ifndef _VX_INODE_H +-#define _VX_INODE_H +- +- +-#define IATTR_TAG 0x01000000 +- +-#define IATTR_ADMIN 0x00000001 +-#define IATTR_WATCH 0x00000002 +-#define IATTR_HIDE 0x00000004 +-#define IATTR_FLAGS 0x00000007 +- +-#define IATTR_BARRIER 0x00010000 +-#define IATTR_IXUNLINK 0x00020000 +-#define IATTR_IMMUTABLE 0x00040000 +-#define IATTR_COW 0x00080000 ++#ifndef _VSERVER_INODE_H ++#define _VSERVER_INODE_H + +-#ifdef __KERNEL__ ++#include + + + #ifdef CONFIG_VSERVER_PROC_SECURE +@@ -27,13 +14,6 @@ + + #define vx_hide_check(c, m) (((m) & IATTR_HIDE) ? vx_check(c, m) : 1) + +-#endif /* __KERNEL__ */ +- +-/* inode ioctls */ +- +-#define FIOC_GETXFLG _IOR('x', 5, long) +-#define FIOC_SETXFLG _IOW('x', 6, long) +- +-#else /* _VX_INODE_H */ ++#else /* _VSERVER_INODE_H */ + #warning duplicate inclusion +-#endif /* _VX_INODE_H */ ++#endif /* _VSERVER_INODE_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/inode_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/inode_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/inode_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/inode_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,30 +1,8 @@ +-#ifndef _VX_INODE_CMD_H +-#define _VX_INODE_CMD_H +- +- +-/* inode vserver commands */ +- +-#define VCMD_get_iattr VC_CMD(INODE, 1, 1) +-#define VCMD_set_iattr VC_CMD(INODE, 2, 1) +- +-#define VCMD_fget_iattr VC_CMD(INODE, 3, 0) +-#define VCMD_fset_iattr VC_CMD(INODE, 4, 0) +- +-struct vcmd_ctx_iattr_v1 { +- const char __user *name; +- uint32_t tag; +- uint32_t flags; +- uint32_t mask; +-}; +- +-struct vcmd_ctx_fiattr_v0 { +- uint32_t tag; +- uint32_t flags; +- uint32_t mask; +-}; ++#ifndef _VSERVER_INODE_CMD_H ++#define _VSERVER_INODE_CMD_H + ++#include + +-#ifdef __KERNEL__ + + + #ifdef CONFIG_COMPAT +@@ -55,5 +33,4 @@ extern int vc_set_iattr_x32(void __user + + #endif /* CONFIG_COMPAT */ + +-#endif /* __KERNEL__ */ +-#endif /* _VX_INODE_CMD_H */ ++#endif /* _VSERVER_INODE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,17 +1,8 @@ +-#ifndef _VX_LIMIT_H +-#define _VX_LIMIT_H +- +-#define VLIMIT_NSOCK 16 +-#define VLIMIT_OPENFD 17 +-#define VLIMIT_ANON 18 +-#define VLIMIT_SHMEM 19 +-#define VLIMIT_SEMARY 20 +-#define VLIMIT_NSEMS 21 +-#define VLIMIT_DENTRY 22 +-#define VLIMIT_MAPPED 23 ++#ifndef _VSERVER_LIMIT_H ++#define _VSERVER_LIMIT_H + ++#include + +-#ifdef __KERNEL__ + + #define VLIM_NOCHECK ((1L << VLIMIT_DENTRY) | (1L << RLIMIT_RSS)) + +@@ -67,5 +58,4 @@ long vx_vsi_cached(struct sysinfo *); + + #define NUM_LIMITS 24 + +-#endif /* __KERNEL__ */ +-#endif /* _VX_LIMIT_H */ ++#endif /* _VSERVER_LIMIT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,43 +1,8 @@ +-#ifndef _VX_LIMIT_CMD_H +-#define _VX_LIMIT_CMD_H +- +- +-/* rlimit vserver commands */ +- +-#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0) +-#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0) +-#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0) +-#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0) +-#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0) +- +-struct vcmd_ctx_rlimit_v0 { +- uint32_t id; +- uint64_t minimum; +- uint64_t softlimit; +- uint64_t maximum; +-}; +- +-struct vcmd_ctx_rlimit_mask_v0 { +- uint32_t minimum; +- uint32_t softlimit; +- uint32_t maximum; +-}; +- +-#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0) +- +-struct vcmd_rlimit_stat_v0 { +- uint32_t id; +- uint32_t hits; +- uint64_t value; +- uint64_t minimum; +- uint64_t maximum; +-}; ++#ifndef _VSERVER_LIMIT_CMD_H ++#define _VSERVER_LIMIT_CMD_H + +-#define CRLIM_UNSET (0ULL) +-#define CRLIM_INFINITY (~0ULL) +-#define CRLIM_KEEP (~1ULL) ++#include + +-#ifdef __KERNEL__ + + #ifdef CONFIG_IA32_EMULATION + +@@ -67,5 +32,4 @@ extern int vc_set_rlimit_x32(struct vx_i + + #endif /* CONFIG_IA32_EMULATION */ + +-#endif /* __KERNEL__ */ +-#endif /* _VX_LIMIT_CMD_H */ ++#endif /* _VSERVER_LIMIT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_def.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_def.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_def.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_def.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_LIMIT_DEF_H +-#define _VX_LIMIT_DEF_H ++#ifndef _VSERVER_LIMIT_DEF_H ++#define _VSERVER_LIMIT_DEF_H + + #include + #include +@@ -44,4 +44,4 @@ static inline void __dump_vx_limit(struc + + #endif + +-#endif /* _VX_LIMIT_DEF_H */ ++#endif /* _VSERVER_LIMIT_DEF_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_int.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_int.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/limit_int.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/limit_int.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,9 +1,5 @@ +-#ifndef _VX_LIMIT_INT_H +-#define _VX_LIMIT_INT_H +- +-#include "context.h" +- +-#ifdef __KERNEL__ ++#ifndef _VSERVER_LIMIT_INT_H ++#define _VSERVER_LIMIT_INT_H + + #define VXD_RCRES_COND(r) VXD_CBIT(cres, r) + #define VXD_RLIMIT_COND(r) VXD_CBIT(limit, r) +@@ -194,5 +190,4 @@ static inline void vx_limit_fixup(struct + } + + +-#endif /* __KERNEL__ */ +-#endif /* _VX_LIMIT_INT_H */ ++#endif /* _VSERVER_LIMIT_INT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/monitor.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/monitor.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/monitor.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/monitor.h 2012-12-13 22:45:02.000000000 +0000 +@@ -1,96 +1,6 @@ +-#ifndef _VX_MONITOR_H +-#define _VX_MONITOR_H +- +-#include +- +-enum { +- VXM_UNUSED = 0, +- +- VXM_SYNC = 0x10, +- +- VXM_UPDATE = 0x20, +- VXM_UPDATE_1, +- VXM_UPDATE_2, +- +- VXM_RQINFO_1 = 0x24, +- VXM_RQINFO_2, +- +- VXM_ACTIVATE = 0x40, +- VXM_DEACTIVATE, +- VXM_IDLE, +- +- VXM_HOLD = 0x44, +- VXM_UNHOLD, +- +- VXM_MIGRATE = 0x48, +- VXM_RESCHED, +- +- /* all other bits are flags */ +- VXM_SCHED = 0x80, +-}; +- +-struct _vxm_update_1 { +- uint32_t tokens_max; +- uint32_t fill_rate; +- uint32_t interval; +-}; +- +-struct _vxm_update_2 { +- uint32_t tokens_min; +- uint32_t fill_rate; +- uint32_t interval; +-}; +- +-struct _vxm_rqinfo_1 { +- uint16_t running; +- uint16_t onhold; +- uint16_t iowait; +- uint16_t uintr; +- uint32_t idle_tokens; +-}; +- +-struct _vxm_rqinfo_2 { +- uint32_t norm_time; +- uint32_t idle_time; +- uint32_t idle_skip; +-}; +- +-struct _vxm_sched { +- uint32_t tokens; +- uint32_t norm_time; +- uint32_t idle_time; +-}; +- +-struct _vxm_task { +- uint16_t pid; +- uint16_t state; +-}; +- +-struct _vxm_event { +- uint32_t jif; +- union { +- uint32_t seq; +- uint32_t sec; +- }; +- union { +- uint32_t tokens; +- uint32_t nsec; +- struct _vxm_task tsk; +- }; +-}; +- +-struct _vx_mon_entry { +- uint16_t type; +- uint16_t xid; +- union { +- struct _vxm_event ev; +- struct _vxm_sched sd; +- struct _vxm_update_1 u1; +- struct _vxm_update_2 u2; +- struct _vxm_rqinfo_1 q1; +- struct _vxm_rqinfo_2 q2; +- }; +-}; ++#ifndef _VSERVER_MONITOR_H ++#define _VSERVER_MONITOR_H + ++#include + +-#endif /* _VX_MONITOR_H */ ++#endif /* _VSERVER_MONITOR_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/network.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/network.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/network.h 2012-12-13 13:40:52.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/network.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,79 +1,6 @@ +-#ifndef _VX_NETWORK_H +-#define _VX_NETWORK_H +- +-#include +- +- +-#define MAX_N_CONTEXT 65535 /* Arbitrary limit */ +- +- +-/* network flags */ +- +-#define NXF_INFO_PRIVATE 0x00000008 +- +-#define NXF_SINGLE_IP 0x00000100 +-#define NXF_LBACK_REMAP 0x00000200 +-#define NXF_LBACK_ALLOW 0x00000400 +- +-#define NXF_HIDE_NETIF 0x02000000 +-#define NXF_HIDE_LBACK 0x04000000 +- +-#define NXF_STATE_SETUP (1ULL << 32) +-#define NXF_STATE_ADMIN (1ULL << 34) +- +-#define NXF_SC_HELPER (1ULL << 36) +-#define NXF_PERSISTENT (1ULL << 38) +- +-#define NXF_ONE_TIME (0x0005ULL << 32) +- +- +-#define NXF_INIT_SET (__nxf_init_set()) +- +-static inline uint64_t __nxf_init_set(void) { +- return NXF_STATE_ADMIN +-#ifdef CONFIG_VSERVER_AUTO_LBACK +- | NXF_LBACK_REMAP +- | NXF_HIDE_LBACK +-#endif +-#ifdef CONFIG_VSERVER_AUTO_SINGLE +- | NXF_SINGLE_IP +-#endif +- | NXF_HIDE_NETIF; +-} +- +- +-/* network caps */ +- +-#define NXC_TUN_CREATE 0x00000001 +- +-#define NXC_RAW_ICMP 0x00000100 +- +-#define NXC_MULTICAST 0x00001000 +- +- +-/* address types */ +- +-#define NXA_TYPE_IPV4 0x0001 +-#define NXA_TYPE_IPV6 0x0002 +- +-#define NXA_TYPE_NONE 0x0000 +-#define NXA_TYPE_ANY 0x00FF +- +-#define NXA_TYPE_ADDR 0x0010 +-#define NXA_TYPE_MASK 0x0020 +-#define NXA_TYPE_RANGE 0x0040 +- +-#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE) +- +-#define NXA_MOD_BCAST 0x0100 +-#define NXA_MOD_LBACK 0x0200 +- +-#define NXA_LOOPBACK 0x1000 +- +-#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK) +-#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK) ++#ifndef _VSERVER_NETWORK_H ++#define _VSERVER_NETWORK_H + +-#ifdef __KERNEL__ + + #include + #include +@@ -81,6 +8,7 @@ static inline uint64_t __nxf_init_set(vo + #include + #include + #include ++#include + + struct nx_addr_v4 { + struct nx_addr_v4 *next; +@@ -145,5 +73,4 @@ struct sock; + #define NX_IPV6(n) (0) + #endif + +-#endif /* __KERNEL__ */ +-#endif /* _VX_NETWORK_H */ ++#endif /* _VSERVER_NETWORK_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/network_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/network_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/network_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/network_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,110 +1,12 @@ +-#ifndef _VX_NETWORK_CMD_H +-#define _VX_NETWORK_CMD_H +- +- +-/* vinfo commands */ ++#ifndef _VSERVER_NETWORK_CMD_H ++#define _VSERVER_NETWORK_CMD_H + +-#define VCMD_task_nid VC_CMD(VINFO, 2, 0) ++#include + +-#ifdef __KERNEL__ + extern int vc_task_nid(uint32_t); + +-#endif /* __KERNEL__ */ +- +-#define VCMD_nx_info VC_CMD(VINFO, 6, 0) +- +-struct vcmd_nx_info_v0 { +- uint32_t nid; +- /* more to come */ +-}; +- +-#ifdef __KERNEL__ + extern int vc_nx_info(struct nx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +-#include +-#include +- +-#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0) +-#define VCMD_net_create VC_CMD(VNET, 1, 1) +- +-struct vcmd_net_create { +- uint64_t flagword; +-}; +- +-#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0) +- +-#define VCMD_net_add VC_CMD(NETALT, 1, 0) +-#define VCMD_net_remove VC_CMD(NETALT, 2, 0) +- +-struct vcmd_net_addr_v0 { +- uint16_t type; +- uint16_t count; +- struct in_addr ip[4]; +- struct in_addr mask[4]; +-}; +- +-#define VCMD_net_add_ipv4_v1 VC_CMD(NETALT, 1, 1) +-#define VCMD_net_rem_ipv4_v1 VC_CMD(NETALT, 2, 1) +- +-struct vcmd_net_addr_ipv4_v1 { +- uint16_t type; +- uint16_t flags; +- struct in_addr ip; +- struct in_addr mask; +-}; +- +-#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 2) +-#define VCMD_net_rem_ipv4 VC_CMD(NETALT, 2, 2) +- +-struct vcmd_net_addr_ipv4_v2 { +- uint16_t type; +- uint16_t flags; +- struct in_addr ip; +- struct in_addr ip2; +- struct in_addr mask; +-}; +- +-#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1) +-#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1) +- +-struct vcmd_net_addr_ipv6_v1 { +- uint16_t type; +- uint16_t flags; +- uint32_t prefix; +- struct in6_addr ip; +- struct in6_addr mask; +-}; +- +-#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0) +-#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0) +- +-struct vcmd_match_ipv4_v0 { +- uint16_t type; +- uint16_t flags; +- uint16_t parent; +- uint16_t prefix; +- struct in_addr ip; +- struct in_addr ip2; +- struct in_addr mask; +-}; +- +-#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0) +-#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0) +- +-struct vcmd_match_ipv6_v0 { +- uint16_t type; +- uint16_t flags; +- uint16_t parent; +- uint16_t prefix; +- struct in6_addr ip; +- struct in6_addr ip2; +- struct in6_addr mask; +-}; +- +- +-#ifdef __KERNEL__ + extern int vc_net_create(uint32_t, void __user *); + extern int vc_net_migrate(struct nx_info *, void __user *); + +@@ -126,39 +28,10 @@ extern int vc_get_match_ipv4(struct nx_i + extern int vc_add_match_ipv6(struct nx_info *, void __user *); + extern int vc_get_match_ipv6(struct nx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* flag commands */ +- +-#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0) +-#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0) +- +-struct vcmd_net_flags_v0 { +- uint64_t flagword; +- uint64_t mask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_nflags(struct nx_info *, void __user *); + extern int vc_set_nflags(struct nx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +- +-/* network caps commands */ +- +-#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0) +-#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0) +- +-struct vcmd_net_caps_v0 { +- uint64_t ncaps; +- uint64_t cmask; +-}; +- +-#ifdef __KERNEL__ + extern int vc_get_ncaps(struct nx_info *, void __user *); + extern int vc_set_ncaps(struct nx_info *, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_CONTEXT_CMD_H */ ++#endif /* _VSERVER_CONTEXT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/percpu.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/percpu.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/percpu.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/percpu.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_PERCPU_H +-#define _VX_PERCPU_H ++#ifndef _VSERVER_PERCPU_H ++#define _VSERVER_PERCPU_H + + #include "cvirt_def.h" + #include "sched_def.h" +@@ -11,4 +11,4 @@ struct _vx_percpu { + + #define PERCPU_PERCTX (sizeof(struct _vx_percpu)) + +-#endif /* _VX_PERCPU_H */ ++#endif /* _VSERVER_PERCPU_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_SCHED_H +-#define _VX_SCHED_H ++#ifndef _VSERVER_SCHED_H ++#define _VSERVER_SCHED_H + + + #ifdef __KERNEL__ +@@ -18,6 +18,6 @@ void vx_update_sched_param(struct _vx_sc + struct _vx_sched_pc *sched_pc); + + #endif /* __KERNEL__ */ +-#else /* _VX_SCHED_H */ ++#else /* _VSERVER_SCHED_H */ + #warning duplicate inclusion +-#endif /* _VX_SCHED_H */ ++#endif /* _VSERVER_SCHED_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,21 +1,11 @@ +-#ifndef _VX_SCHED_CMD_H +-#define _VX_SCHED_CMD_H +- +- +-struct vcmd_prio_bias { +- int32_t cpu_id; +- int32_t prio_bias; +-}; +- +-#define VCMD_set_prio_bias VC_CMD(SCHED, 4, 0) +-#define VCMD_get_prio_bias VC_CMD(SCHED, 5, 0) ++#ifndef _VSERVER_SCHED_CMD_H ++#define _VSERVER_SCHED_CMD_H + +-#ifdef __KERNEL__ + + #include ++#include + + extern int vc_set_prio_bias(struct vx_info *, void __user *); + extern int vc_get_prio_bias(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_SCHED_CMD_H */ ++#endif /* _VSERVER_SCHED_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched_def.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched_def.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/sched_def.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/sched_def.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_SCHED_DEF_H +-#define _VX_SCHED_DEF_H ++#ifndef _VSERVER_SCHED_DEF_H ++#define _VSERVER_SCHED_DEF_H + + #include + #include +@@ -35,4 +35,4 @@ static inline void __dump_vx_sched(struc + + #endif + +-#endif /* _VX_SCHED_DEF_H */ ++#endif /* _VSERVER_SCHED_DEF_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/signal.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/signal.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/signal.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/signal.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_SIGNAL_H +-#define _VX_SIGNAL_H ++#ifndef _VSERVER_SIGNAL_H ++#define _VSERVER_SIGNAL_H + + + #ifdef __KERNEL__ +@@ -9,6 +9,6 @@ struct vx_info; + int vx_info_kill(struct vx_info *, int, int); + + #endif /* __KERNEL__ */ +-#else /* _VX_SIGNAL_H */ ++#else /* _VSERVER_SIGNAL_H */ + #warning duplicate inclusion +-#endif /* _VX_SIGNAL_H */ ++#endif /* _VSERVER_SIGNAL_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/signal_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/signal_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/signal_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/signal_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,43 +1,14 @@ +-#ifndef _VX_SIGNAL_CMD_H +-#define _VX_SIGNAL_CMD_H +- +- +-/* signalling vserver commands */ +- +-#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0) +-#define VCMD_wait_exit VC_CMD(EVENT, 99, 0) +- +-struct vcmd_ctx_kill_v0 { +- int32_t pid; +- int32_t sig; +-}; ++#ifndef _VSERVER_SIGNAL_CMD_H ++#define _VSERVER_SIGNAL_CMD_H + +-struct vcmd_wait_exit_v0 { +- int32_t reboot_cmd; +- int32_t exit_code; +-}; ++#include + +-#ifdef __KERNEL__ + + extern int vc_ctx_kill(struct vx_info *, void __user *); + extern int vc_wait_exit(struct vx_info *, void __user *); + +-#endif /* __KERNEL__ */ +- +-/* process alteration commands */ +- +-#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0) +-#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0) +- +-struct vcmd_pflags_v0 { +- uint32_t flagword; +- uint32_t mask; +-}; +- +-#ifdef __KERNEL__ + + extern int vc_get_pflags(uint32_t pid, void __user *); + extern int vc_set_pflags(uint32_t pid, void __user *); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_SIGNAL_CMD_H */ ++#endif /* _VSERVER_SIGNAL_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/space.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/space.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/space.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/space.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,5 +1,5 @@ +-#ifndef _VX_SPACE_H +-#define _VX_SPACE_H ++#ifndef _VSERVER_SPACE_H ++#define _VSERVER_SPACE_H + + #include + +@@ -7,6 +7,6 @@ struct vx_info; + + int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index); + +-#else /* _VX_SPACE_H */ ++#else /* _VSERVER_SPACE_H */ + #warning duplicate inclusion +-#endif /* _VX_SPACE_H */ ++#endif /* _VSERVER_SPACE_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/space_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/space_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/space_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/space_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,32 +1,8 @@ +-#ifndef _VX_SPACE_CMD_H +-#define _VX_SPACE_CMD_H +- +- +-#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0) +-#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1) +-#define VCMD_enter_space VC_CMD(PROCALT, 1, 2) +- +-#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0) +-#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1) +-#define VCMD_set_space VC_CMD(PROCALT, 3, 2) +- +-#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0) +- +-#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1) +-#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0) +- +- +-struct vcmd_space_mask_v1 { +- uint64_t mask; +-}; +- +-struct vcmd_space_mask_v2 { +- uint64_t mask; +- uint32_t index; +-}; ++#ifndef _VSERVER_SPACE_CMD_H ++#define _VSERVER_SPACE_CMD_H + ++#include + +-#ifdef __KERNEL__ + + extern int vc_enter_space_v1(struct vx_info *, void __user *); + extern int vc_set_space_v1(struct vx_info *, void __user *); +@@ -34,5 +10,4 @@ extern int vc_enter_space(struct vx_info + extern int vc_set_space(struct vx_info *, void __user *); + extern int vc_get_space_mask(void __user *, int); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_SPACE_CMD_H */ ++#endif /* _VSERVER_SPACE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/switch.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/switch.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/switch.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/switch.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,98 +1,8 @@ +-#ifndef _VX_SWITCH_H +-#define _VX_SWITCH_H +- +-#include +- +- +-#define VC_CATEGORY(c) (((c) >> 24) & 0x3F) +-#define VC_COMMAND(c) (((c) >> 16) & 0xFF) +-#define VC_VERSION(c) ((c) & 0xFFF) +- +-#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \ +- | (((i) & 0xFF) << 16) | ((v) & 0xFFF)) +- +-/* +- +- Syscall Matrix V2.8 +- +- |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL| +- |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | | +- |INFO |SETUP | |MOVE | | | | | | +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | | +- HOST | 00| 01| 02| 03| 04| 05| | 06| 07| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | | +- PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- MEMORY | | | | |MEMCTRL| | |SWAP | | +- | 16| 17| 18| 19| 20| 21| | 22| 23| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | | +- | 24| 25| 26| 27| 28| 29| | 30| 31| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- DISK | | | |TAGMIG |DLIMIT | | |INODE | | +- VFS | 32| 33| 34| 35| 36| 37| | 38| 39| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- OTHER |VSTAT | | | | | | |VINFO | | +- | 40| 41| 42| 43| 44| 45| | 46| 47| +- =======+=======+=======+=======+=======+=======+=======+ +=======+=======+ +- SPECIAL|EVENT | | | |FLAGS | | |VSPACE | | +- | 48| 49| 50| 51| 52| 53| | 54| 55| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT | +- | 56| 57| 58| 59| 60|TEST 61| | 62| 63| +- -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ +- +-*/ +- +-#define VC_CAT_VERSION 0 +- +-#define VC_CAT_VSETUP 1 +-#define VC_CAT_VHOST 2 +- +-#define VC_CAT_DEVICE 6 +- +-#define VC_CAT_VPROC 9 +-#define VC_CAT_PROCALT 10 +-#define VC_CAT_PROCMIG 11 +-#define VC_CAT_PROCTRL 12 +- +-#define VC_CAT_SCHED 14 +-#define VC_CAT_MEMCTRL 20 +- +-#define VC_CAT_VNET 25 +-#define VC_CAT_NETALT 26 +-#define VC_CAT_NETMIG 27 +-#define VC_CAT_NETCTRL 28 +- +-#define VC_CAT_TAGMIG 35 +-#define VC_CAT_DLIMIT 36 +-#define VC_CAT_INODE 38 +- +-#define VC_CAT_VSTAT 40 +-#define VC_CAT_VINFO 46 +-#define VC_CAT_EVENT 48 +- +-#define VC_CAT_FLAGS 52 +-#define VC_CAT_VSPACE 54 +-#define VC_CAT_DEBUG 56 +-#define VC_CAT_RLIMIT 60 +- +-#define VC_CAT_SYSTEST 61 +-#define VC_CAT_COMPAT 63 +- +-/* query version */ +- +-#define VCMD_get_version VC_CMD(VERSION, 0, 0) +-#define VCMD_get_vci VC_CMD(VERSION, 1, 0) +- ++#ifndef _VSERVER_SWITCH_H ++#define _VSERVER_SWITCH_H + +-#ifdef __KERNEL__ + + #include ++#include + +-#endif /* __KERNEL__ */ +- +-#endif /* _VX_SWITCH_H */ +- ++#endif /* _VSERVER_SWITCH_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/linux/vserver/tag_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/tag_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/linux/vserver/tag_cmd.h 2012-12-11 15:56:32.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/linux/vserver/tag_cmd.h 2012-12-13 22:29:23.000000000 +0000 +@@ -1,22 +1,10 @@ +-#ifndef _VX_TAG_CMD_H +-#define _VX_TAG_CMD_H +- +- +-/* vinfo commands */ ++#ifndef _VSERVER_TAG_CMD_H ++#define _VSERVER_TAG_CMD_H + +-#define VCMD_task_tag VC_CMD(VINFO, 3, 0) ++#include + +-#ifdef __KERNEL__ + extern int vc_task_tag(uint32_t); + +-#endif /* __KERNEL__ */ +- +-/* context commands */ +- +-#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0) +- +-#ifdef __KERNEL__ + extern int vc_tag_migrate(uint32_t); + +-#endif /* __KERNEL__ */ +-#endif /* _VX_TAG_CMD_H */ ++#endif /* _VSERVER_TAG_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/Kbuild linux-3.7-vs2.3.5.1.3-uapi/include/uapi/Kbuild +--- linux-3.7-vs2.3.5.1.3/include/uapi/Kbuild 2012-12-11 15:47:47.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/Kbuild 2012-12-13 21:33:11.000000000 +0000 +@@ -12,3 +12,4 @@ header-y += video/ + header-y += drm/ + header-y += xen/ + header-y += scsi/ ++header-y += vserver/ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/Kbuild linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/Kbuild +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/Kbuild 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/Kbuild 2012-12-13 21:48:50.000000000 +0000 +@@ -0,0 +1,9 @@ ++ ++header-y += context_cmd.h network_cmd.h space_cmd.h \ ++ cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \ ++ inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \ ++ debug_cmd.h device_cmd.h ++ ++header-y += switch.h context.h network.h monitor.h \ ++ limit.h inode.h device.h ++ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/cacct_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/cacct_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/cacct_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/cacct_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,15 @@ ++#ifndef _UAPI_VS_CACCT_CMD_H ++#define _UAPI_VS_CACCT_CMD_H ++ ++ ++/* virtual host info name commands */ ++ ++#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0) ++ ++struct vcmd_sock_stat_v0 { ++ uint32_t field; ++ uint32_t count[3]; ++ uint64_t total[3]; ++}; ++ ++#endif /* _UAPI_VS_CACCT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/context.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/context.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/context.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/context.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,80 @@ ++#ifndef _UAPI_VS_CONTEXT_H ++#define _UAPI_VS_CONTEXT_H ++ ++#include ++#include ++ ++ ++/* context flags */ ++ ++#define VXF_INFO_SCHED 0x00000002 ++#define VXF_INFO_NPROC 0x00000004 ++#define VXF_INFO_PRIVATE 0x00000008 ++ ++#define VXF_INFO_INIT 0x00000010 ++#define VXF_INFO_HIDE 0x00000020 ++#define VXF_INFO_ULIMIT 0x00000040 ++#define VXF_INFO_NSPACE 0x00000080 ++ ++#define VXF_SCHED_HARD 0x00000100 ++#define VXF_SCHED_PRIO 0x00000200 ++#define VXF_SCHED_PAUSE 0x00000400 ++ ++#define VXF_VIRT_MEM 0x00010000 ++#define VXF_VIRT_UPTIME 0x00020000 ++#define VXF_VIRT_CPU 0x00040000 ++#define VXF_VIRT_LOAD 0x00080000 ++#define VXF_VIRT_TIME 0x00100000 ++ ++#define VXF_HIDE_MOUNT 0x01000000 ++/* was VXF_HIDE_NETIF 0x02000000 */ ++#define VXF_HIDE_VINFO 0x04000000 ++ ++#define VXF_STATE_SETUP (1ULL << 32) ++#define VXF_STATE_INIT (1ULL << 33) ++#define VXF_STATE_ADMIN (1ULL << 34) ++ ++#define VXF_SC_HELPER (1ULL << 36) ++#define VXF_REBOOT_KILL (1ULL << 37) ++#define VXF_PERSISTENT (1ULL << 38) ++ ++#define VXF_FORK_RSS (1ULL << 48) ++#define VXF_PROLIFIC (1ULL << 49) ++ ++#define VXF_IGNEG_NICE (1ULL << 52) ++ ++#define VXF_ONE_TIME (0x0007ULL << 32) ++ ++#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN) ++ ++ ++/* context migration */ ++ ++#define VXM_SET_INIT 0x00000001 ++#define VXM_SET_REAPER 0x00000002 ++ ++/* context caps */ ++ ++#define VXC_SET_UTSNAME 0x00000001 ++#define VXC_SET_RLIMIT 0x00000002 ++#define VXC_FS_SECURITY 0x00000004 ++#define VXC_FS_TRUSTED 0x00000008 ++#define VXC_TIOCSTI 0x00000010 ++ ++/* was VXC_RAW_ICMP 0x00000100 */ ++#define VXC_SYSLOG 0x00001000 ++#define VXC_OOM_ADJUST 0x00002000 ++#define VXC_AUDIT_CONTROL 0x00004000 ++ ++#define VXC_SECURE_MOUNT 0x00010000 ++#define VXC_SECURE_REMOUNT 0x00020000 ++#define VXC_BINARY_MOUNT 0x00040000 ++ ++#define VXC_QUOTA_CTL 0x00100000 ++#define VXC_ADMIN_MAPPER 0x00200000 ++#define VXC_ADMIN_CLOOP 0x00400000 ++ ++#define VXC_KTHREAD 0x01000000 ++#define VXC_NAMESPACE 0x02000000 ++ ++#endif /* _UAPI_VS_CONTEXT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/context_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/context_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/context_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/context_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,115 @@ ++#ifndef _UAPI_VS_CONTEXT_CMD_H ++#define _UAPI_VS_CONTEXT_CMD_H ++ ++ ++/* vinfo commands */ ++ ++#define VCMD_task_xid VC_CMD(VINFO, 1, 0) ++ ++ ++#define VCMD_vx_info VC_CMD(VINFO, 5, 0) ++ ++struct vcmd_vx_info_v0 { ++ uint32_t xid; ++ uint32_t initpid; ++ /* more to come */ ++}; ++ ++ ++#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0) ++ ++struct vcmd_ctx_stat_v0 { ++ uint32_t usecnt; ++ uint32_t tasks; ++ /* more to come */ ++}; ++ ++ ++/* context commands */ ++ ++#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0) ++#define VCMD_ctx_create VC_CMD(VPROC, 1, 1) ++ ++struct vcmd_ctx_create { ++ uint64_t flagword; ++}; ++ ++#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0) ++#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1) ++ ++struct vcmd_ctx_migrate { ++ uint64_t flagword; ++}; ++ ++ ++ ++/* flag commands */ ++ ++#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0) ++#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0) ++ ++struct vcmd_ctx_flags_v0 { ++ uint64_t flagword; ++ uint64_t mask; ++}; ++ ++ ++ ++/* context caps commands */ ++ ++#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1) ++#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1) ++ ++struct vcmd_ctx_caps_v1 { ++ uint64_t ccaps; ++ uint64_t cmask; ++}; ++ ++ ++ ++/* bcaps commands */ ++ ++#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0) ++#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0) ++ ++struct vcmd_bcaps { ++ uint64_t bcaps; ++ uint64_t bmask; ++}; ++ ++ ++ ++/* umask commands */ ++ ++#define VCMD_get_umask VC_CMD(FLAGS, 13, 0) ++#define VCMD_set_umask VC_CMD(FLAGS, 14, 0) ++ ++struct vcmd_umask { ++ uint64_t umask; ++ uint64_t mask; ++}; ++ ++ ++ ++/* wmask commands */ ++ ++#define VCMD_get_wmask VC_CMD(FLAGS, 15, 0) ++#define VCMD_set_wmask VC_CMD(FLAGS, 16, 0) ++ ++struct vcmd_wmask { ++ uint64_t wmask; ++ uint64_t mask; ++}; ++ ++ ++ ++/* OOM badness */ ++ ++#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0) ++#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0) ++ ++struct vcmd_badness_v0 { ++ int64_t bias; ++}; ++ ++#endif /* _UAPI_VS_CONTEXT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/cvirt_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/cvirt_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/cvirt_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/cvirt_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,41 @@ ++#ifndef _UAPI_VS_CVIRT_CMD_H ++#define _UAPI_VS_CVIRT_CMD_H ++ ++ ++/* virtual host info name commands */ ++ ++#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0) ++#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0) ++ ++struct vcmd_vhi_name_v0 { ++ uint32_t field; ++ char name[65]; ++}; ++ ++ ++enum vhi_name_field { ++ VHIN_CONTEXT = 0, ++ VHIN_SYSNAME, ++ VHIN_NODENAME, ++ VHIN_RELEASE, ++ VHIN_VERSION, ++ VHIN_MACHINE, ++ VHIN_DOMAINNAME, ++}; ++ ++ ++ ++#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0) ++ ++struct vcmd_virt_stat_v0 { ++ uint64_t offset; ++ uint64_t uptime; ++ uint32_t nr_threads; ++ uint32_t nr_running; ++ uint32_t nr_uninterruptible; ++ uint32_t nr_onhold; ++ uint32_t nr_forks; ++ uint32_t load[3]; ++}; ++ ++#endif /* _UAPI_VS_CVIRT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/debug_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/debug_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/debug_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/debug_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,24 @@ ++#ifndef _UAPI_VS_DEBUG_CMD_H ++#define _UAPI_VS_DEBUG_CMD_H ++ ++ ++/* debug commands */ ++ ++#define VCMD_dump_history VC_CMD(DEBUG, 1, 0) ++ ++#define VCMD_read_history VC_CMD(DEBUG, 5, 0) ++#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0) ++ ++struct vcmd_read_history_v0 { ++ uint32_t index; ++ uint32_t count; ++ char __user *data; ++}; ++ ++struct vcmd_read_monitor_v0 { ++ uint32_t index; ++ uint32_t count; ++ char __user *data; ++}; ++ ++#endif /* _UAPI_VS_DEBUG_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/device.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/device.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/device.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/device.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,12 @@ ++#ifndef _UAPI_VS_DEVICE_H ++#define _UAPI_VS_DEVICE_H ++ ++ ++#define DATTR_CREATE 0x00000001 ++#define DATTR_OPEN 0x00000002 ++ ++#define DATTR_REMAP 0x00000010 ++ ++#define DATTR_MASK 0x00000013 ++ ++#endif /* _UAPI_VS_DEVICE_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/device_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/device_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/device_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/device_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,16 @@ ++#ifndef _UAPI_VS_DEVICE_CMD_H ++#define _UAPI_VS_DEVICE_CMD_H ++ ++ ++/* device vserver commands */ ++ ++#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0) ++#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0) ++ ++struct vcmd_set_mapping_v0 { ++ const char __user *device; ++ const char __user *target; ++ uint32_t flags; ++}; ++ ++#endif /* _UAPI_VS_DEVICE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/dlimit_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/dlimit_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/dlimit_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/dlimit_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,67 @@ ++#ifndef _UAPI_VS_DLIMIT_CMD_H ++#define _UAPI_VS_DLIMIT_CMD_H ++ ++ ++/* dlimit vserver commands */ ++ ++#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0) ++#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0) ++ ++#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0) ++#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0) ++ ++struct vcmd_ctx_dlimit_base_v0 { ++ const char __user *name; ++ uint32_t flags; ++}; ++ ++struct vcmd_ctx_dlimit_v0 { ++ const char __user *name; ++ uint32_t space_used; /* used space in kbytes */ ++ uint32_t space_total; /* maximum space in kbytes */ ++ uint32_t inodes_used; /* used inodes */ ++ uint32_t inodes_total; /* maximum inodes */ ++ uint32_t reserved; /* reserved for root in % */ ++ uint32_t flags; ++}; ++ ++#define CDLIM_UNSET ((uint32_t)0UL) ++#define CDLIM_INFINITY ((uint32_t)~0UL) ++#define CDLIM_KEEP ((uint32_t)~1UL) ++ ++#define DLIME_UNIT 0 ++#define DLIME_KILO 1 ++#define DLIME_MEGA 2 ++#define DLIME_GIGA 3 ++ ++#define DLIMF_SHIFT 0x10 ++ ++#define DLIMS_USED 0 ++#define DLIMS_TOTAL 2 ++ ++static inline ++uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift) ++{ ++ int exp = (flags & DLIMF_SHIFT) ? ++ (flags >> shift) & DLIME_GIGA : DLIME_KILO; ++ return ((uint64_t)val) << (10 * exp); ++} ++ ++static inline ++uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift) ++{ ++ int exp = 0; ++ ++ if (*flags & DLIMF_SHIFT) { ++ while (val > (1LL << 32) && (exp < 3)) { ++ val >>= 10; ++ exp++; ++ } ++ *flags &= ~(DLIME_GIGA << shift); ++ *flags |= exp << shift; ++ } else ++ val >>= 10; ++ return val; ++} ++ ++#endif /* _UAPI_VS_DLIMIT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/inode.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/inode.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/inode.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/inode.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,23 @@ ++#ifndef _UAPI_VS_INODE_H ++#define _UAPI_VS_INODE_H ++ ++ ++#define IATTR_TAG 0x01000000 ++ ++#define IATTR_ADMIN 0x00000001 ++#define IATTR_WATCH 0x00000002 ++#define IATTR_HIDE 0x00000004 ++#define IATTR_FLAGS 0x00000007 ++ ++#define IATTR_BARRIER 0x00010000 ++#define IATTR_IXUNLINK 0x00020000 ++#define IATTR_IMMUTABLE 0x00040000 ++#define IATTR_COW 0x00080000 ++ ++ ++/* inode ioctls */ ++ ++#define FIOC_GETXFLG _IOR('x', 5, long) ++#define FIOC_SETXFLG _IOW('x', 6, long) ++ ++#endif /* _UAPI_VS_INODE_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/inode_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/inode_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/inode_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/inode_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,26 @@ ++#ifndef _UAPI_VS_INODE_CMD_H ++#define _UAPI_VS_INODE_CMD_H ++ ++ ++/* inode vserver commands */ ++ ++#define VCMD_get_iattr VC_CMD(INODE, 1, 1) ++#define VCMD_set_iattr VC_CMD(INODE, 2, 1) ++ ++#define VCMD_fget_iattr VC_CMD(INODE, 3, 0) ++#define VCMD_fset_iattr VC_CMD(INODE, 4, 0) ++ ++struct vcmd_ctx_iattr_v1 { ++ const char __user *name; ++ uint32_t tag; ++ uint32_t flags; ++ uint32_t mask; ++}; ++ ++struct vcmd_ctx_fiattr_v0 { ++ uint32_t tag; ++ uint32_t flags; ++ uint32_t mask; ++}; ++ ++#endif /* _UAPI_VS_INODE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/limit.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/limit.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/limit.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/limit.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,14 @@ ++#ifndef _UAPI_VS_LIMIT_H ++#define _UAPI_VS_LIMIT_H ++ ++ ++#define VLIMIT_NSOCK 16 ++#define VLIMIT_OPENFD 17 ++#define VLIMIT_ANON 18 ++#define VLIMIT_SHMEM 19 ++#define VLIMIT_SEMARY 20 ++#define VLIMIT_NSEMS 21 ++#define VLIMIT_DENTRY 22 ++#define VLIMIT_MAPPED 23 ++ ++#endif /* _UAPI_VS_LIMIT_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/limit_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/limit_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/limit_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/limit_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,40 @@ ++#ifndef _UAPI_VS_LIMIT_CMD_H ++#define _UAPI_VS_LIMIT_CMD_H ++ ++ ++/* rlimit vserver commands */ ++ ++#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0) ++#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0) ++#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0) ++#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0) ++#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0) ++ ++struct vcmd_ctx_rlimit_v0 { ++ uint32_t id; ++ uint64_t minimum; ++ uint64_t softlimit; ++ uint64_t maximum; ++}; ++ ++struct vcmd_ctx_rlimit_mask_v0 { ++ uint32_t minimum; ++ uint32_t softlimit; ++ uint32_t maximum; ++}; ++ ++#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0) ++ ++struct vcmd_rlimit_stat_v0 { ++ uint32_t id; ++ uint32_t hits; ++ uint64_t value; ++ uint64_t minimum; ++ uint64_t maximum; ++}; ++ ++#define CRLIM_UNSET (0ULL) ++#define CRLIM_INFINITY (~0ULL) ++#define CRLIM_KEEP (~1ULL) ++ ++#endif /* _UAPI_VS_LIMIT_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/monitor.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/monitor.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/monitor.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/monitor.h 2012-12-13 22:45:56.000000000 +0000 +@@ -0,0 +1,96 @@ ++#ifndef _UAPI_VS_MONITOR_H ++#define _UAPI_VS_MONITOR_H ++ ++#include ++ ++ ++enum { ++ VXM_UNUSED = 0, ++ ++ VXM_SYNC = 0x10, ++ ++ VXM_UPDATE = 0x20, ++ VXM_UPDATE_1, ++ VXM_UPDATE_2, ++ ++ VXM_RQINFO_1 = 0x24, ++ VXM_RQINFO_2, ++ ++ VXM_ACTIVATE = 0x40, ++ VXM_DEACTIVATE, ++ VXM_IDLE, ++ ++ VXM_HOLD = 0x44, ++ VXM_UNHOLD, ++ ++ VXM_MIGRATE = 0x48, ++ VXM_RESCHED, ++ ++ /* all other bits are flags */ ++ VXM_SCHED = 0x80, ++}; ++ ++struct _vxm_update_1 { ++ uint32_t tokens_max; ++ uint32_t fill_rate; ++ uint32_t interval; ++}; ++ ++struct _vxm_update_2 { ++ uint32_t tokens_min; ++ uint32_t fill_rate; ++ uint32_t interval; ++}; ++ ++struct _vxm_rqinfo_1 { ++ uint16_t running; ++ uint16_t onhold; ++ uint16_t iowait; ++ uint16_t uintr; ++ uint32_t idle_tokens; ++}; ++ ++struct _vxm_rqinfo_2 { ++ uint32_t norm_time; ++ uint32_t idle_time; ++ uint32_t idle_skip; ++}; ++ ++struct _vxm_sched { ++ uint32_t tokens; ++ uint32_t norm_time; ++ uint32_t idle_time; ++}; ++ ++struct _vxm_task { ++ uint16_t pid; ++ uint16_t state; ++}; ++ ++struct _vxm_event { ++ uint32_t jif; ++ union { ++ uint32_t seq; ++ uint32_t sec; ++ }; ++ union { ++ uint32_t tokens; ++ uint32_t nsec; ++ struct _vxm_task tsk; ++ }; ++}; ++ ++struct _vx_mon_entry { ++ uint16_t type; ++ uint16_t xid; ++ union { ++ struct _vxm_event ev; ++ struct _vxm_sched sd; ++ struct _vxm_update_1 u1; ++ struct _vxm_update_2 u2; ++ struct _vxm_rqinfo_1 q1; ++ struct _vxm_rqinfo_2 q2; ++ }; ++}; ++ ++#endif /* _UAPI_VS_MONITOR_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/network.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/network.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/network.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/network.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,76 @@ ++#ifndef _UAPI_VS_NETWORK_H ++#define _UAPI_VS_NETWORK_H ++ ++#include ++ ++ ++#define MAX_N_CONTEXT 65535 /* Arbitrary limit */ ++ ++ ++/* network flags */ ++ ++#define NXF_INFO_PRIVATE 0x00000008 ++ ++#define NXF_SINGLE_IP 0x00000100 ++#define NXF_LBACK_REMAP 0x00000200 ++#define NXF_LBACK_ALLOW 0x00000400 ++ ++#define NXF_HIDE_NETIF 0x02000000 ++#define NXF_HIDE_LBACK 0x04000000 ++ ++#define NXF_STATE_SETUP (1ULL << 32) ++#define NXF_STATE_ADMIN (1ULL << 34) ++ ++#define NXF_SC_HELPER (1ULL << 36) ++#define NXF_PERSISTENT (1ULL << 38) ++ ++#define NXF_ONE_TIME (0x0005ULL << 32) ++ ++ ++#define NXF_INIT_SET (__nxf_init_set()) ++ ++static inline uint64_t __nxf_init_set(void) { ++ return NXF_STATE_ADMIN ++#ifdef CONFIG_VSERVER_AUTO_LBACK ++ | NXF_LBACK_REMAP ++ | NXF_HIDE_LBACK ++#endif ++#ifdef CONFIG_VSERVER_AUTO_SINGLE ++ | NXF_SINGLE_IP ++#endif ++ | NXF_HIDE_NETIF; ++} ++ ++ ++/* network caps */ ++ ++#define NXC_TUN_CREATE 0x00000001 ++ ++#define NXC_RAW_ICMP 0x00000100 ++ ++#define NXC_MULTICAST 0x00001000 ++ ++ ++/* address types */ ++ ++#define NXA_TYPE_IPV4 0x0001 ++#define NXA_TYPE_IPV6 0x0002 ++ ++#define NXA_TYPE_NONE 0x0000 ++#define NXA_TYPE_ANY 0x00FF ++ ++#define NXA_TYPE_ADDR 0x0010 ++#define NXA_TYPE_MASK 0x0020 ++#define NXA_TYPE_RANGE 0x0040 ++ ++#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE) ++ ++#define NXA_MOD_BCAST 0x0100 ++#define NXA_MOD_LBACK 0x0200 ++ ++#define NXA_LOOPBACK 0x1000 ++ ++#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK) ++#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK) ++ ++#endif /* _UAPI_VS_NETWORK_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/network_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/network_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/network_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/network_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,123 @@ ++#ifndef _UAPI_VS_NETWORK_CMD_H ++#define _UAPI_VS_NETWORK_CMD_H ++ ++ ++/* vinfo commands */ ++ ++#define VCMD_task_nid VC_CMD(VINFO, 2, 0) ++ ++ ++#define VCMD_nx_info VC_CMD(VINFO, 6, 0) ++ ++struct vcmd_nx_info_v0 { ++ uint32_t nid; ++ /* more to come */ ++}; ++ ++ ++#include ++#include ++ ++#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0) ++#define VCMD_net_create VC_CMD(VNET, 1, 1) ++ ++struct vcmd_net_create { ++ uint64_t flagword; ++}; ++ ++#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0) ++ ++#define VCMD_net_add VC_CMD(NETALT, 1, 0) ++#define VCMD_net_remove VC_CMD(NETALT, 2, 0) ++ ++struct vcmd_net_addr_v0 { ++ uint16_t type; ++ uint16_t count; ++ struct in_addr ip[4]; ++ struct in_addr mask[4]; ++}; ++ ++#define VCMD_net_add_ipv4_v1 VC_CMD(NETALT, 1, 1) ++#define VCMD_net_rem_ipv4_v1 VC_CMD(NETALT, 2, 1) ++ ++struct vcmd_net_addr_ipv4_v1 { ++ uint16_t type; ++ uint16_t flags; ++ struct in_addr ip; ++ struct in_addr mask; ++}; ++ ++#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 2) ++#define VCMD_net_rem_ipv4 VC_CMD(NETALT, 2, 2) ++ ++struct vcmd_net_addr_ipv4_v2 { ++ uint16_t type; ++ uint16_t flags; ++ struct in_addr ip; ++ struct in_addr ip2; ++ struct in_addr mask; ++}; ++ ++#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1) ++#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1) ++ ++struct vcmd_net_addr_ipv6_v1 { ++ uint16_t type; ++ uint16_t flags; ++ uint32_t prefix; ++ struct in6_addr ip; ++ struct in6_addr mask; ++}; ++ ++#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0) ++#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0) ++ ++struct vcmd_match_ipv4_v0 { ++ uint16_t type; ++ uint16_t flags; ++ uint16_t parent; ++ uint16_t prefix; ++ struct in_addr ip; ++ struct in_addr ip2; ++ struct in_addr mask; ++}; ++ ++#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0) ++#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0) ++ ++struct vcmd_match_ipv6_v0 { ++ uint16_t type; ++ uint16_t flags; ++ uint16_t parent; ++ uint16_t prefix; ++ struct in6_addr ip; ++ struct in6_addr ip2; ++ struct in6_addr mask; ++}; ++ ++ ++ ++ ++/* flag commands */ ++ ++#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0) ++#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0) ++ ++struct vcmd_net_flags_v0 { ++ uint64_t flagword; ++ uint64_t mask; ++}; ++ ++ ++ ++/* network caps commands */ ++ ++#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0) ++#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0) ++ ++struct vcmd_net_caps_v0 { ++ uint64_t ncaps; ++ uint64_t cmask; ++}; ++ ++#endif /* _UAPI_VS_NETWORK_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/sched_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/sched_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/sched_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/sched_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,13 @@ ++#ifndef _UAPI_VS_SCHED_CMD_H ++#define _UAPI_VS_SCHED_CMD_H ++ ++ ++struct vcmd_prio_bias { ++ int32_t cpu_id; ++ int32_t prio_bias; ++}; ++ ++#define VCMD_set_prio_bias VC_CMD(SCHED, 4, 0) ++#define VCMD_get_prio_bias VC_CMD(SCHED, 5, 0) ++ ++#endif /* _UAPI_VS_SCHED_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/signal_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/signal_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/signal_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/signal_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,31 @@ ++#ifndef _UAPI_VS_SIGNAL_CMD_H ++#define _UAPI_VS_SIGNAL_CMD_H ++ ++ ++/* signalling vserver commands */ ++ ++#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0) ++#define VCMD_wait_exit VC_CMD(EVENT, 99, 0) ++ ++struct vcmd_ctx_kill_v0 { ++ int32_t pid; ++ int32_t sig; ++}; ++ ++struct vcmd_wait_exit_v0 { ++ int32_t reboot_cmd; ++ int32_t exit_code; ++}; ++ ++ ++/* process alteration commands */ ++ ++#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0) ++#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0) ++ ++struct vcmd_pflags_v0 { ++ uint32_t flagword; ++ uint32_t mask; ++}; ++ ++#endif /* _UAPI_VS_SIGNAL_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/space_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/space_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/space_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/space_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,28 @@ ++#ifndef _UAPI_VS_SPACE_CMD_H ++#define _UAPI_VS_SPACE_CMD_H ++ ++ ++#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0) ++#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1) ++#define VCMD_enter_space VC_CMD(PROCALT, 1, 2) ++ ++#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0) ++#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1) ++#define VCMD_set_space VC_CMD(PROCALT, 3, 2) ++ ++#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0) ++ ++#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1) ++#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0) ++ ++ ++struct vcmd_space_mask_v1 { ++ uint64_t mask; ++}; ++ ++struct vcmd_space_mask_v2 { ++ uint64_t mask; ++ uint32_t index; ++}; ++ ++#endif /* _UAPI_VS_SPACE_CMD_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/switch.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/switch.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/switch.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/switch.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,90 @@ ++#ifndef _UAPI_VS_SWITCH_H ++#define _UAPI_VS_SWITCH_H ++ ++#include ++ ++ ++#define VC_CATEGORY(c) (((c) >> 24) & 0x3F) ++#define VC_COMMAND(c) (((c) >> 16) & 0xFF) ++#define VC_VERSION(c) ((c) & 0xFFF) ++ ++#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \ ++ | (((i) & 0xFF) << 16) | ((v) & 0xFFF)) ++ ++/* ++ ++ Syscall Matrix V2.8 ++ ++ |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL| ++ |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | | ++ |INFO |SETUP | |MOVE | | | | | | ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | | ++ HOST | 00| 01| 02| 03| 04| 05| | 06| 07| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | | ++ PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ MEMORY | | | | |MEMCTRL| | |SWAP | | ++ | 16| 17| 18| 19| 20| 21| | 22| 23| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | | ++ | 24| 25| 26| 27| 28| 29| | 30| 31| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ DISK | | | |TAGMIG |DLIMIT | | |INODE | | ++ VFS | 32| 33| 34| 35| 36| 37| | 38| 39| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ OTHER |VSTAT | | | | | | |VINFO | | ++ | 40| 41| 42| 43| 44| 45| | 46| 47| ++ =======+=======+=======+=======+=======+=======+=======+ +=======+=======+ ++ SPECIAL|EVENT | | | |FLAGS | | |VSPACE | | ++ | 48| 49| 50| 51| 52| 53| | 54| 55| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT | ++ | 56| 57| 58| 59| 60|TEST 61| | 62| 63| ++ -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ ++ ++*/ ++ ++#define VC_CAT_VERSION 0 ++ ++#define VC_CAT_VSETUP 1 ++#define VC_CAT_VHOST 2 ++ ++#define VC_CAT_DEVICE 6 ++ ++#define VC_CAT_VPROC 9 ++#define VC_CAT_PROCALT 10 ++#define VC_CAT_PROCMIG 11 ++#define VC_CAT_PROCTRL 12 ++ ++#define VC_CAT_SCHED 14 ++#define VC_CAT_MEMCTRL 20 ++ ++#define VC_CAT_VNET 25 ++#define VC_CAT_NETALT 26 ++#define VC_CAT_NETMIG 27 ++#define VC_CAT_NETCTRL 28 ++ ++#define VC_CAT_TAGMIG 35 ++#define VC_CAT_DLIMIT 36 ++#define VC_CAT_INODE 38 ++ ++#define VC_CAT_VSTAT 40 ++#define VC_CAT_VINFO 46 ++#define VC_CAT_EVENT 48 ++ ++#define VC_CAT_FLAGS 52 ++#define VC_CAT_VSPACE 54 ++#define VC_CAT_DEBUG 56 ++#define VC_CAT_RLIMIT 60 ++ ++#define VC_CAT_SYSTEST 61 ++#define VC_CAT_COMPAT 63 ++ ++/* query version */ ++ ++#define VCMD_get_version VC_CMD(VERSION, 0, 0) ++#define VCMD_get_vci VC_CMD(VERSION, 1, 0) ++ ++#endif /* _UAPI_VS_SWITCH_H */ +diff -NurpP --minimal linux-3.7-vs2.3.5.1.3/include/uapi/vserver/tag_cmd.h linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/tag_cmd.h +--- linux-3.7-vs2.3.5.1.3/include/uapi/vserver/tag_cmd.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.3-uapi/include/uapi/vserver/tag_cmd.h 2012-12-13 22:22:21.000000000 +0000 +@@ -0,0 +1,14 @@ ++#ifndef _UAPI_VS_TAG_CMD_H ++#define _UAPI_VS_TAG_CMD_H ++ ++ ++/* vinfo commands */ ++ ++#define VCMD_task_tag VC_CMD(VINFO, 3, 0) ++ ++ ++/* context commands */ ++ ++#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0) ++ ++#endif /* _UAPI_VS_TAG_CMD_H */ +diff -NurpP linux-3.7-vs2.3.5.1.1/kernel/vserver/network.c linux-3.7-vs2.3.5.1.2/kernel/vserver/network.c +--- linux-3.7-vs2.3.5.1.1/kernel/vserver/network.c 2012-12-13 13:48:35.000000000 +0000 ++++ linux-3.7-vs2.3.5.1.2/kernel/vserver/network.c 2012-12-13 18:10:29.000000000 +0000 +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -592,20 +593,43 @@ int vc_net_migrate(struct nx_info *nxi, + } + + ++static inline ++struct nx_addr_v4 *__find_v4_addr(struct nx_info *nxi, ++ __be32 ip, __be32 ip2, __be32 mask, uint16_t type, uint16_t flags, ++ struct nx_addr_v4 **prev) ++{ ++ struct nx_addr_v4 *nxa = &nxi->v4; ++ ++ for (; nxa; nxa = nxa->next) { ++ if ((nxa->ip[0].s_addr == ip) && ++ (nxa->ip[1].s_addr == ip2) && ++ (nxa->mask.s_addr == mask) && ++ (nxa->type == type) && ++ (nxa->flags == flags)) ++ return nxa; ++ ++ /* save previous entry */ ++ if (prev) ++ *prev = nxa; ++ } ++ return NULL; ++} + + int do_add_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask, + uint16_t type, uint16_t flags) + { +- struct nx_addr_v4 *nxa = &nxi->v4; ++ struct nx_addr_v4 *nxa = NULL; + struct nx_addr_v4 *new = __alloc_nx_addr_v4(); ++ int ret = -EEXIST; + + if (IS_ERR(new)) + return PTR_ERR(new); + + spin_lock(&nxi->addr_lock); ++ if (__find_v4_addr(nxi, ip, ip2, mask, type, flags, &nxa)) ++ goto out_unlock; ++ + if (NX_IPV4(nxi)) { +- /* locate last entry */ +- for (; nxa->next; nxa = nxa->next); + nxa->next = new; + nxa = new; + new = NULL; +@@ -619,25 +643,46 @@ int do_add_v4_addr(struct nx_info *nxi, + nxa->mask.s_addr = mask; + nxa->type = type; + nxa->flags = flags; ++ ret = 0; ++out_unlock: + spin_unlock(&nxi->addr_lock); + if (new) + __dealloc_nx_addr_v4(new); +- return 0; ++ return ret; + } + + int do_remove_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask, + uint16_t type, uint16_t flags) + { +- struct nx_addr_v4 *nxa = &nxi->v4; ++ struct nx_addr_v4 *nxa = NULL; + struct nx_addr_v4 *old = NULL; + int ret = 0; + + spin_lock(&nxi->addr_lock); + switch (type) { +-/* case NXA_TYPE_ADDR: +- break; */ ++ case NXA_TYPE_ADDR: ++ old = __find_v4_addr(nxi, ip, ip2, mask, type, flags, &nxa); ++ if (old) { ++ if (nxa) { ++ nxa->next = old->next; ++ old->next = NULL; ++ } else { ++ if (old->next) { ++ nxa = old; ++ old = old->next; ++ *nxa = *old; ++ old->next = NULL; ++ } else { ++ memset(old, 0, sizeof(*old)); ++ old = NULL; ++ } ++ } ++ } else ++ ret = -ESRCH; ++ break; + + case NXA_TYPE_ANY: ++ nxa = &nxi->v4; + old = xchg(&nxa->next, NULL); + memset(nxa, 0, sizeof(*nxa)); + break; +@@ -788,20 +833,46 @@ int vc_net_rem_ipv4(struct nx_info *nxi, + + #ifdef CONFIG_IPV6 + ++static inline ++struct nx_addr_v6 *__find_v6_addr(struct nx_info *nxi, ++ struct in6_addr *ip, struct in6_addr *mask, ++ uint32_t prefix, uint16_t type, uint16_t flags, ++ struct nx_addr_v6 **prev) ++{ ++ struct nx_addr_v6 *nxa = &nxi->v6; ++ ++ for (; nxa; nxa = nxa->next) { ++ if (ipv6_addr_equal(&nxa->ip, ip) && ++ ipv6_addr_equal(&nxa->mask, mask) && ++ (nxa->prefix == prefix) && ++ (nxa->type == type) && ++ (nxa->flags == flags)) ++ return nxa; ++ ++ /* save previous entry */ ++ if (prev) ++ *prev = nxa; ++ } ++ return NULL; ++} ++ ++ + int do_add_v6_addr(struct nx_info *nxi, + struct in6_addr *ip, struct in6_addr *mask, + uint32_t prefix, uint16_t type, uint16_t flags) + { +- struct nx_addr_v6 *nxa = &nxi->v6; ++ struct nx_addr_v6 *nxa = NULL; + struct nx_addr_v6 *new = __alloc_nx_addr_v6(); ++ int ret = -EEXIST; + + if (IS_ERR(new)) + return PTR_ERR(new); + + spin_lock(&nxi->addr_lock); ++ if (__find_v6_addr(nxi, ip, mask, prefix, type, flags, &nxa)) ++ goto out_unlock; ++ + if (NX_IPV6(nxi)) { +- /* locate last entry */ +- for (; nxa->next; nxa = nxa->next); + nxa->next = new; + nxa = new; + new = NULL; +@@ -812,26 +883,47 @@ int do_add_v6_addr(struct nx_info *nxi, + nxa->prefix = prefix; + nxa->type = type; + nxa->flags = flags; ++ ret = 0; ++out_unlock: + spin_unlock(&nxi->addr_lock); + if (new) + __dealloc_nx_addr_v6(new); +- return 0; ++ return ret; + } + + int do_remove_v6_addr(struct nx_info *nxi, + struct in6_addr *ip, struct in6_addr *mask, + uint32_t prefix, uint16_t type, uint16_t flags) + { +- struct nx_addr_v6 *nxa = &nxi->v6; ++ struct nx_addr_v6 *nxa = NULL; + struct nx_addr_v6 *old = NULL; + int ret = 0; + + spin_lock(&nxi->addr_lock); + switch (type) { +-/* case NXA_TYPE_ADDR: +- break; */ ++ case NXA_TYPE_ADDR: ++ old = __find_v6_addr(nxi, ip, mask, prefix, type, flags, &nxa); ++ if (old) { ++ if (nxa) { ++ nxa->next = old->next; ++ old->next = NULL; ++ } else { ++ if (old->next) { ++ nxa = old; ++ old = old->next; ++ *nxa = *old; ++ old->next = NULL; ++ } else { ++ memset(old, 0, sizeof(*old)); ++ old = NULL; ++ } ++ } ++ } else ++ ret = -ESRCH; ++ break; + + case NXA_TYPE_ANY: ++ nxa = &nxi->v6; + old = xchg(&nxa->next, NULL); + memset(nxa, 0, sizeof(*nxa)); + break; +@@ -872,9 +964,14 @@ int vc_net_remove_ipv6(struct nx_info *n + return -EFAULT; + + switch (vc_data.type) { ++ case NXA_TYPE_ADDR: ++ memset(&vc_data.mask, ~0, sizeof(vc_data.mask)); ++ /* fallthrough */ ++ case NXA_TYPE_MASK: ++ return do_remove_v6_addr(nxi, &vc_data.ip, &vc_data.mask, ++ vc_data.prefix, vc_data.type, vc_data.flags); + case NXA_TYPE_ANY: +- do_remove_v6_addr(nxi, NULL, NULL, 0, vc_data.type, 0); +- break; ++ return do_remove_v6_addr(nxi, NULL, NULL, 0, vc_data.type, 0); + default: + return -EINVAL; + } diff --git a/kernel.spec b/kernel.spec index a2aca5f8..93d53ab5 100644 --- a/kernel.spec +++ b/kernel.spec @@ -1119,9 +1119,9 @@ fi /lib/modules/%{kernel_release}/kernel/sound/ac97_bus.ko* /lib/modules/%{kernel_release}/kernel/sound/sound*.ko* %ifnarch sparc -%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/cx88/cx88-alsa.ko* -%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/em28xx/em28xx-alsa.ko* -%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/saa7134/saa7134-alsa.ko* +%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/pci/cx88/cx88-alsa.ko* +%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/usb/em28xx/em28xx-alsa.ko* +%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/pci/saa7134/saa7134-alsa.ko* %endif %endif %dir /lib/modules/%{kernel_release}/misc @@ -1218,9 +1218,9 @@ fi %endif %ifnarch sparc /lib/modules/%{kernel_release}/kernel/drivers/usb/gadget/g_midi.ko* -/lib/modules/%{kernel_release}/kernel/drivers/media/video/cx88/cx88-alsa.ko* -/lib/modules/%{kernel_release}/kernel/drivers/media/video/em28xx/em28xx-alsa.ko* -/lib/modules/%{kernel_release}/kernel/drivers/media/video/saa7134/saa7134-alsa.ko* +/lib/modules/%{kernel_release}/kernel/drivers/media/pci/cx88/cx88-alsa.ko* +/lib/modules/%{kernel_release}/kernel/drivers/media/usb/em28xx/em28xx-alsa.ko* +/lib/modules/%{kernel_release}/kernel/drivers/media/pci/saa7134/saa7134-alsa.ko* %endif %if %{have_oss} @@ -1252,7 +1252,7 @@ fi %{_kernelsrcdir}/arch/*/kernel/asm-offsets* %{_kernelsrcdir}/arch/*/kernel/sigframe*.h %{_kernelsrcdir}/drivers/lguest/lg.h -%{_kernelsrcdir}/drivers/media/video/bt8xx/bttv.h +%{_kernelsrcdir}/drivers/media/pci/bt8xx/bttv.h %{_kernelsrcdir}/kernel/bounds.c %{_kernelsrcdir}/scripts/basic/*.c %attr(755,root,root) %{_kernelsrcdir}/scripts/kconfig/*.sh @@ -1318,7 +1318,7 @@ fi %exclude %{_kernelsrcdir}/arch/*/kernel/asm-offsets* %exclude %{_kernelsrcdir}/arch/*/kernel/sigframe*.h %exclude %{_kernelsrcdir}/drivers/lguest/lg.h -%exclude %{_kernelsrcdir}/drivers/media/video/bt8xx/bttv.h +%exclude %{_kernelsrcdir}/drivers/media/pci/bt8xx/bttv.h %{_kernelsrcdir}/block %{_kernelsrcdir}/crypto %{_kernelsrcdir}/drivers