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

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

commit 4be499a243d99ff124c25d003545ce6f31508d1d
Author: Xiang Xiao <[email protected]>
AuthorDate: Tue Apr 18 02:33:48 2023 +0800

    procfs: Make g_procfs_entries in the alphabetic order
    
    and option in procfs/Kconfig
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 fs/procfs/Kconfig     | 109 +++++++++++++++++++++++++-------------------------
 fs/procfs/Make.defs   |  11 ++---
 fs/procfs/fs_procfs.c |  62 ++++++++++++++--------------
 3 files changed, 90 insertions(+), 92 deletions(-)

diff --git a/fs/procfs/Kconfig b/fs/procfs/Kconfig
index e371265c01..a99acbf9e1 100644
--- a/fs/procfs/Kconfig
+++ b/fs/procfs/Kconfig
@@ -29,29 +29,6 @@ config FS_PROCFS_MAX_TASKS
 
 menu "Exclude individual procfs entries"
 
-config FS_PROCFS_EXCLUDE_PROCESS
-       bool "Exclude process information"
-       default DEFAULT_SMALL
-       ---help---
-               Causes the process information to be excluded from the procfs 
system.
-               This will reduce code space, but then giving access to process 
info
-               was kinda the whole point of procfs, but hey, whatever.
-
-config FS_PROCFS_EXCLUDE_ENVIRON
-       bool "Exclude environment information"
-       default DEFAULT_SMALL
-       depends on !FS_PROCFS_EXCLUDE_PROCESS
-       ---help---
-               Causes the environment variable information to be excluded from 
the
-               procfs system.  This will reduce code space slightly.
-
-config FS_PROCFS_EXCLUDE_MODULE
-       bool "Exclude module information"
-       depends on MODULE
-       default DEFAULT_SMALL
-       ---help---
-               Causes the module information to be excluded from the procfs 
system.
-
 config FS_PROCFS_EXCLUDE_BLOCKS
        bool "Exclude fs/blocks information"
        depends on !DISABLE_MOUNTPOINT
@@ -61,59 +38,66 @@ config FS_PROCFS_EXCLUDE_BLOCKS
                system.  This procfs file provides the text output for the NSH 
'df'
                command.
 
-config FS_PROCFS_EXCLUDE_MOUNT
-       bool "Exclude fs/mount information"
-       depends on !DISABLE_MOUNTPOINT
+config FS_PROCFS_EXCLUDE_CPULOAD
+       bool "Exclude CPU load"
+       depends on SCHED_CPULOAD
        default DEFAULT_SMALL
-       ---help---
-               Causes the mount point information to be excluded from the 
procfs
-               system.  This procfs file provides the text output for the NSH 
'mount'
-               command.
 
-config FS_PROCFS_EXCLUDE_USAGE
-       bool "Exclude fs/usage information"
-       depends on !DISABLE_MOUNTPOINT
+config FS_PROCFS_EXCLUDE_ENVIRON
+       bool "Exclude environment information"
+       depends on !FS_PROCFS_EXCLUDE_PROCESS
        default DEFAULT_SMALL
        ---help---
-               Causes the fs usage information to be excluded from the procfs
-               system.  This procfs file provides the text output for the NSH 
'df -h'
-               command.
-
-config FS_PROCFS_EXCLUDE_UPTIME
-       bool "Exclude uptime"
-       default DEFAULT_SMALL
+               Causes the environment variable information to be excluded from 
the
+               procfs system.  This will reduce code space slightly.
 
-config FS_PROCFS_EXCLUDE_VERSION
-       bool "Exclude version"
+config FS_PROCFS_EXCLUDE_IOBINFO
+       bool "Exclude iobinfo"
+       depends on MM_IOB
        default DEFAULT_SMALL
 
-config FS_PROCFS_EXCLUDE_CPULOAD
-       bool "Exclude CPU load"
+config FS_PROCFS_EXCLUDE_PROCESS
+       bool "Exclude process information"
        default DEFAULT_SMALL
-       depends on SCHED_CPULOAD
+       ---help---
+               Causes the process information to be excluded from the procfs 
system.
+               This will reduce code space, but then giving access to process 
info
+               was kinda the whole point of procfs, but hey, whatever.
 
-config FS_PROCFS_EXCLUDE_MEMINFO
-       bool "Exclude meminfo"
+config FS_PROCFS_INCLUDE_PROGMEM
+       bool "Include prog mem"
+       depends on ARCH_HAVE_PROGMEM && !FS_PROCFS_EXCLUDE_MEMINFO
        default DEFAULT_SMALL
 
 config FS_PROCFS_EXCLUDE_MEMDUMP
        bool "Exclude memdump"
+       depends on !FS_PROCFS_EXCLUDE_MEMINFO
        default DEFAULT_SMALL
 
-config FS_PROCFS_INCLUDE_PROGMEM
-       bool "Include prog mem"
+config FS_PROCFS_EXCLUDE_MEMINFO
+       bool "Exclude meminfo"
        default DEFAULT_SMALL
