From 167138fd6535d6ac994e6c6f4ed8b7a4536d0586 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 11 Jul 2013 19:21:59 +1000 Subject: [PATCH] cammount: quieter. and only exit when 'q' is pressed. Change-Id: I2c8719490f977d14e526cd34672ce784589dd460 --- cmd/cammount/cammount.go | 9 +++++++-- dev-cammount | 3 +-- pkg/fs/fs.go | 1 - pkg/fs/root.go | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/cammount/cammount.go b/cmd/cammount/cammount.go index 51511cd9c..9eb111f04 100644 --- a/cmd/cammount/cammount.go +++ b/cmd/cammount/cammount.go @@ -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) diff --git a/dev-cammount b/dev-cammount index 58b715fef..db11bb186 100755 --- a/dev-cammount +++ b/dev-cammount @@ -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' 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"; diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index d21751cc8..4f512d331 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -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 diff --git a/pkg/fs/root.go b/pkg/fs/root.go index d96542db2..cd33f9eac 100644 --- a/pkg/fs/root.go +++ b/pkg/fs/root.go @@ -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)