X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=2019-fosdem%2Fbadblocks.sh;fp=2019-fosdem%2Fbadblocks.sh;h=863c6b53d8d6088096416c2f37e6e7c26ffc0441;hb=0d929b23526e74b6f5a49e34b0019f928c7bfec1;hp=0000000000000000000000000000000000000000;hpb=4507e94c3ba68dbf455a9399de5f4ac1732eb5b7;p=libguestfs-talks.git diff --git a/2019-fosdem/badblocks.sh b/2019-fosdem/badblocks.sh new file mode 100755 index 0000000..863c6b5 --- /dev/null +++ b/2019-fosdem/badblocks.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +case "$1" in + open) ;; + get_size) echo 64M ;; + pread) + if [ $4 -le 100000 ] && [ $(( $4+$3 )) -gt 100000 ]; then + echo EIO Bad block >&2 + exit 1 + else + dd if=/dev/zero count=$3 iflag=count_bytes + fi ;; + *) exit 2 ;; +esac