On 23.07.2015 07:16, fu.wei@linaro.org wrote: > From: Fu Wei > > Add accessor functions of "loaded" flag in > grub-core/loader/arm64/linux.c. > > Export accessor functions of "loaded" flag and > grub_linux_get_fdt function in include/grub/arm64/linux.h. > > Purpose: Reuse the existing code of devicetree in linux module. > > Signed-off-by: Fu Wei > --- > grub-core/loader/arm64/linux.c | 13 +++++++++++++ > include/grub/arm64/linux.h | 6 +++++- > 2 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c > index 987f5b9..cf6026e 100644 > --- a/grub-core/loader/arm64/linux.c > +++ b/grub-core/loader/arm64/linux.c > @@ -48,6 +48,19 @@ static grub_addr_t initrd_end; > static void *loaded_fdt; > static void *fdt; > > +/* The accessor functions for "loaded" flag */ > +int > +grub_linux_get_loaded (void) > +{ > + return loaded; > +} > + > +void > +grub_linux_set_loaded (int loaded_flag) > +{ > + loaded = loaded_flag; > +} > + Accessor functions are usually useless in GRUB. We have no public API to respect. So it only adds clutter. Also "loaded" flag is static for а good reason: it's specific to linux.c. I'm going to move fdt part to fdt.c and have uniform interface for both linux and xen. > static void * > get_firmware_fdt (void) > { > diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h > index 65796d9..20058f3 100644 > --- a/include/grub/arm64/linux.h > +++ b/include/grub/arm64/linux.h > @@ -43,10 +43,14 @@ struct grub_arm64_linux_kernel_header > }; > > /* Declare the functions for getting dtb and checking/booting image */ > -void *grub_linux_get_fdt (void); > grub_err_t grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header > *lh); > grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, > char *args); > > +/* Export the accessor functions for gettin dtb and "loaded" flag */ > +void EXPORT_FUNC (*grub_linux_get_fdt) (void); > +int EXPORT_FUNC (grub_linux_get_loaded) (void); > +void EXPORT_FUNC (grub_linux_set_loaded) (int loaded_flag); > + EXPORT_* are necessary only for core. Not for modules. > #endif /* ! GRUB_LINUX_CPU_HEADER */ >