--- a/blockfuse Wed Aug 03 23:40:54 2011 +0200
+++ b/blockfuse Wed Aug 03 23:49:55 2011 +0200
@@ -13,7 +13,7 @@
# blockfuse /mnt
# rsync --inplace -Pa /mnt/sda1 /images/sda1
-# Just a short hack, not documentation, nothing else.
+# Just a short hack, not documentation, nothing else.
# If your're insterested in extending this tool, please tell me, I'm
# willing to put it under some Open Source License. (Currently it's
# not!)
@@ -27,17 +27,15 @@
my $mountpoint = shift // die "$0: need mountpoint!\n";
-if (not `uname -m` =~ /64/) {
- warn "Your're probably not running a 64bit system, the devices sizes "
- . "will be incorrect!\n";
-}
+warn "Your're probably not running a 64bit system, the devices sizes "
+ . "will be incorrect!\n"
+ if not `uname -m` =~ /64/;
fork() and exit 0;
open(STDIN, "</dev/null");
setpgid($$ => $$);
-
Fuse::main(
mountpoint => $mountpoint,
getattr => \&my_getattr,
@@ -52,12 +50,11 @@
my $path = "/dev" . shift;
my @attr = stat $path;
if (-b $path) {
- $attr[9] = time; # fake mtime
- $attr[6] = 0; # clear major/minor
+ $attr[9] = time; # fake mtime
+ $attr[6] = 0; # clear major/minor
$attr[2] |= 0b1000_0000_0000_0000; # set regular file
$attr[2] &= 0b1001_1111_1111_1111; # clear block device
-
eval {
open(my $fh => $path); # size
seek($fh, 0, SEEK_END);