Commit 7730a211 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: compile on Darwin.

parent 49c96946
...@@ -121,9 +121,9 @@ func mount(dir string, options string) (int, error) { ...@@ -121,9 +121,9 @@ func mount(dir string, options string) (int, error) {
defer C.free(unsafe.Pointer(cdir)) defer C.free(unsafe.Pointer(cdir))
fd := C.mountfuse(cdir, errp) fd := C.mountfuse(cdir, errp)
if *errp != nil { if *errp != nil {
return nil, mountError(C.GoString(*errp)) return -1, mountError(C.GoString(*errp))
} }
return fd, nil return int(fd), nil
} }
type mountError string type mountError string
......
package fuse package pathfs
import ( import (
"syscall" "syscall"
"github.com/hanwen/go-fuse/fuse"
) )
func (fs *LoopbackFileSystem) StatFs(name string) *StatfsOut { func (fs *loopbackFileSystem) StatFs(name string) *fuse.StatfsOut {
s := syscall.Statfs_t{} s := syscall.Statfs_t{}
err := syscall.Statfs(fs.GetPath(name), &s) err := syscall.Statfs(fs.GetPath(name), &s)
if err == nil { if err == nil {
return &StatfsOut{ return &fuse.StatfsOut{
Blocks: s.Blocks, Blocks: s.Blocks,
Bsize: uint32(s.Bsize), Bsize: uint32(s.Bsize),
Bfree: s.Bfree, Bfree: s.Bfree,
......
...@@ -108,3 +108,12 @@ func sysListxattr(path string, dest []byte) (sz int, err error) { ...@@ -108,3 +108,12 @@ func sysListxattr(path string, dest []byte) (sz int, err error) {
} }
return return
} }
func sysSetxattr(path string, attr string, val, flag) error {
return syscall.Setxattr(path, attr, val, flag)
}
func sysRemovexattr(path string, attr string) error {
return syscall.Removexattr(path, attr)
}
...@@ -172,7 +172,7 @@ func TestXAttrRead(t *testing.T) { ...@@ -172,7 +172,7 @@ func TestXAttrRead(t *testing.T) {
} }
} }
err = syscall.Setxattr(mounted, "third", []byte("value"), 0) err = sysSetxattr(mounted, "third", []byte("value"), 0)
if err != nil { if err != nil {
t.Error("Setxattr error", err) t.Error("Setxattr error", err)
} }
...@@ -181,7 +181,7 @@ func TestXAttrRead(t *testing.T) { ...@@ -181,7 +181,7 @@ func TestXAttrRead(t *testing.T) {
t.Error("Read back set xattr:", err, string(val)) t.Error("Read back set xattr:", err, string(val))
} }
syscall.Removexattr(mounted, "third") sysRemovexattr(mounted, "third")
val, err = readXAttr(mounted, "third") val, err = readXAttr(mounted, "third")
if err != syscall.ENODATA { if err != syscall.ENODATA {
t.Error("Data not removed?", err, val) t.Error("Data not removed?", err, val)
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
func (ms *Server) systemWrite(req *request, header []byte) Status { func (ms *Server) systemWrite(req *request, header []byte) Status {
if req.flatDataSize() == 0 { if req.flatDataSize() == 0 {
_, err := syscall.Write(ms.mountFd, Write(header)) _, err := syscall.Write(ms.mountFd, header)
return ToStatus(err) return ToStatus(err)
} }
......
...@@ -8,6 +8,6 @@ func (s *Server) setSplice() { ...@@ -8,6 +8,6 @@ func (s *Server) setSplice() {
panic("darwin has no splice.") panic("darwin has no splice.")
} }
func (ms *Server) trySplice(header []byte, req *request, fdData *ReadResultFd) error { func (ms *Server) trySplice(header []byte, req *request, fdData *readResultFd) error {
return fmt.Errorf("unimplemented") return fmt.Errorf("unimplemented")
} }
...@@ -51,6 +51,7 @@ const ( ...@@ -51,6 +51,7 @@ const (
) )
type GetAttrIn struct { type GetAttrIn struct {
InHeader
} }
func (g *GetAttrIn) Flags() uint32 { func (g *GetAttrIn) Flags() uint32 {
......
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