binfmt: Move [elf|nxflat]_[un]initialize to private header file

like what builtin binary format do

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-07-09 04:39:31 +08:00 committed by Petro Karashchenko
parent 899471c6bd
commit 229293f9f8
7 changed files with 76 additions and 73 deletions

View File

@ -41,6 +41,18 @@ ifeq ($(CONFIG_BUILTIN),y)
CSRCS += builtin.c
endif
# ELF application interfaces
ifeq ($(CONFIG_ELF),y)
CSRCS += elf.c
endif
# NXFLAT application interfaces
ifeq ($(CONFIG_NXFLAT),y)
CSRCS += nxflat.c
endif
# Add configured binary modules
include libnxflat/Make.defs

View File

@ -165,6 +165,7 @@ void binfmt_freeargv(FAR char * const *argv);
# define binfmt_freeenv(envp)
#endif
#ifdef CONFIG_BUILTIN
/****************************************************************************
* Name: builtin_initialize
*
@ -179,9 +180,7 @@ void binfmt_freeargv(FAR char * const *argv);
*
****************************************************************************/
#ifdef CONFIG_BUILTIN
int builtin_initialize(void);
#endif
/****************************************************************************
* Name: builtin_uninitialize
@ -194,10 +193,72 @@ int builtin_initialize(void);
*
****************************************************************************/
#ifdef CONFIG_BUILTIN
void builtin_uninitialize(void);
#endif
#ifdef CONFIG_ELF
/****************************************************************************
* Name: elf_initialize
*
* Description:
* In order to use the ELF binary format, this function must be called
* during system initialization to register the ELF binary format.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int elf_initialize(void);
/****************************************************************************
* Name: elf_uninitialize
*
* Description:
* Unregister the ELF binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void elf_uninitialize(void);
#endif
#ifdef CONFIG_NXFLAT
/****************************************************************************
* Name: nxflat_initialize
*
* Description:
* In order to use the NxFLAT binary format, this function must be called
* during system initialization to register the NXFLAT binary
* format.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int nxflat_initialize(void);
/****************************************************************************
* Name: nxflat_uninitialize
*
* Description:
* Unregister the NXFLAT binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void nxflat_uninitialize(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}

View File

@ -25,9 +25,6 @@
#include <nuttx/config.h>
#include <nuttx/binfmt/binfmt.h>
#include <nuttx/binfmt/elf.h>
#include <nuttx/binfmt/nxflat.h>
#include <nuttx/lib/builtin.h>
#include <debug.h>

View File

@ -20,10 +20,6 @@
ifeq ($(CONFIG_ELF),y)
# ELF application interfaces
CSRCS += elf.c
# ELF library
CSRCS += libelf_bind.c libelf_init.c libelf_addrenv.c libelf_iobuffer.c

View File

@ -20,10 +20,6 @@
ifeq ($(CONFIG_NXFLAT),y)
# NXFLAT application interfaces
CSRCS += nxflat.c
# NXFLAT library
CSRCS += libnxflat_init.c libnxflat_uninit.c libnxflat_addrenv.c

View File

@ -158,35 +158,6 @@ extern "C"
#define EXTERN extern
#endif
/****************************************************************************
* Name: elf_initialize
*
* Description:
* In order to use the ELF binary format, this function must be called
* during system initialization to register the ELF binary format.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int elf_initialize(void);
/****************************************************************************
* Name: elf_uninitialize
*
* Description:
* Unregister the ELF binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void elf_uninitialize(void);
/****************************************************************************
* Name: elf_init
*

View File

@ -112,36 +112,6 @@ extern "C"
#define EXTERN extern
#endif
/****************************************************************************
* Name: nxflat_initialize
*
* Description:
* In order to use the NxFLAT binary format, this function must be called
* during system initialization to register the NXFLAT binary
* format.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int nxflat_initialize(void);
/****************************************************************************
* Name: nxflat_uninitialize
*
* Description:
* Unregister the NXFLAT binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void nxflat_uninitialize(void);
/****************************************************************************
* Name: nxflat_verifyheader
*