aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/io-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/io-write.c')
-rw-r--r--libdiskfs/io-write.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libdiskfs/io-write.c b/libdiskfs/io-write.c
index 8b68e1a1..a3c4199e 100644
--- a/libdiskfs/io-write.c
+++ b/libdiskfs/io-write.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1994,95,96,97,2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -29,7 +29,7 @@ diskfs_S_io_write (struct protid *cred,
{
struct node *np;
error_t err;
- int off = offset;
+ off_t off = offset;
if (!cred)
return EOPNOTSUPP;
@@ -50,6 +50,11 @@ diskfs_S_io_write (struct protid *cred,
cred->po->filepointer = np->dn_stat.st_size;
off = cred->po->filepointer;
}
+ if (off < 0)
+ {
+ err = EINVAL;
+ goto out;
+ }
err = 0;
while (off + (off_t) datalen > np->allocsize)
@@ -59,6 +64,8 @@ diskfs_S_io_write (struct protid *cred,
diskfs_node_update (np, 1);
if (err)
goto out;
+ if (np->filemod_reqs)
+ diskfs_notice_filechange (np, FILE_CHANGED_EXTEND, 0, off + datalen);
}
if (off + (off_t) datalen > np->dn_stat.st_size)
@@ -79,6 +86,8 @@ diskfs_S_io_write (struct protid *cred,
&& ((cred->po->openstat & O_FSYNC) || diskfs_synchronous))
diskfs_file_update (np, 1);
+ if (!err && np->filemod_reqs)
+ diskfs_notice_filechange (np, FILE_CHANGED_WRITE, off, off + *amt);
out:
mutex_unlock (&np->lock);
return err;