Implemented dir methods.

geesefs-0-30-9
Aaron Jacobs 2015-08-04 09:03:22 +10:00
parent 7943ab5bf4
commit ad3a463488
1 changed files with 41 additions and 0 deletions

View File

@ -172,3 +172,44 @@ func (fs *errorFS) ReadFile(
return
}
// LOCKS_EXCLUDED(fs.mu)
func (fs *errorFS) OpenDir(
ctx context.Context,
op *fuseops.OpenDirOp) (err error) {
if fs.transformError(op, &err) {
return
}
if op.Inode != fuseops.RootInodeID {
err = fmt.Errorf("Unsupported inode ID: %d", op.Inode)
return
}
return
}
// LOCKS_EXCLUDED(fs.mu)
func (fs *errorFS) ReadDir(
ctx context.Context,
op *fuseops.ReadDirOp) (err error) {
if fs.transformError(op, &err) {
return
}
if op.Inode != fuseops.RootInodeID || op.Offset != 0 {
err = fmt.Errorf("Unexpected request: %#v", op)
return
}
op.BytesRead = fuseutil.WriteDirent(
op.Dst,
fuseutil.Dirent{
Offset: 0,
Inode: fooInodeID,
Name: "foo",
Type: fuseutil.DT_File,
})
return
}