This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 60796a7063c81ecbca4933c033e75832c2f471a8 Author: anjiahao <[email protected]> AuthorDate: Thu Jul 4 18:30:11 2024 +0800 coredump:add const to memory region struct ptr Signed-off-by: anjiahao <[email protected]> --- binfmt/binfmt_coredump.c | 2 +- binfmt/elf.c | 4 ++-- include/nuttx/binfmt/binfmt.h | 4 ++-- include/nuttx/binfmt/elf.h | 2 +- include/nuttx/coredump.h | 2 +- include/nuttx/memoryregion.h | 3 +-- libs/libc/misc/lib_memoryregion.c | 4 ++-- sched/misc/coredump.c | 4 ++-- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/binfmt/binfmt_coredump.c b/binfmt/binfmt_coredump.c index 243a135b6f..a4fd7eea59 100644 --- a/binfmt/binfmt_coredump.c +++ b/binfmt/binfmt_coredump.c @@ -45,7 +45,7 @@ * ****************************************************************************/ -int core_dump(FAR struct memory_region_s *regions, +int core_dump(FAR const struct memory_region_s *regions, FAR struct lib_outstream_s *stream, pid_t pid) { diff --git a/binfmt/elf.c b/binfmt/elf.c index 1ea77cea3f..42fbaca0c4 100644 --- a/binfmt/elf.c +++ b/binfmt/elf.c @@ -70,7 +70,7 @@ static int elf_loadbinary(FAR struct binary_s *binp, FAR const struct symtab_s *exports, int nexports); #ifdef CONFIG_ELF_COREDUMP -static int elf_dumpbinary(FAR struct memory_region_s *regions, +static int elf_dumpbinary(FAR const struct memory_region_s *regions, FAR struct lib_outstream_s *stream, pid_t pid); #endif @@ -382,7 +382,7 @@ errout_with_init: ****************************************************************************/ #ifdef CONFIG_ELF_COREDUMP -static int elf_dumpbinary(FAR struct memory_region_s *regions, +static int elf_dumpbinary(FAR const struct memory_region_s *regions, FAR struct lib_outstream_s *stream, pid_t pid) { diff --git a/include/nuttx/binfmt/binfmt.h b/include/nuttx/binfmt/binfmt.h index 118c483627..934bc8bafc 100644 --- a/include/nuttx/binfmt/binfmt.h +++ b/include/nuttx/binfmt/binfmt.h @@ -139,7 +139,7 @@ struct binfmt_s /* Coredump callback */ - CODE int (*coredump)(FAR struct memory_region_s *regions, + CODE int (*coredump)(FAR const struct memory_region_s *regions, FAR struct lib_outstream_s *stream, pid_t pid); }; @@ -220,7 +220,7 @@ int unregister_binfmt(FAR struct binfmt_s *binfmt); * ****************************************************************************/ -int core_dump(FAR struct memory_region_s *regions, +int core_dump(FAR const struct memory_region_s *regions, FAR struct lib_outstream_s *stream, pid_t pid); diff --git a/include/nuttx/binfmt/elf.h b/include/nuttx/binfmt/elf.h index 0dea9ae448..52e3941790 100644 --- a/include/nuttx/binfmt/elf.h +++ b/include/nuttx/binfmt/elf.h @@ -134,7 +134,7 @@ struct elf_loadinfo_s #ifdef CONFIG_ELF_COREDUMP struct elf_dumpinfo_s { - FAR struct memory_region_s *regions; + FAR const struct memory_region_s *regions; FAR struct lib_outstream_s *stream; pid_t pid; }; diff --git a/include/nuttx/coredump.h b/include/nuttx/coredump.h index 8d2cf207a3..b664074544 100644 --- a/include/nuttx/coredump.h +++ b/include/nuttx/coredump.h @@ -40,7 +40,7 @@ * ****************************************************************************/ -int coredump_set_memory_region(FAR struct memory_region_s *region); +int coredump_set_memory_region(FAR const struct memory_region_s *region); /**************************************************************************** * Name: coredump_initialize diff --git a/include/nuttx/memoryregion.h b/include/nuttx/memoryregion.h index 6499e10bcd..71bb999838 100644 --- a/include/nuttx/memoryregion.h +++ b/include/nuttx/memoryregion.h @@ -39,7 +39,6 @@ struct memory_region_s uintptr_t end; /* End address of this region */ uint32_t flags; /* Figure 5-3: Segment Flag Bits: PF_[X|W|R] */ }; - /**************************************************************************** * Public Function ****************************************************************************/ @@ -91,6 +90,6 @@ alloc_memory_region(FAR const char *format); * ****************************************************************************/ -void free_memory_region(FAR struct memory_region_s *region); +void free_memory_region(FAR const struct memory_region_s *region); #endif /* __INCLUDE_MEMORYREGION_H */ diff --git a/libs/libc/misc/lib_memoryregion.c b/libs/libc/misc/lib_memoryregion.c index 4fe18b2523..1c55e42419 100644 --- a/libs/libc/misc/lib_memoryregion.c +++ b/libs/libc/misc/lib_memoryregion.c @@ -145,10 +145,10 @@ alloc_memory_region(FAR const char *format) * ****************************************************************************/ -void free_memory_region(FAR struct memory_region_s *region) +void free_memory_region(FAR const struct memory_region_s *region) { if (region != NULL) { - lib_free(region); + lib_free((FAR void *)region); } } diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c index 8498998478..3602cada7d 100644 --- a/sched/misc/coredump.c +++ b/sched/misc/coredump.c @@ -47,7 +47,7 @@ static struct lib_blkoutstream_s g_blockstream; static unsigned char *g_blockinfo; #endif -static struct memory_region_s *g_regions; +static const struct memory_region_s *g_regions; /**************************************************************************** * Private Functions @@ -173,7 +173,7 @@ static void coredump_dump_blkdev(pid_t pid) * ****************************************************************************/ -int coredump_set_memory_region(FAR struct memory_region_s *region) +int coredump_set_memory_region(FAR const struct memory_region_s *region) { /* Not free g_regions, because allow call this fun when crash */
