cammount: quieter. and only exit when 'q' is pressed.

Change-Id: I2c8719490f977d14e526cd34672ce784589dd460
This commit is contained in:
Brad Fitzpatrick 2013-07-11 19:21:59 +10:00
parent d245059531
commit 167138fd65
4 changed files with 10 additions and 5 deletions

View File

@ -74,8 +74,13 @@ func main() {
sigc := make(chan os.Signal, 1)
go func() {
var buf [1]byte
os.Stdin.Read(buf[:])
log.Printf("Read from stdin; shutting down.")
for {
os.Stdin.Read(buf[:])
if buf[0] == 'q' {
break
}
}
log.Printf("Read 'q' from stdin; shutting down.")
sigc <- syscall.SIGUSR2
}()
waitc := make(chan error, 1)

View File

@ -38,6 +38,7 @@ $ENV{"CAMLI_AUTH"} = "userpass:camlistore:pass3179";
my $in_child = "false";
if ($^O eq "darwin") {
$in_child = "true";
print "############################################################################\n## Press 'q' <enter> to shut down.\n##\n";
}
exec("$cammount", "--mount_in_child=$in_child", "--server=http://localhost:3179/bs", $dir, @blobref_arg)
@ -46,9 +47,7 @@ warn "Failed to unmount\n" unless try_unmount();
sub try_unmount {
if ($^O eq "darwin") {
print "Try unmount darwin...\n";
unless (`df -n` =~ /\Q$dir\E/) {
print "Not mounted.\n";
return 1;
}
print "Running: diskutil unmount force $dir ...\n";

View File

@ -301,7 +301,6 @@ func (fs *CamliFileSystem) Root() (fuse.Node, fuse.Error) {
}
func (fs *CamliFileSystem) Statfs(req *fuse.StatfsRequest, res *fuse.StatfsResponse, intr fuse.Intr) fuse.Error {
log.Printf("CAMLI StatFS")
// Make some stuff up, just to see if it makes "lsof" happy.
res.Blocks = 1 << 35
res.Bfree = 1 << 34

View File

@ -90,6 +90,8 @@ func (n *root) Lookup(name string, intr fuse.Intr) (fuse.Node, fuse.Error) {
return n.getRootsDir(), nil
case "sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx":
return notImplementDirNode{}, nil
case "mach_kernel", ".hidden", "._.":
return nil, fuse.ENOENT
}
br := blobref.Parse(name)