[Lguest] [patch] cleanup hypercall code
Jes Sorensen
jes at sgi.com
Mon Aug 20 18:19:54 EST 2007
Rusty Russell wrote:
> On Fri, 2007-08-17 at 16:37 +0200, Jes Sorensen wrote:
> arg0 can probably be generically called "hcall_num" or something.
> Actually, it's also often the return, so you're right arg0 is better.
Heh, I already went through that one and came to the same conclusion :)
>> +#define LG_GET_HCALL_ARGS(lg) (struct hcall_args *)&lg->regs->eax
>
> Prefer a union in regs, and less SHOUTING:
>
> static inline struct hcall_args *lg_hcall_args(struct lguest *lg)
> {
> return &lg->regs->hcall_args;
> }
I made it a macro as on some architectures it may end up being
different and not directly mappable to the regs structure, but we can
make it an inline too - I have a slight preference for macros for this
kinda stuff just like we all know orange is prettier than purple. I am
fine with a union on i386, I'll update the patch for that.
>> +/*
>> + * Determine whether the hypercall code was entered because of a real
>> + * hypercall or if it was for some other reason, interrupt, different
>> + * trap .....
>> + */
>> +#define LG_IN_REAL_HCALL(lg) (lg->regs->trapnum == LGUEST_TRAP_ENTRY)
>
> lguest_wants_hcall(lg) maybe?
FISH!
I'm happy with either name to be honest. Given that this is going to be
a very simple macro on some archs, I'd prefer to keep the shouting.
Cheers,
Jes
More information about the Lguest
mailing list