fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / vs_cvirt.h
index 07c3e86..88c4c9f 100644 (file)
@@ -1,60 +1,46 @@
-#ifndef _VX_VS_CVIRT_H
-#define _VX_VS_CVIRT_H
+#ifndef _VS_CVIRT_H
+#define _VS_CVIRT_H
 
 #include "vserver/cvirt.h"
+#include "vserver/context.h"
+#include "vserver/base.h"
 #include "vserver/debug.h"
-#include "vs_base.h"
 
 
-/* utsname virtualization */
-
-static inline struct new_utsname *vx_new_utsname(void)
+static inline void vx_activate_task(struct task_struct *p)
 {
-       if (current->vx_info)
-               return &current->vx_info->cvirt.utsname;
-       return &system_utsname;
-}
-
-#define vx_new_uts(x)          ((vx_new_utsname())->x)
-
+       struct vx_info *vxi;
 
-/* pid faking stuff */
-
-
-#define vx_map_tgid(v,p) \
-       __vx_map_tgid((v), (p), __FILE__, __LINE__)
+       if ((vxi = p->vx_info)) {
+               vx_update_load(vxi);
+               atomic_inc(&vxi->cvirt.nr_running);
+       }
+}
 
-static inline int __vx_map_tgid(struct vx_info *vxi, int pid,
-       char *file, int line)
+static inline void vx_deactivate_task(struct task_struct *p)
 {
-       if (vxi && __vx_flags(vxi->vx_flags, VXF_INFO_INIT, 0)) {
-               vxlprintk(VXD_CBIT(cvirt, 2),
-                       "vx_map_tgid: %p/%llx: %d -> %d",
-                       vxi, vxi->vx_flags, pid,
-                       (pid == vxi->vx_initpid)?1:pid,
-                       file, line);
-               if (pid == vxi->vx_initpid)
-                       return 1;
+       struct vx_info *vxi;
+
+       if ((vxi = p->vx_info)) {
+               vx_update_load(vxi);
+               atomic_dec(&vxi->cvirt.nr_running);
        }
-       return pid;
 }
 
-#define vx_rmap_tgid(v,p) \
-       __vx_rmap_tgid((v), (p), __FILE__, __LINE__)
+static inline void vx_uninterruptible_inc(struct task_struct *p)
+{
+       struct vx_info *vxi;
 
-static inline int __vx_rmap_tgid(struct vx_info *vxi, int pid,
-       char *file, int line)
+       if ((vxi = p->vx_info))
+               atomic_inc(&vxi->cvirt.nr_uninterruptible);
+}
+
+static inline void vx_uninterruptible_dec(struct task_struct *p)
 {
-       if (vxi && __vx_flags(vxi->vx_flags, VXF_INFO_INIT, 0)) {
-               vxlprintk(VXD_CBIT(cvirt, 2),
-                       "vx_rmap_tgid: %p/%llx: %d -> %d",
-                       vxi, vxi->vx_flags, pid,
-                       (pid == 1)?vxi->vx_initpid:pid,
-                       file, line);
-               if ((pid == 1) && vxi->vx_initpid)
-                       return vxi->vx_initpid;
-       }
-       return pid;
+       struct vx_info *vxi;
+
+       if ((vxi = p->vx_info))
+               atomic_dec(&vxi->cvirt.nr_uninterruptible);
 }