Commit Graph

7 Commits (master)

Author SHA1 Message Date
Darrick J. Wong 4ee2669982 debugfs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-10-24 01:26:35 -04:00
Zheng Liu 716a3c3536 libext2fs: handle inline_data in block iterator function
After applied this commit (a7f4c635), we have banned to traverse blocks
for an inode which has inline data because no block belongs to it.  But
before calling this function, we need to check inline data flag.  This
commit add a sanity check ext2fs_inode_has_valid_blocks2() to fix them
except that ext2fs_expand_dir because it will be fixed by another patch.

Meanwhile in this commit it fixes a bug that when we kill a file we
could leak an inode.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-04 08:46:13 -05:00
Theodore Ts'o 1b977a0fad Merge branch 'maint' into next 2013-12-09 14:15:04 -05:00
Zheng Liu 5093775ab4 debugfs: update usage message for open and filefrag
The ussage message for the open and filefrag commands were missing
options; this commit fixes this.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-08 21:06:40 -05:00
Jan Kara 70f4632b62 libext2fs: provide functions to safely access name_len and file_type
Accessing name_len (and file_type) in ext4_dir_entry structure is
somewhat problematic because on big endian architecture we need to now
whether we are really dealing with ext4_dir_entry (which has u16
name_len which needs byte swapping) or ext4_dir_entry_2 (which has u8
name_len which must not be byte swapped).

Currently the code is somewhat surprising and name_len is always
treated as u16 and byte swapped (flag EXT2_DIRBLOCK_V2_STRUCT isn't
ever used) and then masking of name_len is used to access real
name_len or file_type. Doing things this way in applications using
libext2fs is unexpected to say the least (more natural is to type
struct ext4_dir_entry * to struct ext4_dir_entry_2 * but that gives
wrong results on big endian architectures. So provide helper functions
that give endian-safe access to these fields. Also convert users in
e2fsprogs to use these functions.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-06-08 17:03:05 -04:00
Theodore Ts'o 3cebf9c102 debugfs: fix gcc -Wall complaints
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18 22:14:23 -05:00
Theodore Ts'o c4ab66c526 debugfs: add filefrag command
Add the ability to report on the fragmentation of a file on a file
system opened using debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18 22:14:15 -05:00