File: vzlist.h

package info (click to toggle)
vzctl 3.0.22-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,340 kB
  • ctags: 4,462
  • sloc: ansic: 15,696; sh: 11,712; makefile: 460
file content (129 lines) | stat: -rw-r--r-- 2,936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 *  Copyright (C) 2000-2007 SWsoft. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef _VZLIST_H
#define _VZLIST_H

/* #include <linux/vzlist.h> */
#define HAVE_VZLIST_IOCTL 0

#define PROCVEINFO	"/proc/vz/veinfo"
#define PROCVESTAT	"/proc/vz/vestat"
#define PROCUBC		"/proc/user_beancounters"
#define PROCQUOTA	"/proc/vz/vzquota"
#define PROCFSHED	"/proc/fairsched"

#define VZQUOTA		"/usr/sbin/vzquota"

#define MAXCPUUNITS	500000

enum {
	VE_RUNNING,
	VE_STOPPED,
	VE_MOUNTED
};

char *ve_status[]= {
	"running",
	"stopped",
	"mounted"
};

struct Cubc {
	unsigned long kmemsize[5];
	unsigned long lockedpages[5];
	unsigned long privvmpages[5];
	unsigned long shmpages[5];
	unsigned long numproc[5];
	unsigned long physpages[5];
	unsigned long vmguarpages[5];
	unsigned long oomguarpages[5];
	unsigned long numtcpsock[5];
	unsigned long numflock[5];
	unsigned long numpty[5];
	unsigned long numsiginfo[5];
	unsigned long tcpsndbuf[5];
	unsigned long tcprcvbuf[5];
	unsigned long othersockbuf[5];
	unsigned long dgramrcvbuf[5];
	unsigned long numothersock[5];
	unsigned long dcachesize[5];
	unsigned long numfile[5];
	unsigned long numiptent[5];
};

struct Cquota {
	unsigned long diskspace[3];	// 0-usage 1-softlimit 2-hardlimit
	unsigned long diskinodes[3];	// 0-usage 1-softlimit 2-hardlimit
};

struct Cla {
	double la[3];
};

struct Ccpu {
	unsigned long limit[2];		// 0-limit, 1-units
};

struct Cveinfo {
	int veid;
	char *hostname;
	char *name;
	char *ip;
	char *ve_private;
	char *ve_root;
	struct Cubc *ubc;
	struct Cquota *quota;
	struct Cla *la;
	struct Ccpu *cpu;
	int status;
	int hide;
};

#define RES_NONE	0
#define RES_HOSTNAME	1
#define RES_UBC		2
#define RES_QUOTA	3
#define RES_IP		4
#define RES_LA		5
#define RES_CPU		6
#define RES_NAME	7

struct Cfield {
	char *name;
	char *hdr;
	char *hdr_fmt;
	int index;
	int res_type;
	void (* const print_fn)(struct Cveinfo *p, int index);
	int (* const sort_fn)(const void* val1, const void* val2);
};

struct Cfield_order {
	int order;
	struct Cfield_order *next;
};

#ifndef NIPQUAD
#define NIPQUAD(addr) \
	((unsigned char *)&addr)[0], \
	((unsigned char *)&addr)[1], \
	((unsigned char *)&addr)[2], \
	((unsigned char *)&addr)[3]
#endif

#endif //_VZLIST_H