VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 11
-EXTRAVERSION = .7-vs2.0-pre1
+EXTRAVERSION = .7-vs2.0-pre4
NAME=Woozy Numbat
# *DOCUMENTATION*
depends on !SMP && X86_UP_IOAPIC
default y
+config KERNEL_HZ
+ int "Timer Frequency (100-10000)"
+ range 100 10000
+ default "1000"
+ help
+ This allows you to specify the frequency at which the
+ kernel timer interrupt will occur.
+
config X86_TSC
bool
depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ
seq_printf(m, " %s", x86_cap_flags[i]);
seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
- c->loops_per_jiffy/(500000/HZ),
- (c->loops_per_jiffy/(5000/HZ)) % 100);
+ HZ*(c->loops_per_jiffy >> 3)/62500,
+ (HZ*(c->loops_per_jiffy >> 3)/625) % 100);
return 0;
}
printk(KERN_INFO
"Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
cpucount+1,
- bogosum/(500000/HZ),
- (bogosum/(5000/HZ))%100);
+ HZ*(bogosum >> 3)/62500,
+ (HZ*(bogosum >> 3)/625) % 100);
Dprintk("Before bogocount - setting activated=1.\n");
data8 sys_tgkill /* 270 */
data8 compat_sys_utimes
data8 sys32_fadvise64_64
- data8 sys_ni_syscall
+ data8 sys32_vserver
data8 sys_ni_syscall
data8 sys_ni_syscall /* 275 */
data8 sys_ni_syscall
sys sys_mq_timedreceive 5
sys sys_mq_notify 2 /* 4275 */
sys sys_mq_getsetattr 3
- sys sys_ni_syscall 0 /* sys_vserver */
+ sys sys_vserver 3
sys sys_waitid 4
sys sys_ni_syscall 0 /* available, was setaltroot */
sys sys_add_key 5
PTR sys_mq_timedreceive
PTR sys_mq_notify
PTR sys_mq_getsetattr /* 5235 */
- PTR sys_ni_syscall /* sys_vserver */
+ PTR sys_vserver
PTR sys_waitid
PTR sys_ni_syscall /* available, was setaltroot */
PTR sys_add_key
PTR compat_sys_mq_timedreceive
PTR compat_sys_mq_notify
PTR compat_sys_mq_getsetattr
- PTR sys_ni_syscall /* 6240, sys_vserver */
+ PTR sys32_vserver /* 6240 */
PTR sys_waitid
PTR sys_ni_syscall /* available, was setaltroot */
PTR sys_add_key
PTR compat_sys_mq_timedreceive
PTR compat_sys_mq_notify /* 4275 */
PTR compat_sys_mq_getsetattr
- PTR sys_ni_syscall /* sys_vserver */
+ PTR sys32_vserver
PTR sys_waitid
PTR sys_ni_syscall /* available, was setaltroot */
PTR sys_add_key /* 4280 */
int count;
u8 *iomem_base;
u16 iomem_reg_shift;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
unsigned long icount;
int io_type;
void *info;
.llong .ppc32_fadvise64_64 /* 32bit only fadvise64_64 */
.llong .ppc_rtas /* 255 */
.llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */
- .llong .sys_vserver
+ .llong .sys32_vserver
.llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
.llong .compat_sys_mbind
.llong .compat_sys_get_mempolicy /* 260 */
.llong .sys_ni_syscall /* 32bit only fadvise64_64 */
.llong .ppc_rtas /* 255 */
.llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */
- .llong .sys_ni_syscall /* 257 reserved for vserver */
+ .llong .sys_vserver
.llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
.llong .sys_mbind
.llong .sys_get_mempolicy /* 260 */
SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
-SYSCALL(sys_vserver,sys_vserver,sys_vserver)
+SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
.word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
- .word sys_timer_delete, sys32_timer_create, sys_vserver, compat_sys_io_setup, sys_io_destroy
+ .word sys_timer_delete, sys32_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
.word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl
.quad sys_tgkill /* 270 */
.quad compat_sys_utimes
.quad sys32_fadvise64_64
- .quad sys_vserver
+ .quad sys32_vserver
.quad sys_mbind
.quad compat_sys_get_mempolicy /* 275 */
.quad sys_set_mempolicy
// TODO: A better timeout algorithm?
{
int i = 0;
- static const int quantum_ms = 1000/HZ;
+ static const int quantum_ms = (HZ>1000)?1:(1000/HZ);
ret = down_trylock(sem);
for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) {
FD_SILENT_DCL_CLEAR;
} else {
default_drive_params[i].params.select_delay =
- 2 * HZ / 100;
+ SEL_DLY;
default_drive_params[i].params.flags &=
~FD_SILENT_DCL_CLEAR;
}
break;
#endif /* CONFIG_CYZ_INTR */
case CYSETWAIT:
- info->closing_wait = (unsigned short)arg * HZ/100;
+ info->closing_wait = (unsigned int)arg * HZ/100;
ret_val = 0;
break;
case CYGETWAIT:
up to 250 usec for the RDY bit to
go nonzero. */
for (retries = 0;
- retries < loops_per_jiffy / (4000/HZ);
+ retries < HZ*(loops_per_jiffy >> 3)/500;
retries++)
if (inb_p(dtlk_port_tts) &
TTS_WRITABLE)
LOOK
dtlk_write_bytes("\0012I\r", 4);
buffer[b++] = 0;
- __delay(50 * loops_per_jiffy / (1000/HZ));
+ __delay(50 * (loops_per_jiffy >> 3) * HZ / 125);
outb_p(0xff, dtlk_port_lpc);
buffer[b++] = 0;
LOOK
int close_delay;
unsigned short channel;
unsigned short status;
- unsigned short closing_wait;
+ unsigned int closing_wait;
struct isi_board * card;
struct tty_struct * tty;
wait_queue_head_t close_wait;
int type;
int port;
int close_delay;
- unsigned short closing_wait;
+ unsigned int closing_wait;
int count;
int blocked_open;
long event; /* long req'd for set_bit --RR */
int custom_divisor;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
+ unsigned int closing_wait;
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
unsigned long event;
int flags;
int count; /* count of opens */
int line;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
struct mgsl_icount icount;
struct work_struct tqueue_hangup;
short wakeup_chars;
short break_length;
- unsigned short closing_wait;
+ unsigned int closing_wait;
unsigned char mark_mask;
unsigned char IER;
unsigned char MSVR;
struct work_struct tqueue_hangup;
short wakeup_chars;
short break_length;
- unsigned short closing_wait;
+ unsigned int closing_wait;
unsigned char mark_mask;
unsigned char IER;
unsigned char MSVR;
int count; /* count of opens */
int line;
int hw_version;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
struct mgsl_icount icount;
int flags;
int count; /* count of opens */
int line;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
struct mgsl_icount icount;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
- unsigned short close_delay;
+ unsigned int close_delay;
char reserved_char[2];
int hub6;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
+ unsigned int closing_wait; /* time to wait before closing */
+ unsigned int closing_wait2; /* no longer used... */
int reserved[4];
};
int custom_divisor;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
unsigned long last_active;
int line;
int xmit_fifo_size; /* Transmit FIFO info */
int close_delay; /* Do we wait for drain on close ? */
- unsigned short closing_wait;
+ unsigned int closing_wait;
/* We need to know the current clock divisor
* to read the bps rate the chip has currently
struct tq_struct tqueue_hangup;
short wakeup_chars;
short break_length;
- unsigned short closing_wait;
+ unsigned int closing_wait;
unsigned char mark_mask;
unsigned char SRER;
unsigned char MSVR;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
- unsigned short close_delay;
+ unsigned int close_delay;
char reserved_char[2];
int hub6; /* FIXME: We don't have AT&T Hub6 boards! */
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
+ unsigned int closing_wait; /* time to wait before closing */
+ unsigned int closing_wait2; /* no longer used... */
int reserved[4];
};
int custom_divisor;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
unsigned long last_active;
int line;
int count;
u8 *iomem_base;
u16 iomem_reg_shift;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
struct async_icount_24 icount;
int io_type;
struct async_struct *info;
int line;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
unsigned long last_active;
int blocked_open; /* # of blocked opens */
int ignore_status_mask;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
unsigned long last_active;
int line;
int x_char; /* xon/xoff character */
int baud_base;
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
int line;
int count; /* # of fd on device */
int xmit_fifo_size;
int custom_divisor;
int baud_base;
- unsigned short close_delay;
+ unsigned int close_delay;
char reserved_char[2];
int hub6;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
+ unsigned int closing_wait; /* time to wait before closing */
+ unsigned int closing_wait2; /* no longer used... */
int reserved[4];
};
int custom_divisor;
int x_char; /* XON/XOFF character. */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
unsigned long event;
unsigned long last_active;
int line;
inodes_stat.nr_unused--;
}
+EXPORT_SYMBOL_GPL(__iget);
+
/**
* clear_inode - clear an inode
* @inode: inode to clear
}
if (cred->cr_uid != (uid_t) -1)
- current->fsuid = INOXID_UID(1, cred->cr_uid, cred->cr_gid);
+ current->fsuid = INOXID_UID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid);
else
current->fsuid = exp->ex_anon_uid;
if (cred->cr_gid != (gid_t) -1)
- current->fsgid = INOXID_GID(1, cred->cr_uid, cred->cr_gid);
+ current->fsgid = INOXID_GID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid);
else
current->fsgid = exp->ex_anon_gid;
- current->xid = INOXID_XID(1, cred->cr_uid, cred->cr_gid, 0);
+ current->xid = INOXID_XID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid, 0);
if (!cred->cr_group_info)
return -ENOMEM;
ret = set_current_groups(cred->cr_group_info);
- if (INOXID_UID(1, cred->cr_uid, cred->cr_gid)) {
+ if (INOXID_UID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid)) {
cap_t(current->cap_effective) &= ~CAP_NFSD_MASK;
} else {
cap_t(current->cap_effective) |= (CAP_NFSD_MASK &
iap->ia_valid |= ATTR_GID;
gid = ntohl(*p++);
}
- iap->ia_uid = INOXID_UID(1, uid, gid);
- iap->ia_gid = INOXID_GID(1, uid, gid);
- iap->ia_xid = INOXID_XID(1, uid, gid, 0);
+ iap->ia_uid = INOXID_UID(XID_TAG_NFSD, uid, gid);
+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid);
+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0);
if (*p++) {
u64 newsize;
iap->ia_valid |= ATTR_GID;
gid = tmp;
}
- iap->ia_uid = INOXID_UID(1, uid, gid);
- iap->ia_gid = INOXID_GID(1, uid, gid);
- iap->ia_xid = INOXID_XID(1, uid, gid, 0);
+ iap->ia_uid = INOXID_UID(XID_TAG_NFSD, uid, gid);
+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid);
+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0);
if ((tmp = ntohl(*p++)) != (u32)-1) {
iap->ia_valid |= ATTR_SIZE;
iap->ia_size = tmp;
}
}
+#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT)
+
+static inline int proc_pid_visible(struct task_struct *task, int pid)
+{
+ if ((pid == 1) &&
+ !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT))
+ goto visible;
+ if (vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT))
+ goto visible;
+ return 0;
+visible:
+ return 1;
+}
+
/* SMP-safe */
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
{
if (!task)
goto out;
- if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT))
+ /* check for context visibility */
+ if (!proc_pid_visible(task, tgid))
goto out_drop_task;
inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO);
if (leader->tgid != task->tgid)
goto out_drop_task;
- if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT))
+ /* check for context visibility */
+ if (!proc_pid_visible(task, tid))
goto out_drop_task;
inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO);
if (!pid_alive(p))
continue;
- if (!vx_check(vx_task_xid(p), VX_WATCH|VX_IDENT))
+ /* check for context visibility */
+ if (!proc_pid_visible(p, tgid))
continue;
if (--index >= 0)
continue;
if (pid_alive(task)) do {
int tid = task->pid;
- if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT))
+ /* check for context visibility */
+ if (!proc_pid_visible(task, tid))
continue;
if (--index >= 0)
continue;
if (IS_ERR(bdev))
return PTR_ERR(bdev);
#ifdef CONFIG_BLK_DEV_VROOT
- printk(KERN_INFO "bdev=%p, gendisk=%p inode=%p[%d,%d]\n",
- bdev, bdev?bdev->bd_disk:0, bdev->bd_inode,
- imajor(bdev->bd_inode), iminor(bdev->bd_inode));
-
if (bdev && bdev->bd_inode &&
imajor(bdev->bd_inode) == VROOT_MAJOR) {
struct block_device *bdnew =
#ifndef _ASMi386_PARAM_H
#define _ASMi386_PARAM_H
+#include <linux/config.h>
+
#ifdef __KERNEL__
-# define HZ 1000 /* Internal kernel timer frequency */
+# ifdef CONFIG_KERNEL_HZ
+# define HZ CONFIG_KERNEL_HZ
+# else
+# define HZ 1000 /* Internal kernel timer frequency */
+# endif
# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif
int custom_divisor;
int x_char; /* to be pushed out ASAP */
int close_delay;
- unsigned short closing_wait;
+ unsigned int closing_wait;
unsigned long event;
unsigned long last_active;
int count; /* # of fd on device */
#define DTLK_CLEAR 0x18 /* stops speech */
-#define DTLK_MAX_RETRIES (loops_per_jiffy/(10000/HZ))
+#define DTLK_MAX_RETRIES (HZ*(loops_per_jiffy >> 3)/1250)
/* TTS Port Status Flags */
#define TTS_READABLE 0x80 /* mask for bit which is nonzero if a
int blocked_open;
struct tty_struct *tty;
unsigned long event;
- unsigned short closing_wait;
+ unsigned int closing_wait;
int close_delay;
struct real_driver *rd;
int wakeup_chars;
int stat_flags;
int custom_divisor;
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned int closing_wait;
+ unsigned int closing_wait2;
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
unsigned long event;
# define SHIFT_HZ 9
#elif HZ >= 768 && HZ < 1536
# define SHIFT_HZ 10
+#elif HZ >= 1536 && HZ < 3072
+# define SHIFT_HZ 11
+#elif HZ >= 3072 && HZ < 6144
+# define SHIFT_HZ 12
+#elif HZ >= 6144 && HZ < 12288
+# define SHIFT_HZ 13
+#elif HZ >= 12288 && HZ < 24576
+# define SHIFT_HZ 14
#else
# error You lose.
#endif
int xmit_fifo_size;
int custom_divisor;
int baud_base;
- unsigned short close_delay;
+ unsigned int close_delay;
char io_type;
char reserved_char[1];
int hub6;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
+ unsigned int closing_wait; /* time to wait before closing */
+ unsigned int closing_wait2; /* no longer used... */
unsigned char *iomem_base;
unsigned short iomem_reg_shift;
unsigned int port_high;
int count;
u8 *iomem_base;
u16 iomem_reg_shift;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
struct async_icount icount;
int io_type;
struct async_struct *info;
int quot;
int x_char; /* xon/xoff character */
int close_delay;
- unsigned short closing_wait;
- unsigned short closing_wait2; /* obsolete */
+ unsigned int closing_wait;
+ unsigned int closing_wait2; /* obsolete */
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
int LCR; /* Line control register */
typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
void __user *buffer, size_t *lenp, loff_t *ppos);
+typedef int virt_handler (struct ctl_table *ctl, int write, xid_t xid,
+ void **datap, size_t *lenp);
+
extern int proc_dostring(ctl_table *, int, struct file *,
void __user *, size_t *, loff_t *);
extern int proc_dointvec(ctl_table *, int, struct file *,
mode_t mode;
ctl_table *child;
proc_handler *proc_handler; /* Callback for text formatting */
+ virt_handler *virt_handler; /* Context virtualization */
ctl_handler *strategy; /* Callback function for all r/w */
struct proc_dir_entry *de; /* /proc control block */
void *extra1;
}
+static inline void __wakeup_vx_info(struct vx_info *vxi)
+{
+ if (waitqueue_active(&vxi->vx_wait))
+ wake_up_interruptible(&vxi->vx_wait);
+}
+
#else
#warning duplicate inclusion
#endif
#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_QUOTA_CTL 0x00100000
-/* vshelper sync commands */
+/* context state changes */
-#define VS_CONTEXT_CREATED 1
-#define VS_CONTEXT_DESTROY 2
+enum {
+ VSC_STARTUP = 1,
+ VSC_SHUTDOWN,
+};
#ifdef __KERNEL__
pid_t vx_initpid; /* PID of fake init process */
spinlock_t vx_lock;
- wait_queue_head_t vx_exit; /* context exit waitqueue */
+ wait_queue_head_t vx_wait; /* context exit waitqueue */
struct _vx_limit limit; /* vserver limits */
struct _vx_sched sched; /* vserver scheduler */
extern int vx_migrate_task(struct task_struct *, struct vx_info *);
-extern long vs_context_state(struct vx_info *, unsigned int);
+extern long vs_state_change(struct vx_info *, unsigned int);
extern void free_vx_info(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__ */
#define _VX_DLIMIT_H
#include "switch.h"
-#include <linux/spinlock.h>
-
-/* inode 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 (0ULL)
#define CDLIM_INFINITY (~0ULL)
#ifdef __KERNEL__
+#include <linux/spinlock.h>
+
struct super_block;
struct dl_info {
struct super_block *dl_sb; /* associated superblock */
-// struct rw_semaphore dl_sem; /* protect the values */
spinlock_t dl_lock; /* protect the values */
uint64_t dl_space_used; /* used space in bytes */
extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
-
-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 *);
-
-
typedef uint64_t dlsize_t;
#endif /* __KERNEL__ */
#ifdef __KERNEL__
+#ifdef CONFIG_COMPAT
+
+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_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 */
-#define NB_S_CONTEXT 16
-
-#define NB_IPV4ROOT 16
-
-
#ifdef __KERNEL__
extern int vc_new_s_context(uint32_t, void __user *);
extern int vc_set_ipv4root(uint32_t, void __user *);
(((struct inode *)in)->i_sb && \
(((struct inode *)in)->i_sb->s_flags & MS_TAGXID)))
+#ifdef CONFIG_XID_TAG_NFSD
+#define XID_TAG_NFSD 1
+#else
+#define XID_TAG_NFSD 0
+#endif
+
#ifdef CONFIG_INOXID_NONE
struct timer_list watchdog_timer;
struct work_struct tqueue;
- unsigned short close_delay;
- unsigned short closing_wait; /* time to wait before closing */
+ unsigned int close_delay;
+ unsigned int closing_wait; /* time to wait before closing */
int open_count;
int blocked_open; /* # of blocked opens */
#include <linux/route.h>
#include <linux/ip.h>
#include <linux/cache.h>
-#include <linux/vs_context.h>
#include <linux/vs_network.h>
#ifndef __KERNEL__
so that we select tick to get range about 4 seconds.
*/
-#if HZ <= 16 || HZ > 4096
-# error Unsupported: HZ <= 16 or HZ > 4096
+#if HZ <= 16 || HZ > 32768
+# error Unsupported: HZ <= 16 or HZ > 32768
#elif HZ <= 32
# define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG)
#elif HZ <= 64
# define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG)
#elif HZ <= 2048
# define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG)
-#else
+#elif HZ <= 4096
# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 8192
+# define TCP_TW_RECYCLE_TICK (13+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 16384
+# define TCP_TW_RECYCLE_TICK (14+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#else
+# define TCP_TW_RECYCLE_TICK (15+2-TCP_TW_RECYCLE_SLOTS_LOG)
#endif
#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation
loops_per_jiffy = preset_lpj;
printk("Calibrating delay loop (skipped)... "
"%lu.%02lu BogoMIPS preset\n",
- loops_per_jiffy/(500000/HZ),
- (loops_per_jiffy/(5000/HZ)) % 100);
+ HZ*(loops_per_jiffy >> 3)/62500,
+ (HZ*(loops_per_jiffy >> 3)/625) % 100);
} else {
loops_per_jiffy = (1<<12);
/* Round the value and print it */
printk("%lu.%02lu BogoMIPS (lpj=%lu)\n",
- loops_per_jiffy/(500000/HZ),
- (loops_per_jiffy/(5000/HZ)) % 100,
+ HZ*(loops_per_jiffy >> 3)/62500,
+ (HZ*(loops_per_jiffy >> 3)/625) % 100,
loops_per_jiffy);
}
#include <linux/limits.h>
#include <linux/dcache.h>
#include <linux/syscalls.h>
+#include <linux/vserver/cvirt.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
.maxlen = sizeof(system_utsname.sysname),
.mode = 0444,
.proc_handler = &proc_doutsstring,
+ .virt_handler = &vx_uts_virt_handler,
.strategy = &sysctl_string,
},
{
.maxlen = sizeof(system_utsname.release),
.mode = 0444,
.proc_handler = &proc_doutsstring,
+ .virt_handler = &vx_uts_virt_handler,
.strategy = &sysctl_string,
},
{
.maxlen = sizeof(system_utsname.version),
.mode = 0444,
.proc_handler = &proc_doutsstring,
+ .virt_handler = &vx_uts_virt_handler,
.strategy = &sysctl_string,
},
{
.maxlen = sizeof(system_utsname.nodename),
.mode = 0644,
.proc_handler = &proc_doutsstring,
+ .virt_handler = &vx_uts_virt_handler,
.strategy = &sysctl_string,
},
{
.maxlen = sizeof(system_utsname.domainname),
.mode = 0644,
.proc_handler = &proc_doutsstring,
+ .virt_handler = &vx_uts_virt_handler,
.strategy = &sysctl_string,
},
{
int proc_dostring(ctl_table *table, int write, struct file *filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
- size_t len;
+ size_t len, maxlen;
char __user *p;
char c;
-
+ void *data;
+
+ data = table->data;
+ maxlen = table->maxlen;
+ if (table->virt_handler)
+ table->virt_handler(table, write, filp->f_xid, &data, &maxlen);
+
if (!table->data || !table->maxlen || !*lenp ||
(*ppos && !write)) {
*lenp = 0;
return 0;
}
-
+
if (write) {
len = 0;
p = buffer;
break;
len++;
}
- if (len >= table->maxlen)
- len = table->maxlen-1;
- if(copy_from_user(table->data, buffer, len))
+ if (len >= maxlen)
+ len = maxlen-1;
+ if(copy_from_user(data, buffer, len))
return -EFAULT;
- ((char *) table->data)[len] = 0;
+ ((char *) data)[len] = 0;
*ppos += *lenp;
} else {
- len = strlen(table->data);
- if (len > table->maxlen)
- len = table->maxlen;
+ len = strlen(data);
+ if (len > maxlen)
+ len = maxlen;
if (len > *lenp)
len = *lenp;
if (len)
- if(copy_to_user(buffer, table->data, len))
+ if(copy_to_user(buffer, data, len))
return -EFAULT;
if (len < *lenp) {
if(put_user('\n', ((char __user *) buffer) + len))
if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
time_offset += ltemp;
+ #if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0
time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+ #else
+ time_adj = -ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE);
+ #endif
} else {
ltemp = time_offset;
if (!(time_status & STA_FLL))
if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
time_offset -= ltemp;
+ #if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0
time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+ #else
+ time_adj = ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE);
+ #endif
}
/*
endchoice
+config XID_TAG_NFSD
+ bool "Tag NFSD User Auth and Files"
+ default n
+ help
+ Enable this if you do want the kernel nfsd to
+ use the xid tagging specified above.
+ (will require patched clients too)
+
config VSERVER_DEBUG
- bool "Compile Debugging Code"
+ bool "VServer Debugging Code"
default n
help
Set this to yes if you want to be able to activate
increases the kernel size by about 20k.
config VSERVER_HISTORY
- bool "Compile History Tracing"
+ bool "VServer History Tracing"
depends on VSERVER_DEBUG
default n
help
obj-y += vserver.o
vserver-y := switch.o context.o namespace.o sched.o network.o inode.o \
- limit.o cvirt.o signal.o proc.o helper.o init.o dlimit.o
+ limit.o cvirt.o signal.o helper.o init.o dlimit.o
+vserver-$(CONFIG_PROC_FS) += proc.o
vserver-$(CONFIG_VSERVER_DEBUG) += sysctl.o
vserver-$(CONFIG_VSERVER_LEGACY) += legacy.o
vserver-$(CONFIG_VSERVER_LEGACYNET) += legacynet.o
new->vx_parent = NULL;
new->vx_state = 0;
new->vx_lock = SPIN_LOCK_UNLOCKED;
- init_waitqueue_head(&new->vx_exit);
+ init_waitqueue_head(&new->vx_wait);
/* rest of init goes here */
vx_info_init_limit(&new->limit);
might_sleep();
- vs_context_state(vxi, VS_CONTEXT_DESTROY);
+ vxi->vx_state |= VXS_SHUTDOWN;
+ vs_state_change(vxi, VSC_SHUTDOWN);
namespace = xchg(&vxi->vx_namespace, NULL);
if (namespace)
/* context must not be hashed */
BUG_ON(vxi->vx_state & VXS_HASHED);
- get_vx_info(vxi);
vxi->vx_state |= VXS_HASHED;
head = &vx_info_hash[__hashval(vxi->vx_id)];
hlist_add_head(&vxi->vx_hlist, head);
vxi->vx_state &= ~VXS_HASHED;
hlist_del(&vxi->vx_hlist);
- put_vx_info(vxi);
}
spin_lock(&vx_info_hash_lock);
__unhash_vx_info(vxi);
spin_unlock(&vx_info_hash_lock);
+ __wakeup_vx_info(vxi);
}
if (IS_ERR(new_vxi))
return PTR_ERR(new_vxi);
- vs_context_state(new_vxi, VS_CONTEXT_CREATED);
+ vs_state_change(new_vxi, VSC_STARTUP);
ret = new_vxi->vx_id;
vx_migrate_task(current, new_vxi);
/* if this fails, we might end up with a hashed vx_info */
#include <linux/config.h>
#include <linux/sched.h>
+#include <linux/sysctl.h>
#include <linux/types.h>
#include <linux/vs_context.h>
#include <linux/vs_cvirt.h>
}
+int vx_uts_virt_handler(struct ctl_table *ctl, int write, xid_t xid,
+ void **datap, size_t *lenp)
+{
+ switch (ctl->ctl_name) {
+ case KERN_OSTYPE:
+ *datap = vx_new_uts(sysname);
+ break;
+ case KERN_OSRELEASE:
+ *datap = vx_new_uts(release);
+ break;
+ case KERN_VERSION:
+ *datap = vx_new_uts(version);
+ break;
+ case KERN_NODENAME:
+ *datap = vx_new_uts(nodename);
+ break;
+ case KERN_DOMAINNAME:
+ *datap = vx_new_uts(domainname);
+ break;
+ }
+
+ return 0;
+}
+
+
+
/*
* Commands to do_syslog:
*
* Copyright (C) 2004-2005 Herbert Pötzl
*
* V0.01 initial version
+ * V0.02 compat32 splitup
*
*/
#include <linux/namespace.h>
#include <linux/namei.h>
#include <linux/statfs.h>
+#include <linux/compat.h>
#include <linux/vserver/switch.h>
#include <linux/vs_context.h>
#include <linux/vs_dlimit.h>
+#include <linux/vserver/dlimit_cmd.h>
#include <asm/errno.h>
#include <asm/uaccess.h>
-int vc_add_dlimit(uint32_t id, void __user *data)
+int do_addrem_dlimit(uint32_t id, const char __user *name,
+ uint32_t flags, int add)
{
struct nameidata nd;
- struct vcmd_ctx_dlimit_base_v0 vc_data;
int ret;
- if (!vx_check(0, VX_ADMIN))
- return -ENOSYS;
- if (copy_from_user (&vc_data, data, sizeof(vc_data)))
- return -EFAULT;
-
- ret = user_path_walk_link(vc_data.name, &nd);
+ ret = user_path_walk_link(name, &nd);
if (!ret) {
struct super_block *sb;
struct dl_info *dli;
if (!(sb = nd.dentry->d_inode->i_sb))
goto out_release;
- dli = __alloc_dl_info(sb, id);
- spin_lock(&dl_info_hash_lock);
-
- ret = -EEXIST;
- if (__lookup_dl_info(sb, id))
- goto out_unlock;
- __hash_dl_info(dli);
- dli = NULL;
+ if (add) {
+ dli = __alloc_dl_info(sb, id);
+ spin_lock(&dl_info_hash_lock);
+
+ ret = -EEXIST;
+ if (__lookup_dl_info(sb, id))
+ goto out_unlock;
+ __hash_dl_info(dli);
+ dli = NULL;
+ } else {
+ spin_lock(&dl_info_hash_lock);
+ dli = __lookup_dl_info(sb, id);
+
+ ret = -ESRCH;
+ if (!dli)
+ goto out_unlock;
+ __unhash_dl_info(dli);
+ }
ret = 0;
-
out_unlock:
spin_unlock(&dl_info_hash_lock);
- if (dli)
+ if (add && dli)
__dealloc_dl_info(dli);
out_release:
path_release(&nd);
return ret;
}
+int vc_add_dlimit(uint32_t id, void __user *data)
+{
+ struct vcmd_ctx_dlimit_base_v0 vc_data;
+
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 1);
+}
int vc_rem_dlimit(uint32_t id, void __user *data)
{
- struct nameidata nd;
struct vcmd_ctx_dlimit_base_v0 vc_data;
- int ret;
if (!vx_check(0, VX_ADMIN))
return -ENOSYS;
if (copy_from_user (&vc_data, data, sizeof(vc_data)))
return -EFAULT;
- ret = user_path_walk_link(vc_data.name, &nd);
- if (!ret) {
- struct super_block *sb;
- struct dl_info *dli;
-
- ret = -EINVAL;
- if (!nd.dentry->d_inode)
- goto out_release;
- if (!(sb = nd.dentry->d_inode->i_sb))
- goto out_release;
+ return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 0);
+}
- spin_lock(&dl_info_hash_lock);
- dli = __lookup_dl_info(sb, id);
+#ifdef CONFIG_COMPAT
- ret = -ESRCH;
- if (!dli)
- goto out_unlock;
+int vc_add_dlimit_x32(uint32_t id, void __user *data)
+{
+ struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
- __unhash_dl_info(dli);
- ret = 0;
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
- out_unlock:
- spin_unlock(&dl_info_hash_lock);
- out_release:
- path_release(&nd);
- }
- return ret;
+ return do_addrem_dlimit(id,
+ compat_ptr(vc_data.name_ptr), vc_data.flags, 1);
}
-
-int vc_set_dlimit(uint32_t id, void __user *data)
+int vc_rem_dlimit_x32(uint32_t id, void __user *data)
{
- struct nameidata nd;
- struct vcmd_ctx_dlimit_v0 vc_data;
- int ret;
+ struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
if (!vx_check(0, VX_ADMIN))
return -ENOSYS;
if (copy_from_user (&vc_data, data, sizeof(vc_data)))
return -EFAULT;
- ret = user_path_walk_link(vc_data.name, &nd);
+ return do_addrem_dlimit(id,
+ compat_ptr(vc_data.name_ptr), vc_data.flags, 0);
+}
+
+#endif /* CONFIG_COMPAT */
+
+
+static inline
+int do_set_dlimit(uint32_t id, const char __user *name,
+ uint32_t space_used, uint32_t space_total,
+ uint32_t inodes_used, uint32_t inodes_total,
+ uint32_t reserved, uint32_t flags)
+{
+ struct nameidata nd;
+ int ret;
+
+ ret = user_path_walk_link(name, &nd);
if (!ret) {
struct super_block *sb;
struct dl_info *dli;
goto out_release;
if (!(sb = nd.dentry->d_inode->i_sb))
goto out_release;
- if ((vc_data.reserved != (uint32_t)CDLIM_KEEP &&
- vc_data.reserved > 100) ||
- (vc_data.inodes_used != (uint32_t)CDLIM_KEEP &&
- vc_data.inodes_used > vc_data.inodes_total) ||
- (vc_data.space_used != (uint32_t)CDLIM_KEEP &&
- vc_data.space_used > vc_data.space_total))
+ if ((reserved != (uint32_t)CDLIM_KEEP &&
+ reserved > 100) ||
+ (inodes_used != (uint32_t)CDLIM_KEEP &&
+ inodes_used > inodes_total) ||
+ (space_used != (uint32_t)CDLIM_KEEP &&
+ space_used > space_total))
goto out_release;
ret = -ESRCH;
spin_lock(&dli->dl_lock);
- if (vc_data.inodes_used != (uint32_t)CDLIM_KEEP)
- dli->dl_inodes_used = vc_data.inodes_used;
- if (vc_data.inodes_total != (uint32_t)CDLIM_KEEP)
- dli->dl_inodes_total = vc_data.inodes_total;
- if (vc_data.space_used != (uint32_t)CDLIM_KEEP) {
- dli->dl_space_used = vc_data.space_used;
+ if (inodes_used != (uint32_t)CDLIM_KEEP)
+ dli->dl_inodes_used = inodes_used;
+ if (inodes_total != (uint32_t)CDLIM_KEEP)
+ dli->dl_inodes_total = inodes_total;
+ if (space_used != (uint32_t)CDLIM_KEEP) {
+ dli->dl_space_used = space_used;
dli->dl_space_used <<= 10;
}
- if (vc_data.space_total == (uint32_t)CDLIM_INFINITY)
+ if (space_total == (uint32_t)CDLIM_INFINITY)
dli->dl_space_total = (uint64_t)CDLIM_INFINITY;
- else if (vc_data.space_total != (uint32_t)CDLIM_KEEP) {
- dli->dl_space_total = vc_data.space_total;
+ else if (space_total != (uint32_t)CDLIM_KEEP) {
+ dli->dl_space_total = space_total;
dli->dl_space_total <<= 10;
}
- if (vc_data.reserved != (uint32_t)CDLIM_KEEP)
- dli->dl_nrlmult = (1 << 10) * (100 - vc_data.reserved) / 100;
+ if (reserved != (uint32_t)CDLIM_KEEP)
+ dli->dl_nrlmult = (1 << 10) * (100 - reserved) / 100;
spin_unlock(&dli->dl_lock);
return ret;
}
-int vc_get_dlimit(uint32_t id, void __user *data)
+int vc_set_dlimit(uint32_t id, void __user *data)
{
- struct nameidata nd;
struct vcmd_ctx_dlimit_v0 vc_data;
- int ret;
if (!vx_check(0, VX_ADMIN))
return -ENOSYS;
if (copy_from_user (&vc_data, data, sizeof(vc_data)))
return -EFAULT;
- ret = user_path_walk_link(vc_data.name, &nd);
+ return do_set_dlimit(id, vc_data.name,
+ vc_data.space_used, vc_data.space_total,
+ vc_data.inodes_used, vc_data.inodes_total,
+ vc_data.reserved, vc_data.flags);
+}
+
+#ifdef CONFIG_COMPAT
+
+int vc_set_dlimit_x32(uint32_t id, void __user *data)
+{
+ struct vcmd_ctx_dlimit_v0_x32 vc_data;
+
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ return do_set_dlimit(id, compat_ptr(vc_data.name_ptr),
+ vc_data.space_used, vc_data.space_total,
+ vc_data.inodes_used, vc_data.inodes_total,
+ vc_data.reserved, vc_data.flags);
+}
+
+#endif /* CONFIG_COMPAT */
+
+
+static inline
+int do_get_dlimit(uint32_t id, const char __user *name,
+ uint32_t *space_used, uint32_t *space_total,
+ uint32_t *inodes_used, uint32_t *inodes_total,
+ uint32_t *reserved, uint32_t *flags)
+{
+ struct nameidata nd;
+ int ret;
+
+ ret = user_path_walk_link(name, &nd);
if (!ret) {
struct super_block *sb;
struct dl_info *dli;
goto out_release;
if (!(sb = nd.dentry->d_inode->i_sb))
goto out_release;
- if (vc_data.reserved > 100 ||
- vc_data.inodes_used > vc_data.inodes_total ||
- vc_data.space_used > vc_data.space_total)
- goto out_release;
ret = -ESRCH;
dli = locate_dl_info(sb, id);
goto out_release;
spin_lock(&dli->dl_lock);
- vc_data.inodes_used = dli->dl_inodes_used;
- vc_data.inodes_total = dli->dl_inodes_total;
- vc_data.space_used = dli->dl_space_used >> 10;
+ *inodes_used = dli->dl_inodes_used;
+ *inodes_total = dli->dl_inodes_total;
+ *space_used = dli->dl_space_used >> 10;
if (dli->dl_space_total == (uint64_t)CDLIM_INFINITY)
- vc_data.space_total = (uint32_t)CDLIM_INFINITY;
+ *space_total = (uint32_t)CDLIM_INFINITY;
else
- vc_data.space_total = dli->dl_space_total >> 10;
+ *space_total = dli->dl_space_total >> 10;
- vc_data.reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
+ *reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
spin_unlock(&dli->dl_lock);
put_dl_info(dli);
ret = -EFAULT;
- if (copy_to_user(data, &vc_data, sizeof(vc_data)))
- goto out_release;
ret = 0;
out_release:
}
+int vc_get_dlimit(uint32_t id, void __user *data)
+{
+ struct vcmd_ctx_dlimit_v0 vc_data;
+ int ret;
+
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ ret = do_get_dlimit(id, vc_data.name,
+ &vc_data.space_used, &vc_data.space_total,
+ &vc_data.inodes_used, &vc_data.inodes_total,
+ &vc_data.reserved, &vc_data.flags);
+ if (ret)
+ return ret;
+
+ if (copy_to_user(data, &vc_data, sizeof(vc_data)))
+ return -EFAULT;
+ return 0;
+}
+
+#ifdef CONFIG_COMPAT
+
+int vc_get_dlimit_x32(uint32_t id, void __user *data)
+{
+ struct vcmd_ctx_dlimit_v0_x32 vc_data;
+ int ret;
+
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ ret = do_get_dlimit(id, compat_ptr(vc_data.name_ptr),
+ &vc_data.space_used, &vc_data.space_total,
+ &vc_data.inodes_used, &vc_data.inodes_total,
+ &vc_data.reserved, &vc_data.flags);
+ if (ret)
+ return ret;
+
+ if (copy_to_user(data, &vc_data, sizeof(vc_data)))
+ return -EFAULT;
+ return 0;
+}
+
+#endif /* CONFIG_COMPAT */
+
+
void vx_vsi_statfs(struct super_block *sb, struct kstatfs *buf)
{
struct dl_info *dli;
if ((ret = call_usermodehelper(name, argv, envp, sync))) {
printk( KERN_WARNING
- "%s: (%s %s) returned with %d\n",
- name, argv[1], argv[2], ret);
+ "%s: (%s %s) returned %s with %d\n",
+ name, argv[1], argv[2],
+ sync?"sync":"async", ret);
}
vxdprintk(VXD_CBIT(switch, 1),
- "%s: (%s %s) returned with %d",
- name, argv[1], argv[2], ret);
+ "%s: (%s %s) returned %s with %d",
+ name, argv[1], argv[2], sync?"sync":"async", ret);
return ret;
}
case LINUX_REBOOT_CMD_SW_SUSPEND:
argv[1] = "swsusp";
break;
+
+ default:
+ return 0;
}
if (do_vshelper(vshelper_path, argv, envp, 1))
/*
- * invoked by vserver sys_reboot(), with
- * the following arguments
- *
* argv [0] = vshelper_path;
* argv [1] = action: "startup", "shutdown"
* argv [2] = context identifier
* envp [*] = type-specific parameters
*/
-long vs_context_state(struct vx_info *vxi, unsigned int cmd)
+long vs_state_change(struct vx_info *vxi, unsigned int cmd)
{
char id_buf[8], cmd_buf[16];
char *argv[] = {vshelper_path, NULL, id_buf, 0};
snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
switch (cmd) {
- case VS_CONTEXT_CREATED:
+ case VSC_STARTUP:
argv[1] = "startup";
break;
- case VS_CONTEXT_DESTROY:
+ case VSC_SHUTDOWN:
argv[1] = "shutdown";
break;
default:
*
*/
-#include <linux/config.h>
#include <linux/sched.h>
#include <linux/vs_context.h>
#include <linux/proc_fs.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/parser.h>
+#include <linux/compat.h>
#include <linux/vserver/inode.h>
#include <linux/vserver/inode_cmd.h>
#include <linux/vserver/xid.h>
&vc_data.xid, &vc_data.flags, &vc_data.mask);
path_release(&nd);
}
+ if (ret)
+ return ret;
if (copy_to_user (data, &vc_data, sizeof(vc_data)))
ret = -EFAULT;
return ret;
}
+#ifdef CONFIG_COMPAT
+
+int vc_get_iattr_x32(uint32_t id, void __user *data)
+{
+ struct nameidata nd;
+ struct vcmd_ctx_iattr_v1_x32 vc_data = { .xid = -1 };
+ int ret;
+
+ if (!vx_check(0, VX_ADMIN))
+ return -ENOSYS;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ ret = user_path_walk_link(compat_ptr(vc_data.name_ptr), &nd);
+ if (!ret) {
+ ret = __vc_get_iattr(nd.dentry->d_inode,
+ &vc_data.xid, &vc_data.flags, &vc_data.mask);
+ path_release(&nd);
+ }
+ if (ret)
+ return ret;
+
+ if (copy_to_user (data, &vc_data, sizeof(vc_data)))
+ ret = -EFAULT;
+ return ret;
+}
+
+#endif /* CONFIG_COMPAT */
+
+
static int __vc_set_iattr(struct dentry *de, uint32_t *xid, uint32_t *flags, uint32_t *mask)
{
struct inode *in = de->d_inode;
return ret;
}
+#ifdef CONFIG_COMPAT
+
+int vc_set_iattr_x32(uint32_t id, void __user *data)
+{
+ struct nameidata nd;
+ struct vcmd_ctx_iattr_v1_x32 vc_data;
+ int ret;
+
+ if (!capable(CAP_SYS_ADMIN) || !capable(CAP_LINUX_IMMUTABLE))
+ return -EPERM;
+ if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+ return -EFAULT;
+
+ ret = user_path_walk_link(compat_ptr(vc_data.name_ptr), &nd);
+ if (!ret) {
+ ret = __vc_set_iattr(nd.dentry,
+ &vc_data.xid, &vc_data.flags, &vc_data.mask);
+ path_release(&nd);
+ }
+
+ if (copy_to_user (data, &vc_data, sizeof(vc_data)))
+ ret = -EFAULT;
+ return ret;
+}
+
+#endif /* CONFIG_COMPAT */
#ifdef CONFIG_VSERVER_LEGACY
/* per pid info */
-char *task_vx_info(struct task_struct *p, char *buffer)
+int proc_pid_vx_info(struct task_struct *p, char *buffer)
{
struct vx_info *vxi;
+ char * orig = buffer;
buffer += sprintf (buffer,"XID:\t%d\n", vx_task_xid(p));
vxi = task_get_vx_info(p);
,vxi->vx_initpid);
}
put_vx_info(vxi);
- return buffer;
-}
-
-int proc_pid_vx_info(struct task_struct *p, char *buffer)
-{
- char * orig = buffer;
-
- buffer = task_vx_info(p, buffer);
return buffer - orig;
}
-char *task_nx_info(struct task_struct *p, char *buffer)
+
+int proc_pid_nx_info(struct task_struct *p, char *buffer)
{
struct nx_info *nxi;
+ char * orig = buffer;
buffer += sprintf (buffer,"NID:\t%d\n", nx_task_nid(p));
nxi = task_get_nx_info(p);
,NIPQUAD(nxi->v4_bcast));
}
put_nx_info(nxi);
- return buffer;
-}
-
-int proc_pid_nx_info(struct task_struct *p, char *buffer)
-{
- char * orig = buffer;
-
- buffer = task_nx_info(p, buffer);
return buffer - orig;
}
#include <asm/uaccess.h>
#include <linux/vs_context.h>
-#include <linux/vserver/signal.h>
+#include <linux/vserver/signal_cmd.h>
int vc_ctx_kill(uint32_t id, void __user *data)
DECLARE_WAITQUEUE(wait, current);
int ret = 0;
- add_wait_queue(&vxi->vx_exit, &wait);
+ add_wait_queue(&vxi->vx_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
wait:
- if (vx_info_state(vxi, VXS_DEFUNCT))
+ if (vx_info_state(vxi, VXS_SHUTDOWN|VXS_HASHED) == VXS_SHUTDOWN)
goto out;
if (signal_pending(current)) {
ret = -ERESTARTSYS;
out:
set_current_state(TASK_RUNNING);
- remove_wait_queue(&vxi->vx_exit, &wait);
+ remove_wait_queue(&vxi->vx_wait, &wait);
return ret;
}
* V0.03 added rlimit functions
* V0.04 added iattr, task/xid functions
* V0.05 added debug/history stuff
+ * V0.06 added compat32 layer
*
*/
#include <linux/config.h>
#include <linux/linkage.h>
#include <linux/sched.h>
+#include <linux/compat.h>
#include <asm/errno.h>
#include <linux/vserver/network.h>
#include <linux/vserver/debug.h>
-static inline int
-vc_get_version(uint32_t id)
+static inline
+int vc_get_version(uint32_t id)
{
return VCI_VERSION;
}
#include <linux/vserver/sched_cmd.h>
#include <linux/vserver/debug_cmd.h>
#include <linux/vserver/inode_cmd.h>
+#include <linux/vserver/dlimit_cmd.h>
+#include <linux/vserver/signal_cmd.h>
#include <linux/vserver/legacy.h>
#include <linux/vserver/namespace.h>
#include <linux/vserver/inode.h>
-#include <linux/vserver/signal.h>
#include <linux/vserver/dlimit.h>
-extern asmlinkage long
-sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
+#ifdef CONFIG_COMPAT
+#define __COMPAT(name, id, data, compat) \
+ (compat) ? name ## _x32 (id, data) : name (id, data)
+#else
+#define __COMPAT(name, id, data, compat) \
+ name (id, data)
+#endif
+
+
+static inline
+long do_vserver(uint32_t cmd, uint32_t id, void __user *data, int compat)
{
vxdprintk(VXD_CBIT(switch, 0),
- "vc: VCMD_%02d_%d[%d], %d",
+ "vc: VCMD_%02d_%d[%d], %d,%p,%d",
VC_CATEGORY(cmd), VC_COMMAND(cmd),
- VC_VERSION(cmd), id);
+ VC_VERSION(cmd), id, data, compat);
#ifdef CONFIG_VSERVER_LEGACY
if (!capable(CAP_CONTEXT) &&
return vc_set_sched(id, data);
case VCMD_add_dlimit:
- return vc_add_dlimit(id, data);
+ return __COMPAT(vc_add_dlimit, id, data, compat);
case VCMD_rem_dlimit:
- return vc_rem_dlimit(id, data);
+ return __COMPAT(vc_rem_dlimit, id, data, compat);
case VCMD_set_dlimit:
- return vc_set_dlimit(id, data);
+ return __COMPAT(vc_set_dlimit, id, data, compat);
case VCMD_get_dlimit:
- return vc_get_dlimit(id, data);
+ return __COMPAT(vc_get_dlimit, id, data, compat);
}
/* below here only with VX_ADMIN */
#endif
case VCMD_get_iattr:
- return vc_get_iattr(id, data);
+ return __COMPAT(vc_get_iattr, id, data, compat);
case VCMD_set_iattr:
- return vc_set_iattr(id, data);
+ return __COMPAT(vc_set_iattr, id, data, compat);
case VCMD_enter_namespace:
return vc_enter_namespace(id, data);
return -ENOSYS;
}
+extern asmlinkage long
+sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
+{
+ return do_vserver(cmd, id, data, 0);
+}
+
+#ifdef CONFIG_COMPAT
+
+extern asmlinkage long
+sys32_vserver(uint32_t cmd, uint32_t id, void __user *data)
+{
+ return do_vserver(cmd, id, data, 1);
+}
+
+#endif /* CONFIG_COMPAT */
#include <linux/filter.h>
#include <linux/vs_socket.h>
#include <linux/vs_limit.h>
+#include <linux/vs_context.h>
#ifdef CONFIG_INET
#include <net/tcp.h>
static unsigned long ip_ct_sctp_timeout_closed = 10 SECS;
static unsigned long ip_ct_sctp_timeout_cookie_wait = 3 SECS;
static unsigned long ip_ct_sctp_timeout_cookie_echoed = 3 SECS;
-static unsigned long ip_ct_sctp_timeout_established = 5 DAYS;
+static unsigned long ip_ct_sctp_timeout_established = 2 DAYS;
static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;
static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;
static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;
unsigned long ip_ct_tcp_timeout_syn_sent = 2 MINS;
unsigned long ip_ct_tcp_timeout_syn_recv = 60 SECS;
-unsigned long ip_ct_tcp_timeout_established = 5 DAYS;
+unsigned long ip_ct_tcp_timeout_established = 2 DAYS;
unsigned long ip_ct_tcp_timeout_fin_wait = 2 MINS;
unsigned long ip_ct_tcp_timeout_close_wait = 60 SECS;
unsigned long ip_ct_tcp_timeout_last_ack = 30 SECS;
#include <linux/vs_limit.h>
#include <linux/vs_socket.h>
+#include <linux/vs_context.h>
#ifdef CONFIG_SYSCTL
#define SYNC_INIT 0 /* let the user enable it */
int cap_syslog (int type)
{
- if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
+ if ((type != 3 && type != 10) &&
+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SYSLOG))
return -EPERM;
return 0;
}