diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-13 11:33:51 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-13 12:23:37 +0100 |
commit | 3b7c123c8d910eb60ab3b38dec6224e2de9847c9 (patch) | |
tree | a67335010c15af5efb5e27224ae9204883c2b5b8 /cpukit/include/rtems/fs.h | |
parent | Add missing BSD sections. (diff) | |
download | rtems-3b7c123c8d910eb60ab3b38dec6224e2de9847c9.tar.bz2 |
Filesystem: Reference counting for locations
o A new data structure rtems_filesystem_global_location_t was
introduced to be used for
o the mount point location in the mount table entry,
o the file system root location in the mount table entry,
o the root directory location in the user environment, and
o the current directory location in the user environment.
During the path evaluation global start locations are obtained to
ensure that the current file system instance will be not unmounted in
the meantime.
o The user environment uses now reference counting and is protected
from concurrent access.
o The path evaluation process was completely rewritten and simplified.
The IMFS, RFS, NFS, and DOSFS use now a generic path evaluation
method. Recursive calls in the path evaluation have been replaced
with iteration to avoid stack overflows. Only the evaluation of
symbolic links is recursive. No dynamic memory allocations and
intermediate buffers are used in the high level path evaluation. No
global locks are held during the file system instance specific path
evaluation process.
o Recursive symbolic link evaluation is now limited by
RTEMS_FILESYSTEM_SYMLOOP_MAX. Applications can retrieve this value
via sysconf().
o The device file system (devFS) uses now no global variables and
allocation from the workspace. Node names are allocated from the
heap.
o The upper layer lseek() performs now some parameter checks.
o The upper layer ftruncate() performs now some parameter checks.
o unmask() is now restricted to the RWX flags and protected from
concurrent access.
o The fchmod_h and rmnod_h file system node handlers are now a file
system operation.
o The unlink_h operation has been removed. All nodes are now destroyed
with the rmnod_h operation.
o New lock_h, unlock_h, clonenod_h, and are_nodes_equal_h file system
operations.
o The path evaluation and file system operations are now protected by
per file system instance lock and unlock operations.
o Fix and test file descriptor duplicate in fcntl().
o New test fstests/fsnofs01.
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/fs.h | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/cpukit/include/rtems/fs.h b/cpukit/include/rtems/fs.h index 84b18370b5..bf5026f645 100644 --- a/cpukit/include/rtems/fs.h +++ b/cpukit/include/rtems/fs.h @@ -8,6 +8,9 @@ * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * + * Modifications to support reference counting in the file system are + * Copyright (c) 2012 embedded brains GmbH. + * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. @@ -18,6 +21,8 @@ #ifndef _RTEMS_FS_H #define _RTEMS_FS_H +#include <rtems/chain.h> + #ifdef __cplusplus extern "C" { #endif @@ -31,9 +36,6 @@ extern "C" { /* FIXME: shouldn't this better not be here? */ typedef struct rtems_libio_tt rtems_libio_t; -typedef struct rtems_filesystem_location_info_tt - rtems_filesystem_location_info_t; - struct rtems_filesystem_mount_table_entry_tt; typedef struct rtems_filesystem_mount_table_entry_tt rtems_filesystem_mount_table_entry_t; @@ -43,18 +45,57 @@ typedef struct _rtems_filesystem_file_handlers_r typedef struct _rtems_filesystem_operations_table rtems_filesystem_operations_table; -/* - * Structure used to determine a location/filesystem in the tree. +/** + * @brief File system location. + * + * @ingroup LibIO */ - -struct rtems_filesystem_location_info_tt -{ +typedef struct rtems_filesystem_location_info_tt { + rtems_chain_node mt_entry_node; void *node_access; void *node_access_2; const rtems_filesystem_file_handlers_r *handlers; const rtems_filesystem_operations_table *ops; rtems_filesystem_mount_table_entry_t *mt_entry; -}; +} rtems_filesystem_location_info_t; + +/** + * @brief Global file system location. + * + * @ingroup LibIO + * + * The global file system locations are used for + * - the mount point location in the mount table entry, + * - the file system root location in the mount table entry, + * - the root directory location in the user environment, and + * - the current directory location in the user environment. + * + * During the path evaluation global start locations are obtained to ensure + * that the current file system will be not unmounted in the meantime. + * + * To support a release within critical sections of the operating system a + * deferred release is supported. This is similar to malloc() and free(). + * + * @see rtems_filesystem_global_location_obtain() and + * rtems_filesystem_global_location_release(). + */ +typedef struct rtems_filesystem_global_location_t { + rtems_filesystem_location_info_t location; + int reference_count; + + /** + * A release within a critical section of the operating system will add this + * location to a list of deferred released locations. This list is processed + * in the next rtems_filesystem_global_location_obtain() in FIFO order. + */ + struct rtems_filesystem_global_location_t *deferred_released_next; + + /** + * A release within a critical section can happen multiple times. This field + * counts the deferred releases. + */ + int deferred_released_count; +} rtems_filesystem_global_location_t; /* * Return the mount table entry for a path location. |