X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fkernel%2Fcvirt.h;h=eb138787ffa2629a4ec5630a8b896f68545b0dfe;hb=ba02066b569340ffb5a74184caceeb67fe87ac1c;hp=a8a242e02c99503e1169eaa34131a6c6022e010a;hpb=09fcd8d24e21368e9e5a5f49aa1c0bbdcafd9aed;p=util-vserver.git diff --git a/util-vserver/kernel/cvirt.h b/util-vserver/kernel/cvirt.h index a8a242e..eb13878 100644 --- a/util-vserver/kernel/cvirt.h +++ b/util-vserver/kernel/cvirt.h @@ -1,109 +1,25 @@ -#if defined(__KERNEL__) && defined(_VX_INFO_DEF_) - -#include -#include -#include -#include -#include - -/* context sub struct */ - -struct sock_acc { - atomic_t count; - atomic_t total; -}; - -struct _vx_cvirt { - int nr_threads; - int nr_running; - int max_threads; - unsigned long total_forks; - - unsigned int bias_cswtch; - struct timespec bias_idle; - struct timespec bias_tp; - uint64_t bias_jiffies; - - struct new_utsname utsname; - - struct sock_acc sock[5][3]; -}; - - -static inline long vx_sock_count(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].count); -} - - -static inline long vx_sock_total(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].total); -} - - -extern uint64_t vx_idle_jiffies(void); - -static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt) -{ - int i,j; - uint64_t idle_jiffies = vx_idle_jiffies(); - - cvirt->nr_threads = 1; - // new->virt.bias_cswtch = kstat.context_swtch; - cvirt->bias_jiffies = get_jiffies_64(); - - jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle); - do_posix_clock_monotonic_gettime(&cvirt->bias_tp); - - down_read(&uts_sem); - cvirt->utsname = system_utsname; - up_read(&uts_sem); +#ifndef _VX_CVIRT_H +#define _VX_CVIRT_H - for (i=0; i<5; i++) { - for (j=0; j<3; j++) { - atomic_set(&cvirt->sock[i][j].count, 0); - atomic_set(&cvirt->sock[i][j].total, 0); - } - } -} +#ifdef __KERNEL__ -static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) -{ - int i,j, length = 0; - static char *type[] = { "UNSPEC", "UNIX", "INET", "INET6", "OTHER" }; +struct timespec; - for (i=0; i<5; i++) { - length += sprintf(buffer + length, - "%s:", type[i]); - for (j=0; j<3; j++) { - length += sprintf(buffer + length, - "\t%12lu/%-12lu" - ,vx_sock_count(cvirt, i, j) - ,vx_sock_total(cvirt, i, j) - ); - } - buffer[length++] = '\n'; - } - return length; -} +void vx_vsi_uptime(struct timespec *, struct timespec *); -#else /* _VX_INFO_DEF_ */ -#ifndef _VX_CVIRT_H -#define _VX_CVIRT_H -#include "switch.h" +struct vx_info; -/* cvirt vserver commands */ +void vx_update_load(struct vx_info *); -#ifdef __KERNEL__ +int vx_uts_virt_handler(struct ctl_table *ctl, int write, xid_t xid, + void **datap, size_t *lenp); -struct timespec; -void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle); +int vx_do_syslog(int, char __user *, int); #endif /* __KERNEL__ */ - +#else /* _VX_CVIRT_H */ +#warning duplicate inclusion #endif /* _VX_CVIRT_H */ -#endif