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/01/26 11:38:43 UTC

[GitHub] [incubator-nuttx] pkarashchenko opened a new pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

pkarashchenko opened a new pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345


   ## Summary
   Add options for signaling when volume is mounted and unmounted by auto-mounter
   
   ## Impact
   None. Feature is disabled by default
   
   ## Testing
   Tested with SAME70-QMTECH board


-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r796466876



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,37 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  devpath = kmm_zalloc(sizeof(CONFIG_FS_AUTOMOUNTER_VFS_PATH) +

Review comment:
       Personally I do not like this way, but can't find a better solution without dynamic allocation.




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r796519360



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,28 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  /* Register driver */
+
+  sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "/automount%u",

Review comment:
       How about we change CONFIG_FS_AUTOMOUNTER_VFS_PATH to /var?




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798869321



##########
File path: include/nuttx/fs/ioctl.h
##########
@@ -177,6 +177,12 @@
                                            * OUT: None
                                            */
 
+#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s

Review comment:
       I am fine with either.




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r795934070



##########
File path: fs/mount/fs_automount.c
##########
@@ -75,24 +87,305 @@ struct automounter_state_s
   struct wdog_s wdog;                        /* Delay to retry un-mounts */
   bool mounted;                              /* True: Volume has been mounted */
   bool inserted;                             /* True: Media has been inserted */
+
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+  sem_t exclsem;                             /* Supports exclusive access to the device */
+  bool registered;                           /* True: if driver has been registered */
+
+  /* The following is a singly linked list of open references to the
+   * automounter device.
+   */
+
+  FAR struct automounter_open_s *ao_open;
+#endif /* CONFIG_FS_AUTOMOUNTER_DRIVER */
+};
+
+/* This structure describes the state of one open button driver instance */
+
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+struct automounter_open_s
+{
+  /* Supports a singly linked list */
+
+  FAR struct automounter_open_s *ao_flink;
+
+  /* Button event notification information */

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] pkarashchenko commented on a change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798533858



##########
File path: include/nuttx/fs/ioctl.h
##########
@@ -177,6 +177,12 @@
                                            * OUT: None
                                            */
 
+#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s

Review comment:
       Or maybe `FIOC_AM_NOTIFY`?




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r795048450



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,28 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  /* Register driver */
+
+  sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "/automount%u",

Review comment:
       Yes. This is a good suggestion. Thank you!




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r794742516



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,28 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  /* Register driver */
+
+  sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "/automount%u",

Review comment:
       why not register driver at:
   sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "%s", lower->mountpoint);

##########
File path: fs/mount/fs_automount.c
##########
@@ -75,24 +87,305 @@ struct automounter_state_s
   struct wdog_s wdog;                        /* Delay to retry un-mounts */
   bool mounted;                              /* True: Volume has been mounted */
   bool inserted;                             /* True: Media has been inserted */
