You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/01 01:05:06 UTC

[GitHub] [incubator-nuttx] masayuki2009 opened a new pull request, #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

masayuki2009 opened a new pull request, #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979

   ## Summary
   
   - In the case of CONFIG_BUILD_KERNEL=y, showing Kmem and Page
     info is enough for free command
   
   ## Impact
   
   - CONFIG_BUILD_KERNEL=y only
   
   ## Testing
   
   - Tested with sabre-6quad:netknsh
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960245543


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   OK, I'll try to modify them later.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960436630


##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   ```suggestion
   #ifdef CONFIG_BUILD_FLAT
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960142446


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   @xiaoxiang781216 
   Hmm, the change does not show Kmem.
   
   the original PR
   
   ```
   nsh> free
                      total       used       free    largest  nused  nfree
           Kmem:  125677760      20864  125656896  125651936     60      3
           Page:  134217728    2256896  131960832  131960832
   ```
   
   after the changed applied
   
   ```
   nsh> free
                      total       used       free    largest  nused  nfree
           Page:  134217728    2256896  131960832  131960832
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960450614


##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   @xiaoxiang781216 
   It does not work as expected if I applied the suggested change.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960478907


##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   After more thought, procfs should still work for Umm in protected build since the user space address isn't overlapped with each other. Your change is right. Let's address the first issue.



##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   After more thought, procfs should still work for Umm in protected build since the user space address isn't overlapped with each other. Your change is right. Let's address the first comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#issuecomment-1233822212

   @xiaoxiang781216 
   Please review this PR again.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960508701


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   @xiaoxiang781216 
   OK, so we can remove `#ifdef CONFIG_KERNEL` which added to  `procfs_register_meminfo()`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960183166


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   @xiaoxiang781216 
   Hmm, it still does not work as expected.
   The following is the call stack when Umem is registered.
   As you can see `procfs_regster_meminfo` is linked to the kernel.
   
   ```
   (gdb) where
   #0  procfs_register_meminfo (entry=entry@entry=0x80200144) at procfs/fs_procfsmeminfo.c:582
   #1  0x10805748 in mm_initialize (name=name@entry=0x1081beef "Umem", heapstart=0x80200150, heapstart@entry=0x80200000, heapsize=1048240) at mm_heap/mm_initialize.c:235
   #2  0x10805da4 in umm_initialize (heap_start=heap_start@entry=0x80200000, heap_size=<optimized out>) at umm_heap/umm_initialize.c:84
   #3  0x10814f30 in exec_module (binp=binp@entry=0x10827310, filename=filename@entry=0x1081b569 "/system/bin/init", argv=argv@entry=0x0, envp=0x10827420, envp@entry=0x0) at binfmt_execmodule.c:186
   #4  0x10814420 in exec_spawn (filename=filename@entry=0x1081b569 "/system/bin/init", argv=argv@entry=0x0, envp=envp@entry=0x0, exports=exports@entry=0x0, nexports=nexports@entry=0, attr=attr@entry=0x10824dc8) \
   at binfmt_exec.c:126
   #5  0x108014e4 in nx_start_application () at init/nx_bringup.c:295
   #6  nx_create_initthread () at init/nx_bringup.c:363
   #7  nx_bringup () at init/nx_bringup.c:446
   #8  0x1080143c in nx_start () at init/nx_start.c:691
   #9  0x00000000 in ?? ()
   (gdb) p entry->name
   $3 = 0x1081beef "Umem"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960237986


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   @xiaoxiang781216 
   I think I should modify `mm_initialize()` not to call `procfs_register_meminfo()` for the Umm instead of modifying `procfs_register_meminfo()`. What do you think?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960511132


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960287712


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   people may use mm_heap manage the private buffer in userspace. In this case, the linker will report symbol not found.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960478907


##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   After more thought, procfs should still work for Umm in protected build since the user space address isn't overlapped with each other.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko merged pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960137165


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   ```suggestion
   #if define(CONFIG_BUILD_KERNEL) && define(__KERNEL__)
   ```
   and remove strcmp.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960283612


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   Not necessary but we can add it to reduce code size.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960436630


##########
mm/umm_heap/umm_initialize.c:
##########
@@ -81,7 +81,11 @@
 
 void umm_initialize(FAR void *heap_start, size_t heap_size)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   ```suggestion
   #ifndef CONFIG_BUILD_FLAT
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960281884


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   should we add '__KERNEL__' too?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960436028


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   look like mm_initialize already check it:):
   https://github.com/apache/incubator-nuttx/blob/master/mm/mm_heap/mm_initialize.c#L234-L236
   we don't need check it inside procfs_register_meminfo again.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960233109


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   Umm is a special case, should we add both? mm_heap can be used by apps custom heap.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960288984


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   Done
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960193961


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   Got, the initialization is still happened in kernel space, not user space for umm.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960242944


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   yes, it also possible to add bool argument to skip the register, or we can use name == NULL .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960200461


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   Yes.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6979: fs: procfs: Ignore to register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r960158575


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,13 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+#ifdef CONFIG_BUILD_KERNEL

Review Comment:
   sorry the condition should be
   if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6979: mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6979:
URL: https://github.com/apache/incubator-nuttx/pull/6979#discussion_r961115879


##########
fs/procfs/fs_procfsmeminfo.c:
##########
@@ -578,6 +578,11 @@ static int meminfo_stat(FAR const char *relpath, FAR struct stat *buf)
 
 void procfs_register_meminfo(FAR struct procfs_meminfo_entry_s *entry)
 {
+  if (NULL == entry->name)

Review Comment:
   personally I prefer a
   ```
   if (entry->name != NULL)
     {
       entry->next = g_procfs_meminfo;
       g_procfs_meminfo = entry;
     }
   ```
   but that is only a personal preference



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org