64 |
sub read_filenames; |
sub read_filenames; |
65 |
sub fuse_module_loaded; |
sub fuse_module_loaded; |
66 |
|
|
67 |
|
# evil, evil way to solve this. It makes this module non-reentrant. But, since |
68 |
|
# fuse calls another copy of this script for each mount anyway, this shouldn't |
69 |
|
# be a problem. |
70 |
|
my $fuse_self; |
71 |
|
|
72 |
sub mount { |
sub mount { |
73 |
my $class = shift; |
my $class = shift; |
74 |
my $self = {}; |
my $self = {}; |
82 |
carp "mount needs 'mount' as mountpoint" unless ($arg->{'mount'}); |
carp "mount needs 'mount' as mountpoint" unless ($arg->{'mount'}); |
83 |
|
|
84 |
# save (some) arguments in self |
# save (some) arguments in self |
85 |
$self->{$_} = $arg->{$_} foreach (qw(mount)); |
foreach (qw(mount invalidate)) { |
86 |
|
$self->{$_} = $arg->{$_}; |
87 |
|
$fuse_self->{$_} = $arg->{$_}; |
88 |
|
} |
89 |
|
|
90 |
foreach (qw(filenames read update)) { |
foreach (qw(filenames read update)) { |
91 |
carp "mount needs '$_' SQL" unless ($arg->{$_}); |
carp "mount needs '$_' SQL" unless ($arg->{$_}); |
151 |
return 1; |
return 1; |
152 |
} |
} |
153 |
|
|
154 |
|
#$SIG{'INT'} = sub { |
155 |
|
# print STDERR "umount called by SIG INT\n"; |
156 |
|
# umount; |
157 |
|
#}; |
158 |
|
|
159 |
|
sub DESTROY { |
160 |
|
my $self = shift; |
161 |
|
print STDERR "umount called by DESTROY\n"; |
162 |
|
$self->umount; |
163 |
|
} |
164 |
|
|
165 |
=head2 fuse_module_loaded |
=head2 fuse_module_loaded |
166 |
|
|
167 |
Checks if C<fuse> module is loaded in kernel. |
Checks if C<fuse> module is loaded in kernel. |
367 |
return 0; |
return 0; |
368 |
} |
} |
369 |
print "updated '$file' [",$files{$file}{id},"]\n"; |
print "updated '$file' [",$files{$file}{id},"]\n"; |
370 |
|
|
371 |
|
$fuse_self->{'invalidate'}->() if (ref $fuse_self->{'invalidate'}); |
372 |
} |
} |
373 |
return 1; |
return 1; |
374 |
} |
} |