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

Return Status from File.GetAttr too.

parent 55280611
...@@ -152,8 +152,8 @@ func (me *DefaultFile) Release() { ...@@ -152,8 +152,8 @@ func (me *DefaultFile) Release() {
} }
func (me *DefaultFile) GetAttr() *Attr { func (me *DefaultFile) GetAttr() (*Attr, Status) {
return nil return nil, ENOSYS
} }
func (me *DefaultFile) Fsync(*FsyncIn) (code Status) { func (me *DefaultFile) Fsync(*FsyncIn) (code Status) {
......
...@@ -46,9 +46,9 @@ func (me *MutableDataFile) getAttr() *Attr { ...@@ -46,9 +46,9 @@ func (me *MutableDataFile) getAttr() *Attr {
return a return a
} }
func (me *MutableDataFile) GetAttr() *Attr { func (me *MutableDataFile) GetAttr() (*Attr, Status) {
me.GetAttrCalled = true me.GetAttrCalled = true
return me.getAttr() return me.getAttr(), OK
} }
func (me *MutableDataFile) Fsync(*FsyncIn) (code Status) { func (me *MutableDataFile) Fsync(*FsyncIn) (code Status) {
......
...@@ -208,12 +208,12 @@ func (me *LoopbackFile) Chown(uid uint32, gid uint32) Status { ...@@ -208,12 +208,12 @@ func (me *LoopbackFile) Chown(uid uint32, gid uint32) Status {
return OsErrorToErrno(me.file.Chown(int(uid), int(gid))) return OsErrorToErrno(me.file.Chown(int(uid), int(gid)))
} }
func (me *LoopbackFile) GetAttr() *Attr { func (me *LoopbackFile) GetAttr() (*Attr, Status) {
fi, err := me.file.Stat() fi, err := me.file.Stat()
if err != nil { if err != nil {
return nil return nil, OsErrorToErrno(err)
} }
a := &Attr{} a := &Attr{}
CopyFileInfo(fi, a) CopyFileInfo(fi, a)
return a return a, OK
} }
...@@ -76,9 +76,12 @@ func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn) { ...@@ -76,9 +76,12 @@ func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn) {
func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) { func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
if input.Flags&FUSE_GETATTR_FH != 0 { if input.Flags&FUSE_GETATTR_FH != 0 {
f, mount := me.getFile(input.Fh) f, mount := me.getFile(input.Fh)
attr := f.GetAttr() attr, err := f.GetAttr()
if attr != nil { if err != OK && err != ENOSYS {
return nil, err
}
if attr != nil {
out = &AttrOut{ out = &AttrOut{
Attr: *attr, Attr: *attr,
} }
......
...@@ -522,11 +522,12 @@ type File interface { ...@@ -522,11 +522,12 @@ type File interface {
Release() Release()
Fsync(*FsyncIn) (code Status) Fsync(*FsyncIn) (code Status)
GetAttr() *Attr GetAttr() (*Attr, Status)
Utimens(atimeNs uint64, mtimeNs uint64) Status
Truncate(size uint64) Status
Chown(uid uint32, gid uint32) Status Chown(uid uint32, gid uint32) Status
Chmod(perms uint32) Status Chmod(perms uint32) Status
Utimens(atimeNs uint64, mtimeNs uint64) Status
Truncate(size uint64) Status
} }
type RawDir interface { type RawDir interface {
......
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