updated to 2.6.12.2-vs2.0-rc5
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Sun, 3 Jul 2005 14:02:03 +0000 (14:02 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Sun, 3 Jul 2005 14:02:03 +0000 (14:02 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2121 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/kernel/context.h
util-vserver/kernel/context_cmd.h
util-vserver/kernel/cvirt_cmd.h
util-vserver/kernel/debug.h
util-vserver/kernel/namespace.h
util-vserver/kernel/namespace_cmd.h [new file with mode: 0644]
util-vserver/kernel/network.h
util-vserver/kernel/network_cmd.h
util-vserver/kernel/switch.h

index a5a77e0..79f9053 100644 (file)
@@ -36,6 +36,8 @@
 #define VXF_STATE_SETUP                (1ULL<<32)
 #define VXF_STATE_INIT         (1ULL<<33)
 
+#define VXF_STATE_HELPER       (1ULL<<36)
+
 #define VXF_FORK_RSS           (1ULL<<48)
 #define VXF_PROLIFIC           (1ULL<<49)
 
@@ -43,6 +45,8 @@
 
 #define VXF_ONE_TIME           (0x0003ULL<<32)
 
+#define VXF_INIT_SET           (VXF_STATE_SETUP|VXF_STATE_INIT)
+
 
 /* context caps */
 
@@ -66,6 +70,9 @@
 enum {
        VSC_STARTUP = 1,
        VSC_SHUTDOWN,
+
+       VSC_NETUP,
+       VSC_NETDOWN,
 };
 
 
@@ -81,7 +88,6 @@ enum {
 
 struct vx_info {
        struct hlist_node vx_hlist;             /* linked list of contexts */
-       struct rcu_head vx_rcu;                 /* the rcu head */
        xid_t vx_id;                            /* context id */
        atomic_t vx_usecnt;                     /* usage count */
        atomic_t vx_tasks;                      /* tasks count */
@@ -96,7 +102,6 @@ struct vx_info {
 
        pid_t vx_initpid;                       /* PID of fake init process */
 
-       spinlock_t vx_lock;
        wait_queue_head_t vx_wait;              /* context exit waitqueue */
 
        struct _vx_limit limit;                 /* vserver limits */
@@ -114,7 +119,6 @@ struct vx_info {
 #define VXS_PAUSED     0x0010
 #define VXS_ONHOLD     0x0020
 #define VXS_SHUTDOWN   0x0100
-#define VXS_DEFUNCT    0x1000
 #define VXS_RELEASED   0x8000
 
 /* check conditions */
@@ -150,8 +154,6 @@ extern int vx_migrate_task(struct task_struct *, struct vx_info *);
 
 extern long vs_state_change(struct vx_info *, unsigned int);
 
-extern void free_vx_info(struct vx_info *);
-
 
 #endif /* __KERNEL__ */
 #else  /* _VX_CONTEXT_H */
index 637a0d8..f631095 100644 (file)
@@ -27,7 +27,13 @@ extern int vc_vx_info(uint32_t, void __user *);
 
 /* context commands */
 
-#define VCMD_ctx_create                VC_CMD(VPROC, 1, 0)
+#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       VC_CMD(PROCMIG, 1, 0)
 
 #ifdef __KERNEL__
index 368f527..3260b9f 100644 (file)
@@ -1,7 +1,34 @@
 #ifndef _VX_CVIRT_CMD_H
 #define _VX_CVIRT_CMD_H
 
-/*  cvirt vserver commands */
+/* 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,
+};
+
+
+#ifdef __KERNEL__
+
+#include <linux/compiler.h>
+
+extern int vc_set_vhi_name(uint32_t, void __user *);
+extern int vc_get_vhi_name(uint32_t, void __user *);
+
+#endif /* __KERNEL__ */
 #endif /* _VX_CVIRT_CMD_H */
index 1a18fe8..1e58c4e 100644 (file)
@@ -152,186 +152,85 @@ static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *
        }
 }
 
-static inline void vxh_throw_oops(void)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       entry->type = VXH_THROW_OOPS;
-       preempt_enable();
-
-       /* prevent further acquisition */
-       vxh_active = 0;
-}
 
-static inline void vxh_get_vx_info(struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_GET_VX_INFO;
-       preempt_enable();
-}
-
-static inline void vxh_put_vx_info(struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_PUT_VX_INFO;
+#define __VXH_BODY(__type, __data)             \
+       struct _vx_hist_entry *entry;           \
+                                               \
+       preempt_disable();                      \
+       entry = vxh_advance(VXH_HERE());        \
+       __data;                                 \
+       entry->type = __type;                   \
        preempt_enable();
-}
-
-static inline void vxh_init_vx_info(struct vx_info *vxi, void *data)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->sc.data = data;
-       entry->type = VXH_INIT_VX_INFO;
-       preempt_enable();
-}
-
-static inline void vxh_set_vx_info(struct vx_info *vxi, void *data)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->sc.data = data;
-       entry->type = VXH_SET_VX_INFO;
-       preempt_enable();
-}
-
-static inline void vxh_clr_vx_info(struct vx_info *vxi, void *data)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->sc.data = data;
-       entry->type = VXH_CLR_VX_INFO;
-       preempt_enable();
-}
 
