local blocksize
local block
local subsector
-
+
echo "# $device: reiserfs filesystem detected" 1>&2
echo "fstype reiserfs"
# Step 6: Get filesystem blocksize and convert sector number to filesystem block number
blocksize="`debugreiserfs $device 2>/dev/null | awk '/^Blocksize:/{print $2/512}'`"
-
+
if [ -z "$blocksize" ]; then
- echo "! $device is not reiserfs" 1>&2
- exit 1
+ echo "! $device is not reiserfs" 1>&2
+ exit 1
fi
block="`dc -e "$sector $blocksize ~ n [ ] n p"`" #`"
# Step 7: Check, whether block is in use
if debugreiserfs -1 $block $device 2>&1 >/dev/null | grep -qF "free in ondisk bitmap"; then
- echo "blockstate free"
- exit 0
+ echo "blockstate free"
+ exit 0
fi
echo "blockstate used"
type="`debugreiserfs -1 $block $device 2>/dev/null | sed -e '/^=*$/d' | head -1`"
case "$type" in
- "Looks like unformatted") type="data" ;;
- "Reiserfs super block"*) type="superblock" ;;
- "LEAF NODE"*) type="meta" ;;
- "INTERNAL NODE"*) type="meta" ;;
- "Desc block"*) type="journal" ;;
- *) type="" ;;
+ "Looks like unformatted") type="data" ;;
+ "Reiserfs super block"*) type="superblock" ;;
+ "LEAF NODE"*) type="meta" ;;
+ "INTERNAL NODE"*) type="meta" ;;
+ "Desc block"*) type="journal" ;;
+ *) type="" ;;
esac
if [ -n "$type" ]; then
- echo "blocktype $type"
+ echo "blocktype $type"
fi
# Step 8: Find object id to which this block belongs
if entry is None:
return [ '/' ]
else:
- rv = []
- for name, parent in entry:
- for path in scan_path(parent):
- rv.append(os.path.join(path,name))
- return rv
+ rv = []
+ for name, parent in entry:
+ for path in scan_path(parent):
+ rv.append(os.path.join(path,name))
+ return rv
def parse():
global fp
while True:
- while True:
- l = fp.readline()
+ while True:
+ l = fp.readline()
#sys.stderr.write("> parse: %s\n" % repr(l))
- if not(l) : return
+ if not(l) : return
if l.strip() == 67*"=" : break
- parse_leafnode()
+ parse_leafnode()
parse()