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