forked from tytso/e2fsprogs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
694 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Filesystem volume name: <none> | ||
Last mounted on: <not available> | ||
Filesystem magic number: 0xEF53 | ||
Filesystem revision #: 1 (dynamic) | ||
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file dir_nlink extra_isize metadata_csum | ||
Default mount options: (none) | ||
Filesystem state: clean | ||
Errors behavior: Continue | ||
Filesystem OS type: Linux | ||
Inode count: 1024 | ||
Block count: 16384 | ||
Reserved block count: 819 | ||
Overhead clusters: 1543 | ||
Free blocks: 13119 | ||
Free inodes: 984 | ||
First block: 1 | ||
Block size: 1024 | ||
Fragment size: 1024 | ||
Group descriptor size: 64 | ||
Reserved GDT blocks: 127 | ||
Blocks per group: 8192 | ||
Fragments per group: 8192 | ||
Inodes per group: 512 | ||
Inode blocks per group: 128 | ||
Flex block group size: 16 | ||
Mount count: 0 | ||
Check interval: 15552000 (6 months) | ||
Reserved blocks uid: 0 | ||
Reserved blocks gid: 0 | ||
First inode: 11 | ||
Inode size: 256 | ||
Required extra isize: 32 | ||
Desired extra isize: 32 | ||
Journal inode: 8 | ||
Default directory hash: half_md4 | ||
Journal backup: inode blocks | ||
Checksum type: crc32c | ||
Journal features: (none) | ||
Total journal size: 1024k | ||
Total journal blocks: 1024 | ||
Max transaction length: 1024 | ||
Fast commit length: 0 | ||
Journal sequence: 0x00000001 | ||
Journal start: 0 | ||
|
||
|
||
Group 0: (Blocks 1-8192) | ||
Primary superblock at 1, Group descriptors at 2-2 | ||
Reserved GDT blocks at 3-129 | ||
Block bitmap at 130 (+129) | ||
Inode bitmap at 132 (+131) | ||
Inode table at 134-261 (+133) | ||
6081 free blocks, 472 free inodes, 4 directories, 472 unused inodes | ||
Free blocks: 2112-8192 | ||
Free inodes: 41-512 | ||
Group 1: (Blocks 8193-16383) [INODE_UNINIT] | ||
Backup superblock at 8193, Group descriptors at 8194-8194 | ||
Reserved GDT blocks at 8195-8321 | ||
Block bitmap at 131 (bg #0 + 130) | ||
Inode bitmap at 133 (bg #0 + 132) | ||
Inode table at 262-389 (bg #0 + 261) | ||
7038 free blocks, 512 free inodes, 0 directories, 512 unused inodes | ||
Free blocks: 9346-16383 | ||
Free inodes: 513-1024 | ||
debugfs: stat /progs/test_rel.c | ||
Inode: III Type: regular | ||
Generation: 0 Version: 0x00000000:00000000 | ||
Size: 14627 | ||
File ACL: 0 | ||
Links: 1 Blockcount: 30 | ||
Fragment: Address: 0 Number: 0 Size: 0 | ||
Size of extra inode fields: 32 | ||
EXTENTS: | ||
(0-14):2092-2106 | ||
progs/ | ||
progs/Makefile | ||
progs/Makefile.in | ||
progs/crcsum | ||
progs/crcsum.c | ||
progs/crcsum.o | ||
progs/hold_inode.c | ||
progs/random_exercise.c | ||
progs/test_data/ | ||
progs/test_data/bma.setup | ||
progs/test_data/expect.brel | ||
progs/test_data/expect.icount | ||
progs/test_data/expect.irel | ||
progs/test_data/ima.setup | ||
progs/test_data/normal.setup | ||
progs/test_data/opt.setup | ||
progs/test_data/test.brel | ||
progs/test_data/test.icount | ||
progs/test_data/test.irel | ||
progs/test_icount | ||
progs/test_icount.c | ||
progs/test_icount.h | ||
progs/test_icount.o | ||
progs/test_icount_cmds.c | ||
progs/test_icount_cmds.ct | ||
progs/test_icount_cmds.o | ||
progs/test_rel.c | ||
progs/test_rel.h | ||
progs/test_rel_cmds.ct | ||
Pass 1: Checking inodes, blocks, and sizes | ||
Pass 2: Checking directory structure | ||
Pass 3: Checking directory connectivity | ||
Pass 4: Checking reference counts | ||
Pass 5: Checking group summary information | ||
test.img: 40/1024 files (0.0% non-contiguous), 3265/16384 blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*-[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/X \1\/\2 \3\/\4 \5-\6 AAA-BBB \7/g | ||
s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/Y \1\/\2 \3\/\4 \5-\6 AAA \7/g | ||
s/Mode:.*$//g | ||
s/User:.*Size:/Size:/g | ||
s/^Inode: [0-9]*/Inode: III/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# vim: filetype=sh | ||
|
||
test_description="create fs image from GNU tarball" | ||
if ! test -x $DEBUGFS_EXE; then | ||
echo "$test_name: $test_description: skipped (no debugfs)" | ||
return 0 | ||
fi | ||
|
||
MKFS_TAR=$TMPFILE.tar | ||
OUT=$test_name.log | ||
EXP=$test_dir/expect | ||
|
||
tar --sort=name -C $SRCDIR --format=gnu -cf $MKFS_TAR progs | ||
$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,64bit -E lazy_itable_init=1 -b 1024 -a $MKFS_TAR $TMPFILE 16384 > $OUT 2>&1 | ||
|
||
$DUMPE2FS $TMPFILE >> $OUT 2>&1 | ||
cat > $TMPFILE.cmd << ENDL | ||
stat /progs/test_rel.c | ||
ENDL | ||
$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep -v "(time|checksum):" >> $OUT | ||
|
||
$DEBUGFS -R "dump /progs/test_rel.c $TMPFILE.test_rel.c" $TMPFILE 2>&1 >> $OUT | ||
|
||
# extract the files and directories from the image and tar them again to make | ||
# sure that a tarball from the image contents is bit-by-bit identical to the | ||
# tarball the image was created from -- essentially this checks whether a | ||
# roundtrip from tar to ext4 to tar remains identical | ||
mkdir -p "$TMPFILE.dir" | ||
$DEBUGFS -R "rdump /progs $TMPFILE.dir" $TMPFILE >> $OUT 2>&1 | ||
tar --sort=name -C $TMPFILE.dir --format=gnu -cvf $TMPFILE.new.tar progs >> $OUT 2>&1 | ||
|
||
$FSCK -f -n $TMPFILE >> $OUT 2>&1 | ||
|
||
sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp | ||
mv $OUT.tmp $OUT | ||
|
||
# Do the verification | ||
cmp -s $OUT $EXP && cmp -s progs/test_rel.c $TMPFILE.test_rel.c && cmp $MKFS_TAR $TMPFILE.new.tar | ||
status=$? | ||
|
||
if [ "$status" = 0 ] ; then | ||
echo "$test_name: $test_description: ok" | ||
touch $test_name.ok | ||
else | ||
echo "$test_name: $test_description: failed" | ||
diff $DIFF_OPTS $EXP $OUT > $test_name.failed | ||
fi | ||
|
||
rm -rf $TMPFILE.cmd $MKFS_TAR $TMPFILE.test_rel.c $TMPFILE.dir $TMPFILE.new.tar | ||
unset MKFS_TAR OUT EXP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
Filesystem volume name: <none> | ||
Last mounted on: <not available> | ||
Filesystem magic number: 0xEF53 | ||
Filesystem revision #: 1 (dynamic) | ||
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file dir_nlink extra_isize metadata_csum | ||
Default mount options: (none) | ||
Filesystem state: clean | ||
Errors behavior: Continue | ||
Filesystem OS type: Linux | ||
Inode count: 1024 | ||
Block count: 16384 | ||
Reserved block count: 819 | ||
Overhead clusters: 1543 | ||
Free blocks: 14827 | ||
Free inodes: 1012 | ||
First block: 1 | ||
Block size: 1024 | ||
Fragment size: 1024 | ||
Group descriptor size: 64 | ||
Reserved GDT blocks: 127 | ||
Blocks per group: 8192 | ||
Fragments per group: 8192 | ||
Inodes per group: 512 | ||
Inode blocks per group: 128 | ||
Flex block group size: 16 | ||
Mount count: 0 | ||
Check interval: 15552000 (6 months) | ||
Reserved blocks uid: 0 | ||
Reserved blocks gid: 0 | ||
First inode: 11 | ||
Inode size: 256 | ||
Required extra isize: 32 | ||
Desired extra isize: 32 | ||
Journal inode: 8 | ||
Default directory hash: half_md4 | ||
Journal backup: inode blocks | ||
Checksum type: crc32c | ||
Journal features: (none) | ||
Total journal size: 1024k | ||
Total journal blocks: 1024 | ||
Max transaction length: 1024 | ||
Fast commit length: 0 | ||
Journal sequence: 0x00000001 | ||
Journal start: 0 | ||
|
||
|
||
Group 0: (Blocks 1-8192) | ||
Primary superblock at 1, Group descriptors at 2-2 | ||
Reserved GDT blocks at 3-129 | ||
Block bitmap at 130 (+129) | ||
Inode bitmap at 132 (+131) | ||
Inode table at 134-261 (+133) | ||
7789 free blocks, 500 free inodes, 2 directories, 500 unused inodes | ||
Free blocks: 404-8192 | ||
Free inodes: 13-512 | ||
Group 1: (Blocks 8193-16383) [INODE_UNINIT] | ||
Backup superblock at 8193, Group descriptors at 8194-8194 | ||
Reserved GDT blocks at 8195-8321 | ||
Block bitmap at 131 (bg #0 + 130) | ||
Inode bitmap at 133 (bg #0 + 132) | ||
Inode table at 262-389 (bg #0 + 261) | ||
7038 free blocks, 512 free inodes, 0 directories, 512 unused inodes | ||
Free blocks: 9346-16383 | ||
Free inodes: 513-1024 | ||
debugfs: stat /file | ||
Inode: III Type: regular | ||
Generation: 0 Version: 0x00000000:00000000 | ||
Size: 0 | ||
File ACL: 0 | ||
Links: 1 Blockcount: 0 | ||
Fragment: Address: 0 Number: 0 Size: 0 | ||
ctime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 | ||
atime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 | ||
mtime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 | ||
Size of extra inode fields: 32 | ||
Extended attributes: | ||
security.capability (20) = 01 00 00 02 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||
EXTENTS: | ||
debugfs: ea_list /file | ||
Extended attributes: | ||
security.capability (20) = 01 00 00 02 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||
Pass 1: Checking inodes, blocks, and sizes | ||
Pass 2: Checking directory structure | ||
Pass 3: Checking directory connectivity | ||
Pass 4: Checking reference counts | ||
Pass 5: Checking group summary information | ||
test.img: 12/1024 files (0.0% non-contiguous), 1557/16384 blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
my @entries = ( | ||
# filename mode type content | ||
['./PaxHeaders/file', oct(644), 'x', "57 SCHILY.xattr.security.capability=\x01\0\0\x02\0\x20\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x0a"], | ||
['file', oct(644), 0, ''], | ||
); | ||
|
||
my $num_entries = 0; | ||
|
||
foreach my $file (@entries) { | ||
my ( $fname, $mode, $type, $content) = @{$file}; | ||
my $entry = pack( | ||
'a100 a8 a8 a8 a12 a12 A8 a1 a100 a6 a2 a32 a32 a8 a8 a155 x12', | ||
$fname, | ||
sprintf( '%07o', $mode ), | ||
sprintf( '%07o', 0 ), # uid | ||
sprintf( '%07o', 0 ), # gid | ||
sprintf( '%011o', length $content ), # size | ||
sprintf( '%011o', 0 ), # mtime | ||
'', # checksum | ||
$type, | ||
'', # linkname | ||
"ustar", # magic | ||
"00", # version | ||
'', # username | ||
'', # groupname | ||
'', # dev major | ||
'', # dev minor | ||
'', # prefix | ||
); | ||
|
||
# compute and insert checksum | ||
substr( $entry, 148, 7 ) = | ||
sprintf( "%06o\0", unpack( "%16C*", $entry ) ); | ||
print $entry; | ||
$num_entries += 1; | ||
|
||
if (length $content) { | ||
print(pack 'a512', $content); | ||
$num_entries += 1; | ||
} | ||
} | ||
|
||
# https://www.gnu.org/software/tar/manual/html_node/Standard.html | ||
# | ||
# Physically, an archive consists of a series of file entries terminated by an | ||
# end-of-archive entry, which consists of two 512 blocks of zero bytes. At the | ||
# end of the archive file there are two 512-byte blocks filled with binary | ||
# zeros as an end-of-file marker. | ||
|
||
print(pack 'a512', ''); | ||
print(pack 'a512', ''); | ||
$num_entries += 2; | ||
|
||
# https://www.gnu.org/software/tar/manual/html_section/tar_76.html | ||
# | ||
# Some devices requires that all write operations be a multiple of a certain | ||
# size, and so, tar pads the archive out to the next record boundary. | ||
# | ||
# The default blocking factor is 20. With a block size of 512 bytes, we get a | ||
# record size of 10240. | ||
|
||
for (my $i = $num_entries; $i < 20; $i++) { | ||
print(pack 'a512', ''); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*-[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/X \1\/\2 \3\/\4 \5-\6 AAA-BBB \7/g | ||
s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/Y \1\/\2 \3\/\4 \5-\6 AAA \7/g | ||
s/Mode:.*$//g | ||
s/User:.*Size:/Size:/g | ||
s/^Inode: [0-9]*/Inode: III/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# vim: filetype=sh | ||
|
||
test_description="create fs image from pax tarball with xattrs" | ||
if ! test -x $DEBUGFS_EXE; then | ||
echo "$test_name: $test_description: skipped (no debugfs)" | ||
return 0 | ||
fi | ||
|
||
OUT=$test_name.log | ||
EXP=$test_dir/expect | ||
|
||
perl $test_dir/mkpaxtar.pl > $TMPFILE.tar | ||
$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,64bit -E lazy_itable_init=1 -b 1024 -a $TMPFILE.tar $TMPFILE 16384 > $OUT 2>&1 | ||
|
||
$DUMPE2FS $TMPFILE >> $OUT 2>&1 | ||
cat > $TMPFILE.cmd << ENDL | ||
stat /file | ||
ea_list /file | ||
ENDL | ||
$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep -v '^(crtime|Inode checksum):' >> $OUT | ||
|
||
$FSCK -f -n $TMPFILE >> $OUT 2>&1 | ||
|
||
sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp | ||
mv $OUT.tmp $OUT | ||
|
||
# Do the verification | ||
cmp -s $OUT $EXP | ||
status=$? | ||
|
||
if [ "$status" = 0 ] ; then | ||
echo "$test_name: $test_description: ok" | ||
touch $test_name.ok | ||
else | ||
echo "$test_name: $test_description: failed" | ||
diff $DIFF_OPTS $EXP $OUT > $test_name.failed | ||
fi | ||
|
||
rm -rf $TMPFILE.cmd $TMPFILE.tar | ||
unset OUT EXP |
Oops, something went wrong.