Definition of mfn_t in x86's hvm/grant_table.h
Hi,
while fixing a violation of R8.4 related to a missing include in x86/hvm/grant_table.c I included <asm/hvm/grant_table.h>, since that file contains just the declarations needed by the .c file. However, since the declaration uses the type mfn_t, which is defined in an header not included from hvm/grant_table.h I'm wondering what is preferred:
1. include #include <asm/paging.h> in asm/hvm/grant_table.h, so that mfn_t can be used without relying on other headers using this one to provide it.
2. include <asm/grant_table.h> in x86/hvm/grant_table.c, which includes more declarations than needed, but has all type definitions.
I prefer (1), but (2) does not have major downsides either.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Quoted 15 lines · Nicola Vetrini
while fixing a violation of R8.4 related to a missing include in
x86/hvm/grant_table.c
I included <asm/hvm/grant_table.h>, since that file contains just the declarations needed
by the .c file. However, since the declaration uses the typemfn_t, which is defined in an
header not included fromhvm/grant_table.hI'm wondering what is preferred:
1. include #include <asm/paging.h> inasm/hvm/grant_table.h, so thatmfn_tcan be used
without relying on other headers using this one to provide it.
2. include <asm/grant_table.h> inx86/hvm/grant_table.c, which includes more declarations
than needed, but has all type definitions.
Quoted 1 line
I prefer (1), but (2) does not have major downsides either.
Why asm/paging.h? xen/mm-frame.h is what you need for mfn_t. I'd be fine with (1) in that case, but if it was asm/paging.h that's needed (for another reason) I guess I'd prefer (2).
Jan
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Nicola Vetrini
while fixing a violation of R8.4 related to a missing include in
x86/hvm/grant_table.c
I included <asm/hvm/grant_table.h>, since that file contains just the declarations needed
by the .c file. However, since the declaration uses the typemfn_t, which is defined in an
header not included fromhvm/grant_table.hI'm wondering what is preferred:
1. include #include <asm/paging.h> inasm/hvm/grant_table.h, so thatmfn_tcan be used
without relying on other headers using this one to provide it.
2. include <asm/grant_table.h> inx86/hvm/grant_table.c, which includes more declarations
than needed, but has all type definitions.
Quoted 7 lines
Quoted 1 line
I prefer (1), but (2) does not have major downsides either.
Why
asm/paging.h?xen/mm-frame.his what you need formfn_t. I'd be fine with (1) in that case, but if it wasasm/paging.hthat's needed (for another reason) I guess I'd prefer (2).Jan
This is part of a patch series now [1].
I put asm/paging because asm/grant_table uses it and I wasn't entirely sure whether including mm-frame directly was the right thing to do. I don't remember whether I actually tested that solution, but changing the included header should not be problematic.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)