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/libfs/src/dosfs/msdos_file.c | |
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 'cpukit/libfs/src/dosfs/msdos_file.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_file.c | 88 |
1 files changed, 5 insertions, 83 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c index 5378a25914..b2f98b890d 100644 --- a/cpukit/libfs/src/dosfs/msdos_file.c +++ b/cpukit/libfs/src/dosfs/msdos_file.c @@ -41,8 +41,8 @@ * and errno set appropriately */ int -msdos_file_open(rtems_libio_t *iop, const char *pathname, uint32_t flag, - uint32_t mode) +msdos_file_open(rtems_libio_t *iop, const char *pathname, int oflag, + mode_t mode) { int rc = RC_OK; rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -268,9 +268,9 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence) */ int msdos_file_stat( - rtems_filesystem_location_info_t *loc, - struct stat *buf - ) + const rtems_filesystem_location_info_t *loc, + struct stat *buf +) { rtems_status_code sc = RTEMS_SUCCESSFUL; msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; @@ -426,81 +426,3 @@ msdos_file_datasync(rtems_libio_t *iop) rtems_semaphore_release(fs_info->vol_sema); return RC_OK; } - - -/* msdos_file_ioctl -- - * - * - * PARAMETERS: - * iop - file control block - * ... - * - * RETURNS: - * - */ -int -msdos_file_ioctl(rtems_libio_t *iop,uint32_t command, void *buffer) -{ - int rc = RC_OK; - - return rc; -} - -/* msdos_file_chmod -- - * Change the attributes of the file. This currently does - * nothing and returns no error. - * - * PARAMETERS: - * pathloc - node description - * mode - the new mode - * - * RETURNS: - * RC_OK always - */ -int -msdos_file_chmod(rtems_filesystem_location_info_t *pathloc, - mode_t mode) -{ - return RC_OK; -} - -/* msdos_file_rmnod -- - * Remove node associated with a file - set up first name character to - * predefined value(and write it to the disk), and mark fat-file which - * correspondes to the file as "removed" - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_rmnod(rtems_filesystem_location_info_t *parent_pathloc, - rtems_filesystem_location_info_t *pathloc) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = pathloc->node_access; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); - - /* mark file removed */ - rc = msdos_set_first_char4file_name(pathloc->mt_entry, - &fat_fd->dir_pos, - MSDOS_THIS_DIR_ENTRY_EMPTY); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - fat_file_mark_removed(pathloc->mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} |