You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/06/30 23:07:05 UTC

[incubator-nuttx] branch master updated (4ba1baf -> 06215be)

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 4ba1baf  libc/debug: Rename CONFIG_EABI_UNWINDER to CONFIG_UNWINDER
     new ec30d6e  fs: Initialize fs_allmaps_s::exclsem in declaration directly
     new 06215be  mmap: Implement the minial but reasonable mlock/munlock/mprotect

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 fs/mmap/Make.defs                                  |  2 +-
 fs/mmap/fs_mmap.c                                  |  3 +-
 .../libc/unistd/lib_getuid.c => fs/mmap/fs_mmisc.c | 53 +++++++++++++---------
 fs/mmap/fs_munmap.c                                |  1 -
 fs/mmap/fs_rammap.c                                | 29 ++----------
 fs/mmap/fs_rammap.h                                |  1 -
 6 files changed, 38 insertions(+), 51 deletions(-)
 copy libs/libc/unistd/lib_getuid.c => fs/mmap/fs_mmisc.c (69%)

[incubator-nuttx] 01/02: fs: Initialize fs_allmaps_s::exclsem in declaration directly

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit ec30d6ef6b6e246dc32407675c4b54140df33673
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jun 24 01:42:11 2021 +0800

    fs: Initialize fs_allmaps_s::exclsem in declaration directly
    
    and then remove rammap_initialize and caller
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Ife9f04d409b3a14a3be4bbb61c23da6e7a9f8a3d
---
 fs/mmap/fs_munmap.c |  1 -
 fs/mmap/fs_rammap.c | 29 ++++-------------------------
 fs/mmap/fs_rammap.h |  1 -
 3 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/fs/mmap/fs_munmap.c b/fs/mmap/fs_munmap.c
index c0404a2..bb4f127 100644
--- a/fs/mmap/fs_munmap.c
+++ b/fs/mmap/fs_munmap.c
@@ -103,7 +103,6 @@ int munmap(FAR void *start, size_t length)
 
   /* Find a region containing this start and length in the list of regions */
 
-  rammap_initialize();
   ret = nxsem_wait(&g_rammaps.exclsem);
   if (ret < 0)
     {
diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c
index 55a9830..2145a7a 100644
--- a/fs/mmap/fs_rammap.c
+++ b/fs/mmap/fs_rammap.c
@@ -46,36 +46,16 @@
 
 /* This is the list of all mapped files */
 
-struct fs_allmaps_s g_rammaps;
+struct fs_allmaps_s g_rammaps =
+{
+  SEM_INITIALIZER(1)
+};
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: rammap_initialize
- *
- * Description:
- *   Verified that this capability has been initialized.
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- ****************************************************************************/
-
-void rammap_initialize(void)
-{
-  if (!g_rammaps.initialized)
-    {
-      nxsem_init(&g_rammaps.exclsem, 0, 1);
-      g_rammaps.initialized = true;
-    }
-}
-
-/****************************************************************************
  * Name: rammmap
  *
  * Description:
@@ -197,7 +177,6 @@ FAR void *rammap(int fd, size_t length, off_t offset)
 
   /* Add the buffer to the list of regions */
 
-  rammap_initialize();
   ret = nxsem_wait(&g_rammaps.exclsem);
   if (ret < 0)
     {
diff --git a/fs/mmap/fs_rammap.h b/fs/mmap/fs_rammap.h
index 8e107c0..fc8a6c9 100644
--- a/fs/mmap/fs_rammap.h
+++ b/fs/mmap/fs_rammap.h
@@ -65,7 +65,6 @@ struct fs_rammap_s
 
 struct fs_allmaps_s
 {
-  bool                initialized; /* True: This structure has been initialized */
   sem_t               exclsem;     /* Provides exclusive access the list */
   struct fs_rammap_s *head;        /* List of mapped files */
 };

[incubator-nuttx] 02/02: mmap: Implement the minial but reasonable mlock/munlock/mprotect

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 06215be327b28d9f798e5d0a61a90762d01f283b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jun 24 02:29:19 2021 +0800

    mmap: Implement the minial but reasonable mlock/munlock/mprotect
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I538e0d78ecd0680374a2e0f56adbc61d7a4e6d1f
---
 fs/mmap/Make.defs  |  2 +-
 fs/mmap/fs_mmap.c  |  3 +--
 fs/mmap/fs_mmisc.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/fs/mmap/Make.defs b/fs/mmap/Make.defs
index d7cfa57..ab8cbd0 100644
--- a/fs/mmap/Make.defs
+++ b/fs/mmap/Make.defs
@@ -18,7 +18,7 @@
 #
 ############################################################################
 
-CSRCS += fs_mmap.c fs_munmap.c
+CSRCS += fs_mmap.c fs_munmap.c fs_mmisc.c
 
 ifeq ($(CONFIG_FS_RAMMAP),y)
 CSRCS += fs_rammap.c
diff --git a/fs/mmap/fs_mmap.c b/fs/mmap/fs_mmap.c
index 6b210b5..baab91f 100644
--- a/fs/mmap/fs_mmap.c
+++ b/fs/mmap/fs_mmap.c
@@ -132,8 +132,7 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
    * logic is not in place.
    */
 
-  if (prot == PROT_NONE ||
-      (flags & (MAP_FIXED | MAP_DENYWRITE)) != 0)
+  if ((flags & (MAP_FIXED | MAP_DENYWRITE)) != 0)
     {
       ferr("ERROR: Unsupported options, prot=%x flags=%04x\n", prot, flags);
       ret = -ENOSYS;
diff --git a/fs/mmap/fs_mmisc.c b/fs/mmap/fs_mmisc.c
new file mode 100644
index 0000000..a7ede82
--- /dev/null
+++ b/fs/mmap/fs_mmisc.c
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * fs/mmap/fs_mmisc.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/mman.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/* The empty implementation is enough since the paging isn't supported yet. */
+
+int mlock(FAR const void *addr, size_t len)
+{
+  return 0;
+}
+
+int mlockall(int flags)
+{
+  return 0;
+}
+
+int munlock(FAR const void *addr, size_t len)
+{
+  return 0;
+}
+
+int munlockall(void)
+{
+  return 0;
+}
+
+/* The empty implementation is enough since MMU/MPU mayn't exist. */
+
+int mprotect(FAR void *addr, size_t len, int prot)
+{
+  return 0;
+}
+
+/* Ignore the advice since there is no alternative strategy to select. */
+
+int posix_madvise(FAR void *addr, size_t len, int advice)
+{
+  return 0;
+}