3 # This is the script that was used to create the image.gz in this directory.
24 local target=$(perl -e 'print "A" x '$len)
29 # Overwrite the length in the header of the encrypted symlink target
30 set_encrypted_symlink_len() {
34 echo "zap_block -f <$ino> -p $((len%256)) -o 0 -l 1 0"
35 echo "zap_block -f <$ino> -p $((len/256)) -o 1 -l 1 0"
40 local encrypted=${2:-false}
51 ino=$(symlink 1 $dir/empty)
52 echo "set_inode_field <$ino> i_size 10"
53 echo "set_inode_field <$ino> block[0] 0"
55 symlink 1 $dir/fast_min > /dev/null
57 ino=$(symlink 10 $dir/fast_isize_too_small)
58 echo "set_inode_field <$ino> i_size 1"
60 ino=$(symlink 10 $dir/fast_isize_too_large)
61 echo "set_inode_field <$ino> i_size 20"
63 symlink $((59 - overhead)) $dir/fast_max > /dev/null
65 symlink $((60 - overhead)) $dir/slow_min > /dev/null
67 ino=$(symlink 100 $dir/slow_isize_too_small)
68 echo "set_inode_field <$ino> i_size 80"
70 ino=$(symlink 100 $dir/slow_isize_too_large)
71 echo "set_inode_field <$ino> i_size 120"
73 symlink $((BLOCKSIZE - 1 - overhead)) $dir/slow_max > /dev/null
75 ino=$(symlink $((BLOCKSIZE - 1 - overhead)) $dir/one_too_long)
76 echo "set_inode_field <$ino> i_size $BLOCKSIZE"
77 echo "zap_block -f <$ino> -p 65 0"
79 set_encrypted_symlink_len $ino $((BLOCKSIZE - overhead))
82 ino=$(symlink $((BLOCKSIZE - 1 - overhead)) $dir/too_long)
83 echo "set_inode_field <$ino> i_size $((BLOCKSIZE + 1000))"
84 echo "zap_block -f <$ino> -p 65 0"
86 set_encrypted_symlink_len $ino $((BLOCKSIZE + 1000 - overhead))
90 do_debugfs < debugfs_commands
93 create_encrypted_symlinks() {
97 echo | e4crypt add_key $dir
98 create_symlinks $dir true
100 # Move symlinks into an unencrypted directory (leaving their targets
101 # encrypted). This makes the fsck output consistent.
102 mv $dir ${dir}~encrypted
104 mv ${dir}~encrypted/* $dir
108 umount mnt &> /dev/null || true
109 dd if=/dev/zero of=image bs=1024 count=600
111 mke2fs -O 'encrypt,^extents,^64bit' -b $BLOCKSIZE -I 256 image
114 create_symlinks mnt/default
115 create_encrypted_symlinks mnt/encrypted
117 do_tune2fs -O extents
118 create_symlinks mnt/extents
119 create_encrypted_symlinks mnt/extents_encrypted
121 do_debugfs -R 'feature inline_data'
122 create_symlinks mnt/inline_data
124 rm -rf debugfs_commands mnt/*~encrypted