-       depends on ARCH_HAVE_PROGMEM && !FS_PROCFS_EXCLUDE_MEMINFO
 
-config FS_PROCFS_EXCLUDE_IOBINFO
-       bool "Exclude iobinfo"
-       depends on MM_IOB
+config FS_PROCFS_EXCLUDE_MODULE
+       bool "Exclude module information"
+       depends on MODULE
+       default DEFAULT_SMALL
+       ---help---
+               Causes the module information to be excluded from the procfs 
system.
+
+config FS_PROCFS_EXCLUDE_MOUNT
+       bool "Exclude fs/mount information"
+       depends on !DISABLE_MOUNTPOINT
        default DEFAULT_SMALL
+       ---help---
+               Causes the mount point information to be excluded from the 
procfs
+               system.  This procfs file provides the text output for the NSH 
'mount'
+               command.
 
 config FS_PROCFS_EXCLUDE_MOUNTS
        bool "Exclude mounts"
-       default DEFAULT_SMALL
        depends on !DISABLE_MOUNTPOINT
+       default DEFAULT_SMALL
 
 config FS_PROCFS_EXCLUDE_NET
        bool "Exclude network"
@@ -140,5 +124,22 @@ config FS_PROCFS_EXCLUDE_TCBINFO
        depends on DEBUG_TCBINFO
        default DEFAULT_SMALL
 
+config FS_PROCFS_EXCLUDE_UPTIME
+       bool "Exclude uptime"
+       default DEFAULT_SMALL
+
+config FS_PROCFS_EXCLUDE_USAGE
+       bool "Exclude fs/usage information"
+       depends on !DISABLE_MOUNTPOINT
+       default DEFAULT_SMALL
+       ---help---
+               Causes the fs usage information to be excluded from the procfs
+               system.  This procfs file provides the text output for the NSH 
'df -h'
+               command.
+
+config FS_PROCFS_EXCLUDE_VERSION
+       bool "Exclude version"
+       default DEFAULT_SMALL
+
 endmenu # Exclude individual procfs entries
 endif # FS_PROCFS
diff --git a/fs/procfs/Make.defs b/fs/procfs/Make.defs
index c7104eb12b..eb30d4ed94 100644
--- a/fs/procfs/Make.defs
+++ b/fs/procfs/Make.defs
@@ -21,13 +21,10 @@
 ifeq ($(CONFIG_FS_PROCFS),y)
 # Files required for procfs file system support
 
-CSRCS += fs_procfs.c fs_procfsutil.c fs_procfsproc.c fs_procfsuptime.c
-CSRCS += fs_procfscpuload.c fs_procfsmeminfo.c fs_procfsiobinfo.c
-CSRCS += fs_procfsversion.c fs_procfstcbinfo.c
-
-ifeq ($(CONFIG_SCHED_CRITMONITOR),y)
-CSRCS += fs_procfscritmon.c
-endif
+CSRCS += fs_procfs.c fs_procfscpuload.c fs_procfscritmon.c
+CSRCS += fs_procfsiobinfo.c fs_procfsmeminfo.c fs_procfsproc.c
+CSRCS += fs_procfstcbinfo.c fs_procfsuptime.c fs_procfsutil.c
+CSRCS += fs_procfsversion.c
 
 # Include procfs build support
 
diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c
index e0f0d849ee..8dc3305d76 100644
--- a/fs/procfs/fs_procfs.c
+++ b/fs/procfs/fs_procfs.c
@@ -52,19 +52,19 @@
  * External Definitions
  ****************************************************************************/
 
-extern const struct procfs_operations g_proc_operations;
-extern const struct procfs_operations g_pm_operations;
-extern const struct procfs_operations g_irq_operations;
 extern const struct procfs_operations g_cpuload_operations;
 extern const struct procfs_operations g_critmon_operations;
+extern const struct procfs_operations g_iobinfo_operations;
+extern const struct procfs_operations g_irq_operations;
 extern const struct procfs_operations g_meminfo_operations;
 extern const struct procfs_operations g_memdump_operations;
 extern const struct procfs_operations g_mempool_operations;
-extern const struct procfs_operations g_iobinfo_operations;
 extern const struct procfs_operations g_module_operations;
+extern const struct procfs_operations g_pm_operations;
+extern const struct procfs_operations g_proc_operations;
+extern const struct procfs_operations g_tcbinfo_operations;
 extern const struct procfs_operations g_uptime_operations;
 extern const struct procfs_operations g_version_operations;
-extern const struct procfs_operations g_tcbinfo_operations;
 
 /* This is not good.  These are implemented in other sub-systems.  Having to
  * deal with them here is not a good coupling. What is really needed is a
@@ -72,10 +72,10 @@ extern const struct procfs_operations g_tcbinfo_operations;
  * configuration.
  */
 
+extern const struct procfs_operations g_mount_operations;
 extern const struct procfs_operations g_net_operations;
 extern const struct procfs_operations g_netroute_operations;
 extern const struct procfs_operations g_part_operations;
