Replace tar2iso example with badblocks example.
[libguestfs-talks.git] / 2019-fosdem / badblocks.sh
diff --git a/2019-fosdem/badblocks.sh b/2019-fosdem/badblocks.sh
new file mode 100755 (executable)
index 0000000..863c6b5
--- /dev/null
@@ -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