Commit 681d28a2 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move CreateIn.

parent 71266c84
...@@ -276,7 +276,7 @@ type RawFileSystem interface { ...@@ -276,7 +276,7 @@ type RawFileSystem interface {
RemoveXAttr(header *InHeader, attr string) (code Status) RemoveXAttr(header *InHeader, attr string) (code Status)
// File handling. // File handling.
Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status)
Open(header *InHeader, input *raw.OpenIn) (flags uint32, handle uint64, status Status) Open(header *InHeader, input *raw.OpenIn) (flags uint32, handle uint64, status Status)
Read(*InHeader, *ReadIn, BufferPool) ([]byte, Status) Read(*InHeader, *ReadIn, BufferPool) ([]byte, Status)
......
...@@ -86,7 +86,7 @@ func (me *DefaultRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c ...@@ -86,7 +86,7 @@ func (me *DefaultRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) {
return 0, 0, nil, ENOSYS return 0, 0, nil, ENOSYS
} }
......
...@@ -267,7 +267,7 @@ func (me *FileSystemConnector) Access(header *InHeader, input *raw.AccessIn) (co ...@@ -267,7 +267,7 @@ func (me *FileSystemConnector) Access(header *InHeader, input *raw.AccessIn) (co
return n.fsInode.Access(input.Mask, &header.Context) return n.fsInode.Access(input.Mask, &header.Context)
} }
func (me *FileSystemConnector) Create(header *InHeader, input *CreateIn, name string) (flags uint32, h uint64, out *EntryOut, code Status) { func (me *FileSystemConnector) Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, h uint64, out *EntryOut, code Status) {
parent := me.toInode(header.NodeId) parent := me.toInode(header.NodeId)
f, fi, fsNode, code := parent.fsInode.Create(name, uint32(input.Flags), input.Mode, &header.Context) f, fi, fsNode, code := parent.fsInode.Create(name, uint32(input.Flags), input.Mode, &header.Context)
if !code.Ok() { if !code.Ok() {
......
...@@ -255,7 +255,7 @@ func (me *LockingRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c ...@@ -255,7 +255,7 @@ func (me *LockingRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c
return me.RawFileSystem.Access(header, input) return me.RawFileSystem.Access(header, input)
} }
func (me *LockingRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) { func (me *LockingRawFileSystem) Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) {
defer me.locked()() defer me.locked()()
return me.RawFileSystem.Create(header, input, name) return me.RawFileSystem.Create(header, input, name)
} }
......
...@@ -120,7 +120,7 @@ func doOpen(state *MountState, req *request) { ...@@ -120,7 +120,7 @@ func doOpen(state *MountState, req *request) {
} }
func doCreate(state *MountState, req *request) { func doCreate(state *MountState, req *request) {
flags, handle, entry, status := state.fileSystem.Create(req.inHeader, (*CreateIn)(req.inData), req.filenames[0]) flags, handle, entry, status := state.fileSystem.Create(req.inHeader, (*raw.CreateIn)(req.inData), req.filenames[0])
req.status = status req.status = status
if status.Ok() { if status.Ok() {
req.outData = unsafe.Pointer(&CreateOut{ req.outData = unsafe.Pointer(&CreateOut{
...@@ -411,7 +411,7 @@ func init() { ...@@ -411,7 +411,7 @@ func init() {
_OP_RELEASEDIR: unsafe.Sizeof(raw.ReleaseIn{}), _OP_RELEASEDIR: unsafe.Sizeof(raw.ReleaseIn{}),
_OP_FSYNCDIR: unsafe.Sizeof(raw.FsyncIn{}), _OP_FSYNCDIR: unsafe.Sizeof(raw.FsyncIn{}),
_OP_ACCESS: unsafe.Sizeof(raw.AccessIn{}), _OP_ACCESS: unsafe.Sizeof(raw.AccessIn{}),
_OP_CREATE: unsafe.Sizeof(CreateIn{}), _OP_CREATE: unsafe.Sizeof(raw.CreateIn{}),
_OP_INTERRUPT: unsafe.Sizeof(raw.InterruptIn{}), _OP_INTERRUPT: unsafe.Sizeof(raw.InterruptIn{}),
_OP_BMAP: unsafe.Sizeof(raw.BmapIn{}), _OP_BMAP: unsafe.Sizeof(raw.BmapIn{}),
_OP_IOCTL: unsafe.Sizeof(raw.IoctlIn{}), _OP_IOCTL: unsafe.Sizeof(raw.IoctlIn{}),
...@@ -555,7 +555,7 @@ func init() { ...@@ -555,7 +555,7 @@ func init() {
_OP_IOCTL: func(ptr unsafe.Pointer) interface{} { return (*raw.IoctlIn)(ptr) }, _OP_IOCTL: func(ptr unsafe.Pointer) interface{} { return (*raw.IoctlIn)(ptr) },
_OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenIn)(ptr) }, _OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenIn)(ptr) },
_OP_MKNOD: func(ptr unsafe.Pointer) interface{} { return (*raw.MknodIn)(ptr) }, _OP_MKNOD: func(ptr unsafe.Pointer) interface{} { return (*raw.MknodIn)(ptr) },
_OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateIn)(ptr) }, _OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*raw.CreateIn)(ptr) },
_OP_READ: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, _OP_READ: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) },
_OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, _OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) },
_OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*raw.AccessIn)(ptr) }, _OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*raw.AccessIn)(ptr) },
......
...@@ -39,12 +39,6 @@ func (me *AttrOut) String() string { ...@@ -39,12 +39,6 @@ func (me *AttrOut) String() string {
me.AttrValid, me.AttrValidNsec, &me.Attr) me.AttrValid, me.AttrValidNsec, &me.Attr)
} }
func (me *CreateIn) String() string {
return fmt.Sprintf(
"{0%o [%s] (0%o)}", me.Mode,
raw.FlagString(raw.OpenFlagNames, int(me.Flags), "O_RDONLY"), me.Umask)
}
func (me *EntryOut) String() string { func (me *EntryOut) String() string {
return fmt.Sprintf("{%d E%d.%09d A%d.%09d %v}", return fmt.Sprintf("{%d E%d.%09d A%d.%09d %v}",
me.NodeId, me.EntryValid, me.EntryValidNsec, me.NodeId, me.EntryValid, me.EntryValidNsec,
......
...@@ -124,13 +124,6 @@ type AttrOut struct { ...@@ -124,13 +124,6 @@ type AttrOut struct {
Attr Attr
} }
type CreateIn struct {
Flags uint32
Mode uint32
Umask uint32
Padding uint32
}
type CreateOut struct { type CreateOut struct {
EntryOut EntryOut
raw.OpenOut raw.OpenOut
......
...@@ -170,3 +170,9 @@ func (me *AccessIn) String() string { ...@@ -170,3 +170,9 @@ func (me *AccessIn) String() string {
return fmt.Sprintf("{%s}", FlagString(accessFlagName, int(me.Mask), "")) return fmt.Sprintf("{%s}", FlagString(accessFlagName, int(me.Mask), ""))
} }
func (me *CreateIn) String() string {
return fmt.Sprintf(
"{0%o [%s] (0%o)}", me.Mode,
FlagString(OpenFlagNames, int(me.Flags), "O_RDONLY"), me.Umask)
}
...@@ -276,3 +276,10 @@ type OutHeader struct { ...@@ -276,3 +276,10 @@ type OutHeader struct {
Status int32 Status int32
Unique uint64 Unique uint64
} }
type CreateIn struct {
Flags uint32
Mode uint32
Umask 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