diff --git a/fuseutil/dirent.go b/fuseutil/dirent.go index 59ebf39..c12ad1e 100644 --- a/fuseutil/dirent.go +++ b/fuseutil/dirent.go @@ -4,13 +4,24 @@ package fuseutil import ( + "syscall" "unsafe" - bazilfuse "bazil.org/fuse" "github.com/jacobsa/fuse" ) -type DirentType bazilfuse.DirentType +type DirentType uint32 + +const ( + DT_Unknown DirentType = 0 + DT_Socket DirentType = syscall.DT_SOCK + DT_Link DirentType = syscall.DT_LNK + DT_File DirentType = syscall.DT_REG + DT_Block DirentType = syscall.DT_BLK + DT_Directory DirentType = syscall.DT_DIR + DT_Char DirentType = syscall.DT_CHR + DT_FIFO DirentType = syscall.DT_FIFO +) // A struct representing an entry within a directory file, describing a child. // See notes on fuse.ReadDirResponse and on AppendDirent for details. diff --git a/samples/hello_fs.go b/samples/hello_fs.go index e6ad10a..64a5b8d 100644 --- a/samples/hello_fs.go +++ b/samples/hello_fs.go @@ -46,7 +46,23 @@ func (fs *HelloFS) OpenDir( } // We have a fixed directory structure. -var gDirectoryEntries = map[fuse.InodeID][]fuseutil.Dirent{} +var gDirectoryEntries = map[fuse.InodeID][]fuseutil.Dirent{ + // root + rootInode: []fuseutil.Dirent{ + fuseutil.Dirent{ + Offset: 1, + Inode: helloInode, + Name: "hello", + Type: fuseutil.DT_File, + }, + fuseutil.Dirent{ + Offset: 2, + Inode: dirInode, + Name: "dir", + Type: fuseutil.DT_Directory, + }, + }, +} func (fs *HelloFS) ReadDir( ctx context.Context,