From 42cefe94f7ba94a81610cdf332cf9b448872b1f9 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Mon, 30 Mar 2015 16:20:02 +1100 Subject: [PATCH] Revised a plan. --- samples/forgetfs/forget_fs.go | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/samples/forgetfs/forget_fs.go b/samples/forgetfs/forget_fs.go index fe28174..76b4af8 100644 --- a/samples/forgetfs/forget_fs.go +++ b/samples/forgetfs/forget_fs.go @@ -14,7 +14,10 @@ package forgetfs -import "github.com/jacobsa/fuse" +import ( + "github.com/jacobsa/fuse" + "github.com/jacobsa/fuse/fuseutil" +) // Create a file system whose sole contents are a file named "foo" and a // directory named "bar". @@ -30,15 +33,27 @@ import "github.com/jacobsa/fuse" // there are no inodes with non-zero reference counts remaining, after // unmounting. func NewFileSystem() (fs *ForgetFS) { - fs = &ForgetFS{} + impl := &fsImpl{} + + fs = &ForgetFS{ + impl: impl, + server: fuseutil.NewFileSystemServer(impl), + } + return } +//////////////////////////////////////////////////////////////////////// +// ForgetFS +//////////////////////////////////////////////////////////////////////// + type ForgetFS struct { + impl *fsImpl + server fuse.Server } func (fs *ForgetFS) ServeOps(c *fuse.Connection) { - panic("TODO: Export dispatch function from fuseutil and use it here.") + fs.server.ServeOps(c) } // Panic if there are any inodes that have a non-zero reference count. For use @@ -46,3 +61,11 @@ func (fs *ForgetFS) ServeOps(c *fuse.Connection) { func (fs *ForgetFS) Check() { panic("TODO") } + +//////////////////////////////////////////////////////////////////////// +// Actual implementation +//////////////////////////////////////////////////////////////////////// + +type fsImpl struct { + fuseutil.NotImplementedFileSystem +}