flushFS.GetInodeAttributes

geesefs-0-30-9
Aaron Jacobs 2015-03-20 11:40:14 +11:00
parent d7fec86069
commit 38e2aaff58
1 changed files with 32 additions and 0 deletions

View File

@ -48,6 +48,14 @@ type flushFS struct {
// Helpers
////////////////////////////////////////////////////////////////////////
// LOCKS_REQUIRED(fs.mu)
func (fs *flushFS) rootAttributes() fuse.InodeAttributes {
return fuse.InodeAttributes{
Nlink: 1,
Mode: 0777 | os.ModeDir,
}
}
// LOCKS_REQUIRED(fs.mu)
func (fs *flushFS) fooAttributes() fuse.InodeAttributes {
return fuse.InodeAttributes{
@ -90,3 +98,27 @@ func (fs *flushFS) LookUpInode(
return
}
func (fs *flushFS) GetInodeAttributes(
ctx context.Context,
req *fuse.GetInodeAttributesRequest) (
resp *fuse.GetInodeAttributesResponse, err error) {
resp = &fuse.GetInodeAttributesResponse{}
fs.mu.Lock()
defer fs.mu.Unlock()
switch req.Inode {
case fuse.RootInodeID:
resp.Attributes = fs.rootAttributes()
return
case fooID:
resp.Attributes = fs.fooAttributes()
return
default:
err = fuse.ENOENT
return
}
}