Commit 06ca7ac3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move Attr, AttrOut, EntryOut to raw.

parent a4c74fec
......@@ -249,22 +249,22 @@ type DefaultFile struct{}
//
// Include DefaultRawFileSystem to inherit a null implementation.
type RawFileSystem interface {
Lookup(header *InHeader, name string) (out *EntryOut, status Status)
Lookup(header *InHeader, name string) (out *raw.EntryOut, status Status)
Forget(nodeid, nlookup uint64)
// Attributes.
GetAttr(header *InHeader, input *raw.GetAttrIn) (out *AttrOut, code Status)
SetAttr(header *InHeader, input *raw.SetAttrIn) (out *AttrOut, code Status)
GetAttr(header *InHeader, input *raw.GetAttrIn) (out *raw.AttrOut, code Status)
SetAttr(header *InHeader, input *raw.SetAttrIn) (out *raw.AttrOut, code Status)
// Modifying structure.
Mknod(header *InHeader, input *raw.MknodIn, name string) (out *EntryOut, code Status)
Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *EntryOut, code Status)
Mknod(header *InHeader, input *raw.MknodIn, name string) (out *raw.EntryOut, code Status)
Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *raw.EntryOut, code Status)
Unlink(header *InHeader, name string) (code Status)
Rmdir(header *InHeader, name string) (code Status)
Rename(header *InHeader, input *raw.RenameIn, oldName string, newName string) (code Status)
Link(header *InHeader, input *raw.LinkIn, filename string) (out *EntryOut, code Status)
Link(header *InHeader, input *raw.LinkIn, filename string) (out *raw.EntryOut, code Status)
Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
Symlink(header *InHeader, pointedTo string, linkName string) (out *raw.EntryOut, code Status)
Readlink(header *InHeader) (out []byte, code Status)
Access(header *InHeader, input *raw.AccessIn) (code Status)
......@@ -276,7 +276,7 @@ type RawFileSystem interface {
RemoveXAttr(header *InHeader, attr string) (code Status)
// File handling.
Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status)
Create(header *InHeader, input *raw.CreateIn, name string) (flags uint32, handle uint64, out *raw.EntryOut, code Status)
Open(header *InHeader, input *raw.OpenIn) (flags uint32, handle uint64, status Status)
Read(*InHeader, *ReadIn, BufferPool) ([]byte, Status)
......
......@@ -11,14 +11,14 @@ func (me *DefaultRawFileSystem) StatFs(h *InHeader) *StatfsOut {
return nil
}
func (me *DefaultRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status) {
func (me *DefaultRawFileSystem) Lookup(h *InHeader, name string) (out *raw.EntryOut, code Status) {
return nil, ENOSYS
}
func (me *DefaultRawFileSystem) Forget(nodeID, nlookup uint64) {
}
func (me *DefaultRawFileSystem) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *AttrOut, code Status) {
func (me *DefaultRawFileSystem) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *raw.AttrOut, code Status) {
return nil, ENOSYS
}
......@@ -26,7 +26,7 @@ func (me *DefaultRawFileSystem) Open(header *InHeader, input *raw.OpenIn) (flags
return 0, 0, OK
}
func (me *DefaultRawFileSystem) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *AttrOut, code Status) {
func (me *DefaultRawFileSystem) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *raw.AttrOut, code Status) {
return nil, ENOSYS
}
......@@ -34,11 +34,11 @@ func (me *DefaultRawFileSystem) Readlink(header *InHeader) (out []byte, code Sta
return nil, ENOSYS
}
func (me *DefaultRawFileSystem) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *EntryOut, code Status) {
return new(EntryOut), ENOSYS
func (me *DefaultRawFileSystem) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *raw.EntryOut, code Status) {
return new(raw.EntryOut), ENOSYS
}
func (me *DefaultRawFileSystem) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *EntryOut, code Status) {
func (me *DefaultRawFileSystem) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *raw.EntryOut, code Status) {
return nil, ENOSYS
}
......@@ -50,7 +50,7 @@ func (me *DefaultRawFileSystem) Rmdir(header *InHeader, name string) (code Statu
return ENOSYS
}
func (me *DefaultRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) {
func (me *DefaultRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *raw.EntryOut, code Status) {
return nil, ENOSYS
}
......@@ -58,7 +58,7 @@ func (me *DefaultRawFileSystem) Rename(header *InHeader, input *raw.RenameIn, ol
return ENOSYS
}
func (me *DefaultRawFileSystem) Link(header *InHeader, input *raw.LinkIn, name string) (out *EntryOut, code Status) {
func (me *DefaultRawFileSystem) Link(header *InHeader, input *raw.LinkIn, name string) (out *raw.EntryOut, code Status) {
return nil, ENOSYS
}
......@@ -86,7 +86,7 @@ func (me *DefaultRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c
return ENOSYS
}
func (me *DefaultRawFileSystem) Create(header *InHeader, input *raw.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 *raw.EntryOut, code Status) {
return 0, 0, nil, ENOSYS
}
......
......@@ -79,9 +79,9 @@ func (me *FileSystemConnector) verify() {
}
// Generate EntryOut and increase the lookup count for an inode.
func (me *FileSystemConnector) childLookup(fi *Attr, fsi FsNode) (out *EntryOut) {
func (me *FileSystemConnector) childLookup(fi *raw.Attr, fsi FsNode) (out *raw.EntryOut) {
n := fsi.Inode()
out = n.mount.fileInfoToEntry(fi)
out = n.mount.attrToEntry(fi)
out.Ino = me.lookupUpdate(n)
out.NodeId = out.Ino
if out.Nlink == 0 {
......
......@@ -4,6 +4,8 @@ import (
"log"
"sync"
"unsafe"
"github.com/hanwen/go-fuse/raw"
)
var _ = log.Println
......@@ -53,27 +55,27 @@ func (me *fileSystemMount) mountName() string {
return ""
}
func (me *fileSystemMount) setOwner(attr *Attr) {
func (me *fileSystemMount) setOwner(attr *raw.Attr) {
if me.options.Owner != nil {
attr.Owner = *me.options.Owner
attr.Owner = *(*raw.Owner)(me.options.Owner)
}
}
func (me *fileSystemMount) fileInfoToEntry(attr *Attr) (out *EntryOut) {
out = &EntryOut{}
func (me *fileSystemMount) attrToEntry(attr *raw.Attr) (out *raw.EntryOut) {
out = &raw.EntryOut{}
out.Attr = *attr
splitDuration(me.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec)
splitDuration(me.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
me.setOwner(&out.Attr)
if !attr.IsDir() && attr.Nlink == 0 {
if attr.Mode & S_IFDIR == 0 && attr.Nlink == 0 {
out.Nlink = 1
}
return out
}
func (me *fileSystemMount) fillAttr(a *Attr, nodeId uint64) (out *AttrOut) {
out = &AttrOut{}
func (me *fileSystemMount) fillAttr(a *raw.Attr, nodeId uint64) (out *raw.AttrOut) {
out = &raw.AttrOut{}
out.Attr = *a
splitDuration(me.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
me.setOwner(&out.Attr)
......@@ -142,9 +144,9 @@ func (me *fileSystemMount) registerFileHandle(node *Inode, dir rawDir, f File, f
}
// Creates a return entry for a non-existent path.
func (me *fileSystemMount) negativeEntry() (*EntryOut, Status) {
func (me *fileSystemMount) negativeEntry() (*raw.EntryOut, Status) {
if me.options.NegativeTimeout > 0.0 {
out := new(EntryOut)
out := new(raw.EntryOut)
out.NodeId = 0
splitDuration(me.options.NegativeTimeout, &out.EntryValid, &out.EntryValidNsec)
return out, OK
......
......@@ -50,7 +50,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex
return fi, child, code
}
func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *EntryOut, code Status) {
func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *raw.EntryOut, code Status) {
parent := me.toInode(header.NodeId)
if !parent.IsDir() {
log.Printf("Lookup %q called on non-Directory node %d", name, header.NodeId)
......@@ -67,7 +67,9 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry
if child == nil {
log.Println("HUH", name)
}
out = child.mount.fileInfoToEntry(fi)
rawAttr := (*raw.Attr)(fi)
out = child.mount.attrToEntry(rawAttr)
out.NodeId = me.lookupUpdate(child)
out.Generation = 1
out.Ino = out.NodeId
......@@ -80,7 +82,7 @@ func (me *FileSystemConnector) Forget(nodeID, nlookup uint64) {
me.forgetUpdate(node, int(nlookup))
}
func (me *FileSystemConnector) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *AttrOut, code Status) {
func (me *FileSystemConnector) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *raw.AttrOut, code Status) {
node := me.toInode(header.NodeId)
var f File
......@@ -94,7 +96,9 @@ func (me *FileSystemConnector) GetAttr(header *InHeader, input *raw.GetAttrIn) (
if !code.Ok() {
return nil, code
}
out = node.mount.fillAttr(fi, header.NodeId)
rawAttr := (*raw.Attr)(fi)
out = node.mount.fillAttr(rawAttr, header.NodeId)
return out, OK
}
......@@ -137,7 +141,7 @@ func (me *FileSystemConnector) Open(header *InHeader, input *raw.OpenIn) (flags
return opened.FuseFlags, h, OK
}
func (me *FileSystemConnector) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *AttrOut, code Status) {
func (me *FileSystemConnector) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *raw.AttrOut, code Status) {
node := me.toInode(header.NodeId)
var f File
if input.Valid&raw.FATTR_FH != 0 {
......@@ -183,7 +187,8 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *raw.SetAttrIn) (
fi, code := node.fsInode.GetAttr(f, &header.Context)
if code.Ok() {
out = node.mount.fillAttr(fi, header.NodeId)
rawAttr := (*raw.Attr)(fi)
out = node.mount.fillAttr(rawAttr, header.NodeId)
}
return out, code
}
......@@ -193,21 +198,23 @@ func (me *FileSystemConnector) Readlink(header *InHeader) (out []byte, code Stat
return n.fsInode.Readlink(&header.Context)
}
func (me *FileSystemConnector) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *EntryOut, code Status) {
func (me *FileSystemConnector) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *raw.EntryOut, code Status) {
parent := me.toInode(header.NodeId)
fi, fsNode, code := parent.fsInode.Mknod(name, input.Mode, uint32(input.Rdev), &header.Context)
rawAttr := (*raw.Attr)(fi)
if code.Ok() {
out = me.childLookup(fi, fsNode)
out = me.childLookup(rawAttr, fsNode)
}
return out, code
}
func (me *FileSystemConnector) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *EntryOut, code Status) {
func (me *FileSystemConnector) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *raw.EntryOut, code Status) {
parent := me.toInode(header.NodeId)
fi, fsInode, code := parent.fsInode.Mkdir(name, input.Mode, &header.Context)
if code.Ok() {
out = me.childLookup(fi, fsInode)
rawAttr := (*raw.Attr)(fi)
out = me.childLookup(rawAttr, fsInode)
}
return out, code
}
......@@ -222,11 +229,12 @@ func (me *FileSystemConnector) Rmdir(header *InHeader, name string) (code Status
return parent.fsInode.Rmdir(name, &header.Context)
}
func (me *FileSystemConnector) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) {
func (me *FileSystemConnector) Symlink(header *InHeader, pointedTo string, linkName string) (out *raw.EntryOut, code Status) {
parent := me.toInode(header.NodeId)
fi, fsNode, code := parent.fsInode.Symlink(linkName, pointedTo, &header.Context)
if code.Ok() {
out = me.childLookup(fi, fsNode)
rawAttr := (*raw.Attr)(fi)
out = me.childLookup(rawAttr, fsNode)
}
return out, code
}
......@@ -246,7 +254,7 @@ func (me *FileSystemConnector) Rename(header *InHeader, input *raw.RenameIn, old
return oldParent.fsInode.Rename(oldName, newParent.fsInode, newName, &header.Context)
}
func (me *FileSystemConnector) Link(header *InHeader, input *raw.LinkIn, name string) (out *EntryOut, code Status) {
func (me *FileSystemConnector) Link(header *InHeader, input *raw.LinkIn, name string) (out *raw.EntryOut, code Status) {
existing := me.toInode(input.Oldnodeid)
parent := me.toInode(header.NodeId)
......@@ -256,7 +264,8 @@ func (me *FileSystemConnector) Link(header *InHeader, input *raw.LinkIn, name st
fi, fsInode, code := parent.fsInode.Link(name, existing.fsInode, &header.Context)
if code.Ok() {
out = me.childLookup(fi, fsInode)
rawAttr := (*raw.Attr)(fi)
out = me.childLookup(rawAttr, fsInode)
}
return out, code
......@@ -267,13 +276,14 @@ func (me *FileSystemConnector) Access(header *InHeader, input *raw.AccessIn) (co
return n.fsInode.Access(input.Mask, &header.Context)
}
func (me *FileSystemConnector) Create(header *InHeader, input *raw.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 *raw.EntryOut, code Status) {
parent := me.toInode(header.NodeId)
f, fi, fsNode, code := parent.fsInode.Create(name, uint32(input.Flags), input.Mode, &header.Context)
if !code.Ok() {
return 0, 0, nil, code
}
out = me.childLookup(fi, fsNode)
rawAttr := (*raw.Attr)(fi)
out = me.childLookup(rawAttr, fsNode)
handle, opened := parent.mount.registerFileHandle(fsNode.Inode(), nil, f, input.Flags)
return opened.FuseFlags, handle, out, code
}
......
......@@ -160,7 +160,7 @@ func NewLockingRawFileSystem(rfs RawFileSystem) *LockingRawFileSystem {
return l
}
func (me *LockingRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status) {
func (me *LockingRawFileSystem) Lookup(h *InHeader, name string) (out *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Lookup(h, name)
}
......@@ -170,7 +170,7 @@ func (me *LockingRawFileSystem) Forget(nodeID uint64, nlookup uint64) {
me.RawFileSystem.Forget(nodeID, nlookup)
}
func (me *LockingRawFileSystem) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *AttrOut, code Status) {
func (me *LockingRawFileSystem) GetAttr(header *InHeader, input *raw.GetAttrIn) (out *raw.AttrOut, code Status) {
defer me.locked()()
return me.RawFileSystem.GetAttr(header, input)
}
......@@ -180,7 +180,7 @@ func (me *LockingRawFileSystem) Open(header *InHeader, input *raw.OpenIn) (flags
return me.RawFileSystem.Open(header, input)
}
func (me *LockingRawFileSystem) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *AttrOut, code Status) {
func (me *LockingRawFileSystem) SetAttr(header *InHeader, input *raw.SetAttrIn) (out *raw.AttrOut, code Status) {
defer me.locked()()
return me.RawFileSystem.SetAttr(header, input)
}
......@@ -190,12 +190,12 @@ func (me *LockingRawFileSystem) Readlink(header *InHeader) (out []byte, code Sta
return me.RawFileSystem.Readlink(header)
}
func (me *LockingRawFileSystem) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *EntryOut, code Status) {
func (me *LockingRawFileSystem) Mknod(header *InHeader, input *raw.MknodIn, name string) (out *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Mknod(header, input, name)
}
func (me *LockingRawFileSystem) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *EntryOut, code Status) {
func (me *LockingRawFileSystem) Mkdir(header *InHeader, input *raw.MkdirIn, name string) (out *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Mkdir(header, input, name)
}
......@@ -210,7 +210,7 @@ func (me *LockingRawFileSystem) Rmdir(header *InHeader, name string) (code Statu
return me.RawFileSystem.Rmdir(header, name)
}
func (me *LockingRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) {
func (me *LockingRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Symlink(header, pointedTo, linkName)
}
......@@ -220,7 +220,7 @@ func (me *LockingRawFileSystem) Rename(header *InHeader, input *raw.RenameIn, ol
return me.RawFileSystem.Rename(header, input, oldName, newName)
}
func (me *LockingRawFileSystem) Link(header *InHeader, input *raw.LinkIn, name string) (out *EntryOut, code Status) {
func (me *LockingRawFileSystem) Link(header *InHeader, input *raw.LinkIn, name string) (out *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Link(header, input, name)
}
......@@ -255,7 +255,7 @@ func (me *LockingRawFileSystem) Access(header *InHeader, input *raw.AccessIn) (c
return me.RawFileSystem.Access(header, input)
}
func (me *LockingRawFileSystem) Create(header *InHeader, input *raw.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 *raw.EntryOut, code Status) {
defer me.locked()()
return me.RawFileSystem.Create(header, input, name)
}
......
......@@ -123,8 +123,8 @@ func doCreate(state *MountState, req *request) {
flags, handle, entry, status := state.fileSystem.Create(req.inHeader, (*raw.CreateIn)(req.inData), req.filenames[0])
req.status = status
if status.Ok() {
req.outData = unsafe.Pointer(&CreateOut{
EntryOut: *entry,
req.outData = unsafe.Pointer(&raw.CreateOut{
raw.EntryOut: *entry,
raw.OpenOut: raw.OpenOut{
Fh: handle,
OpenFlags: flags,
......@@ -421,13 +421,13 @@ func init() {
}
for op, sz := range map[opcode]uintptr{
_OP_LOOKUP: unsafe.Sizeof(EntryOut{}),
_OP_GETATTR: unsafe.Sizeof(AttrOut{}),
_OP_SETATTR: unsafe.Sizeof(AttrOut{}),
_OP_SYMLINK: unsafe.Sizeof(EntryOut{}),
_OP_MKNOD: unsafe.Sizeof(EntryOut{}),
_OP_MKDIR: unsafe.Sizeof(EntryOut{}),
_OP_LINK: unsafe.Sizeof(EntryOut{}),
_OP_LOOKUP: unsafe.Sizeof(raw.EntryOut{}),
_OP_GETATTR: unsafe.Sizeof(raw.AttrOut{}),
_OP_SETATTR: unsafe.Sizeof(raw.AttrOut{}),
_OP_SYMLINK: unsafe.Sizeof(raw.EntryOut{}),
_OP_MKNOD: unsafe.Sizeof(raw.EntryOut{}),
_OP_MKDIR: unsafe.Sizeof(raw.EntryOut{}),
_OP_LINK: unsafe.Sizeof(raw.EntryOut{}),
_OP_OPEN: unsafe.Sizeof(raw.OpenOut{}),
_OP_WRITE: unsafe.Sizeof(raw.WriteOut{}),
_OP_STATFS: unsafe.Sizeof(StatfsOut{}),
......@@ -435,7 +435,7 @@ func init() {
_OP_LISTXATTR: unsafe.Sizeof(raw.GetXAttrOut{}),
_OP_INIT: unsafe.Sizeof(raw.InitOut{}),
_OP_OPENDIR: unsafe.Sizeof(raw.OpenOut{}),
_OP_CREATE: unsafe.Sizeof(CreateOut{}),
_OP_CREATE: unsafe.Sizeof(raw.CreateOut{}),
_OP_BMAP: unsafe.Sizeof(raw.BmapOut{}),
_OP_IOCTL: unsafe.Sizeof(raw.IoctlOut{}),
_OP_POLL: unsafe.Sizeof(raw.PollOut{}),
......@@ -530,15 +530,15 @@ func init() {
// Outputs.
for op, f := range map[opcode]castPointerFunc{
_OP_LOOKUP: func(ptr unsafe.Pointer) interface{} { return (*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_OPENDIR: func(ptr unsafe.Pointer) interface{} { return (*raw.OpenOut)(ptr) },
_OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) },
_OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateOut)(ptr) },
_OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) },
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*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_LINK: func(ptr unsafe.Pointer) interface{} { return (*raw.EntryOut)(ptr) },
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*raw.AttrOut)(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 (*raw.EntryOut)(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_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) },
......
......@@ -33,23 +33,6 @@ func (me *Attr) String() string {
me.Ctime, me.Ctimensec)
}
func (me *AttrOut) String() string {
return fmt.Sprintf(
"{A%d.%09d %v}",
me.AttrValid, me.AttrValidNsec, &me.Attr)
}
func (me *EntryOut) String() string {
return fmt.Sprintf("{%d E%d.%09d A%d.%09d %v}",
me.NodeId, me.EntryValid, me.EntryValidNsec,
me.AttrValid, me.AttrValidNsec, &me.Attr)
}
func (me *CreateOut) String() string {
return fmt.Sprintf("{%v %v}", &me.EntryOut, &me.OpenOut)
}
func (me *ReadIn) String() string {
return fmt.Sprintf("{Fh %d off %d sz %d %s L %d %s}",
me.Fh, me.Offset, me.Size,
......@@ -58,7 +41,6 @@ func (me *ReadIn) String() string {
raw.FlagString(raw.OpenFlagNames, int(me.Flags), "RDONLY"))
}
func (me *Kstatfs) String() string {
return fmt.Sprintf(
"{b%d f%d fs%d ff%d bs%d nl%d frs%d}",
......
......@@ -58,28 +58,9 @@ const (
)
type Attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
Atimensec uint32
Mtimensec uint32
Ctimensec uint32
Mode uint32
Nlink uint32
Owner
Rdev uint32
Blksize uint32
Padding uint32
}
type Attr raw.Attr
type Owner struct {
Uid uint32
Gid uint32
}
type Owner raw.Owner
type Context struct {
Owner
......@@ -99,28 +80,6 @@ type Kstatfs struct {
Spare [6]uint32
}
type EntryOut struct {
NodeId uint64
Generation uint64
EntryValid uint64
AttrValid uint64
EntryValidNsec uint32
AttrValidNsec uint32
Attr
}
type AttrOut struct {
AttrValid uint64
AttrValidNsec uint32
Dummy uint32
Attr
}
type CreateOut struct {
EntryOut
raw.OpenOut
}
const (
READ_LOCKOWNER = (1 << 1)
)
......
......@@ -180,3 +180,19 @@ func (me *FlushIn) String() string {
return fmt.Sprintf("{Fh %d}", me.Fh)
}
func (me *AttrOut) String() string {
return fmt.Sprintf(
"{A%d.%09d %v}",
me.AttrValid, me.AttrValidNsec, &me.Attr)
}
func (me *EntryOut) String() string {
return fmt.Sprintf("{%d E%d.%09d A%d.%09d %v}",
me.NodeId, me.EntryValid, me.EntryValidNsec,
me.AttrValid, me.AttrValidNsec, &me.Attr)
}
func (me *CreateOut) String() string {
return fmt.Sprintf("{%v %v}", &me.EntryOut, &me.OpenOut)
}
......@@ -310,3 +310,43 @@ type FlushIn struct {
Padding uint32
LockOwner uint64
}
type Attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
Atimensec uint32
Mtimensec uint32
Ctimensec uint32
Mode uint32
Nlink uint32
Owner
Rdev uint32
Blksize uint32
Padding uint32
}
type EntryOut struct {
NodeId uint64
Generation uint64
EntryValid uint64
AttrValid uint64
EntryValidNsec uint32
AttrValidNsec uint32
Attr
}
type AttrOut struct {
AttrValid uint64
AttrValidNsec uint32
Dummy uint32
Attr
}
type CreateOut struct {
EntryOut
OpenOut
}
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