+
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+  sem_t exclsem;                             /* Supports exclusive access to the device */
+  bool registered;                           /* True: if driver has been registered */
+
+  /* The following is a singly linked list of open references to the
+   * automounter device.
+   */
+
+  FAR struct automounter_open_s *ao_open;
+#endif /* CONFIG_FS_AUTOMOUNTER_DRIVER */
+};
+
+/* This structure describes the state of one open button driver instance */
+
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+struct automounter_open_s
+{
+  /* Supports a singly linked list */
+
+  FAR struct automounter_open_s *ao_flink;
+
+  /* Button event notification information */

Review comment:
       Remove Button




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798532301



##########
File path: include/nuttx/fs/ioctl.h
##########
@@ -177,6 +177,12 @@
                                            * OUT: None
                                            */
 
+#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s

Review comment:
       Can we keep a short name?
   I was just looking into
   ```
   #define FIONREAD        _FIOC(0x0007)     /* IN:  Location to return value (int *)
                                              * OUT: Bytes readable from this fd
                                              */
   #define FIONWRITE       _FIOC(0x0008)     /* IN:  Location to return value (int *)
                                              * OUT: Number bytes in send queue
                                              */
   #define FIONSPACE       _FIOC(0x0009)     /* IN:  Location to return value (int *)
                                              * OUT: Free space in send queue.
                                              */
   ```
   that are `FIONREAD` and not `FIOC_QUEUE_NREAD`, etc.

##########
File path: include/nuttx/fs/ioctl.h
##########
@@ -177,6 +177,12 @@
                                            * OUT: None
                                            */
 
+#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s

Review comment:
       Can we keep a short name?
   I was just looking into
   ```
   #define FIONREAD        _FIOC(0x0007)     /* IN:  Location to return value (int *)
                                              * OUT: Bytes readable from this fd
                                              */
   #define FIONWRITE       _FIOC(0x0008)     /* IN:  Location to return value (int *)
                                              * OUT: Number bytes in send queue
                                              */
   #define FIONSPACE       _FIOC(0x0009)     /* IN:  Location to return value (int *)
                                              * OUT: Free space in send queue.
                                              */
   ```
   that are `FIONREAD` and not `FIOC_QUEUE_NREAD`, etc.




-- 
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 merged pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345


   


-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r795935435



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,28 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  /* Register driver */
+
+  sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "/automount%u",

Review comment:
       Done. Please review. I'm just not sure should `CONFIG_FS_AUTOMOUNTER_VFS_PATH` be just `/var`, `/var/mnt` or `/var/mount`. Because now it leads to `/var/mount/mnt/sdcard0` and seems to be some king of duplication of `mount` and `mnt`.




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798532620



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,28 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  /* Register driver */
+
+  sprintf(devpath, CONFIG_FS_AUTOMOUNTER_VFS_PATH "/automount%u",

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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r796517528



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,37 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  devpath = kmm_zalloc(sizeof(CONFIG_FS_AUTOMOUNTER_VFS_PATH) +

Review comment:
       Another way is use PATH_MAX

##########
File path: include/nuttx/fs/ioctl.h
##########
@@ -177,6 +177,12 @@
                                            * OUT: None
                                            */
 
+#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s

Review comment:
       FIOC_AUTOMOUNT_NOTIFY?

##########
File path: fs/Kconfig
##########
@@ -42,6 +42,22 @@ config FS_AUTOMOUNTER_DEBUG
 		system debug is not enable.  This is useful primarily for in vivo
 		unit testing of the auto-mount feature.
 
+config FS_AUTOMOUNTER_DRIVER
+	bool "Auto-mounter driver"
+	default n
+	depends on FS_AUTOMOUNTER
+	---help---
+		Enabling this option will lead to registering of a character driver
+		on FS_AUTOMOUNTER_VFS_PATH + mount point path for auto-mounter.
+		Example: /var/mount/mnt/sdcard0
+		
+config FS_AUTOMOUNTER_VFS_PATH
+	string "Path to auto-mounter driver"
+	default "/var/mount"

Review comment:
       let's change the default to /var, so the final path is /var/mnt/sdcard0




-- 
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 change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798532801



##########
File path: fs/Kconfig
##########
@@ -42,6 +42,22 @@ config FS_AUTOMOUNTER_DEBUG
 		system debug is not enable.  This is useful primarily for in vivo
 		unit testing of the auto-mount feature.
 
+config FS_AUTOMOUNTER_DRIVER
+	bool "Auto-mounter driver"
+	default n
+	depends on FS_AUTOMOUNTER
+	---help---
+		Enabling this option will lead to registering of a character driver
+		on FS_AUTOMOUNTER_VFS_PATH + mount point path for auto-mounter.
+		Example: /var/mount/mnt/sdcard0
+		
+config FS_AUTOMOUNTER_VFS_PATH
+	string "Path to auto-mounter driver"
+	default "/var/mount"

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] pkarashchenko commented on a change in pull request #5345: fs_automount: add options for signaling when volume is mounted and unmounted

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5345:
URL: https://github.com/apache/incubator-nuttx/pull/5345#discussion_r798532900



##########
File path: fs/mount/fs_automount.c
##########
@@ -551,6 +862,37 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
       ferr("ERROR: Failed to schedule work: %d\n", ret);
     }
 
+#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER
+
+  /* Initialize the new automount driver instance */
+
+  nxsem_init(&priv->exclsem, 0, 1);
+
+  devpath = kmm_zalloc(sizeof(CONFIG_FS_AUTOMOUNTER_VFS_PATH) +

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