From 9241725312d208b7452a83fa25120f93037b153f Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Thu, 17 Sep 2020 15:26:35 +0800 Subject: [PATCH] fs/munmap: export the symbols to avoid build break on C++ syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit base/metrics/persistent_memory_allocator.cc:1009:18: error: expected id-expression before ‘-’ token 1009 | int result = ::munmap(memory, size); | ^~~~~~ Change-Id: I24e55c18d09553d3acc341a27063d01489d905ec Signed-off-by: chao.an --- fs/mmap/Make.defs | 4 ++-- fs/mmap/fs_munmap.c | 14 ++++++++------ include/sys/mman.h | 7 ++----- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/mmap/Make.defs b/fs/mmap/Make.defs index 09428e5567..f7d0a3c90c 100644 --- a/fs/mmap/Make.defs +++ b/fs/mmap/Make.defs @@ -33,10 +33,10 @@ # ############################################################################ -CSRCS += fs_mmap.c +CSRCS += fs_mmap.c fs_munmap.c ifeq ($(CONFIG_FS_RAMMAP),y) -CSRCS += fs_munmap.c fs_rammap.c +CSRCS += fs_rammap.c endif # Include MMAP build support diff --git a/fs/mmap/fs_munmap.c b/fs/mmap/fs_munmap.c index bd3d18e019..722e961953 100644 --- a/fs/mmap/fs_munmap.c +++ b/fs/mmap/fs_munmap.c @@ -52,8 +52,6 @@ #include "inode/inode.h" #include "fs_rammap.h" -#ifdef CONFIG_FS_RAMMAP - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -110,6 +108,7 @@ int munmap(FAR void *start, size_t length) { +#ifdef CONFIG_FS_RAMMAP FAR struct fs_rammap_s *prev; FAR struct fs_rammap_s *curr; FAR void *newaddr; @@ -129,7 +128,8 @@ int munmap(FAR void *start, size_t length) /* Search the list of regions */ - for (prev = NULL, curr = g_rammaps.head; curr; prev = curr, curr = curr->flink) + for (prev = NULL, curr = g_rammaps.head; curr; + prev = curr, curr = curr->flink) { /* Does this region include any part of the specified range? */ @@ -196,7 +196,8 @@ int munmap(FAR void *start, size_t length) else { - newaddr = kumm_realloc(curr->addr, sizeof(struct fs_rammap_s) + length); + newaddr = kumm_realloc(curr->addr, + sizeof(struct fs_rammap_s) + length); DEBUGASSERT(newaddr == (FAR void *)(curr->addr)); UNUSED(newaddr); /* May not be used */ curr->length = length; @@ -211,6 +212,7 @@ errout_with_semaphore: errout: set_errno(errcode); return ERROR; -} - +#else + return OK; #endif /* CONFIG_FS_RAMMAP */ +} diff --git a/include/sys/mman.h b/include/sys/mman.h index 9c748f5498..4d8b0e053e 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -174,16 +174,13 @@ int msync(FAR void *addr, size_t len, int flags); int munlock(FAR const void *addr, size_t len); int munlockall(void); -#ifdef CONFIG_FS_RAMMAP int munmap(FAR void *start, size_t length); -#else -# define munmap(start, length) -#endif int posix_madvise(FAR void *addr, size_t len, int advice); int posix_mem_offset(FAR const void *addr, size_t len, FAR off_t *off, FAR size_t *contig_len, FAR int *fildes); -int posix_typed_mem_get_info(int fildes, FAR struct posix_typed_mem_info *info); +int posix_typed_mem_get_info(int fildes, + FAR struct posix_typed_mem_info *info); int posix_typed_mem_open(FAR const char *name, int oflag, int tflag); int shm_open(FAR const char *name, int oflag, mode_t mode); int shm_unlink(FAR const char *name);