+++ /dev/null
-#ifndef _VX_CACCT_H
-#define _VX_CACCT_H
-
-
-enum sock_acc_field {
- VXA_SOCK_UNSPEC = 0,
- VXA_SOCK_UNIX,
- VXA_SOCK_INET,
- VXA_SOCK_INET6,
- VXA_SOCK_PACKET,
- VXA_SOCK_OTHER,
- VXA_SOCK_SIZE /* array size */
-};
-
-#endif /* _VX_CACCT_H */
};
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-
-extern int vc_sock_stat(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
#endif /* _VX_CACCT_CMD_H */
+++ /dev/null
-#ifndef _VX_CACCT_DEF_H
-#define _VX_CACCT_DEF_H
-
-#include <asm/atomic.h>
-#include <linux/vserver/cacct.h>
-
-
-struct _vx_sock_acc {
- atomic_t count;
- atomic_t total;
-};
-
-/* context sub struct */
-
-struct _vx_cacct {
- struct _vx_sock_acc sock[VXA_SOCK_SIZE][3];
- atomic_t slab[8];
- atomic_t page[6][8];
-};
-
-#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<6; 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_CACCT_DEF_H */
+++ /dev/null
-#ifndef _VX_CACCT_INT_H
-#define _VX_CACCT_INT_H
-
-
-#ifdef __KERNEL__
-
-static inline
-unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos)
-{
- return atomic_read(&cacct->sock[type][pos].count);
-}
-
-
-static inline
-unsigned long vx_sock_total(struct _vx_cacct *cacct, int type, int pos)
-{
- return atomic_read(&cacct->sock[type][pos].total);
-}
-
-#endif /* __KERNEL__ */
-#endif /* _VX_CACCT_INT_H */
+++ /dev/null
-#ifndef _VX_CONTEXT_H
-#define _VX_CONTEXT_H
-
-#include <linux/types.h>
-//#include <linux/capability.h>
-
-
-#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
-
-#ifdef CONFIG_VSERVER_DYNAMIC_IDS
-#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
-#else
-#define MIN_D_CONTEXT 65536
-#endif
-
-#define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
-
-/* context flags */
-
-#define VXF_INFO_LOCK 0x00000001
-#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
-#define 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_CAP_MASK 0x00000000
-
-#define VXC_SET_UTSNAME 0x00000001
-#define VXC_SET_RLIMIT 0x00000002
-
-#define VXC_RAW_ICMP 0x00000100
-#define VXC_SYSLOG 0x00001000
-
-#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
-
-
-/* context state changes */
-
-enum {
- VSC_STARTUP = 1,
- VSC_SHUTDOWN,
-
- VSC_NETUP,
- VSC_NETDOWN,
-};
-
-
-#ifdef __KERNEL__
-
-#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/rcupdate.h>
-
-#include "limit_def.h"
-#include "sched_def.h"
-#include "cvirt_def.h"
-#include "cacct_def.h"
-
-struct _vx_info_pc {
- struct _vx_sched_pc sched_pc;
- struct _vx_cvirt_pc cvirt_pc;
-};
-
-struct vx_info {
- struct hlist_node vx_hlist; /* linked list of contexts */
- xid_t vx_id; /* context id */
- atomic_t vx_usecnt; /* usage count */
- atomic_t vx_tasks; /* tasks count */
- struct vx_info *vx_parent; /* parent context */
- int vx_state; /* context state */
-
- struct namespace *vx_namespace; /* private namespace */
- struct fs_struct *vx_fs; /* private namespace fs */
- uint64_t vx_flags; /* context flags */
- uint64_t vx_bcaps; /* bounding caps (system) */
- uint64_t vx_ccaps; /* context caps (vserver) */
- kernel_cap_t vx_cap_bset; /* the guest's bset */
-
- struct task_struct *vx_reaper; /* guest reaper process */
- pid_t vx_initpid; /* PID of guest init */
-
- struct _vx_limit limit; /* vserver limits */
- struct _vx_sched sched; /* vserver scheduler */
- struct _vx_cvirt cvirt; /* virtual/bias stuff */
- struct _vx_cacct cacct; /* context accounting */
-
-#ifndef CONFIG_SMP
- struct _vx_info_pc info_pc; /* per cpu data */
-#else
- struct _vx_info_pc *ptr_pc; /* per cpu array */
-#endif
-
- wait_queue_head_t vx_wait; /* context exit waitqueue */
- int reboot_cmd; /* last sys_reboot() cmd */
- int exit_code; /* last process exit code */
-
- char vx_name[65]; /* vserver name */
-};
-
-#ifndef CONFIG_SMP
-#define vx_ptr_pc(vxi) (&(vxi)->info_pc)
-#define vx_per_cpu(vxi, v, id) vx_ptr_pc(vxi)->v
-#else
-#define vx_ptr_pc(vxi) ((vxi)->ptr_pc)
-#define vx_per_cpu(vxi, v, id) per_cpu_ptr(vx_ptr_pc(vxi), id)->v
-#endif
-
-#define vx_cpu(vxi, v) vx_per_cpu(vxi, v, smp_processor_id())
-
-
-struct vx_info_save {
- struct vx_info *vxi;
- xid_t xid;
-};
-
-
-/* status flags */
-
-#define VXS_HASHED 0x0001
-#define VXS_PAUSED 0x0010
-#define VXS_SHUTDOWN 0x0100
-#define VXS_HELPER 0x1000
-#define VXS_RELEASED 0x8000
-
-/* check conditions */
-
-#define VX_ADMIN 0x0001
-#define VX_WATCH 0x0002
-#define VX_HIDE 0x0004
-#define VX_HOSTID 0x0008
-
-#define VX_IDENT 0x0010
-#define VX_EQUIV 0x0020
-#define VX_PARENT 0x0040
-#define VX_CHILD 0x0080
-
-#define VX_ARG_MASK 0x00F0
-
-#define VX_DYNAMIC 0x0100
-#define VX_STATIC 0x0200
-
-#define VX_ATR_MASK 0x0F00
-
-
-#ifdef CONFIG_VSERVER_PRIVACY
-#define VX_ADMIN_P (0)
-#define VX_WATCH_P (0)
-#else
-#define VX_ADMIN_P VX_ADMIN
-#define VX_WATCH_P VX_WATCH
-#endif
-
-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 *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);
-
-extern int vx_migrate_task(struct task_struct *, struct vx_info *);
-
-extern long vs_state_change(struct vx_info *, unsigned int);
-
-
-#endif /* __KERNEL__ */
-#else /* _VX_CONTEXT_H */
-#warning duplicate inclusion
-#endif /* _VX_CONTEXT_H */
#define VCMD_task_xid VC_CMD(VINFO, 1, 0)
-#ifdef __KERNEL__
-extern int vc_task_xid(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
#define VCMD_vx_info VC_CMD(VINFO, 5, 0)
/* 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)
/* more to come */
};
-#ifdef __KERNEL__
-extern int vc_ctx_stat(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
/* context commands */
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 */
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 */
uint64_t cmask;
};
-#ifdef __KERNEL__
-extern int vc_get_ccaps_v0(struct vx_info *, void __user *);
-extern int vc_set_ccaps_v0(struct vx_info *, void __user *);
-extern int vc_get_ccaps(struct vx_info *, void __user *);
-extern int vc_set_ccaps(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
/* bcaps commands */
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__ */
#endif /* _VX_CONTEXT_CMD_H */
+++ /dev/null
-#ifndef _VX_CVIRT_H
-#define _VX_CVIRT_H
-
-
-#ifdef __KERNEL__
-
-struct timespec;
-
-void vx_vsi_uptime(struct timespec *, struct timespec *);
-
-
-struct vx_info;
-
-void vx_update_load(struct vx_info *);
-
-
-int vx_uts_virt_handler(struct ctl_table *ctl, int write, xid_t xid,
- void **datap, size_t *lenp);
-
-
-int vx_do_syslog(int, char __user *, int);
-
-#endif /* __KERNEL__ */
-#endif /* _VX_CVIRT_H */
};
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-
-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)
uint32_t load[3];
};
-#ifdef __KERNEL__
-extern int vc_virt_stat(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
#endif /* _VX_CVIRT_CMD_H */
+++ /dev/null
-#ifndef _VX_CVIRT_DEF_H
-#define _VX_CVIRT_DEF_H
-
-#include <linux/jiffies.h>
-#include <linux/utsname.h>
-#include <linux/spinlock.h>
-#include <linux/wait.h>
-#include <linux/time.h>
-#include <asm/atomic.h>
-
-
-struct _vx_usage_stat {
- uint64_t user;
- uint64_t nice;
- uint64_t system;
- uint64_t softirq;
- uint64_t irq;
- uint64_t idle;
- uint64_t iowait;
-};
-
-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 */
-
- char log_buf[1024];
-};
-
-
-/* context sub struct */
-
-struct _vx_cvirt {
-// 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 */
-
- atomic_t nr_onhold; /* processes on hold */
- uint32_t onhold_last; /* jiffies when put on hold */
-
- struct timeval bias_tv; /* time offset to the host */
- struct timespec bias_idle;
- struct timespec bias_uptime; /* context creation point */
- uint64_t bias_clock; /* offset in clock_t */
-
- struct new_utsname utsname;
-
- spinlock_t load_lock; /* lock for the load averages */
- atomic_t load_updates; /* nr of load updates done so far */
- uint32_t load_last; /* last time load was calculated */
- uint32_t load[3]; /* load averages 1,5,15 */
-
- atomic_t total_forks; /* number of forks so far */
-
- struct _vx_syslog syslog;
-};
-
-struct _vx_cvirt_pc {
- struct _vx_usage_stat cpustat;
-};
-
-
-#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
-
-#endif /* _VX_CVIRT_DEF_H */
+++ /dev/null
-#ifndef _VX_DEBUG_H
-#define _VX_DEBUG_H
-
-
-#define VXD_CBIT(n,m) (vx_debug_ ## n & (1 << (m)))
-#define VXD_CMIN(n,m) (vx_debug_ ## n > (m))
-#define VXD_MASK(n,m) (vx_debug_ ## n & (m))
-
-#define VXD_QPOS(v,p) (((uint32_t)(v) >> ((p)*8)) & 0xFF)
-#define VXD_QUAD(v) VXD_QPOS(v,0), VXD_QPOS(v,1), \
- VXD_QPOS(v,2), VXD_QPOS(v,3)
-#define VXF_QUAD "%u.%u.%u.%u"
-
-#define VXD_DEV(d) (d), (d)->bd_inode->i_ino, \
- imajor((d)->bd_inode), iminor((d)->bd_inode)
-#define VXF_DEV "%p[%lu,%d:%d]"
-
-
-#define __FUNC__ __func__
-
-
-#ifdef CONFIG_VSERVER_DEBUG
-
-extern unsigned int vx_debug_switch;
-extern unsigned int vx_debug_xid;
-extern unsigned int vx_debug_nid;
-extern unsigned int vx_debug_tag;
-extern unsigned int vx_debug_net;
-extern unsigned int vx_debug_limit;
-extern unsigned int vx_debug_cres;
-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: "
-#define VX_WARNLEVEL KERN_WARNING "vxW: "
-
-#define vxdprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f "\n" , ##x); \
- } while (0)
-
-#define vxlprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f " @%s:%d\n", x); \
- } while (0)
-
-#define vxfprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
- } while (0)
-
-
-#define vxwprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_WARNLEVEL f "\n" , ##x); \
- } while (0)
-
-
-#define vxd_path(d,m) \
- ({ static char _buffer[PATH_MAX]; \
- d_path((d), (m), _buffer, sizeof(_buffer)); })
-
-#define vxd_cond_path(n) \
- ((n) ? vxd_path((n)->dentry, (n)->mnt) : "<null>" )
-
-
-struct vx_info;
-
-void dump_vx_info(struct vx_info *, int);
-void dump_vx_info_inactive(int);
-
-#else /* CONFIG_VSERVER_DEBUG */
-
-#define vx_debug_switch 0
-#define vx_debug_xid 0
-#define vx_debug_nid 0
-#define vx_debug_tag 0
-#define vx_debug_net 0
-#define vx_debug_limit 0
-#define vx_debug_cres 0
-#define vx_debug_dlim 0
-#define vx_debug_cvirt 0
-
-#define vxdprintk(x...) do { } while (0)
-#define vxlprintk(x...) do { } while (0)
-#define vxfprintk(x...) do { } while (0)
-#define vxwprintk(x...) do { } while (0)
-
-#define vxd_path "<none>"
-#define vxd_cond_path vxd_path
-
-#endif /* CONFIG_VSERVER_DEBUG */
-
-
-#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
-
-
-#endif /* _VX_DEBUG_H */
struct vcmd_read_history_v0 {
uint32_t index;
uint32_t count;
- char __user *data;
+ char *data;
};
struct vcmd_read_monitor_v0 {
uint32_t index;
uint32_t count;
- char __user *data;
+ char *data;
};
-#ifdef __KERNEL__
-
-#ifdef CONFIG_COMPAT
-
-#include <asm/compat.h>
-
-struct vcmd_read_history_v0_x32 {
- uint32_t index;
- uint32_t count;
- compat_uptr_t data_ptr;
-};
-
-struct vcmd_read_monitor_v0_x32 {
- uint32_t index;
- uint32_t count;
- compat_uptr_t data_ptr;
-};
-
-#endif /* CONFIG_COMPAT */
-
-extern int vc_dump_history(uint32_t);
-
-extern int vc_read_history(uint32_t, void __user *);
-extern int vc_read_monitor(uint32_t, void __user *);
-
-#ifdef CONFIG_COMPAT
-
-extern int vc_read_history_x32(uint32_t, void __user *);
-extern int vc_read_monitor_x32(uint32_t, void __user *);
-
-#endif /* CONFIG_COMPAT */
-
-#endif /* __KERNEL__ */
#endif /* _VX_DEBUG_CMD_H */
+++ /dev/null
-#ifndef _VX_DLIMIT_H
-#define _VX_DLIMIT_H
-
-#include "switch.h"
-
-
-#ifdef __KERNEL__
-
-/* keep in sync with CDLIM_INFINITY */
-
-#define DLIM_INFINITY (~0ULL)
-
-#include <linux/spinlock.h>
-
-struct super_block;
-
-struct dl_info {
- struct hlist_node dl_hlist; /* linked list of contexts */
- struct rcu_head dl_rcu; /* the rcu head */
- tag_t dl_tag; /* context tag */
- atomic_t dl_usecnt; /* usage count */
- atomic_t dl_refcnt; /* reference count */
-
- struct super_block *dl_sb; /* associated superblock */
-
- spinlock_t dl_lock; /* protect the values */
-
- unsigned long long dl_space_used; /* used space in bytes */
- unsigned long long dl_space_total; /* maximum space in bytes */
- unsigned long dl_inodes_used; /* used inodes */
- unsigned long dl_inodes_total; /* maximum inodes */
-
- unsigned int dl_nrlmult; /* non root limit mult */
-};
-
-struct rcu_head;
-
-extern void rcu_free_dl_info(struct rcu_head *);
-extern void unhash_dl_info(struct dl_info *);
-
-extern struct dl_info *locate_dl_info(struct super_block *, tag_t);
-
-
-struct kstatfs;
-
-extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
-
-typedef uint64_t dlsize_t;
-
-#endif /* __KERNEL__ */
-#else /* _VX_DLIMIT_H */
-#warning duplicate inclusion
-#endif /* _VX_DLIMIT_H */
#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0)
struct vcmd_ctx_dlimit_base_v0 {
- const char __user *name;
+ const char *name;
uint32_t flags;
};
struct vcmd_ctx_dlimit_v0 {
- const char __user *name;
+ const char *name;
uint32_t space_used; /* used space in kbytes */
uint32_t space_total; /* maximum space in kbytes */
uint32_t inodes_used; /* used inodes */
#define CDLIM_INFINITY ((uint32_t)~0UL)
#define CDLIM_KEEP ((uint32_t)~1UL)
-#ifdef __KERNEL__
-
-#ifdef CONFIG_COMPAT
-
-#include <asm/compat.h>
-
-struct vcmd_ctx_dlimit_base_v0_x32 {
- compat_uptr_t name_ptr;
- uint32_t flags;
-};
-
-struct vcmd_ctx_dlimit_v0_x32 {
- compat_uptr_t name_ptr;
- 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;
-};
-
-#endif /* CONFIG_COMPAT */
-
-#include <linux/compiler.h>
-
-extern int vc_add_dlimit(uint32_t, void __user *);
-extern int vc_rem_dlimit(uint32_t, void __user *);
-
-extern int vc_set_dlimit(uint32_t, void __user *);
-extern int vc_get_dlimit(uint32_t, void __user *);
-
-#ifdef CONFIG_COMPAT
-
-extern int vc_add_dlimit_x32(uint32_t, void __user *);
-extern int vc_rem_dlimit_x32(uint32_t, void __user *);
-
-extern int vc_set_dlimit_x32(uint32_t, void __user *);
-extern int vc_get_dlimit_x32(uint32_t, void __user *);
-
-#endif /* CONFIG_COMPAT */
-
-#endif /* __KERNEL__ */
#endif /* _VX_DLIMIT_CMD_H */
+++ /dev/null
-#ifndef _VX_GLOBAL_H
-#define _VX_GLOBAL_H
-
-
-extern atomic_t vx_global_ctotal;
-extern atomic_t vx_global_cactive;
-
-#endif /* _VX_GLOBAL_H */
+++ /dev/null
-#ifndef _VX_HISTORY_H
-#define _VX_HISTORY_H
-
-
-enum {
- VXH_UNUSED=0,
- VXH_THROW_OOPS=1,
-
- VXH_GET_VX_INFO,
- VXH_PUT_VX_INFO,
- VXH_INIT_VX_INFO,
- VXH_SET_VX_INFO,
- VXH_CLR_VX_INFO,
- VXH_CLAIM_VX_INFO,
- VXH_RELEASE_VX_INFO,
- VXH_ALLOC_VX_INFO,
- VXH_DEALLOC_VX_INFO,
- VXH_HASH_VX_INFO,
- VXH_UNHASH_VX_INFO,
- VXH_LOC_VX_INFO,
- VXH_LOOKUP_VX_INFO,
- VXH_CREATE_VX_INFO,
-};
-
-struct _vxhe_vxi {
- struct vx_info *ptr;
- unsigned xid;
- unsigned usecnt;
- unsigned tasks;
-};
-
-struct _vxhe_set_clr {
- void *data;
-};
-
-struct _vxhe_loc_lookup {
- unsigned arg;
-};
-
-struct _vx_hist_entry {
- void *loc;
- unsigned short seq;
- unsigned short type;
- struct _vxhe_vxi vxi;
- union {
- struct _vxhe_set_clr sc;
- struct _vxhe_loc_lookup ll;
- };
-};
-
-#ifdef CONFIG_VSERVER_HISTORY
-
-extern unsigned volatile int vxh_active;
-
-struct _vx_hist_entry *vxh_advance(void *loc);
-
-
-static inline
-void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
-{
- entry->vxi.ptr = vxi;
- if (vxi) {
- entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
- entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
- entry->vxi.xid = vxi->vx_id;
- }
-}
-
-
-#define __HERE__ current_text_addr()
-
-#define __VXH_BODY(__type, __data, __here) \
- struct _vx_hist_entry *entry; \
- \
- preempt_disable(); \
- entry = vxh_advance(__here); \
- __data; \
- entry->type = __type; \
- preempt_enable();
-
-
- /* pass vxi only */
-
-#define __VXH_SMPL \
- __vxh_copy_vxi(entry, vxi)
-
-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
-
-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_LONG \
- __vxh_copy_vxi(entry, vxi); \
- entry->ll.arg = arg
-
-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 *__here)
-{
- __VXH_BODY(VXH_THROW_OOPS, {}, __here);
- /* prevent further acquisition */
- vxh_active = 0;
-}
-
-
-#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);
-
-#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);
-
-#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__);
-
-#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__);
-
-#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,h) do { } while (0)
-#define __vxh_put_vx_info(v,h) 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,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)
-
-#define vxh_hash_vx_info(v) do { } while (0)
-#define vxh_unhash_vx_info(v) do { } while (0)
-
-#define vxh_loc_vx_info(a,v) do { } while (0)
-#define vxh_lookup_vx_info(a,v) do { } while (0)
-#define vxh_create_vx_info(a,v) do { } while (0)
-
-#define vxh_dump_history() do { } while (0)
-
-
-#endif /* CONFIG_VSERVER_HISTORY */
-
-#endif /* _VX_HISTORY_H */
+++ /dev/null
-#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_IUNLINK 0x00020000
-#define IATTR_IMMUTABLE 0x00040000
-
-#ifdef __KERNEL__
-
-
-#ifdef CONFIG_VSERVER_PROC_SECURE
-#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
-#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
-#else
-#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
-#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
-#endif
-
-#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 */
-#warning duplicate inclusion
-#endif /* _VX_INODE_H */
};
struct vcmd_ctx_iattr_v1 {
- const char __user *name;
+ const char *name;
uint32_t xid;
uint32_t flags;
uint32_t mask;
};
-#ifdef __KERNEL__
-
-
-#ifdef CONFIG_COMPAT
-
-#include <asm/compat.h>
-
-struct vcmd_ctx_iattr_v1_x32 {
- compat_uptr_t name_ptr;
- uint32_t xid;
- uint32_t flags;
- uint32_t mask;
-};
-
-#endif /* CONFIG_COMPAT */
-
-#include <linux/compiler.h>
-
-extern int vc_get_iattr_v0(uint32_t, void __user *);
-extern int vc_set_iattr_v0(uint32_t, void __user *);
-
-extern int vc_get_iattr(uint32_t, void __user *);
-extern int vc_set_iattr(uint32_t, void __user *);
-
-#ifdef CONFIG_COMPAT
-
-extern int vc_get_iattr_x32(uint32_t, void __user *);
-extern int vc_set_iattr_x32(uint32_t, void __user *);
-
-#endif /* CONFIG_COMPAT */
-
-#endif /* __KERNEL__ */
#endif /* _VX_INODE_CMD_H */
#define VX_INFO_NAMESPACE 128 /* save private namespace */
-#ifdef __KERNEL__
-extern int vc_new_s_context(uint32_t, void __user *);
-extern int vc_set_ipv4root(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
#endif /* _VX_LEGACY_H */
+++ /dev/null
-#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
-
-#ifdef __KERNEL__
-
-#define VLIM_NOCHECK (1L << VLIMIT_DENTRY)
-
-/* keep in sync with CRLIM_INFINITY */
-
-#define VLIM_INFINITY (~0ULL)
-
-#ifndef RLIM_INFINITY
-#warning RLIM_INFINITY is undefined
-#endif
-
-#define __rlim_val(l,r,v) ((l)->res[(r)].v)
-
-#define __rlim_soft(l,r) __rlim_val(l,r,soft)
-#define __rlim_hard(l,r) __rlim_val(l,r,hard)
-
-#define __rlim_rcur(l,r) __rlim_val(l,r,rcur)
-#define __rlim_rmin(l,r) __rlim_val(l,r,rmin)
-#define __rlim_rmax(l,r) __rlim_val(l,r,rmax)
-
-#define __rlim_lhit(l,r) __rlim_val(l,r,lhit)
-#define __rlim_hit(l,r) atomic_inc(&__rlim_lhit(l,r))
-
-typedef atomic_long_t rlim_atomic_t;
-typedef unsigned long rlim_t;
-
-#define __rlim_get(l,r) atomic_long_read(&__rlim_rcur(l,r))
-#define __rlim_set(l,r,v) atomic_long_set(&__rlim_rcur(l,r), v)
-#define __rlim_inc(l,r) atomic_long_inc(&__rlim_rcur(l,r))
-#define __rlim_dec(l,r) atomic_long_dec(&__rlim_rcur(l,r))
-#define __rlim_add(l,r,v) atomic_long_add(v, &__rlim_rcur(l,r))
-#define __rlim_sub(l,r,v) atomic_long_sub(v, &__rlim_rcur(l,r))
-
-
-#if (RLIM_INFINITY == VLIM_INFINITY)
-#define VX_VLIM(r) ((long long)(long)(r))
-#define VX_RLIM(v) ((rlim_t)(v))
-#else
-#define VX_VLIM(r) (((r) == RLIM_INFINITY) \
- ? VLIM_INFINITY : (long long)(r))
-#define VX_RLIM(v) (((v) == VLIM_INFINITY) \
- ? RLIM_INFINITY : (rlim_t)(v))
-#endif
-
-struct sysinfo;
-
-void vx_vsi_meminfo(struct sysinfo *);
-void vx_vsi_swapinfo(struct sysinfo *);
-
-#define NUM_LIMITS 24
-
-#endif /* __KERNEL__ */
-#endif /* _VX_LIMIT_H */
#define CRLIM_INFINITY (~0ULL)
#define CRLIM_KEEP (~1ULL)
-#ifdef __KERNEL__
-
-#ifdef CONFIG_IA32_EMULATION
-
-struct vcmd_ctx_rlimit_v0_x32 {
- uint32_t id;
- uint64_t minimum;
- uint64_t softlimit;
- uint64_t maximum;
-} __attribute__ ((aligned (4)));
-
-#endif /* CONFIG_IA32_EMULATION */
-
-#include <linux/compiler.h>
-
-extern int vc_get_rlimit_mask(uint32_t, void __user *);
-extern int vc_get_rlimit(struct vx_info *, void __user *);
-extern int vc_set_rlimit(struct vx_info *, void __user *);
-extern int vc_reset_minmax(struct vx_info *, void __user *);
-
-extern int vc_rlimit_stat(struct vx_info *, void __user *);
-
-#ifdef CONFIG_IA32_EMULATION
-
-extern int vc_get_rlimit_x32(struct vx_info *, void __user *);
-extern int vc_set_rlimit_x32(struct vx_info *, void __user *);
-
-#endif /* CONFIG_IA32_EMULATION */
-
-#endif /* __KERNEL__ */
#endif /* _VX_LIMIT_CMD_H */
+++ /dev/null
-#ifndef _VX_LIMIT_DEF_H
-#define _VX_LIMIT_DEF_H
-
-#include <asm/atomic.h>
-#include <asm/resource.h>
-
-#include "limit.h"
-
-
-struct _vx_res_limit {
- rlim_t soft; /* Context soft limit */
- rlim_t hard; /* Context hard limit */
-
- rlim_atomic_t rcur; /* Current value */
- rlim_t rmin; /* Context minimum */
- rlim_t rmax; /* Context maximum */
-
- atomic_t lhit; /* Limit hits */
-};
-
-/* context sub struct */
-
-struct _vx_limit {
- struct _vx_res_limit res[NUM_LIMITS];
-};
-
-#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/%8lu, %8ld/%8ld, %8d\n",
- i, (unsigned long)__rlim_get(limit, i),
- (unsigned long)__rlim_rmin(limit, i),
- (unsigned long)__rlim_rmax(limit, i),
- (long)__rlim_soft(limit, i),
- (long)__rlim_hard(limit, i),
- atomic_read(&__rlim_lhit(limit, i)));
- }
-}
-
-#endif
-
-#endif /* _VX_LIMIT_DEF_H */
+++ /dev/null
-#ifndef _VX_LIMIT_INT_H
-#define _VX_LIMIT_INT_H
-
-
-#ifdef __KERNEL__
-
-#define VXD_RCRES_COND(r) VXD_CBIT(cres, (r))
-#define VXD_RLIMIT_COND(r) VXD_CBIT(limit, (r))
-
-extern const char *vlimit_name[NUM_LIMITS];
-
-static inline void __vx_acc_cres(struct vx_info *vxi,
- int res, int dir, void *_data, char *_file, int _line)
-{
- if (VXD_RCRES_COND(res))
- vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5ld%s (%p)",
- (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
- (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
- (dir > 0) ? "++" : "--", _data, _file, _line);
- if (!vxi)
- return;
-
- if (dir > 0)
- __rlim_inc(&vxi->limit, res);
- else
- __rlim_dec(&vxi->limit, res);
-}
-
-static inline void __vx_add_cres(struct vx_info *vxi,
- int res, int amount, void *_data, char *_file, int _line)
-{
- if (VXD_RCRES_COND(res))
- vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5ld += %5d (%p)",
- (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
- (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
- amount, _data, _file, _line);
- if (amount == 0)
- return;
- if (!vxi)
- return;
- __rlim_add(&vxi->limit, res, amount);
-}
-
-static inline int __vx_cres_avail(struct vx_info *vxi,
- int res, int num, char *_file, int _line)
-{
- rlim_t value;
-
- if (VXD_RLIMIT_COND(res))
- vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld/%5ld > %5ld + %5d",
- (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
- (vxi ? (long)__rlim_soft(&vxi->limit, res) : -1),
- (vxi ? (long)__rlim_hard(&vxi->limit, res) : -1),
- (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
- num, _file, _line);
- if (num == 0)
- return 1;
- if (!vxi)
- return 1;
-
- value = __rlim_get(&vxi->limit, res);
-
- if (value > __rlim_rmax(&vxi->limit, res))
- __rlim_rmax(&vxi->limit, res) = value;
- else if (value < __rlim_rmin(&vxi->limit, res))
- __rlim_rmin(&vxi->limit, res) = value;
-
- if (__rlim_soft(&vxi->limit, res) == RLIM_INFINITY)
- return -1;
- if (value + num <= __rlim_soft(&vxi->limit, res))
- return -1;
-
- if (__rlim_hard(&vxi->limit, res) == RLIM_INFINITY)
- return 1;
- if (value + num <= __rlim_hard(&vxi->limit, res))
- return 1;
-
- __rlim_hit(&vxi->limit, res);
- return 0;
-}
-
-#endif /* __KERNEL__ */
-#endif /* _VX_LIMIT_INT_H */
+++ /dev/null
-#ifndef _VX_NAMESPACE_H
-#define _VX_NAMESPACE_H
-
-
-#include <linux/types.h>
-
-struct vx_info;
-struct namespace;
-struct fs_struct;
-
-extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *);
-
-#else /* _VX_NAMESPACE_H */
-#warning duplicate inclusion
-#endif /* _VX_NAMESPACE_H */
+++ /dev/null
-#ifndef _VX_NAMESPACE_CMD_H
-#define _VX_NAMESPACE_CMD_H
-
-
-#define VCMD_enter_namespace VC_CMD(PROCALT, 1, 0)
-/* XXX: This is not available in recent kernels */
-#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
-#define VCMD_set_namespace_v0 VC_CMD(PROCALT, 3, 0)
-#define VCMD_set_namespace VC_CMD(PROCALT, 3, 1)
-
-
-#ifdef __KERNEL__
-
-extern int vc_enter_namespace(struct vx_info *, void __user *);
-extern int vc_set_namespace(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
-#endif /* _VX_NAMESPACE_CMD_H */
#define NXA_TYPE_ANY ((uint16_t)-1)
-#ifdef __KERNEL__
-
-#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/rcupdate.h>
-#include <asm/atomic.h>
-
-
-struct nx_info {
- struct hlist_node nx_hlist; /* linked list of nxinfos */
- nid_t nx_id; /* vnet id */
- atomic_t nx_usecnt; /* usage 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 */
-
- int nbipv4;
- __u32 ipv4[NB_IPV4ROOT]; /* Process can only bind to these IPs */
- /* The first one is used to connect */
- /* and for bind any service */
- /* The other must be used explicity */
- __u32 mask[NB_IPV4ROOT]; /* Netmask for each ipv4 */
- /* Used to select the proper source */
- /* address for sockets */
- __u32 v4_bcast; /* Broadcast address to receive UDP */
-
- char nx_name[65]; /* network context name */
-};
-
-
-/* status flags */
-
-#define NXS_HASHED 0x0001
-#define NXS_SHUTDOWN 0x0100
-#define NXS_RELEASED 0x8000
-
-/* check conditions */
-
-#define NX_ADMIN 0x0001
-#define NX_WATCH 0x0002
-#define NX_BLEND 0x0004
-#define NX_HOSTID 0x0008
-
-#define NX_IDENT 0x0010
-#define NX_EQUIV 0x0020
-#define NX_PARENT 0x0040
-#define NX_CHILD 0x0080
-
-#define NX_ARG_MASK 0x00F0
-
-#define NX_DYNAMIC 0x0100
-#define NX_STATIC 0x0200
-
-#define NX_ATR_MASK 0x0F00
-
-
-extern struct nx_info *lookup_nx_info(int);
-
-extern int get_nid_list(int, unsigned int *, int);
-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;
-
-#ifdef CONFIG_INET
-int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
-int dev_in_nx_info(struct net_device *, struct nx_info *);
-
-#else /* CONFIG_INET */
-static inline
-int ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
-{
- return 1;
-}
-
-static inline
-int dev_in_nx_info(struct net_device *d, struct nx_info *n)
-{
- return 1;
-}
-#endif /* CONFIG_INET */
-
-struct sock;
-
-#ifdef CONFIG_INET
-int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
-#else /* CONFIG_INET */
-static inline
-int nx_addr_conflict(struct nx_info *n, uint32_t a, struct sock *s)
-{
- return 1;
-}
-#endif /* CONFIG_INET */
-
-#endif /* __KERNEL__ */
#else /* _VX_NETWORK_H */
#warning duplicate inclusion
#endif /* _VX_NETWORK_H */
#define VCMD_task_nid VC_CMD(VINFO, 2, 0)
-#ifdef __KERNEL__
-extern int vc_task_nid(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
#define VCMD_nx_info VC_CMD(VINFO, 6, 0)
/* more to come */
};
-#ifdef __KERNEL__
-extern int vc_nx_info(struct nx_info *, void __user *);
-
-#endif /* __KERNEL__ */
#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0)
#define VCMD_net_create VC_CMD(VNET, 1, 1)
};
-#ifdef __KERNEL__
-extern int vc_net_create(uint32_t, void __user *);
-extern int vc_net_migrate(struct nx_info *, void __user *);
-
-extern int vc_net_add(struct nx_info *, void __user *);
-extern int vc_net_remove(struct nx_info *, void __user *);
-
-#endif /* __KERNEL__ */
/* flag commands */
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 */
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 */
+++ /dev/null
-#ifndef _VX_SCHED_H
-#define _VX_SCHED_H
-
-
-#ifdef __KERNEL__
-
-struct timespec;
-
-void vx_vsi_uptime(struct timespec *, struct timespec *);
-
-
-struct vx_info;
-
-void vx_update_load(struct vx_info *);
-
-
-int vx_tokens_recalc(struct _vx_sched_pc *,
- unsigned long *, unsigned long *, int [2]);
-
-void vx_update_sched_param(struct _vx_sched *sched,
- struct _vx_sched_pc *sched_pc);
-
-#endif /* __KERNEL__ */
-#else /* _VX_SCHED_H */
-#warning duplicate inclusion
-#endif /* _VX_SCHED_H */
#define SCHED_KEEP (-2) /* only for v2 */
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-
-extern int vc_set_sched_v2(struct vx_info *, void __user *);
-extern int vc_set_sched_v3(struct vx_info *, void __user *);
-extern int vc_set_sched(struct vx_info *, void __user *);
-
-#endif /* __KERNEL__ */
#endif /* _VX_SCHED_CMD_H */
+++ /dev/null
-#ifndef _VX_SCHED_DEF_H
-#define _VX_SCHED_DEF_H
-
-#include <linux/spinlock.h>
-#include <linux/jiffies.h>
-#include <linux/cpumask.h>
-#include <asm/atomic.h>
-#include <asm/param.h>
-
-
-/* context sub struct */
-
-struct _vx_sched {
- spinlock_t tokens_lock; /* lock for token bucket */
-
- int tokens; /* number of CPU tokens */
- int fill_rate[2]; /* Fill rate: add X tokens... */
- int interval[2]; /* Divisor: per Y jiffies */
- int tokens_min; /* Limit: minimum for unhold */
- int tokens_max; /* Limit: no more than N tokens */
-
- unsigned update_mask; /* which features should be updated */
- cpumask_t update; /* CPUs which should update */
-
- int prio_bias; /* bias offset for priority */
- int vavavoom; /* last calculated vavavoom */
-};
-
-struct _vx_sched_pc {
- int tokens; /* number of CPU tokens */
- int flags; /* bucket flags */
-
- int fill_rate[2]; /* Fill rate: add X tokens... */
- int interval[2]; /* Divisor: per Y jiffies */
- int tokens_min; /* Limit: minimum for unhold */
- int tokens_max; /* Limit: no more than N tokens */
-
- unsigned long norm_time; /* last time accounted */
- unsigned long idle_time; /* non linear time for fair sched */
- unsigned long token_time; /* token time for accounting */
- unsigned long onhold; /* jiffies when put on hold */
-
- uint64_t user_ticks; /* token tick events */
- uint64_t sys_ticks; /* token tick events */
- uint64_t hold_ticks; /* token ticks paused */
-};
-
-
-#define VXSF_ONHOLD 0x0001
-#define VXSF_IDLE_TIME 0x0100
-
-#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, %4d\n",
- sched->fill_rate[0], sched->interval[0],
- sched->fill_rate[1], sched->interval[1],
- sched->tokens_min, sched->tokens_max);
- printk("\t priority = %4d, %4d\n",
- sched->prio_bias, sched->vavavoom);
-}
-
-#endif
-
-#endif /* _VX_SCHED_DEF_H */
+++ /dev/null
-#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 */
int32_t exit_code;
};
-#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, 1, 0)
-#define VCMD_set_pflags VC_CMD(PROCALT, 2, 0)
+#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 */
--- /dev/null
+#ifndef _VX_SPACE_CMD_H
+#define _VX_SPACE_CMD_H
+
+
+#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0)
+#define VCMD_enter_space VC_CMD(PROCALT, 1, 1)
+
+/* XXX: This is not available in recent kernels */
+#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
+
+#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0)
+#define VCMD_set_space VC_CMD(PROCALT, 3, 1)
+
+#define VCMD_get_space_mask VC_CMD(PROCALT, 4, 0)
+
+
+struct vcmd_space_mask {
+ uint64_t mask;
+};
+
+
+#endif /* _VX_SPACE_CMD_H */
#define VCMD_get_vci VC_CMD(VERSION, 1, 0)
-#ifdef __KERNEL__
-
-#include <linux/errno.h>
-
-
-#else /* __KERNEL__ */
#define __user
-#endif /* __KERNEL__ */
#endif /* _VX_SWITCH_H */
+++ /dev/null
-#ifndef _DX_TAG_H
-#define _DX_TAG_H
-
-
-#define DX_TAG(in) (IS_TAGGED(in))
-
-
-#ifdef CONFIG_DX_TAG_NFSD
-#define DX_TAG_NFSD 1
-#else
-#define DX_TAG_NFSD 0
-#endif
-
-
-#ifdef CONFIG_TAGGING_NONE
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) (0)
-
-#define TAGINO_UID(cond, uid, tag) (uid)
-#define TAGINO_GID(cond, gid, tag) (gid)
-
-#endif
-
-
-#ifdef CONFIG_TAGGING_GID16
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0x0000FFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) \
- ((cond) ? (((gid) >> 16) & 0xFFFF) : 0)
-
-#define TAGINO_UID(cond, uid, tag) (uid)
-#define TAGINO_GID(cond, gid, tag) \
- ((cond) ? (((gid) & 0xFFFF) | ((tag) << 16)) : (gid))
-
-#endif
-
-
-#ifdef CONFIG_TAGGING_ID24
-
-#define MAX_UID 0x00FFFFFF
-#define MAX_GID 0x00FFFFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) \
- ((cond) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
-
-#define TAGINO_UID(cond, uid, tag) \
- ((cond) ? (((uid) & 0xFFFFFF) | (((tag) & 0xFF00) << 16)) : (uid))
-#define TAGINO_GID(cond, gid, tag) \
- ((cond) ? (((gid) & 0xFFFFFF) | (((tag) & 0x00FF) << 24)) : (gid))
-
-#endif
-
-
-#ifdef CONFIG_TAGGING_UID16
-
-#define MAX_UID 0x0000FFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) \
- ((cond) ? (((uid) >> 16) & 0xFFFF) : 0)
-
-#define TAGINO_UID(cond, uid, tag) \
- ((cond) ? (((uid) & 0xFFFF) | ((tag) << 16)) : (uid))
-#define TAGINO_GID(cond, gid, tag) (gid)
-
-#endif
-
-
-#ifdef CONFIG_TAGGING_INTERN
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) \
- ((cond) ? (tag) : 0)
-
-#define TAGINO_UID(cond, uid, tag) (uid)
-#define TAGINO_GID(cond, gid, tag) (gid)
-
-#endif
-
-
-#ifdef CONFIG_TAGGING_RUNTIME
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOTAG_TAG(cond, uid, gid, tag) (0)
-
-#define TAGINO_UID(cond, uid, tag) (uid)
-#define TAGINO_GID(cond, gid, tag) (gid)
-
-#endif
-
-
-#ifndef CONFIG_TAGGING_NONE
-#define dx_current_fstag(sb) \
- ((sb)->s_flags & MS_TAGGED ? dx_current_tag(): 0)
-#else
-#define dx_current_fstag(sb) (0)
-#endif
-
-#ifndef CONFIG_TAGGING_INTERN
-#define TAGINO_TAG(cond, tag) (0)
-#else
-#define TAGINO_TAG(cond, tag) ((cond) ? (tag) : 0)
-#endif
-
-#define INOTAG_UID(cond, uid, gid) \
- ((cond) ? ((uid) & MAX_UID) : (uid))
-#define INOTAG_GID(cond, uid, gid) \
- ((cond) ? ((gid) & MAX_GID) : (gid))
-
-
-static inline uid_t dx_map_uid(uid_t uid)
-{
- if ((uid > MAX_UID) && (uid != -1))
- uid = -2;
- return (uid & MAX_UID);
-}
-
-static inline gid_t dx_map_gid(gid_t gid)
-{
- if ((gid > MAX_GID) && (gid != -1))
- gid = -2;
- return (gid & MAX_GID);
-}
-
-
-#ifdef CONFIG_VSERVER_LEGACY
-#define FIOC_GETTAG _IOR('x', 1, long)
-#define FIOC_SETTAG _IOW('x', 2, long)
-#define FIOC_SETTAGJ _IOW('x', 3, long)
-#endif
-
-#ifdef CONFIG_PROPAGATE
-
-int dx_parse_tag(char *string, tag_t *tag, int remove);
-
-void __dx_propagate_tag(struct nameidata *nd, struct inode *inode);
-
-#define dx_propagate_tag(n,i) __dx_propagate_tag(n,i)
-
-#else
-#define dx_propagate_tag(n,i) do { } while (0)
-#endif
-
-#endif /* _DX_TAG_H */