--- linux-2.4.24/fs/Config.in 2003-11-28 18:26:21.000000000 +0000 +++ linux-2.4.24/fs/Config.in-ext2-privacy 2004-01-27 21:56:58.000000000 +0000 @@ -92,6 +92,7 @@ tristate 'ROM file system support' CONFIG_ROMFS_FS tristate 'Second extended fs support' CONFIG_EXT2_FS +dep_mbool ' ext2 privacy support' CONFIG_EXT2_FS_PRIVACY $CONFIG_EXT2_FS tristate 'System V/Xenix/V7/Coherent file system support' CONFIG_SYSV_FS --- linux-2.4.24/fs/ext2/balloc.c 2003-06-13 15:51:37.000000000 +0100 +++ linux-2.4.24/fs/ext2-privacy/balloc.c 2004-01-28 00:52:59.000000000 +0000 @@ -247,6 +247,23 @@ return slot; } +static inline void destroy_block(struct inode *inode, unsigned long block) +{ +#ifdef CONFIG_EXT2_FS_PRIVACY + struct buffer_head * bh; + + bh = sb_getblk(inode->i_sb, block); + + memset(bh->b_data, 0x00, bh->b_size); + + mark_buffer_dirty(bh); + wait_on_buffer(bh); + brelse(bh); + + return; +#endif +} + /* Free given blocks, update quota and i_blocks field */ void ext2_free_blocks (struct inode * inode, unsigned long block, unsigned long count) @@ -319,6 +336,8 @@ "bit already cleared for block %lu", block); else { DQUOT_FREE_BLOCK(inode, 1); + + destroy_block(sb, block); gdp->bg_free_blocks_count = cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)+1); es->s_free_blocks_count = --- linux-2.4.24/fs/ext2/dir.c 2002-11-28 23:53:15.000000000 +0000 +++ linux-2.4.24/fs/ext2-privacy/dir.c 2004-01-25 17:15:27.000000000 +0000 @@ -468,6 +468,15 @@ return err; } +static inline mark_deleted_dir(struct ext2_dir_entry_2 *dir) +{ +#ifndef CONFIG_EXT2_FS_PRIVACY + dir->inode = 0; +#else + memset(dir, 0, dir->rec_len); +#endif +} + /* * ext2_delete_entry deletes a directory entry by merging it with the * previous entry. Page is up-to-date. Releases the page. @@ -495,7 +504,7 @@ BUG(); if (pde) pde->rec_len = cpu_to_le16(to-from); - dir->inode = 0; + mark_deleted_dir(dir); err = ext2_commit_chunk(page, from, to); UnlockPage(page); ext2_put_page(page); --- linux-2.4.24/fs/ext2/inode.c 2003-06-13 15:51:37.000000000 +0100 +++ linux-2.4.24/fs/ext2-privacy/inode.c 2004-01-27 21:33:59.000000000 +0000 @@ -46,6 +46,36 @@ ext2_discard_prealloc (inode); } +static inline void delete_inode(struct inode *inode) +{ +#ifndef CONFIG_EXT2_FS_PRIVACY + inode->u.ext2_i.i_dtime = CURRENT_TIME; +#else + inode->i_mode = 0; + inode->i_uid = 0; + inode->i_gid = 0; + inode->i_nlink = 0; + inode->i_atime = 0; + inode->i_ctime = 0; + inode->i_mtime = 0; + inode->u.ext2_i.i_dtime = 0; + inode->u.ext2_i.i_flags = 0; + inode->u.ext2_i.i_faddr = 0; + inode->u.ext2_i.i_frag_no = 0; + inode->u.ext2_i.i_frag_size = 0; + inode->u.ext2_i.i_file_acl = 0; + inode->i_generation = 0; +#endif +} + +static inline void delete_blocks(struct inode *inode) +{ +#ifdef CONFIG_EXT2_FS_PRIVACY + inode->i_blocks = 0; + memset(&inode->u.ext2_i.i_data, 0x00, sizeof(inode->u.ext2_i.i_data)); +#endif +} + /* * Called at the last iput() if i_nlink is zero. */ @@ -57,12 +87,18 @@ inode->i_ino == EXT2_ACL_IDX_INO || inode->i_ino == EXT2_ACL_DATA_INO) goto no_delete; - inode->u.ext2_i.i_dtime = CURRENT_TIME; + + delete_inode(inode); mark_inode_dirty(inode); ext2_update_inode(inode, IS_SYNC(inode)); + inode->i_size = 0; if (inode->i_blocks) ext2_truncate (inode); + delete_blocks(inode); + mark_inode_dirty(inode); + ext2_update_inode(inode, IS_SYNC(inode)); + ext2_free_inode (inode); unlock_kernel();