casaroli commented on code in PR #3952:
URL: https://github.com/apache/nuttx-apps/pull/3952#discussion_r4436805551


##########
system/nxinit/builtin.c:
##########
@@ -359,69 +399,101 @@ static int cmd_unlink(FAR struct action_manager_s *am,
   return ret;
 }
 
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: init_builtin_run
+#ifndef CONFIG_DISABLE_MOUNTPOINT
+/* mount <type> <device> <dir> [<flag>]* [<options>]
  *
- * Description:
- *   Execute the builtin command of NxInit, builtin App, or NSH builtin.
- *
- * Input Parameters:
- *   am   - Instance of Action Manager.
- *   argc - Argument count.
- *   argv - A pointer to an array of string arguments. The end of the array
- *          is indicated with a NULL entry.
- *
- * Returned Value:
- *   Returns 0 (for NxInit builtin) or a PID (for builtin App or NSH builtin)
- *   on success; Returns the negative value of errno on failure.
- ****************************************************************************/
+ * <flag> is one of g_mount_flags.  A last argument that is not a flag is
+ * the option string of the file system (the data of mount()).  A line in
+ * another form, as the NSH command "mount -t <type> ..." that some board
+ * init.rc files use, runs as a program as before.
+ */
 
-int init_builtin_run(FAR struct action_manager_s *am,
+static int cmd_mount(FAR struct action_manager_s *am,
                      int argc, FAR char **argv)
 {
-  char cmd[CONFIG_SYSTEM_NXINIT_RC_LINE_MAX];
-  posix_spawnattr_t attr;
-  FAR char *args[4];
-  sigset_t blocked;
-  sigset_t builtin;
-  sigset_t mask;
-  pid_t pid;
-  size_t i;
+  FAR const char *data = NULL;
+  unsigned long flags = 0;
+  size_t j;
   int ret;
+  int i;
 
-  for (i = 0; i < nitems(g_builtin); i++)
+  UNUSED(am);
+
+  if (argc < 4 || argv[1][0] == '-')
     {
-      if (!strcmp(g_builtin[i].cmd, argv[0]))
+      return builtin_spawn(argc, argv);

Review Comment:
   The sim `init.rc` (boards/sim/sim/sim/src/etc/init.d/init.rc:34-41) has 
three lines in the NSH form, for example `mount -t tmpfs /tmp`. Without this 
check they call `mount()` with the type `-t` and fail.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to