[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
jffs_file_write always appends to file.
This patch makes it use the 'ppos' argument, but even with the addition of
the jffs_delete_data() call, the filesystem needs to be remounted before
the 'new' data appear in the right position.
(... more stuff that might be fixed if we were using the page cache,
methinks...)
I'm off home. Bob, if you want to take a look at this, feel free. This
patch is all there is that I haven't committed to CVS. I posted my test
program earlier, IIRC.
Index: inode-v22.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/inode-v22.c,v
retrieving revision 1.14
diff -u -w -r1.14 inode-v22.c
--- inode-v22.c 2000/08/02 13:34:46 1.14
+++ inode-v22.c 2000/08/02 16:32:46
@@ -1459,7 +1459,7 @@
raw_inode.atime = CURRENT_TIME;
raw_inode.mtime = raw_inode.atime;
raw_inode.ctime = f->ctime;
- raw_inode.offset = f->size;
+ raw_inode.offset = pos;
raw_inode.dsize = count;
raw_inode.rsize = 0;
raw_inode.nsize = 0;
@@ -1467,6 +1467,11 @@
raw_inode.spare = 0;
raw_inode.rename = 0;
raw_inode.deleted = 0;
+
+ if (pos < f->size) {
+ node->removed_size = raw_inode.rsize = jffs_min(count, f->size - pos);
+ jffs_delete_data(f, node);
+ }
/* TODO: BAAAAAAAAD! buf is a userspace-pointer, and should be
treated as such, with copy_from_user etc... */
--
dwmw2