updated to 2.6.13.3-vs2.1.0-rc4 headers
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Fri, 28 Oct 2005 17:49:52 +0000 (17:49 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Fri, 28 Oct 2005 17:49:52 +0000 (17:49 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2191 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/Makefile.am
util-vserver/kernel/context.h
util-vserver/kernel/cvirt_def.h
util-vserver/kernel/debug.h
util-vserver/kernel/global.h [new file with mode: 0644]
util-vserver/kernel/limit.h
util-vserver/kernel/limit_def.h
util-vserver/kernel/network.h
util-vserver/kernel/sched_def.h
util-vserver/kernel/signal.h [new file with mode: 0644]
util-vserver/kernel/xid.h

index 8adb41e..5a3d4f4 100644 (file)
@@ -58,7 +58,8 @@ BUILT_SOURCES =               pathconfig.h \
 
 man_MANS =
 
-kernel_HDRS =          kernel/context.h        \
+kernel_HDRS =                                  \
+                       kernel/context.h        \
                        kernel/context_cmd.h    \
                        kernel/cvirt.h          \
                        kernel/cvirt_cmd.h      \
@@ -67,6 +68,7 @@ kernel_HDRS =         kernel/context.h        \
                        kernel/debug_cmd.h      \
                        kernel/dlimit.h         \
                        kernel/dlimit_cmd.h     \
+                       kernel/global.h         \
                        kernel/inode.h          \
                        kernel/inode_cmd.h      \
                        kernel/legacy.h         \
@@ -80,11 +82,13 @@ kernel_HDRS =               kernel/context.h        \
                        kernel/sched.h          \
                        kernel/sched_cmd.h      \
                        kernel/sched_def.h      \
+                       kernel/signal.h         \
                        kernel/signal_cmd.h     \
                        kernel/switch.h         \
                        kernel/xid.h
 
 
+
 EXTRA_PROGRAMS =
 EXTRA_DIST =           pathconfig.h.pathsubst \
                        util-vserver.spec \
index 79f9053..2cc8238 100644 (file)
@@ -36,7 +36,8 @@
 #define VXF_STATE_SETUP                (1ULL<<32)
 #define VXF_STATE_INIT         (1ULL<<33)
 
-#define VXF_STATE_HELPER       (1ULL<<36)
+#define VXF_SC_HELPER          (1ULL<<36)
+#define VXF_REBOOT_KILL                (1ULL<<37)
 
 #define VXF_FORK_RSS           (1ULL<<48)
 #define VXF_PROLIFIC           (1ULL<<49)
@@ -112,6 +113,11 @@ struct vx_info {
        char vx_name[65];                       /* vserver name */
 };
 
+struct vx_info_save {
+       struct vx_info *vxi;
+       xid_t xid;
+};
+
 
 /* status flags */
 
@@ -144,8 +150,8 @@ struct vx_info {
 extern void claim_vx_info(struct vx_info *, struct task_struct *);
 extern void release_vx_info(struct vx_info *, struct task_struct *);
 
-extern struct vx_info *locate_vx_info(int);
-extern struct vx_info *locate_or_create_vx_info(int);
+extern struct vx_info *lookup_vx_info(int);
+extern struct vx_info *lookup_or_create_vx_info(int);
 
 extern int get_xid_list(int, unsigned int *, int);
 extern int xid_is_hashed(xid_t);
index c352890..9fabb31 100644 (file)
@@ -23,10 +23,10 @@ struct _vx_syslog {
        wait_queue_head_t log_wait;
        spinlock_t logbuf_lock;         /* lock for the log buffer */
 
-       unsigned long log_start;        /* next char to be read by syslog() */
-       unsigned long con_start;        /* next char to be sent to consoles */
-       unsigned long log_end;          /* most-recently-written-char + 1 */
-       unsigned long logged_chars;     /* #chars since last read+clear operation */
+       unsigned long log_start;        /* next char to be read by syslog() */
+       unsigned long con_start;        /* next char to be sent to consoles */
+       unsigned long log_end;  /* most-recently-written-char + 1 */
+       unsigned long logged_chars;     /* #chars since last read+clear operation */
 
        char log_buf[1024];
 };
@@ -35,7 +35,7 @@ struct _vx_syslog {
 /* context sub struct */
 
 struct _vx_cvirt {
-       int max_threads;                /* maximum allowed threads */
+//     int max_threads;                /* maximum allowed threads */
        atomic_t nr_threads;            /* number of current threads */
        atomic_t nr_running;            /* number of running threads */
        atomic_t nr_uninterruptible;    /* number of uninterruptible threads */
@@ -61,6 +61,24 @@ struct _vx_cvirt {
        struct _vx_syslog syslog;
 };
 
+
+#ifdef CONFIG_VSERVER_DEBUG
+
+static inline void __dump_vx_cvirt(struct _vx_cvirt *cvirt)
+{
+       printk("\t_vx_cvirt:\n");
+       printk("\t threads: %4d, %4d, %4d, %4d\n",
+               atomic_read(&cvirt->nr_threads),
+               atomic_read(&cvirt->nr_running),
+               atomic_read(&cvirt->nr_uninterruptible),
+               atomic_read(&cvirt->nr_onhold));
+       /* add rest here */
+       printk("\t total_forks = %d\n", atomic_read(&cvirt->total_forks));
+}
+
+#endif
+
+
 struct _vx_sock_acc {
        atomic_t count;
        atomic_t total;
@@ -69,9 +87,29 @@ struct _vx_sock_acc {
 /* context sub struct */
 
 struct _vx_cacct {
-       unsigned long total_forks;
-
        struct _vx_sock_acc sock[5][3];
 };
 
+#ifdef CONFIG_VSERVER_DEBUG
+
+static inline void __dump_vx_cacct(struct _vx_cacct *cacct)
+{
+       int i,j;
+
+       printk("\t_vx_cacct:");
+       for (i=0; i<5; i++) {
+               struct _vx_sock_acc *ptr = cacct->sock[i];
+
+               printk("\t [%d] =", i);
+               for (j=0; j<3; j++) {
+                       printk(" [%d] = %8d, %8d", j,
+                               atomic_read(&ptr[j].count),
+                               atomic_read(&ptr[j].total));
+               }
+               printk("\n");
+       }
+}
+
+#endif
+
 #endif /* _VX_CVIRT_DEF_H */
index 1e58c4e..b84cbbb 100644 (file)
@@ -24,7 +24,9 @@ extern unsigned int vx_debug_nid;
 extern unsigned int vx_debug_net;
 extern unsigned int vx_debug_limit;
 extern unsigned int vx_debug_dlim;
+extern unsigned int vx_debug_quota;
 extern unsigned int vx_debug_cvirt;
+extern unsigned int vx_debug_misc;
 
 
 #define VX_LOGLEVEL    "vxD: "
@@ -60,6 +62,10 @@ extern unsigned int vx_debug_cvirt;
        ({ static char _buffer[PATH_MAX];                       \
           d_path((d), (m), _buffer, sizeof(_buffer)); })
 
+
+void dump_vx_info(struct vx_info *, int);
+void dump_vx_info_inactive(int);
+
 #else  /* CONFIG_VSERVER_DEBUG */
 
 #define vx_debug_switch 0
@@ -77,6 +83,7 @@ extern unsigned int vx_debug_cvirt;
 
 #define vxd_path       "<none>"
 
+
 #endif /* CONFIG_VSERVER_DEBUG */
 
 
@@ -135,14 +142,9 @@ struct _vx_hist_entry {
 
 struct _vx_hist_entry *vxh_advance(void *loc);
 
-#define        VXH_HERE()              \
-       ({ __label__ here;      \
-               here:;          \
-               &&here; })
-
 
-
-static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
+static inline
+void   __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
 {
        entry->vxi.ptr = vxi;
        if (vxi) {
@@ -153,95 +155,118 @@ static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *
 }
 
 
-#define __VXH_BODY(__type, __data)             \
+#define        __HERE__ \
+       ({ __label__ __vxh_label; __vxh_label:; &&__vxh_label; })
+
+#define __VXH_BODY(__type, __data, __here)     \
        struct _vx_hist_entry *entry;           \
                                                \
        preempt_disable();                      \
-       entry = vxh_advance(VXH_HERE());        \
+       entry = vxh_advance(__here);            \
        __data;                                 \
        entry->type = __type;                   \
        preempt_enable();
 
 
        /* pass vxi only */
-#define __VXH_SIMPLE                           \
+
+#define __VXH_SMPL                             \
        __vxh_copy_vxi(entry, vxi)
 
-#define VXH_SIMPLE(__name, __type)             \
-static inline void __name(struct vx_info *vxi) \
-{                                              \
-       __VXH_BODY(__type, __VXH_SIMPLE)        \
+static inline
+void   __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
+{
+       __VXH_BODY(__type, __VXH_SMPL, __here)
 }
 
        /* pass vxi and data (void *) */
+
 #define __VXH_DATA                             \
        __vxh_copy_vxi(entry, vxi);             \
        entry->sc.data = data
 
-#define VXH_DATA(__name, __type)               \
-static inline                                  \
-void __name(struct vx_info *vxi, void *data)   \
-{                                              \
-       __VXH_BODY(__type, __VXH_DATA)          \
+static inline
+void   __vxh_data(struct vx_info *vxi, void *data,
+                       int __type, void *__here)
+{
+       __VXH_BODY(__type, __VXH_DATA, __here)
 }
 
        /* pass vxi and arg (long) */
-#define __VXH_LARG                             \
+
+#define __VXH_LONG                             \
        __vxh_copy_vxi(entry, vxi);             \
        entry->ll.arg = arg
 
-#define VXH_LARG(__name, __type)               \
-static inline                                  \
-void __name(struct vx_info *vxi, long arg)     \
-{                                              \
-       __VXH_BODY(__type, __VXH_LARG)          \
+static inline
+void   __vxh_long(struct vx_info *vxi, long arg,
+                       int __type, void *__here)
+{
+       __VXH_BODY(__type, __VXH_LONG, __here)
 }
 
 
-static inline void vxh_throw_oops(void)
+static inline
+void   __vxh_throw_oops(void *__here)
 {
-       __VXH_BODY(VXH_THROW_OOPS, {});
+       __VXH_BODY(VXH_THROW_OOPS, {}, __here);
        /* prevent further acquisition */
        vxh_active = 0;
 }
 
-VXH_SIMPLE(vxh_get_vx_info,    VXH_GET_VX_INFO);
-VXH_SIMPLE(vxh_put_vx_info,    VXH_PUT_VX_INFO);
 
-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);
+#define vxh_throw_oops()       __vxh_throw_oops(__HERE__);
+
+#define __vxh_get_vx_info(v,h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
+#define __vxh_put_vx_info(v,h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
+
+#define __vxh_init_vx_info(v,d,h) \
+       __vxh_data(v,d, VXH_INIT_VX_INFO, h);
+#define __vxh_set_vx_info(v,d,h) \
+       __vxh_data(v,d, VXH_SET_VX_INFO, h);
+#define __vxh_clr_vx_info(v,d,h) \
+       __vxh_data(v,d, VXH_CLR_VX_INFO, h);
 
-VXH_DATA(vxh_claim_vx_info,    VXH_CLAIM_VX_INFO);
-VXH_DATA(vxh_release_vx_info,  VXH_RELEASE_VX_INFO);
+#define __vxh_claim_vx_info(v,d,h) \
+       __vxh_data(v,d, VXH_CLAIM_VX_INFO, h);
+#define __vxh_release_vx_info(v,d,h) \
+       __vxh_data(v,d, VXH_RELEASE_VX_INFO, h);
 
-VXH_SIMPLE(vxh_alloc_vx_info,  VXH_ALLOC_VX_INFO);
-VXH_SIMPLE(vxh_dealloc_vx_info, VXH_DEALLOC_VX_INFO);
+#define vxh_alloc_vx_info(v) \
+       __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
+#define vxh_dealloc_vx_info(v) \
+       __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
 
-VXH_SIMPLE(vxh_hash_vx_info,   VXH_HASH_VX_INFO);
-VXH_SIMPLE(vxh_unhash_vx_info, VXH_UNHASH_VX_INFO);
+#define vxh_hash_vx_info(v) \
+       __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
+#define vxh_unhash_vx_info(v) \
+       __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
 
-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);
+#define vxh_loc_vx_info(v,l) \
+       __vxh_long(v,l, VXH_LOC_VX_INFO, __HERE__);
+#define vxh_lookup_vx_info(v,l) \
+       __vxh_long(v,l, VXH_LOOKUP_VX_INFO, __HERE__);
+#define vxh_create_vx_info(v,l) \
+       __vxh_long(v,l, VXH_CREATE_VX_INFO, __HERE__);
 
 extern void vxh_dump_history(void);
 
 
 #else  /* CONFIG_VSERVER_HISTORY */
 
+#define        __HERE__        0
 
 #define vxh_throw_oops()               do { } while (0)
 
-#define vxh_get_vx_info(v)             do { } while (0)
-#define vxh_put_vx_info(v)             do { } while (0)
+#define __vxh_get_vx_info(v,h)         do { } while (0)
+#define __vxh_put_vx_info(v,h)         do { } while (0)
 
-#define vxh_init_vx_info(v,d)          do { } while (0)
-#define vxh_set_vx_info(v,d)           do { } while (0)
-#define vxh_clr_vx_info(v,d)           do { } while (0)
+#define __vxh_init_vx_info(v,d,h)      do { } while (0)
+#define __vxh_set_vx_info(v,d,h)       do { } while (0)
+#define __vxh_clr_vx_info(v,d,h)       do { } while (0)
 
-#define vxh_claim_vx_info(v,d)         do { } while (0)
-#define vxh_release_vx_info(v,d)       do { } while (0)
+#define __vxh_claim_vx_info(v,d,h)     do { } while (0)
+#define __vxh_release_vx_info(v,d,h)   do { } while (0)
 
 #define vxh_alloc_vx_info(v)           do { } while (0)
 #define vxh_dealloc_vx_info(v)         do { } while (0)
@@ -261,8 +286,11 @@ extern void vxh_dump_history(void);
 
 #ifdef CONFIG_VSERVER_DEBUG
 #define vxd_assert_lock(l)     assert_spin_locked(l)
+#define vxd_assert(c,f,x...)   vxlprintk(!(c), \
+       "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
 #else
 #define        vxd_assert_lock(l)      do { } while (0)
+#define vxd_assert(c,f,x...)   do { } while (0)
 #endif
 
 
diff --git a/util-vserver/kernel/global.h b/util-vserver/kernel/global.h
new file mode 100644 (file)
index 0000000..ad60acb
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef _VX_GLOBAL_H
+#define _VX_GLOBAL_H
+
+#ifndef        CONFIG_VSERVER
+#warning config options missing
+#endif
+
+
+extern atomic_t vx_global_ctotal;
+extern atomic_t vx_global_cactive;
+
+#endif /* _VX_GLOBAL_H */
index 449a4fc..d23f46e 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _VX_LIMIT_H
 #define _VX_LIMIT_H
 
+
+#define VLIMIT_NSOCK   16
+#define VLIMIT_OPENFD  17
+#define VLIMIT_ANON    18
+#define VLIMIT_SHMEM   19
+
 #ifdef __KERNEL__
 
 struct sysinfo;
@@ -10,12 +16,9 @@ void vx_vsi_swapinfo(struct sysinfo *);
 
 #define VXD_RLIMIT(r,l)                (VXD_CBIT(limit, (l)) && ((r) == (l)))
 
-#define NUM_LIMITS     24
+#define        VXD_RLIMIT_COND(r)      (VXD_CBIT(limit, (r)))
 
-#define VLIMIT_NSOCK   16
-#define VLIMIT_OPENFD  17
-#define VLIMIT_ANON    18
-#define VLIMIT_SHMEM   19
+#define NUM_LIMITS     24
 
 extern const char *vlimit_name[NUM_LIMITS];
 
index bab1def..0a2e211 100644 (file)
@@ -9,7 +9,7 @@
 /* context sub struct */
 
 struct _vx_limit {
-       atomic_t ticks;
+//     atomic_t ticks;
 
        unsigned long rlim[NUM_LIMITS];         /* Context limit */
        unsigned long rmax[NUM_LIMITS];         /* Context maximum */
@@ -17,5 +17,21 @@ struct _vx_limit {
        atomic_t lhit[NUM_LIMITS];              /* Limit hits */
 };
 
+#ifdef CONFIG_VSERVER_DEBUG
+
+static inline void __dump_vx_limit(struct _vx_limit *limit)
+{
+       int i;
+
+       printk("\t_vx_limit:");
+       for (i=0; i<NUM_LIMITS; i++) {
+               printk("\t [%2d] = %8lu, %8lu, %8d, %8d\n",
+                       i, limit->rlim[i], limit->rmax[i],
+                       atomic_read(&limit->rcur[i]),
+                       atomic_read(&limit->lhit[i]));
+       }
+}
+
+#endif
 
 #endif /* _VX_LIMIT_DEF_H */
index 29c5bd2..2771f13 100644 (file)
@@ -15,7 +15,7 @@
 
 #define NXF_STATE_SETUP                (1ULL<<32)
 
-#define NXF_STATE_HELPER       (1ULL<<36)
+#define NXF_SC_HELPER          (1ULL<<36)
 
 #define NXF_ONE_TIME           (0x0001ULL<<32)
 
@@ -70,8 +70,7 @@ struct nx_info {
 #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);
+extern struct nx_info *lookup_nx_info(int);
 
 extern int get_nid_list(int, unsigned int *, int);
 extern int nid_is_hashed(nid_t);
index 3a57761..e8e13f9 100644 (file)
@@ -35,4 +35,20 @@ struct _vx_sched {
        struct _vx_ticks cpu[NR_CPUS];
 };
 
+
+#ifdef CONFIG_VSERVER_DEBUG
+
+static inline void __dump_vx_sched(struct _vx_sched *sched)
+{
+       printk("\t_vx_sched:\n");
+       printk("\t tokens: %4d, %4d, %4d, %4d, %4d\n",
+               atomic_read(&sched->tokens),
+               sched->fill_rate, sched->interval,
+               sched->tokens_min, sched->tokens_max);
+       printk("\t priority = %4d, %4d\n",
+               sched->priority_bias, sched->vavavoom);
+}
+
+#endif
+
 #endif /* _VX_SCHED_DEF_H */
diff --git a/util-vserver/kernel/signal.h b/util-vserver/kernel/signal.h
new file mode 100644 (file)
index 0000000..b17c18e
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _VX_SIGNAL_H
+#define _VX_SIGNAL_H
+
+#ifdef __KERNEL__
+
+
+struct vx_info;
+
+int vx_info_kill(struct vx_info *, int, int);
+
+#endif /* __KERNEL__ */
+#else  /* _VX_SIGNAL_H */
+#warning duplicate inclusion
+#endif /* _VX_SIGNAL_H */
index 4848951..b789e8d 100644 (file)
@@ -5,11 +5,7 @@
 #warning config options missing
 #endif
 
-#define XID_TAG_SB(sb) (sb->s_flags & MS_TAGXID)
-
-#define XID_TAG(in)    (!(in) || \
-       (((struct inode *)in)->i_sb && \
-       XID_TAG_SB(((struct inode *)in)->i_sb)))
+#define XID_TAG(in)    (IS_TAGXID(in))
 
 
 #ifdef CONFIG_XID_TAG_NFSD
 #endif
 
 
-#ifdef CONFIG_INOXID_NONE
+#ifndef CONFIG_INOXID_NONE
+#define vx_current_fsxid(sb)   \
+       ((sb)->s_flags & MS_TAGXID ? current->xid : 0)
+#else
 #define vx_current_fsxid(sb)   (0)
+#endif
+
+#ifndef CONFIG_INOXID_INTERN
+#define XIDINO_XID(tag, xid)   (0)
 #else
-#define vx_current_fsxid(sb)   \
-       (XID_TAG_SB(sb) ? current->xid : 0)
+#define XIDINO_XID(tag, xid)   ((tag) ? (xid) : 0)
 #endif
 
 #define INOXID_UID(tag, uid, gid)      \
@@ -139,7 +141,16 @@ static inline gid_t vx_map_gid(gid_t gid)
 #define FIOC_SETXIDJ   _IOW('x', 3, long)
 #endif
 
+#ifdef CONFIG_XID_PROPAGATE
+
 int vx_parse_xid(char *string, xid_t *xid, int remove);
-void vx_propagate_xid(struct nameidata *nd, struct inode *inode);
+
+void __vx_propagate_xid(struct nameidata *nd, struct inode *inode);
+
+#define vx_propagate_xid(n,i)  __vx_propagate_xid(n,i)
+
+#else
+#define vx_propagate_xid(n,i)  do { } while (0)
+#endif
 
 #endif /* _VX_XID_H */