Commit 5ee7b794 authored by Ivan Krasin's avatar Ivan Krasin

Added stub for receive_fuse_conn

parent 376d1aa1
...@@ -7,5 +7,8 @@ GOFILES=\ ...@@ -7,5 +7,8 @@ GOFILES=\
fuse.go\ fuse.go\
types.go\ types.go\
OFILES=\
utils.$O\
include $(GOROOT)/src/Make.pkg include $(GOROOT)/src/Make.pkg
...@@ -14,6 +14,7 @@ type FileSystem interface { ...@@ -14,6 +14,7 @@ type FileSystem interface {
type MountPoint struct { type MountPoint struct {
mountPoint string mountPoint string
f *os.File
} }
// Mount create a fuse fs on the specified mount point. // Mount create a fuse fs on the specified mount point.
...@@ -48,7 +49,11 @@ func Mount(mountPoint string, fs FileSystem) (m *MountPoint, err os.Error) { ...@@ -48,7 +49,11 @@ func Mount(mountPoint string, fs FileSystem) (m *MountPoint, err os.Error) {
if w.ExitStatus() != 0 { if w.ExitStatus() != 0 {
return nil, os.NewError(fmt.Sprintf("fusermount exited with code %d\n", w.ExitStatus())) return nil, os.NewError(fmt.Sprintf("fusermount exited with code %d\n", w.ExitStatus()))
} }
m = &MountPoint { mountPoint } f, err := getFuseConn(local)
if err != nil {
return
}
m = &MountPoint { mountPoint, f }
return return
} }
...@@ -68,6 +73,19 @@ func (m *MountPoint) Unmount() (err os.Error) { ...@@ -68,6 +73,19 @@ func (m *MountPoint) Unmount() (err os.Error) {
if w.ExitStatus() != 0 { if w.ExitStatus() != 0 {
return os.NewError(fmt.Sprintf("fusermount exited with code %d\n", w.ExitStatus())) return os.NewError(fmt.Sprintf("fusermount exited with code %d\n", w.ExitStatus()))
} }
m.f.Close()
return
}
func getFuseConn(local net.Conn) (f * os.File, err os.Error) {
var fd int
errno := receive_fuse_conn(local.File().Fd(), &fd)
if errno != 0 {
return nil, os.NewError(fmt.Sprintf("receive_fuse_conn failed with errno: %d", errno))
}
f = os.NewFile(fd, "fuse-conn")
return return
} }
func receive_fuse_conn(fd int, fuse_fd *int) int
int receive_fuse_conn(int fd, int* fuse_fd) {
if (fd < 0) {
return -1;
}
*fuse_fd = -1;
return -1;
}
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