Commit a4c74fec authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move FlushIn

parent c08fcaa9
...@@ -282,7 +282,7 @@ type RawFileSystem interface { ...@@ -282,7 +282,7 @@ type RawFileSystem interface {
Release(header *InHeader, input *raw.ReleaseIn) Release(header *InHeader, input *raw.ReleaseIn)
Write(*InHeader, *WriteIn, []byte) (written uint32, code Status) Write(*InHeader, *WriteIn, []byte) (written uint32, code Status)
Flush(header *InHeader, input *FlushIn) Status Flush(header *InHeader, input *raw.FlushIn) Status
Fsync(*InHeader, *raw.FsyncIn) (code Status) Fsync(*InHeader, *raw.FsyncIn) (code Status)
// Directory handling // Directory handling
......
...@@ -113,7 +113,7 @@ func (me *DefaultRawFileSystem) Write(header *InHeader, input *WriteIn, data []b ...@@ -113,7 +113,7 @@ func (me *DefaultRawFileSystem) Write(header *InHeader, input *WriteIn, data []b
return 0, ENOSYS return 0, ENOSYS
} }
func (me *DefaultRawFileSystem) Flush(header *InHeader, input *FlushIn) Status { func (me *DefaultRawFileSystem) Flush(header *InHeader, input *raw.FlushIn) Status {
return OK return OK
} }
......
...@@ -348,7 +348,7 @@ func (me *FileSystemConnector) StatFs(header *InHeader) *StatfsOut { ...@@ -348,7 +348,7 @@ func (me *FileSystemConnector) StatFs(header *InHeader) *StatfsOut {
return node.FsNode().StatFs() return node.FsNode().StatFs()
} }
func (me *FileSystemConnector) Flush(header *InHeader, input *FlushIn) Status { func (me *FileSystemConnector) Flush(header *InHeader, input *raw.FlushIn) Status {
node := me.toInode(header.NodeId) node := me.toInode(header.NodeId)
opened := node.mount.getOpenedFile(input.Fh) opened := node.mount.getOpenedFile(input.Fh)
return opened.WithFlags.File.Flush() return opened.WithFlags.File.Flush()
......
...@@ -285,7 +285,7 @@ func (me *LockingRawFileSystem) Write(header *InHeader, input *WriteIn, data []b ...@@ -285,7 +285,7 @@ func (me *LockingRawFileSystem) Write(header *InHeader, input *WriteIn, data []b
return me.RawFileSystem.Write(header, input, data) return me.RawFileSystem.Write(header, input, data)
} }
func (me *LockingRawFileSystem) Flush(header *InHeader, input *FlushIn) Status { func (me *LockingRawFileSystem) Flush(header *InHeader, input *raw.FlushIn) Status {
defer me.locked()() defer me.locked()()
return me.RawFileSystem.Flush(header, input) return me.RawFileSystem.Flush(header, input)
} }
......
...@@ -280,7 +280,7 @@ func doRead(state *MountState, req *request) { ...@@ -280,7 +280,7 @@ func doRead(state *MountState, req *request) {
} }
func doFlush(state *MountState, req *request) { func doFlush(state *MountState, req *request) {
req.status = state.fileSystem.Flush(req.inHeader, (*FlushIn)(req.inData)) req.status = state.fileSystem.Flush(req.inHeader, (*raw.FlushIn)(req.inData))
} }
func doRelease(state *MountState, req *request) { func doRelease(state *MountState, req *request) {
...@@ -404,7 +404,7 @@ func init() { ...@@ -404,7 +404,7 @@ func init() {
_OP_SETXATTR: unsafe.Sizeof(raw.SetXAttrIn{}), _OP_SETXATTR: unsafe.Sizeof(raw.SetXAttrIn{}),
_OP_GETXATTR: unsafe.Sizeof(raw.GetXAttrIn{}), _OP_GETXATTR: unsafe.Sizeof(raw.GetXAttrIn{}),
_OP_LISTXATTR: unsafe.Sizeof(raw.GetXAttrIn{}), _OP_LISTXATTR: unsafe.Sizeof(raw.GetXAttrIn{}),
_OP_FLUSH: unsafe.Sizeof(FlushIn{}), _OP_FLUSH: unsafe.Sizeof(raw.FlushIn{}),
_OP_INIT: unsafe.Sizeof(raw.InitIn{}), _OP_INIT: unsafe.Sizeof(raw.InitIn{}),
_OP_OPENDIR: unsafe.Sizeof(raw.OpenIn{}), _OP_OPENDIR: unsafe.Sizeof(raw.OpenIn{}),
_OP_READDIR: unsafe.Sizeof(ReadIn{}), _OP_READDIR: unsafe.Sizeof(ReadIn{}),
...@@ -548,7 +548,7 @@ func init() { ...@@ -548,7 +548,7 @@ func init() {
// Inputs. // Inputs.
for op, f := range map[opcode]castPointerFunc{ for op, f := range map[opcode]castPointerFunc{
_OP_FLUSH: func(ptr unsafe.Pointer) interface{} { return (*FlushIn)(ptr) }, _OP_FLUSH: func(ptr unsafe.Pointer) interface{} { return (*raw.FlushIn)(ptr) },
_OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.GetAttrIn)(ptr) }, _OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.GetAttrIn)(ptr) },
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.SetAttrIn)(ptr) }, _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.SetAttrIn)(ptr) },
_OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*raw.InitIn)(ptr) }, _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*raw.InitIn)(ptr) },
......
...@@ -59,10 +59,6 @@ func (me *ReadIn) String() string { ...@@ -59,10 +59,6 @@ func (me *ReadIn) String() string {
} }
func (me *FlushIn) String() string {
return fmt.Sprintf("{Fh %d}", me.Fh)
}
func (me *Kstatfs) String() string { func (me *Kstatfs) String() string {
return fmt.Sprintf( return fmt.Sprintf(
"{b%d f%d fs%d ff%d bs%d nl%d frs%d}", "{b%d f%d fs%d ff%d bs%d nl%d frs%d}",
......
...@@ -121,13 +121,6 @@ type CreateOut struct { ...@@ -121,13 +121,6 @@ type CreateOut struct {
raw.OpenOut raw.OpenOut
} }
type FlushIn struct {
Fh uint64
Unused uint32
Padding uint32
LockOwner uint64
}
const ( const (
READ_LOCKOWNER = (1 << 1) READ_LOCKOWNER = (1 << 1)
) )
......
...@@ -176,3 +176,7 @@ func (me *CreateIn) String() string { ...@@ -176,3 +176,7 @@ func (me *CreateIn) String() string {
FlagString(OpenFlagNames, int(me.Flags), "O_RDONLY"), me.Umask) FlagString(OpenFlagNames, int(me.Flags), "O_RDONLY"), me.Umask)
} }
func (me *FlushIn) String() string {
return fmt.Sprintf("{Fh %d}", me.Fh)
}
...@@ -303,3 +303,10 @@ const ( ...@@ -303,3 +303,10 @@ const (
NOTIFY_INVAL_ENTRY = -3 NOTIFY_INVAL_ENTRY = -3
NOTIFY_CODE_MAX = -4 NOTIFY_CODE_MAX = -4
) )
type FlushIn struct {
Fh uint64
Unused uint32
Padding uint32
LockOwner uint64
}
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