bin/blockfuse
changeset 12 01a602d2806e
parent 10 4ab3408f01d2
equal deleted inserted replaced
11:d449f009da48 12:01a602d2806e
    21 # You should have received a copy of the GNU General Public License
    21 # You should have received a copy of the GNU General Public License
    22 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    22 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    23 
    23 
    24 
    24 
    25 # blockfuse maps the block devices found in /dev/ to regular
    25 # blockfuse maps the block devices found in /dev/ to regular
    26 # files in your mountpoint. Currently it fakes the mtime to force
    26 # files in your mountpoint. [disabled:Currently it fakes the mtime to force
    27 # rsync comparing the source and destination!
    27 # rsync comparing the source and destination!]
    28 
    28 
    29 #   blockfuse /mnt
    29 #   blockfuse /mnt
    30 #   rsync --inplace -Pa /mnt/sda1 /images/sda1
    30 #   rsync --inplace -Pa /mnt/sda1 /images/sda1
    31 
    31 
    32 # Just a short hack, no nice documentation, nothing else.
    32 # Just a short hack, no nice documentation, nothing else.
    81 
    81 
    82 sub my_getattr {
    82 sub my_getattr {
    83     my $path = "/dev" . shift;
    83     my $path = "/dev" . shift;
    84     my @attr = stat $path;
    84     my @attr = stat $path;
    85     if (-b $path) {
    85     if (-b $path) {
    86         $attr[9] = time;    # fake mtime
    86         #$attr[9] = time;    # fake mtime
    87         $attr[6] = 0;       # clear major/minor
    87         $attr[6] = 0;       # clear major/minor
    88         $attr[2] |= 0b1000_0000_0000_0000;    # set regular file
    88         $attr[2] |= 0b1000_0000_0000_0000;    # set regular file
    89         $attr[2] &= 0b1001_1111_1111_1111;    # clear block device
    89         $attr[2] &= 0b1001_1111_1111_1111;    # clear block device
    90 
    90 
    91         eval {
    91         eval {