diff options
author | Miles Bader <miles@gnu.org> | 1995-04-20 15:03:38 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-04-20 15:03:38 +0000 |
commit | b0f1b3152e2a7737cc5c6a31dcbbd105ba4a4465 (patch) | |
tree | 93ca332e675749f492d6acbba0e164a6522ac80f /ext2fs/truncate.c | |
parent | e268002d4136f313b6e9e3fdd92e29467317f688 (diff) |
Formerly truncate.c.~13~
Diffstat (limited to 'ext2fs/truncate.c')
-rw-r--r-- | ext2fs/truncate.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c index 42c1a977..fc63824e 100644 --- a/ext2fs/truncate.c +++ b/ext2fs/truncate.c @@ -106,7 +106,7 @@ trunc_direct (struct node * node, unsigned long length) node->dn->info.i_data[i] = 0; - node->dn_stat.st_blocks -= blocks; + node->dn_stat.st_blocks -= blocks << log2_stat_blocks_per_fs_block; node->dn_stat_dirty = 1; if (free_count == 0) { @@ -187,7 +187,7 @@ trunc_indirect (struct node * node, unsigned long length, ext2_free_blocks (block, 1); #endif - node->dn_stat.st_blocks -= blocks; + node->dn_stat.st_blocks -= blocks << log2_stat_blocks_per_fs_block; node->dn_stat_dirty = 1; } @@ -202,7 +202,7 @@ trunc_indirect (struct node * node, unsigned long length, { block = *p; *p = 0; - node->dn_stat.st_blocks -= blocks; + node->dn_stat.st_blocks -= blocks << log2_stat_blocks_per_fs_block; node->dn_stat_dirty = 1; ext2_free_blocks (block, 1); } @@ -254,7 +254,7 @@ trunc_dindirect (struct node * node, unsigned long length, { block = *p; *p = 0; - node->dn_stat.st_blocks -= blocks; + node->dn_stat.st_blocks -= blocks << log2_stat_blocks_per_fs_block; node->dn_stat_dirty = 1; ext2_free_blocks (block, 1); } @@ -305,7 +305,7 @@ trunc_tindirect (struct node * node, unsigned long length) { block = *p; *p = 0; - node->dn_stat.st_blocks -= blocks; + node->dn_stat.st_blocks -= blocks << log2_stat_blocks_per_fs_block; node->dn_stat_dirty = 1; ext2_free_blocks (block, 1); } @@ -373,8 +373,8 @@ diskfs_truncate (struct node *node, off_t length) int offset; mode_t mode = node->dn_stat.st_mode; - if (diskfs_readonly) - return EROFS; + assert (!diskfs_readonly); + if (S_ISDIR(mode)) return EISDIR; if (!S_ISREG(mode)) @@ -441,8 +441,7 @@ diskfs_truncate (struct node *node, off_t length) error_t diskfs_grow (struct node *node, off_t size, struct protid *cred) { - if (diskfs_readonly) - return EROFS; + assert (!diskfs_readonly); if (size > node->allocsize) node->allocsize = size; return 0; |