+_filesize()
+{
+ ls -l $1 | $AWK_PROG -v bsize="$bsize" '{print "filesize = " $5 / bsize}'
+}
+
+_block_filter()
+{
+ $AWK_PROG -v bsize="$bsize" '
+ /blocksize/ {
+ printf(" blocksize BSIZE\n")
+
+ next
+ }
+
+ /CMD/ {
+ split($3, off, "=")
+ offset = strtonum(off[2])
+ if (offset != -1)
+ offset = offset / bsize
+
+ split($4, len, "=")
+ nr_blocks = strtonum(len[2])
+ if (nr_blocks != -1)
+ nr_blocks = nr_blocks / bsize
+
+ printf(" %s %s off=%s, len=%d\n", $1, $2, offset, nr_blocks)
+
+ next
+ }
+
+ /MAP/ {
+ split($2, off, "=")
+ offset = strtonum(off[2])
+ if (offset != -1)
+ offset = offset / bsize
+
+ split($3, len, "=")
+
+ nr_blocks = strtonum(len[2])
+
+ if (nr_blocks != -1)
+ nr_blocks = nr_blocks / bsize
+
+ printf(" %s off=%s, len=%d %s\n", $1, offset, nr_blocks, $4)
+
+ next
+ }
+
+ /TRUNCATE/ {
+ split($2, off, "=")
+ offset = strtonum(off[2]) / bsize
+
+ printf(" %s off=%s\n", $1, offset)
+
+ next
+ }
+
+ /\[[0-9]+,[0-9]+\]:/ {
+ printf(" %s BLOCKRANGE\n", $1)
+
+ next
+ }
+
+ {
+ print
+
+ next
+ }
+ '
+}
+