-static inline void vxh_claim_vx_info(struct vx_info *vxi, void *data)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->sc.data = data;
-       entry->type = VXH_CLAIM_VX_INFO;
-       preempt_enable();
-}
 
-static inline void vxh_release_vx_info(struct vx_info *vxi, void *data)
-{
-       struct _vx_hist_entry *entry;
+       /* pass vxi only */
+#define __VXH_SIMPLE                           \
+       __vxh_copy_vxi(entry, vxi)
 
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->sc.data = data;
-       entry->type = VXH_RELEASE_VX_INFO;
-       preempt_enable();
+#define VXH_SIMPLE(__name, __type)             \
+static inline void __name(struct vx_info *vxi) \
+{                                              \
+       __VXH_BODY(__type, __VXH_SIMPLE)        \
 }
 
-static inline void vxh_alloc_vx_info(struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
+       /* pass vxi and data (void *) */
+#define __VXH_DATA                             \
+       __vxh_copy_vxi(entry, vxi);             \
+       entry->sc.data = data
 
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_ALLOC_VX_INFO;
-       preempt_enable();
+#define VXH_DATA(__name, __type)               \
+static inline                                  \
+void __name(struct vx_info *vxi, void *data)   \
+{                                              \
+       __VXH_BODY(__type, __VXH_DATA)          \
 }
 
-static inline void vxh_dealloc_vx_info(struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
+       /* pass vxi and arg (long) */
+#define __VXH_LARG                             \
+       __vxh_copy_vxi(entry, vxi);             \
+       entry->ll.arg = arg
 
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_DEALLOC_VX_INFO;
-       preempt_enable();
+#define VXH_LARG(__name, __type)               \
+static inline                                  \
+void __name(struct vx_info *vxi, long arg)     \
+{                                              \
+       __VXH_BODY(__type, __VXH_LARG)          \
 }
 
-static inline void vxh_hash_vx_info(struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_HASH_VX_INFO;
-       preempt_enable();
-}
 
-static inline void vxh_unhash_vx_info(struct vx_info *vxi)
+static inline void vxh_throw_oops(void)
 {
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->type = VXH_UNHASH_VX_INFO;
-       preempt_enable();
+       __VXH_BODY(VXH_THROW_OOPS, {});
+       /* prevent further acquisition */
+       vxh_active = 0;
 }
 
-static inline void vxh_loc_vx_info(unsigned arg, struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
+VXH_SIMPLE(vxh_get_vx_info,    VXH_GET_VX_INFO);
+VXH_SIMPLE(vxh_put_vx_info,    VXH_PUT_VX_INFO);
 
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->ll.arg = arg;
-       entry->type = VXH_LOC_VX_INFO;
-       preempt_enable();
-}
+VXH_DATA(vxh_init_vx_info,     VXH_INIT_VX_INFO);
+VXH_DATA(vxh_set_vx_info,      VXH_SET_VX_INFO);
+VXH_DATA(vxh_clr_vx_info,      VXH_CLR_VX_INFO);
 
-static inline void vxh_lookup_vx_info(unsigned arg, struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
+VXH_DATA(vxh_claim_vx_info,    VXH_CLAIM_VX_INFO);
+VXH_DATA(vxh_release_vx_info,  VXH_RELEASE_VX_INFO);
 
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->ll.arg = arg;
-       entry->type = VXH_LOOKUP_VX_INFO;
-       preempt_enable();
-}
+VXH_SIMPLE(vxh_alloc_vx_info,  VXH_ALLOC_VX_INFO);
+VXH_SIMPLE(vxh_dealloc_vx_info, VXH_DEALLOC_VX_INFO);
 
-static inline void vxh_create_vx_info(unsigned arg, struct vx_info *vxi)
-{
-       struct _vx_hist_entry *entry;
-
-       preempt_disable();
-       entry = vxh_advance(VXH_HERE());
-       __vxh_copy_vxi(entry, vxi);
-       entry->ll.arg = arg;
-       entry->type = VXH_CREATE_VX_INFO;
-       preempt_enable();
-}
+VXH_SIMPLE(vxh_hash_vx_info,   VXH_HASH_VX_INFO);
+VXH_SIMPLE(vxh_unhash_vx_info, VXH_UNHASH_VX_INFO);
 
+VXH_LARG(vxh_loc_vx_info,      VXH_LOC_VX_INFO);
+VXH_LARG(vxh_lookup_vx_info,   VXH_LOOKUP_VX_INFO);
+VXH_LARG(vxh_create_vx_info,   VXH_CREATE_VX_INFO);
 
 extern void vxh_dump_history(void);
 
+
 #else  /* CONFIG_VSERVER_HISTORY */
 
+
 #define vxh_throw_oops()               do { } while (0)
 
 #define vxh_get_vx_info(v)             do { } while (0)
index 8518a56..1a6bb84 100644 (file)
@@ -3,56 +3,12 @@
 
 #include <linux/types.h>
 
-
-/* virtual host info names */
-
-#define VCMD_vx_set_vhi_name   VC_CMD(VHOST, 1, 0)
-#define VCMD_vx_get_vhi_name   VC_CMD(VHOST, 2, 0)
-
-struct vcmd_vx_vhi_name_v0 {
-       uint32_t field;
-       char name[65];
-};
-
-
-enum vx_vhi_name_field {
-       VHIN_CONTEXT=0,
-       VHIN_SYSNAME,
-       VHIN_NODENAME,
-       VHIN_RELEASE,
-       VHIN_VERSION,
-       VHIN_MACHINE,
-       VHIN_DOMAINNAME,
-};
-
-
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-
-extern int vc_set_vhi_name(uint32_t, void __user *);
-extern int vc_get_vhi_name(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
-
-#define VCMD_enter_namespace   VC_CMD(PROCALT, 1, 0)
-#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
-#define VCMD_set_namespace     VC_CMD(PROCALT, 3, 0)
-
-#ifdef __KERNEL__
-
 struct vx_info;
 struct namespace;
 struct fs_struct;
-struct vfsmount;
 
 extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *);
 
-extern int vc_enter_namespace(uint32_t, void __user *);
-extern int vc_cleanup_namespace(uint32_t, void __user *);
-extern int vc_set_namespace(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
 #else  /* _VX_NAMESPACE_H */
 #warning duplicate inclusion
 #endif /* _VX_NAMESPACE_H */
diff --git a/util-vserver/kernel/namespace_cmd.h b/util-vserver/kernel/namespace_cmd.h
new file mode 100644 (file)
index 0000000..7533100
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _VX_NAMESPACE_CMD_H
+#define _VX_NAMESPACE_CMD_H
+
+#define VCMD_enter_namespace   VC_CMD(PROCALT, 1, 0)
+#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
+#define VCMD_set_namespace     VC_CMD(PROCALT, 3, 0)
+
+
+#ifdef __KERNEL__
+
+extern int vc_enter_namespace(uint32_t, void __user *);
+extern int vc_cleanup_namespace(uint32_t, void __user *);
+extern int vc_set_namespace(uint32_t, void __user *);
+
+#endif /* __KERNEL__ */
+#endif /* _VX_NAMESPACE_CMD_H */
index 591ec21..f475b3f 100644 (file)
 #define NB_IPV4ROOT    16
 
 
+/* context flags */
+
+#define NXF_STATE_SETUP                (1ULL<<32)
+
+#define NXF_STATE_HELPER       (1ULL<<36)
+
+#define NXF_INIT_SET           (0)
+
+
 #ifdef __KERNEL__
 
 #include <linux/list.h>
 
 struct nx_info {
        struct hlist_node nx_hlist;     /* linked list of nxinfos */
-       struct rcu_head nx_rcu;         /* the rcu head */
        nid_t nx_id;                    /* vnet id */
        atomic_t nx_usecnt;             /* usage count */
-       atomic_t nx_refcnt;             /* reference count */
+       atomic_t nx_tasks;              /* tasks count */
+       int nx_state;                   /* context state */
 
        uint64_t nx_flags;              /* network flag word */
        uint64_t nx_ncaps;              /* network capabilities */
@@ -43,9 +52,11 @@ struct nx_info {
 };
 
 
-struct rcu_head;
+/* status flags */
 
-extern void unhash_nx_info(struct nx_info *);
+#define NXS_HASHED      0x0001
+#define NXS_SHUTDOWN    0x0100
+#define NXS_RELEASED    0x8000
 
 extern struct nx_info *locate_nx_info(int);
 extern struct nx_info *locate_or_create_nx_info(int);
@@ -55,6 +66,8 @@ extern int nid_is_hashed(nid_t);
 
 extern int nx_migrate_task(struct task_struct *, struct nx_info *);
 
+extern long vs_net_change(struct nx_info *, unsigned int);
+
 struct in_ifaddr;
 struct net_device;
 
index 4403f54..d23961e 100644 (file)
@@ -23,7 +23,13 @@ extern int vc_nx_info(uint32_t, void __user *);
 
 #endif /* __KERNEL__ */
 
-#define VCMD_net_create                VC_CMD(VNET, 1, 0)
+#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)
@@ -37,8 +43,6 @@ struct        vcmd_net_nx_v0 {
        /* more to come */
 };
 
-//     IPN_TYPE_IPV4
-
 
 #ifdef __KERNEL__
 extern int vc_net_create(uint32_t, void __user *);
@@ -62,7 +66,6 @@ extern int vc_set_nflags(uint32_t, void __user *);
 
 #define IPF_STATE_SETUP                (1ULL<<32)
 
-
 #define IPF_ONE_TIME           (0x0001ULL<<32)
 
 #define VCMD_get_ncaps         VC_CMD(FLAGS, 7, 0)
index 81f5c23..36b09c4 100644 (file)
@@ -77,7 +77,7 @@
 
 /*  interface version */
 
-#define VCI_VERSION            0x00010025
+#define VCI_VERSION            0x00020001
 
 
 /*  query version */