summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2010-08-26 06:35:22 +0000
committerChris Johns <chrisj@rtems.org>2010-08-26 06:35:22 +0000
commit958641833fa160c8fd673c1ef97bf7ae64eca459 (patch)
tree2d9bc0523150d6e305e87d9ccb401e02e8a1a63f /cpukit/libfs
parentRegenerate. (diff)
downloadrtems-958641833fa160c8fd673c1ef97bf7ae64eca459.tar.bz2
2010-08-26 Chris Johns <chrisj@rtems.org>
* libfs/src/rfs/rtems-rfs-file.c: Check then load the inode if not present on the close. * libfs/src/rfs/rtems-rfs-format.c: Initialise the buffer chain.
Diffstat (limited to 'cpukit/libfs')
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-file.c28
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-format.c1
2 files changed, 18 insertions, 11 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-file.c b/cpukit/libfs/src/rfs/rtems-rfs-file.c
index a93cb17003..e17c705c8c 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-file.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-file.c
@@ -158,18 +158,24 @@ rtems_rfs_file_close (rtems_rfs_file_system* fs,
if (handle->shared->references == 0)
{
- /*
- * @todo This could be clever and only update if different.
- */
- rtems_rfs_inode_set_atime (&handle->shared->inode,
- handle->shared->atime);
- rtems_rfs_inode_set_mtime (&handle->shared->inode,
- handle->shared->mtime);
- rtems_rfs_inode_set_ctime (&handle->shared->inode,
- handle->shared->ctime);
- handle->shared->map.size.count = handle->shared->size.count;
- handle->shared->map.size.offset = handle->shared->size.offset;
+ if (!rtems_rfs_inode_is_loaded (&handle->shared->inode))
+ rrc = rtems_rfs_inode_load (fs, &handle->shared->inode);
+ if (rrc == 0)
+ {
+ /*
+ * @todo This could be clever and only update if different.
+ */
+ rtems_rfs_inode_set_atime (&handle->shared->inode,
+ handle->shared->atime);
+ rtems_rfs_inode_set_mtime (&handle->shared->inode,
+ handle->shared->mtime);
+ rtems_rfs_inode_set_ctime (&handle->shared->inode,
+ handle->shared->ctime);
+ handle->shared->map.size.count = handle->shared->size.count;
+ handle->shared->map.size.offset = handle->shared->size.offset;
+ }
+
rc = rtems_rfs_block_map_close (fs, &handle->shared->map);
if (rc > 0)
{
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-format.c b/cpukit/libfs/src/rfs/rtems-rfs-format.c
index a11fd71488..e92228f4da 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-format.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-format.c
@@ -538,6 +538,7 @@ rtems_rfs_format (const char* name, const rtems_rfs_format_config* config)
memset (&fs, 0, sizeof (rtems_rfs_file_system));
+ rtems_chain_initialize_empty (&fs.buffers);
rtems_chain_initialize_empty (&fs.release);
rtems_chain_initialize_empty (&fs.release_modified);
rtems_chain_initialize_empty (&fs.file_shares);