Lines Matching +full:1 +full:v2

30 status=1	# failure is the default!
36 rm -f "$TEST_DIR"/sn{0,1,2}{,-pre,-extra,-post}
38 trap "_cleanup; exit \$status" 0 1 2 3 15
48 # (1) We create a v2 image that supports nothing but refcount_bits=16
52 _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
55 # $1: image filename
59 id_len=$(peek_file_be "$1" $(($2 + 12)) 2)
60 name_len=$(peek_file_be "$1" $(($2 + 14)) 2)
61 extra_len=$(peek_file_be "$1" $(($2 + 36)) 4)
68 # $1: image filename
71 nb_entries=$(peek_file_be "$1" 60 4)
72 offset=$(peek_file_be "$1" 64 8)
74 echo "Snapshots in $1:" | _filter_testdir | _filter_imgfmt
77 id_len=$(peek_file_be "$1" $((offset + 12)) 2)
78 name_len=$(peek_file_be "$1" $((offset + 14)) 2)
79 extra_len=$(peek_file_be "$1" $((offset + 36)) 4)
86 echo " ID: $(peek_file_raw "$1" $id_ofs $id_len)"
87 echo " Name: $(peek_file_raw "$1" $name_ofs $name_len)"
90 echo " VM state size: $(peek_file_be "$1" $extra_ofs 8)"
93 echo " Disk size: $(peek_file_be "$1" $((extra_ofs + 8)) 8)"
96 echo " Icount: $(peek_file_be "$1" $((extra_ofs + 16)) 8)"
100 "$(peek_file_raw "$1" $((extra_ofs + 16)) $((extra_len - 16)) \
104 offset=$((offset + $(snapshot_table_entry_size "$1" $offset)))
111 # $1: Start offset of what to allocate
118 cluster=$(($1 / 65536))
124 exit 1
127 cluster=$((cluster + 1))
133 echo '=== Create v2 template ==='
136 # Create v2 image with a snapshot table with three entries:
137 # [0]: No extra data (valid with v2, not valid with v3)
138 # [1]: Has extra data unknown to qemu
140 # valid with v2, not valid with v3)
142 TEST_IMG="$TEST_IMG.v2.orig" IMGOPTS='compat=0.10' _make_test_img 64M
143 $QEMU_IMG snapshot -c sn0 "$TEST_IMG.v2.orig"
144 $QEMU_IMG snapshot -c sn1 "$TEST_IMG.v2.orig"
145 $QEMU_IMG snapshot -c sn2 "$TEST_IMG.v2.orig"
148 sn_table_ofs=$(peek_file_be "$TEST_IMG.v2.orig" 64 8)
155 sn0_eds=$(peek_file_be "$TEST_IMG.v2.orig" $((sn0_ofs + 36)) 4)
156 sn0_ids=$(($(peek_file_be "$TEST_IMG.v2.orig" $((sn0_ofs + 12)) 2) +
157 $(peek_file_be "$TEST_IMG.v2.orig" $((sn0_ofs + 14)) 2)))
158 sn0_len=$(snapshot_table_entry_size "$TEST_IMG.v2.orig" $sn0_ofs)
160 sn1_eds=$(peek_file_be "$TEST_IMG.v2.orig" $((sn1_ofs + 36)) 4)
161 sn1_ids=$(($(peek_file_be "$TEST_IMG.v2.orig" $((sn1_ofs + 12)) 2) +
162 $(peek_file_be "$TEST_IMG.v2.orig" $((sn1_ofs + 14)) 2)))
163 sn1_len=$(snapshot_table_entry_size "$TEST_IMG.v2.orig" $sn1_ofs)
165 sn2_eds=$(peek_file_be "$TEST_IMG.v2.orig" $((sn2_ofs + 36)) 4)
166 sn2_ids=$(($(peek_file_be "$TEST_IMG.v2.orig" $((sn2_ofs + 12)) 2) +
167 $(peek_file_be "$TEST_IMG.v2.orig" $((sn2_ofs + 14)) 2)))
168 sn2_len=$(snapshot_table_entry_size "$TEST_IMG.v2.orig" $sn2_ofs)
171 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn0-pre" bs=1 skip=$sn0_ofs count=40 \
173 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn1-pre" bs=1 skip=$sn1_ofs count=40 \
175 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn2-pre" bs=1 skip=$sn2_ofs count=40 \
179 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn0-extra" bs=1 \
181 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn1-extra" bs=1 \
183 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn2-extra" bs=1 \
187 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn0-post" bs=1 \
190 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn1-post" bs=1 \
193 dd if="$TEST_IMG.v2.orig" of="$TEST_DIR/sn2-post" bs=1 \
224 | dd of="$TEST_IMG.v2.orig" bs=1 seek=$sn_table_ofs conv=notrunc \
228 TEST_IMG="$TEST_IMG.v2.orig" _check_test_img
229 print_snapshot_table "$TEST_IMG.v2.orig"
235 cp "$TEST_IMG.v2.orig" "$TEST_IMG.v3.orig"
244 # Force the v2 file to be v3. v3 requires each snapshot table entry
247 cp "$TEST_IMG.v2.orig" "$TEST_IMG"
261 # (v3 by default, v2 by choice through $IMGOPTS.)
265 if echo "$IMGOPTS" | grep -q 'compat=\(0\.10\|v2\)' 2> /dev/null; then
266 subver=v2
327 # Fill a snapshot with 1 kB of extra data, a 65535-char ID, and a
343 # 1 kB of extra data
349 # Hook up snapshot table somewhere safe (at 1 MB)
356 dd if="$TEST_DIR/sn0" of="$TEST_IMG" bs=1 seek=$offset conv=notrunc \
360 sn_count=$((sn_count + 1))
366 # (Put it two clusters before 1 MB, and one L2 table one cluster
367 # before 1 MB)
383 "$(printf '%08x' $sn_count | sed -e 's/\(..\)/\\x\1/g')"
395 echo "$((sn_count - 1)) snapshots should remain:"
412 # decreasing to 1 kB, the penultimate snapshot will fit into 64 MB
424 # truncated to 1 kB), so we drop the last three snapshots and
434 # (The -1024 comes from the 1 kB of extra data we already have)
438 "$(printf '%08x' $extra_data_size | sed -e 's/\(..\)/\\x\1/g')"
442 sn_count=$((sn_count + 1))
446 dd if="$TEST_DIR/sn0" of="$TEST_IMG" bs=1 seek=$offset conv=notrunc \
450 sn_count=$((sn_count + 1))
464 "$(printf '%08x' $sn_count | sed -e 's/\(..\)/\\x\1/g')"
480 # Create a v2 image, for speeds' sake: All-zero snapshot table entries
481 # are only valid in v2.
484 # Hook up snapshot table somewhere safe (at 1 MB)
490 # only in v2 (v3 needs 16 bytes of extra data, so we would have to
496 # (Put it two clusters before 1 MB, and one L2 table one cluster
497 # before 1 MB)