- Update Xen patches to 3.3-rc5 and c/s 1157.
[linux-flexiantxendom0-3.2.10.git] / drivers / xen / balloon / common.h
1 /******************************************************************************
2  * balloon/common.h
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License version 2
6  * as published by the Free Software Foundation; or, when distributed
7  * separately from the Linux kernel or incorporated into other
8  * software packages, subject to the following license:
9  * 
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this source file (the "Software"), to deal in the Software without
12  * restriction, including without limitation the rights to use, copy, modify,
13  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
14  * and to permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  * 
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  * 
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  */
28
29 #ifndef __XEN_BALLOON_COMMON_H__
30 #define __XEN_BALLOON_COMMON_H__
31
32 #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
33
34 struct balloon_stats {
35         /* We aim for 'current allocation' == 'target allocation'. */
36         unsigned long current_pages;
37         unsigned long target_pages;
38         /*
39          * Drivers may alter the memory reservation independently, but they
40          * must inform the balloon driver so we avoid hitting the hard limit.
41          */
42         unsigned long driver_pages;
43         /* Number of pages in high- and low-memory balloons. */
44         unsigned long balloon_low;
45         unsigned long balloon_high;
46 };
47
48 extern struct balloon_stats balloon_stats;
49 #define bs balloon_stats
50
51 int balloon_sysfs_init(void);
52 void balloon_sysfs_exit(void);
53
54 void balloon_set_new_target(unsigned long target);
55 unsigned long balloon_minimum_target(void);
56
57 #endif /* __XEN_BALLOON_COMMON_H__ */