diff --git a/clients/go/cammount/main.go b/clients/go/cammount/main.go index e26b24193..8b5d72682 100644 --- a/clients/go/cammount/main.go +++ b/clients/go/cammount/main.go @@ -20,6 +20,7 @@ import ( "flag" "fmt" "io/ioutil" + "log" "os" "sort" @@ -28,7 +29,8 @@ import ( "camlistore.org/pkg/cacher" "camlistore.org/pkg/client" "camlistore.org/pkg/fs" - "camlistore.org/third_party/github.com/hanwen/go-fuse/fuse" + + "camlistore.org/third_party/code.google.com/p/rsc/fuse" ) func PrintMap(m map[string]float64) { @@ -48,7 +50,6 @@ func PrintMap(m map[string]float64) { func main() { // Scans the arg list and sets up flags debug := flag.Bool("debug", false, "print debugging messages.") - threaded := flag.Bool("threaded", true, "switch off threading; print debugging messages.") client.AddFlags() flag.Parse() @@ -79,35 +80,19 @@ func main() { fetcher := cacher.NewCachingFetcher(diskcache, client) fs := fs.NewCamliFileSystem(fetcher, root) - timing := fuse.NewTimingPathFilesystem(fs) - - conn := fuse.NewPathFileSystemConnector(timing) - rawTiming := fuse.NewTimingRawFilesystem(conn) - - state := fuse.NewMountState(rawTiming) - state.Debug = *debug - - mountPoint := flag.Arg(1) - err = state.Mount(mountPoint) - if err != nil { - fmt.Printf("MountFuse fail: %v\n", err) - os.Exit(1) + if *debug { + // TODO: set fs's logger } - fmt.Printf("Mounted %s on %s (threaded=%v, debug=%v)\n", root.String(), mountPoint, *threaded, *debug) - state.Loop(*threaded) - fmt.Println("Finished", state.Stats()) + mountPoint := flag.Arg(1) - counts := state.OperationCounts() - fmt.Println("Counts: ", counts) - - latency := state.Latencies() - fmt.Println("MountState latency (ms):") - PrintMap(latency) - - latency = timing.Latencies() - fmt.Println("Path ops (ms):", latency) - - latency = rawTiming.Latencies() - fmt.Println("Raw FS (ms):", latency) + conn, err := fuse.Mount(mountPoint) + if err != nil { + log.Fatalf("Mount: %v", err) + } + err = conn.Serve(fs) + if err != nil { + log.Fatalf("Serve: %", err) + } + log.Printf("fuse process ending.") } diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index dfeb355b8..e8d2bb767 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -36,6 +36,7 @@ import ( var _ = fmt.Println var _ = log.Println +var _ = bytes.NewReader var errNotDir = fuse.Errno(syscall.ENOTDIR) @@ -48,6 +49,15 @@ type CamliFileSystem struct { nameToAttr *lru.Cache // ~map[string]*fuse.Attr } +type CamliFile struct { + fs *CamliFileSystem + blob *blobref.BlobRef + ss *schema.Superset + + size uint64 // memoized +} + + var _ fuse.FS = (*CamliFileSystem)(nil) func NewCamliFileSystem(fetcher blobref.SeekFetcher, root *blobref.BlobRef) *CamliFileSystem { @@ -206,6 +216,7 @@ func (fs *CamliFileSystem) blobRefFromName(name string) (retbr *blobref.BlobRef, return nil, fuse.ENOENT } +/* func (fs *CamliFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Error) { if attr, ok := fs.nameToAttr.Get(name); ok { return attr.(*fuse.Attr), nil @@ -384,14 +395,6 @@ func (fs *CamliFileSystem) Readlink(name string) (target string, status fuse.Err return ss.SymlinkTargetString(), nil } -type CamliFile struct { - fs *CamliFileSystem - blob *blobref.BlobRef - ss *schema.Superset - - size uint64 // memoized -} - func (f *CamliFile) Size() uint64 { if f.size == 0 { f.size = f.ss.SumPartsSize() @@ -429,6 +432,8 @@ func (file *CamliFile) Read(ri *fuse.ReadIn, bp *fuse.BufferPool) (retbuf []byte return } +*/ + func (file *CamliFile) GetReader() (io.ReadCloser, error) { return file.ss.NewFileReader(file.fs.fetcher) }