Commit 042b95af authored by Ivan Krasin's avatar Ivan Krasin

Eliminated Init func from FileSystem interface

parent a4692c96
...@@ -13,7 +13,6 @@ const ( ...@@ -13,7 +13,6 @@ const (
) )
type FileSystem interface { type FileSystem interface {
Init(in *InitIn) (out *InitOut, code Error, err os.Error)
GetAttr(h *InHeader, in *GetAttrIn) (out *AttrOut, code Error, err os.Error) GetAttr(h *InHeader, in *GetAttrIn) (out *AttrOut, code Error, err os.Error)
} }
...@@ -138,13 +137,20 @@ func initFuse(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest) ...@@ -138,13 +137,20 @@ func initFuse(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest)
return return
} }
fmt.Printf("in: %v\n", in) fmt.Printf("in: %v\n", in)
var out *InitOut if in.Major != FUSE_KERNEL_VERSION {
out, res, err := fs.Init(in) fmt.Printf("Major versions does not match. Given %d, want %d\n", in.Major, FUSE_KERNEL_VERSION)
if err != nil { return serialize(h, EIO, nil)
return }
} if in.Minor < FUSE_KERNEL_MINOR_VERSION {
data, err = serialize(h, res, out) fmt.Printf("Minor version is less than we support. Given %d, want at least %d\n", in.Minor, FUSE_KERNEL_MINOR_VERSION)
return return serialize(h, EIO, nil)
}
out := new(InitOut)
out.Major = FUSE_KERNEL_VERSION
out.Minor = FUSE_KERNEL_MINOR_VERSION
out.MaxReadAhead = in.MaxReadAhead
out.MaxWrite = 65536
return serialize(h, OK, out)
} }
func getAttr(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest) (data [][]byte, err os.Error) { func getAttr(fs FileSystem, h *InHeader, r io.Reader, mr chan *managerRequest) (data [][]byte, err os.Error) {
......
package fuse package fuse
import ( import (
"fmt"
"log" "log"
"os" "os"
"testing" "testing"
...@@ -13,25 +12,6 @@ const ( ...@@ -13,25 +12,6 @@ const (
type testFuse struct{} type testFuse struct{}
func (fs *testFuse) Init(in *InitIn) (out *InitOut, code Error, err os.Error) {
if in.Major != FUSE_KERNEL_VERSION {
fmt.Printf("Major versions does not match. Given %d, want %d\n", in.Major, FUSE_KERNEL_VERSION)
code = EIO
return
}
if in.Minor < FUSE_KERNEL_MINOR_VERSION {
fmt.Printf("Minor version is less than we support. Given %d, want at least %d\n", in.Minor, FUSE_KERNEL_MINOR_VERSION)
code = EIO
return
}
out = new(InitOut)
out.Major = FUSE_KERNEL_VERSION
out.Minor = FUSE_KERNEL_MINOR_VERSION
out.MaxReadAhead = in.MaxReadAhead
out.MaxWrite = 65536
return
}
func (fs *testFuse) GetAttr(h *InHeader, in *GetAttrIn) (out *AttrOut, code Error, err os.Error) { func (fs *testFuse) GetAttr(h *InHeader, in *GetAttrIn) (out *AttrOut, code Error, err os.Error) {
out = new(AttrOut) out = new(AttrOut)
out.Ino = h.NodeId out.Ino = h.NodeId
......
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