Commit 884812f5 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Gofmt.

parent e0de488a
...@@ -347,7 +347,7 @@ type DefaultRawFileSystem struct{} ...@@ -347,7 +347,7 @@ type DefaultRawFileSystem struct{}
// will give the correct result for Lstat (ENOENT), but the kernel // will give the correct result for Lstat (ENOENT), but the kernel
// will still issue file Open() on the inode. // will still issue file Open() on the inode.
type RawFsInit struct { type RawFsInit struct {
InodeNotify func(*raw.NotifyInvalInodeOut) Status InodeNotify func(*raw.NotifyInvalInodeOut) Status
EntryNotify func(parent uint64, name string) Status EntryNotify func(parent uint64, name string) Status
DeleteNotify func(parent uint64, child uint64, name string) Status DeleteNotify func(parent uint64, child uint64, name string) Status
} }
...@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status { ...@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status {
} }
func TestDeleteNotify(t *testing.T) { func TestDeleteNotify(t *testing.T) {
dir, err := ioutil.TempDir("","") dir, err := ioutil.TempDir("", "")
if err != nil { if err != nil {
t.Fatalf("TempDir failed %v", err) t.Fatalf("TempDir failed %v", err)
} }
...@@ -57,12 +57,12 @@ func TestDeleteNotify(t *testing.T) { ...@@ -57,12 +57,12 @@ func TestDeleteNotify(t *testing.T) {
ch.FsNode().(*memNode).SetInode(nil) ch.FsNode().(*memNode).SetInode(nil)
flip := flipNode{ flip := flipNode{
memNode: ch.FsNode().(*memNode), memNode: ch.FsNode().(*memNode),
ok: make(chan int), ok: make(chan int),
} }
newCh := fs.Root().Inode().New(true, &flip) newCh := fs.Root().Inode().New(true, &flip)
fs.Root().Inode().AddChild("testdir", newCh) fs.Root().Inode().AddChild("testdir", newCh)
err = ioutil.WriteFile(mnt + "/testdir/testfile", []byte{42}, 0644) err = ioutil.WriteFile(mnt+"/testdir/testfile", []byte{42}, 0644)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -85,11 +85,11 @@ func TestDeleteNotify(t *testing.T) { ...@@ -85,11 +85,11 @@ func TestDeleteNotify(t *testing.T) {
defer func() { defer func() {
cmd.Process.Kill() cmd.Process.Kill()
time.Sleep(100*time.Millisecond) time.Sleep(100 * time.Millisecond)
}() }()
// Wait until tail opened the file. // Wait until tail opened the file.
time.Sleep(100*time.Millisecond) time.Sleep(100 * time.Millisecond)
err = os.Remove(mnt + "/testdir/testfile") err = os.Remove(mnt + "/testdir/testfile")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
......
...@@ -459,7 +459,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string ...@@ -459,7 +459,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string
} }
entry := &raw.NotifyInvalDeleteOut{ entry := &raw.NotifyInvalDeleteOut{
Parent: parent, Parent: parent,
Child: child, Child: child,
NameLen: uint32(len(name)), NameLen: uint32(len(name)),
} }
......
...@@ -57,8 +57,8 @@ const ( ...@@ -57,8 +57,8 @@ const (
_OP_BATCH_FORGET = int32(42) _OP_BATCH_FORGET = int32(42)
// Ugh - what will happen if FUSE introduces a new opcode here? // Ugh - what will happen if FUSE introduces a new opcode here?
_OP_NOTIFY_ENTRY = int32(51) _OP_NOTIFY_ENTRY = int32(51)
_OP_NOTIFY_INODE = int32(52) _OP_NOTIFY_INODE = int32(52)
_OP_NOTIFY_DELETE = int32(53) _OP_NOTIFY_DELETE = int32(53)
_OPCODE_COUNT = int32(54) _OPCODE_COUNT = int32(54)
...@@ -412,73 +412,73 @@ func init() { ...@@ -412,73 +412,73 @@ func init() {
} }
for op, sz := range map[int32]uintptr{ for op, sz := range map[int32]uintptr{
_OP_LOOKUP: unsafe.Sizeof(raw.EntryOut{}), _OP_LOOKUP: unsafe.Sizeof(raw.EntryOut{}),
_OP_GETATTR: unsafe.Sizeof(raw.AttrOut{}), _OP_GETATTR: unsafe.Sizeof(raw.AttrOut{}),
_OP_SETATTR: unsafe.Sizeof(raw.AttrOut{}), _OP_SETATTR: unsafe.Sizeof(raw.AttrOut{}),
_OP_SYMLINK: unsafe.Sizeof(raw.EntryOut{}), _OP_SYMLINK: unsafe.Sizeof(raw.EntryOut{}),
_OP_MKNOD: unsafe.Sizeof(raw.EntryOut{}), _OP_MKNOD: unsafe.Sizeof(raw.EntryOut{}),
_OP_MKDIR: unsafe.Sizeof(raw.EntryOut{}), _OP_MKDIR: unsafe.Sizeof(raw.EntryOut{}),
_OP_LINK: unsafe.Sizeof(raw.EntryOut{}), _OP_LINK: unsafe.Sizeof(raw.EntryOut{}),
_OP_OPEN: unsafe.Sizeof(raw.OpenOut{}), _OP_OPEN: unsafe.Sizeof(raw.OpenOut{}),
_OP_WRITE: unsafe.Sizeof(raw.WriteOut{}), _OP_WRITE: unsafe.Sizeof(raw.WriteOut{}),
_OP_STATFS: unsafe.Sizeof(StatfsOut{}), _OP_STATFS: unsafe.Sizeof(StatfsOut{}),
_OP_GETXATTR: unsafe.Sizeof(raw.GetXAttrOut{}), _OP_GETXATTR: unsafe.Sizeof(raw.GetXAttrOut{}),
_OP_LISTXATTR: unsafe.Sizeof(raw.GetXAttrOut{}), _OP_LISTXATTR: unsafe.Sizeof(raw.GetXAttrOut{}),
_OP_INIT: unsafe.Sizeof(raw.InitOut{}), _OP_INIT: unsafe.Sizeof(raw.InitOut{}),
_OP_OPENDIR: unsafe.Sizeof(raw.OpenOut{}), _OP_OPENDIR: unsafe.Sizeof(raw.OpenOut{}),
_OP_CREATE: unsafe.Sizeof(raw.CreateOut{}), _OP_CREATE: unsafe.Sizeof(raw.CreateOut{}),
_OP_BMAP: unsafe.Sizeof(raw.BmapOut{}), _OP_BMAP: unsafe.Sizeof(raw.BmapOut{}),
_OP_IOCTL: unsafe.Sizeof(raw.IoctlOut{}), _OP_IOCTL: unsafe.Sizeof(raw.IoctlOut{}),
_OP_POLL: unsafe.Sizeof(raw.PollOut{}), _OP_POLL: unsafe.Sizeof(raw.PollOut{}),
_OP_NOTIFY_ENTRY: unsafe.Sizeof(raw.NotifyInvalEntryOut{}), _OP_NOTIFY_ENTRY: unsafe.Sizeof(raw.NotifyInvalEntryOut{}),
_OP_NOTIFY_INODE: unsafe.Sizeof(raw.NotifyInvalInodeOut{}), _OP_NOTIFY_INODE: unsafe.Sizeof(raw.NotifyInvalInodeOut{}),
_OP_NOTIFY_DELETE: unsafe.Sizeof(raw.NotifyInvalDeleteOut{}), _OP_NOTIFY_DELETE: unsafe.Sizeof(raw.NotifyInvalDeleteOut{}),
} { } {
operationHandlers[op].OutputSize = sz operationHandlers[op].OutputSize = sz
} }
for op, v := range map[int32]string{ for op, v := range map[int32]string{
_OP_LOOKUP: "LOOKUP", _OP_LOOKUP: "LOOKUP",
_OP_FORGET: "FORGET", _OP_FORGET: "FORGET",
_OP_BATCH_FORGET: "BATCH_FORGET", _OP_BATCH_FORGET: "BATCH_FORGET",
_OP_GETATTR: "GETATTR", _OP_GETATTR: "GETATTR",
_OP_SETATTR: "SETATTR", _OP_SETATTR: "SETATTR",
_OP_READLINK: "READLINK", _OP_READLINK: "READLINK",
_OP_SYMLINK: "SYMLINK", _OP_SYMLINK: "SYMLINK",
_OP_MKNOD: "MKNOD", _OP_MKNOD: "MKNOD",
_OP_MKDIR: "MKDIR", _OP_MKDIR: "MKDIR",
_OP_UNLINK: "UNLINK", _OP_UNLINK: "UNLINK",
_OP_RMDIR: "RMDIR", _OP_RMDIR: "RMDIR",
_OP_RENAME: "RENAME", _OP_RENAME: "RENAME",
_OP_LINK: "LINK", _OP_LINK: "LINK",
_OP_OPEN: "OPEN", _OP_OPEN: "OPEN",
_OP_READ: "READ", _OP_READ: "READ",
_OP_WRITE: "WRITE", _OP_WRITE: "WRITE",
_OP_STATFS: "STATFS", _OP_STATFS: "STATFS",
_OP_RELEASE: "RELEASE", _OP_RELEASE: "RELEASE",
_OP_FSYNC: "FSYNC", _OP_FSYNC: "FSYNC",
_OP_SETXATTR: "SETXATTR", _OP_SETXATTR: "SETXATTR",
_OP_GETXATTR: "GETXATTR", _OP_GETXATTR: "GETXATTR",
_OP_LISTXATTR: "LISTXATTR", _OP_LISTXATTR: "LISTXATTR",
_OP_REMOVEXATTR: "REMOVEXATTR", _OP_REMOVEXATTR: "REMOVEXATTR",
_OP_FLUSH: "FLUSH", _OP_FLUSH: "FLUSH",
_OP_INIT: "INIT", _OP_INIT: "INIT",
_OP_OPENDIR: "OPENDIR", _OP_OPENDIR: "OPENDIR",
_OP_READDIR: "READDIR", _OP_READDIR: "READDIR",
_OP_RELEASEDIR: "RELEASEDIR", _OP_RELEASEDIR: "RELEASEDIR",
_OP_FSYNCDIR: "FSYNCDIR", _OP_FSYNCDIR: "FSYNCDIR",
_OP_GETLK: "GETLK", _OP_GETLK: "GETLK",
_OP_SETLK: "SETLK", _OP_SETLK: "SETLK",
_OP_SETLKW: "SETLKW", _OP_SETLKW: "SETLKW",
_OP_ACCESS: "ACCESS", _OP_ACCESS: "ACCESS",
_OP_CREATE: "CREATE", _OP_CREATE: "CREATE",
_OP_INTERRUPT: "INTERRUPT", _OP_INTERRUPT: "INTERRUPT",
_OP_BMAP: "BMAP", _OP_BMAP: "BMAP",
_OP_DESTROY: "DESTROY", _OP_DESTROY: "DESTROY",
_OP_IOCTL: "IOCTL", _OP_IOCTL: "IOCTL",
_OP_POLL: "POLL", _OP_POLL: "POLL",
_OP_NOTIFY_ENTRY: "NOTIFY_ENTRY", _OP_NOTIFY_ENTRY: "NOTIFY_ENTRY",
_OP_NOTIFY_INODE: "NOTIFY_INODE", _OP_NOTIFY_INODE: "NOTIFY_INODE",
_OP_NOTIFY_DELETE: "NOTIFY_DELETE", _OP_NOTIFY_DELETE: "NOTIFY_DELETE",
} { } {
operationHandlers[op].Name = v operationHandlers[op].Name = v
...@@ -523,19 +523,19 @@ func init() { ...@@ -523,19 +523,19 @@ func init() {
// Outputs. // Outputs.
for op, f := range map[int32]castPointerFunc{ for op, f := range map[int32]castPointerFunc{
_OP_LOOKUP: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) }, _OP_LOOKUP: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) },
_OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenOut)(ptr) }, _OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenOut)(ptr) },
_OP_OPENDIR: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenOut)(ptr) }, _OP_OPENDIR: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenOut)(ptr) },
_OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.AttrOut)(ptr) }, _OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.AttrOut)(ptr) },
_OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*raw.CreateOut)(ptr) }, _OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*raw.CreateOut)(ptr) },
_OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) }, _OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) },
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.AttrOut)(ptr) }, _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.AttrOut)(ptr) },
_OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*raw.InitOut)(ptr) }, _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*raw.InitOut)(ptr) },
_OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) }, _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) },
_OP_NOTIFY_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalEntryOut)(ptr) }, _OP_NOTIFY_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalEntryOut)(ptr) },
_OP_NOTIFY_INODE: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalInodeOut)(ptr) }, _OP_NOTIFY_INODE: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalInodeOut)(ptr) },
_OP_NOTIFY_DELETE: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalDeleteOut)(ptr) }, _OP_NOTIFY_DELETE: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalDeleteOut)(ptr) },
_OP_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) }, _OP_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) },
} { } {
operationHandlers[op].DecodeOut = f operationHandlers[op].DecodeOut = f
} }
......
...@@ -298,22 +298,21 @@ type NotifyInvalEntryOut struct { ...@@ -298,22 +298,21 @@ type NotifyInvalEntryOut struct {
Padding uint32 Padding uint32
} }
type NotifyInvalDeleteOut struct { type NotifyInvalDeleteOut struct {
Parent uint64; Parent uint64
Child uint64; Child uint64
NameLen uint32; NameLen uint32
Padding uint32; Padding uint32
} }
const ( const (
NOTIFY_POLL = -1 NOTIFY_POLL = -1
NOTIFY_INVAL_INODE = -2 NOTIFY_INVAL_INODE = -2
NOTIFY_INVAL_ENTRY = -3 NOTIFY_INVAL_ENTRY = -3
NOTIFY_STORE = -4 NOTIFY_STORE = -4
NOTIFY_RETRIEVE = -5 NOTIFY_RETRIEVE = -5
NOTIFY_INVAL_DELETE = -6 NOTIFY_INVAL_DELETE = -6
NOTIFY_CODE_MAX = -6 NOTIFY_CODE_MAX = -6
) )
type FlushIn struct { type FlushIn struct {
......
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