Filesystem: Wait for unmount() to finish

This commit is contained in:
Sebastian Huber
2012-05-23 11:39:50 +02:00
parent 4acbff6c8e
commit 847ad441cd
7 changed files with 143 additions and 54 deletions

View File

@@ -1459,6 +1459,13 @@ struct rtems_filesystem_mount_table_entry_tt {
* string.
*/
char *dev;
/**
* The task that initiated the unmount process. After unmount process
* completion this task will be notified via the
* @ref RTEMS_FILESYSTEM_UNMOUNT_EVENT.
*/
rtems_id unmount_task;
};
/**
@@ -1513,9 +1520,18 @@ int rtems_filesystem_unregister(
/**
* @brief Unmounts the file system at @a mount_path.
*
* @todo Due to file system implementation shortcomings it is possible to
* unmount file systems in use. This likely leads to heap corruption. Unmount
* only file systems which are not in use by the application.
* The function waits for the unmount process completion. In case the calling
* thread uses resources of the unmounted file system the function may never
* return. In case the calling thread has its root or current directory in the
* unmounted file system the function returns with an error status and errno is
* set to EBUSY.
*
* The unmount process completion notification uses the RTEMS classic API
* event @ref RTEMS_FILESYSTEM_UNMOUNT_EVENT. It is a fatal error to terminate
* the calling thread while waiting for this event.
*
* A concurrent unmount request for the same file system instance has
* unpredictable effects.
*
* @retval 0 Successful operation.
* @retval -1 An error occured. The @c errno indicates the error.

View File

@@ -38,6 +38,16 @@ extern "C" {
#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O')
#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n)
/**
* @brief Event to signal an unmount process completion.
*
* This event should equal the RTEMS_BDBUF_TRANSFER_SYNC event to avoid too
* many events reserved for the file system.
*
* @see rtems_filesystem_do_unmount() and unmount().
*/
#define RTEMS_FILESYSTEM_UNMOUNT_EVENT RTEMS_EVENT_1
extern rtems_id rtems_libio_semaphore;
/*