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

Move Access type.

parent 1ee2df8c
......@@ -266,7 +266,7 @@ type RawFileSystem interface {
Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
Readlink(header *InHeader) (out []byte, code Status)
Access(header *InHeader, input *AccessIn) (code Status)
Access(header *InHeader, input *raw.AccessIn) (code Status)
// Extended attributes.
GetXAttrSize(header *InHeader, attr string) (sz int, code Status)
......
......@@ -82,7 +82,7 @@ func (me *DefaultRawFileSystem) RemoveXAttr(header *InHeader, attr string) Statu
return ENOSYS
}
func (me *DefaultRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status) {
func (me *DefaultRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (code Status) {
return ENOSYS
}
......
......@@ -262,7 +262,7 @@ func (me *FileSystemConnector) Link(header *InHeader, input *raw.LinkIn, name st
return out, code
}
func (me *FileSystemConnector) Access(header *InHeader, input *AccessIn) (code Status) {
func (me *FileSystemConnector) Access(header *InHeader, input *raw.AccessIn) (code Status) {
n := me.toInode(header.NodeId)
return n.fsInode.Access(input.Mask, &header.Context)
}
......
......@@ -250,7 +250,7 @@ func (me *LockingRawFileSystem) RemoveXAttr(header *InHeader, attr string) Statu
return me.RawFileSystem.RemoveXAttr(header, attr)
}
func (me *LockingRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status) {
func (me *LockingRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (code Status) {
defer me.locked()()
return me.RawFileSystem.Access(header, input)
}
......
......@@ -309,7 +309,7 @@ func doRemoveXAttr(state *MountState, req *request) {
}
func doAccess(state *MountState, req *request) {
req.status = state.fileSystem.Access(req.inHeader, (*AccessIn)(req.inData))
req.status = state.fileSystem.Access(req.inHeader, (*raw.AccessIn)(req.inData))
}
func doSymlink(state *MountState, req *request) {
......@@ -410,7 +410,7 @@ func init() {
_OP_READDIR: unsafe.Sizeof(ReadIn{}),
_OP_RELEASEDIR: unsafe.Sizeof(raw.ReleaseIn{}),
_OP_FSYNCDIR: unsafe.Sizeof(FsyncIn{}),
_OP_ACCESS: unsafe.Sizeof(AccessIn{}),
_OP_ACCESS: unsafe.Sizeof(raw.AccessIn{}),
_OP_CREATE: unsafe.Sizeof(CreateIn{}),
_OP_INTERRUPT: unsafe.Sizeof(raw.InterruptIn{}),
_OP_BMAP: unsafe.Sizeof(raw.BmapIn{}),
......@@ -558,7 +558,7 @@ func init() {
_OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateIn)(ptr) },
_OP_READ: 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 (*AccessIn)(ptr) },
_OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*raw.AccessIn)(ptr) },
_OP_FORGET: func(ptr unsafe.Pointer) interface{} { return (*raw.ForgetIn)(ptr) },
_OP_BATCH_FORGET: func(ptr unsafe.Pointer) interface{} { return (*raw.BatchForgetIn)(ptr) },
_OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*raw.LinkIn)(ptr) },
......
......@@ -7,7 +7,6 @@ import (
var writeFlagNames map[int]string
var readFlagNames map[int]string
var accessFlagName map[int]string
func init() {
writeFlagNames = map[int]string{
......@@ -17,11 +16,6 @@ func init() {
readFlagNames = map[int]string{
READ_LOCKOWNER: "LOCKOWNER",
}
accessFlagName = map[int]string{
X_OK: "x",
W_OK: "w",
R_OK: "r",
}
}
func (me *Attr) String() string {
......@@ -75,10 +69,6 @@ func (me *FlushIn) String() string {
return fmt.Sprintf("{Fh %d}", me.Fh)
}
func (me *AccessIn) String() string {
return fmt.Sprintf("{%s}", raw.FlagString(accessFlagName, int(me.Mask), ""))
}
func (me *Kstatfs) String() string {
return fmt.Sprintf(
"{b%d f%d fs%d ff%d bs%d nl%d frs%d}",
......
......@@ -182,20 +182,6 @@ type FsyncIn struct {
Padding uint32
}
// For AccessIn.Mask.
const (
X_OK = 1
W_OK = 2
R_OK = 4
F_OK = 0
)
type AccessIn struct {
Mask uint32
Padding uint32
}
type InHeader struct {
Length uint32
opcode
......
......@@ -10,6 +10,7 @@ var initFlagNames map[int]string
var releaseFlagNames map[int]string
var OpenFlagNames map[int]string
var FuseOpenFlagNames map[int]string
var accessFlagName map[int]string
func init() {
initFlagNames = map[int]string{
......@@ -50,6 +51,12 @@ func init() {
FOPEN_KEEP_CACHE: "CACHE",
FOPEN_NONSEEKABLE: "NONSEEK",
}
accessFlagName = map[int]string{
X_OK: "x",
W_OK: "w",
R_OK: "r",
}
}
func FlagString(names map[int]string, fl int, def string) string {
......@@ -159,3 +166,7 @@ func (me *GetXAttrIn) String() string {
func (me *GetXAttrOut) String() string {
return fmt.Sprintf("{sz %d}", me.Size)
}
func (me *AccessIn) String() string {
return fmt.Sprintf("{%s}", FlagString(accessFlagName, int(me.Mask), ""))
}
......@@ -251,3 +251,16 @@ type LkIn struct {
type LkOut struct {
Lk FileLock
}
// For AccessIn.Mask.
const (
X_OK = 1
W_OK = 2
R_OK = 4
F_OK = 0
)
type AccessIn struct {
Mask 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