aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lg.h
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-17 16:19:42 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 06:50:18 -0500
commit382ac6b3fbc0ea6a5697fc6caaf7e7de12fa8b96 (patch)
treebdda012251f29775b2e1201f3b2b3e38c4680f42 /drivers/lguest/lg.h
parent934faab464c6a26ed1a226b6cf7111b35405dde1 (diff)
lguest: get rid of lg variable assignments
We can save some lines of code by getting rid of *lg = cpu... lines of code spread everywhere by now. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r--drivers/lguest/lg.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 0d6f6435d72c..b75ce3b17afe 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -111,22 +111,22 @@ extern struct mutex lguest_lock;
111/* core.c: */ 111/* core.c: */
112int lguest_address_ok(const struct lguest *lg, 112int lguest_address_ok(const struct lguest *lg,
113 unsigned long addr, unsigned long len); 113 unsigned long addr, unsigned long len);
114void __lgread(struct lguest *, void *, unsigned long, unsigned); 114void __lgread(struct lg_cpu *, void *, unsigned long, unsigned);
115void __lgwrite(struct lguest *, unsigned long, const void *, unsigned); 115void __lgwrite(struct lg_cpu *, unsigned long, const void *, unsigned);
116 116
117/*H:035 Using memory-copy operations like that is usually inconvient, so we 117/*H:035 Using memory-copy operations like that is usually inconvient, so we
118 * have the following helper macros which read and write a specific type (often 118 * have the following helper macros which read and write a specific type (often
119 * an unsigned long). 119 * an unsigned long).
120 * 120 *
121 * This reads into a variable of the given type then returns that. */ 121 * This reads into a variable of the given type then returns that. */
122#define lgread(lg, addr, type) \ 122#define lgread(cpu, addr, type) \
123 ({ type _v; __lgread((lg), &_v, (addr), sizeof(_v)); _v; }) 123 ({ type _v; __lgread((cpu), &_v, (addr), sizeof(_v)); _v; })
124 124
125/* This checks that the variable is of the given type, then writes it out. */ 125/* This checks that the variable is of the given type, then writes it out. */
126#define lgwrite(lg, addr, type, val) \ 126#define lgwrite(cpu, addr, type, val) \
127 do { \ 127 do { \
128 typecheck(type, val); \ 128 typecheck(type, val); \
129 __lgwrite((lg), (addr), &(val), sizeof(val)); \ 129 __lgwrite((cpu), (addr), &(val), sizeof(val)); \
130 } while(0) 130 } while(0)
131/* (end of memory access helper routines) :*/ 131/* (end of memory access helper routines) :*/
132 132
@@ -171,13 +171,13 @@ void guest_new_pagetable(struct lg_cpu *cpu, unsigned long pgtable);
171void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i); 171void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i);
172void guest_pagetable_clear_all(struct lg_cpu *cpu); 172void guest_pagetable_clear_all(struct lg_cpu *cpu);
173void guest_pagetable_flush_user(struct lg_cpu *cpu); 173void guest_pagetable_flush_user(struct lg_cpu *cpu);
174void guest_set_pte(struct lguest *lg, unsigned long gpgdir, 174void guest_set_pte(struct lg_cpu *cpu, unsigned long gpgdir,
175 unsigned long vaddr, pte_t val); 175 unsigned long vaddr, pte_t val);
176void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages); 176void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages);
177int demand_page(struct lg_cpu *cpu, unsigned long cr2, int errcode); 177int demand_page(struct lg_cpu *cpu, unsigned long cr2, int errcode);
178void pin_page(struct lg_cpu *cpu, unsigned long vaddr); 178void pin_page(struct lg_cpu *cpu, unsigned long vaddr);
179unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr); 179unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr);
180void page_table_guest_data_init(struct lguest *lg); 180void page_table_guest_data_init(struct lg_cpu *cpu);
181 181
182/* <arch>/core.c: */ 182/* <arch>/core.c: */
183void lguest_arch_host_init(void); 183void lguest_arch_host_init(void);
@@ -197,7 +197,7 @@ void lguest_device_remove(void);
197 197
198/* hypercalls.c: */ 198/* hypercalls.c: */
199void do_hypercalls(struct lg_cpu *cpu); 199void do_hypercalls(struct lg_cpu *cpu);
200void write_timestamp(struct lguest *lg); 200void write_timestamp(struct lg_cpu *cpu);
201 201
202/*L:035 202/*L:035
203 * Let's step aside for the moment, to study one important routine that's used 203 * Let's step aside for the moment, to study one important routine that's used
@@ -223,12 +223,12 @@ void write_timestamp(struct lguest *lg);
223 * Like any macro which uses an "if", it is safely wrapped in a run-once "do { 223 * Like any macro which uses an "if", it is safely wrapped in a run-once "do {
224 * } while(0)". 224 * } while(0)".
225 */ 225 */
226#define kill_guest(lg, fmt...) \ 226#define kill_guest(cpu, fmt...) \
227do { \ 227do { \
228 if (!(lg)->dead) { \ 228 if (!(cpu)->lg->dead) { \
229 (lg)->dead = kasprintf(GFP_ATOMIC, fmt); \ 229 (cpu)->lg->dead = kasprintf(GFP_ATOMIC, fmt); \
230 if (!(lg)->dead) \ 230 if (!(cpu)->lg->dead) \
231 (lg)->dead = ERR_PTR(-ENOMEM); \ 231 (cpu)->lg->dead = ERR_PTR(-ENOMEM); \
232 } \ 232 } \
233} while(0) 233} while(0)
234/* (End of aside) :*/ 234/* (End of aside) :*/