-extern const struct procfs_operations g_mount_operations;
 extern const struct procfs_operations g_smartfs_operations;
 
 /****************************************************************************
@@ -103,43 +103,43 @@ static const struct procfs_entry_s g_procfs_entries[] =
   { "critmon",      &g_critmon_operations,  PROCFS_FILE_TYPE   },
 #endif
 
-#ifdef CONFIG_SCHED_IRQMONITOR
-  { "irqs",         &g_irq_operations,      PROCFS_FILE_TYPE   },
+#ifndef CONFIG_FS_PROCFS_EXCLUDE_BLOCKS
+  { "fs/blocks",    &g_mount_operations,    PROCFS_FILE_TYPE   },
 #endif
 
-#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMINFO
-  { "meminfo",      &g_meminfo_operations,  PROCFS_FILE_TYPE   },
-#  ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMDUMP
-  { "memdump",      &g_memdump_operations,  PROCFS_FILE_TYPE   },
-#  endif
+#ifndef CONFIG_FS_PROCFS_EXCLUDE_MOUNT
+  { "fs/mount",     &g_mount_operations,    PROCFS_FILE_TYPE   },
 #endif
 
-#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
-  { "mempool",      &g_mempool_operations,  PROCFS_FILE_TYPE   },
+#if defined(CONFIG_FS_SMARTFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS)
+  { "fs/smartfs**", &g_smartfs_operations,  PROCFS_UNKOWN_TYPE },
 #endif
 
-#if defined(CONFIG_MM_IOB) && !defined(CONFIG_FS_PROCFS_EXCLUDE_IOBINFO)
-  { "iobinfo",      &g_iobinfo_operations,  PROCFS_FILE_TYPE   },
+#ifndef CONFIG_FS_PROCFS_EXCLUDE_USAGE
+  { "fs/usage",     &g_mount_operations,    PROCFS_FILE_TYPE   },
 #endif
 
-#if defined(CONFIG_MODULE) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
-  { "modules",      &g_module_operations,   PROCFS_FILE_TYPE   },
+#if defined(CONFIG_MM_IOB) && !defined(CONFIG_FS_PROCFS_EXCLUDE_IOBINFO)
+  { "iobinfo",      &g_iobinfo_operations,  PROCFS_FILE_TYPE   },
 #endif
 
-#ifndef CONFIG_FS_PROCFS_EXCLUDE_BLOCKS
-  { "fs/blocks",    &g_mount_operations,    PROCFS_FILE_TYPE   },
+#ifdef CONFIG_SCHED_IRQMONITOR
+  { "irqs",         &g_irq_operations,      PROCFS_FILE_TYPE   },
 #endif
 
-#ifndef CONFIG_FS_PROCFS_EXCLUDE_MOUNT
-  { "fs/mount",     &g_mount_operations,    PROCFS_FILE_TYPE   },
+#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMINFO
+#  ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMDUMP
+  { "memdump",      &g_memdump_operations,  PROCFS_FILE_TYPE   },
+#  endif
+  { "meminfo",      &g_meminfo_operations,  PROCFS_FILE_TYPE   },
 #endif
 
-#ifndef CONFIG_FS_PROCFS_EXCLUDE_USAGE
-  { "fs/usage",     &g_mount_operations,    PROCFS_FILE_TYPE   },
+#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
+  { "mempool",      &g_mempool_operations,  PROCFS_FILE_TYPE   },
 #endif
 
-#if defined(CONFIG_FS_SMARTFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS)
-  { "fs/smartfs**", &g_smartfs_operations,  PROCFS_UNKOWN_TYPE },
+#if defined(CONFIG_MODULE) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
+  { "modules",      &g_module_operations,   PROCFS_FILE_TYPE   },
 #endif
 
 #if defined(CONFIG_NET) && !defined(CONFIG_FS_PROCFS_EXCLUDE_NET)
@@ -165,6 +165,10 @@ static const struct procfs_entry_s g_procfs_entries[] =
   { "self/**",      &g_proc_operations,     PROCFS_UNKOWN_TYPE },
 #endif
 
+#if defined(CONFIG_DEBUG_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
+  { "tcbinfo",      &g_tcbinfo_operations,  PROCFS_FILE_TYPE   },
+#endif
+
 #if !defined(CONFIG_FS_PROCFS_EXCLUDE_UPTIME)
   { "uptime",       &g_uptime_operations,   PROCFS_FILE_TYPE   },
 #endif
@@ -172,10 +176,6 @@ static const struct procfs_entry_s g_procfs_entries[] =
 #if !defined(CONFIG_FS_PROCFS_EXCLUDE_VERSION)
   { "version",      &g_version_operations,  PROCFS_FILE_TYPE   },
 #endif
-
-#if defined(CONFIG_DEBUG_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
-  { "tcbinfo",      &g_tcbinfo_operations,  PROCFS_FILE_TYPE   },
-#endif
 };
 
 #ifdef CONFIG_FS_PROCFS_REGISTER

Reply via email to