change log for rtems (2011-03-14)
rtems-vc at rtems.org
rtems-vc at rtems.org
Mon Mar 14 05:10:25 UTC 2011
*ccj* (on branch rtems-4-10-branch):
2011-03-14 Chris Johns <chrisj at rtems.org>
PR 1757/filesystem
* libfs/src/rfs/rtems-rfs-block-pos.h,
libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-file.c,
libfs/src/rfs/rtems-rfs-rtems-file.c: Set the file size in
iop-size when a file is open. Fix lseek to end of file then write
for sizes less than half the file system block size.
M 1.2346.2.82 cpukit/ChangeLog
M 1.1.2.4 cpukit/libfs/src/rfs/rtems-rfs-block-pos.h
M 1.1.2.3 cpukit/libfs/src/rfs/rtems-rfs-block.h
M 1.4.2.3 cpukit/libfs/src/rfs/rtems-rfs-file.c
M 1.4.2.3 cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c
diff -u rtems/cpukit/ChangeLog:1.2346.2.81 rtems/cpukit/ChangeLog:1.2346.2.82
--- rtems/cpukit/ChangeLog:1.2346.2.81 Tue Mar 8 16:14:54 2011
+++ rtems/cpukit/ChangeLog Mon Mar 14 00:07:19 2011
@@ -1,3 +1,12 @@
+2011-03-14 Chris Johns <chrisj at rtems.org>
+
+ PR 1757/filesystem
+ * libfs/src/rfs/rtems-rfs-block-pos.h,
+ libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-file.c,
+ libfs/src/rfs/rtems-rfs-rtems-file.c: Set the file size in
+ iop-size when a file is open. Fix lseek to end of file then write
+ for sizes less than half the file system block size.
+
2011-03-08 Joel Sherrill <joel.sherrilL at OARcorp.com>
PR 1759/cpukit
diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.1.2.3 rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.1.2.4
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.1.2.3 Wed Jun 16 23:38:29 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h Mon Mar 14 00:07:18 2011
@@ -193,6 +193,12 @@
if ((_b)->boff) --(_b)->bno; } while (0)
/**
+ * Do the sizes match ?
+ */
+#define rtems_rfs_block_size_equal(_lhs, _rhs) \
+ (((_lhs)->count == (_rhs)->count) && ((_lhs)->offset == (_rhs)->count))
+
+/**
* Zero a block size.
*
* @param size A pointer to the block size.
diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.1.2.2 rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.1.2.3
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.1.2.2 Wed Jun 16 23:38:29 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h Mon Mar 14 00:07:18 2011
@@ -163,11 +163,6 @@
#define rtems_rfs_block_map_size_offset(_m) ((_m)->size.offset)
/**
- * Set the size offset for the map.
- */
-#define rtems_rfs_block_map_set_size_offset(_m, _o) ((_m)->size.offset = (_o))
-
-/**
* Are we at the last block in the map ?
*/
#define rtems_rfs_block_map_last(_m) \
@@ -196,6 +191,33 @@
#define rtems_rfs_block_map_block_offset(_m) ((_m)->bpos.boff)
/**
+ * Set the size offset for the map. The map is tagged as dirty.
+ *
+ * @param map Pointer to the open map to set the offset in.
+ * @param offset The offset to set in the map's size.
+ */
+static inline void
+rtems_rfs_block_map_set_size_offset (rtems_rfs_block_map* map,
+ rtems_rfs_block_off offset)
+{
+ map->size.offset = offset;
+ map->dirty = true;
+}
+
+/**
+ * Set the map's size. The map is tagged as dirty.
+ *
+ * @param map Pointer to the open map to set the offset in.
+ * @param size The size to set in the map's size.
+ */
+static inline void
+rtems_rfs_block_map_set_size (rtems_rfs_block_map* map,
+ rtems_rfs_block_size* size)
+{
+ rtems_rfs_block_copy_size (&map->size, size);
+ map->dirty = true;
+}
+/**
* Open a block map. The block map data in the inode is copied into the
* map. The buffer handles are opened. The block position is set to the start
* so a seek of offset 0 will return the first block.
diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.4.2.2 rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.4.2.3
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.4.2.2 Thu Aug 26 01:35:22 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c Mon Mar 14 00:07:18 2011
@@ -172,8 +172,10 @@
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_block_size_equal (&handle->shared->size,
+ &handle->shared->map.size))
+ rtems_rfs_block_map_set_size (&handle->shared->map,
+ &handle->shared->size);
}
rc = rtems_rfs_block_map_close (fs, &handle->shared->map);
@@ -420,8 +422,8 @@
* This means the file needs to set the file size to the pos only when a
* write occurs.
*/
- if (pos <= rtems_rfs_file_shared_get_size (rtems_rfs_file_fs (handle),
- handle->shared))
+ if (pos < rtems_rfs_file_shared_get_size (rtems_rfs_file_fs (handle),
+ handle->shared))
rtems_rfs_file_set_bpos (handle, pos);
*new_pos = pos;
diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.4.2.2 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.4.2.3
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.4.2.2 Mon Oct 18 17:48:55 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c Mon Mar 14 00:07:18 2011
@@ -70,6 +70,7 @@
if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FILE_OPEN))
printf("rtems-rfs: file-open: handle:%p\n", file);
+ iop->size = rtems_rfs_file_size (file);
iop->file_info = file;
rtems_rfs_rtems_unlock (fs);
@@ -195,21 +196,25 @@
pos = iop->offset;
/*
- * If the iop position is past the physical end of the file we need to set the
- * file size to the new length before writing.
+ * If the iop position is past the physical end of the file we need to set
+ * the file size to the new length before writing. If the position equals the
+ * size of file we are still past the end of the file as positions number
+ * from 0. For a specific position we need a file that has a length of one
+ * more.
*/
- if (pos > rtems_rfs_file_size (file))
+ if (pos >= rtems_rfs_file_size (file))
{
- rc = rtems_rfs_file_set_size (file, pos);
+ rc = rtems_rfs_file_set_size (file, pos + 1);
if (rc)
{
rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
return rtems_rfs_rtems_error ("file-write: write extend", rc);
}
- rtems_rfs_file_set_bpos (file, pos);
}
+ rtems_rfs_file_set_bpos (file, pos);
+
while (count)
{
size_t size = count;
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110314/5bcca715/attachment.html>
More information about the vc
mailing list