Commit 1f16ee66 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: Hide the RawFileSystem implementation of FileSystemConnector behind

the RawFS() method.
parent e50569a4
......@@ -43,7 +43,7 @@ func main() {
}
pathFs := pathfs.NewPathNodeFs(finalFs, nil)
conn := fuse.NewFileSystemConnector(pathFs, opts)
state := fuse.NewMountState(conn)
state := fuse.NewMountState(conn.RawFS())
state.SetDebug(*debug)
mountPoint := flag.Arg(0)
......
......@@ -21,22 +21,17 @@ var paranoia = false
// FilesystemConnector is a raw FUSE filesystem that manages
// in-process mounts and inodes. Its job is twofold:
//
// * It translates between the raw kernel interface (padded structs of
// It translates between the raw kernel interface (padded structs of
// int32 and int64) and the more abstract Go-ish NodeFileSystem
// interface.
//
// * It manages mounting and unmounting of NodeFileSystems into the
// directory hierarchy
//
// To achieve this, the connector only needs a pointer to the root
// node.
// It manages mounting and unmounting of NodeFileSystems into the
// directory hierarchy.
type FileSystemConnector struct {
// Used as the generation inodes. This must be 64-bit aligned,
// for sync/atomic on i386 to work properly.
generation uint64
DefaultRawFileSystem
debug bool
// Callbacks for talking back to the kernel.
......@@ -100,12 +95,11 @@ func (c *FileSystemConnector) verify() {
root.verify(c.rootNode.mountPoint)
}
// Generate EntryOut and increase the lookup count for an inode.
func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
func (c *rawBridge) childLookup(out *raw.EntryOut, fsi FsNode) {
n := fsi.Inode()
fsi.GetAttr((*Attr)(&out.Attr), nil, nil)
n.mount.fillEntry(out)
out.Ino = c.lookupUpdate(n)
out.Ino = c.fsConn().lookupUpdate(n)
out.NodeId = out.Ino
if out.Nlink == 0 {
// With Nlink == 0, newer kernels will refuse link
......@@ -114,7 +108,7 @@ func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
}
}
func (c *FileSystemConnector) toInode(nodeid uint64) *Inode {
func (c *rawBridge) toInode(nodeid uint64) *Inode {
if nodeid == raw.FUSE_ROOT_ID {
return c.rootNode
}
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ var _ = log.Println
func MountNodeFileSystem(mountpoint string, nodeFs NodeFileSystem, opts *FileSystemOptions) (*MountState, *FileSystemConnector, error) {
conn := NewFileSystemConnector(nodeFs, opts)
mountState := NewMountState(conn)
mountState := NewMountState(conn.RawFS())
err := mountState.Mount(mountpoint, nil)
if err != nil {
return nil, nil, err
......
......@@ -30,7 +30,7 @@ func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
NegativeTimeout: 0.0,
})
connector.SetDebug(VerboseTest())
state := NewMountState(connector)
state := NewMountState(connector.RawFS())
state.Mount(mnt, nil)
//me.state.SetDebug(false)
......
......@@ -84,7 +84,7 @@ func NewTestCase(t *testing.T) *testCase {
AttrTimeout: testTtl,
NegativeTimeout: 0.0,
})
rfs = fuse.NewLockingRawFileSystem(me.connector)
rfs = fuse.NewLockingRawFileSystem(me.connector.RawFS())
me.connector.SetDebug(fuse.VerboseTest())
me.state = fuse.NewMountState(rfs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment