Commit 2b37e448 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move notify types.

parent 681d28a2
...@@ -314,6 +314,6 @@ type DefaultRawFileSystem struct{} ...@@ -314,6 +314,6 @@ 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(*NotifyInvalInodeOut) Status InodeNotify func(*raw.NotifyInvalInodeOut) Status
EntryNotify func(parent uint64, name string) Status EntryNotify func(parent uint64, name string) Status
} }
...@@ -10,6 +10,8 @@ import ( ...@@ -10,6 +10,8 @@ import (
"strings" "strings"
"time" "time"
"unsafe" "unsafe"
"github.com/hanwen/go-fuse/raw"
) )
// Tests should set to true. // Tests should set to true.
...@@ -336,7 +338,7 @@ func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) ...@@ -336,7 +338,7 @@ func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64)
if n == 0 { if n == 0 {
return OK return OK
} }
out := NotifyInvalInodeOut{ out := raw.NotifyInvalInodeOut{
Length: length, Length: length,
Off: off, Off: off,
Ino: n, Ino: n,
......
...@@ -75,7 +75,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) error { ...@@ -75,7 +75,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) error {
return err return err
} }
initParams := RawFsInit{ initParams := RawFsInit{
InodeNotify: func(n *NotifyInvalInodeOut) Status { InodeNotify: func(n *raw.NotifyInvalInodeOut) Status {
return me.writeInodeNotify(n) return me.writeInodeNotify(n)
}, },
EntryNotify: func(parent uint64, n string) Status { EntryNotify: func(parent uint64, n string) Status {
...@@ -279,7 +279,7 @@ func (me *MountState) write(req *request) Status { ...@@ -279,7 +279,7 @@ func (me *MountState) write(req *request) Status {
return ToStatus(err) return ToStatus(err)
} }
func (me *MountState) writeInodeNotify(entry *NotifyInvalInodeOut) Status { func (me *MountState) writeInodeNotify(entry *raw.NotifyInvalInodeOut) Status {
req := request{ req := request{
inHeader: &InHeader{ inHeader: &InHeader{
opcode: _OP_NOTIFY_INODE, opcode: _OP_NOTIFY_INODE,
...@@ -305,7 +305,7 @@ func (me *MountState) writeEntryNotify(parent uint64, name string) Status { ...@@ -305,7 +305,7 @@ func (me *MountState) writeEntryNotify(parent uint64, name string) Status {
handler: operationHandlers[_OP_NOTIFY_ENTRY], handler: operationHandlers[_OP_NOTIFY_ENTRY],
status: NOTIFY_INVAL_ENTRY, status: NOTIFY_INVAL_ENTRY,
} }
entry := &NotifyInvalEntryOut{ entry := &raw.NotifyInvalEntryOut{
Parent: parent, Parent: parent,
NameLen: uint32(len(name)), NameLen: uint32(len(name)),
} }
......
...@@ -439,8 +439,8 @@ func init() { ...@@ -439,8 +439,8 @@ func init() {
_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(NotifyInvalEntryOut{}), _OP_NOTIFY_ENTRY: unsafe.Sizeof(raw.NotifyInvalEntryOut{}),
_OP_NOTIFY_INODE: unsafe.Sizeof(NotifyInvalInodeOut{}), _OP_NOTIFY_INODE: unsafe.Sizeof(raw.NotifyInvalInodeOut{}),
} { } {
operationHandlers[op].OutputSize = sz operationHandlers[op].OutputSize = sz
} }
...@@ -539,8 +539,8 @@ func init() { ...@@ -539,8 +539,8 @@ func init() {
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) }, _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*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 (*EntryOut)(ptr) }, _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) },
_OP_NOTIFY_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalEntryOut)(ptr) }, _OP_NOTIFY_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalEntryOut)(ptr) },
_OP_NOTIFY_INODE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalInodeOut)(ptr) }, _OP_NOTIFY_INODE: func(ptr unsafe.Pointer) interface{} { return (*raw.NotifyInvalInodeOut)(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
......
...@@ -184,15 +184,3 @@ type Dirent struct { ...@@ -184,15 +184,3 @@ type Dirent struct {
NameLen uint32 NameLen uint32
Typ uint32 Typ uint32
} }
type NotifyInvalInodeOut struct {
Ino uint64
Off int64
Length int64
}
type NotifyInvalEntryOut struct {
Parent uint64
NameLen uint32
Padding uint32
}
...@@ -283,3 +283,16 @@ type CreateIn struct { ...@@ -283,3 +283,16 @@ type CreateIn struct {
Umask uint32 Umask uint32
Padding uint32 Padding uint32
} }
type NotifyInvalInodeOut struct {
Ino uint64
Off int64
Length int64
}
type NotifyInvalEntryOut struct {
Parent uint64
NameLen uint32
Padding 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