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

Trim TODOs.

parent 5e0b2dbf
...@@ -36,6 +36,9 @@ type FsNode interface { ...@@ -36,6 +36,9 @@ type FsNode interface {
// within the treeLock critical section, so you cannot look at // within the treeLock critical section, so you cannot look at
// other inodes. // other inodes.
Deletable() bool Deletable() bool
// OnForget is called when the reference to this inode is
// dropped from the tree.
OnForget() OnForget()
// Misc. // Misc.
......
...@@ -97,7 +97,6 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status) ...@@ -97,7 +97,6 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status)
slice := buffers.AllocBuffer(input.Size) slice := buffers.AllocBuffer(input.Size)
n, err := me.File.ReadAt(slice, int64(input.Offset)) n, err := me.File.ReadAt(slice, int64(input.Offset))
// TODO - fix Go ndocumentation.
if err == io.EOF { if err == io.EOF {
err = nil err = nil
} }
......
...@@ -109,8 +109,6 @@ func (me *FileSystemConnector) toInode(nodeid uint64) *Inode { ...@@ -109,8 +109,6 @@ func (me *FileSystemConnector) toInode(nodeid uint64) *Inode {
} }
// Must run outside treeLock. Returns the nodeId. // Must run outside treeLock. Returns the nodeId.
//
// TODO - write a stress test to exercise this.
func (me *FileSystemConnector) lookupUpdate(node *Inode) uint64 { func (me *FileSystemConnector) lookupUpdate(node *Inode) uint64 {
node.treeLock.Lock() node.treeLock.Lock()
defer node.treeLock.Unlock() defer node.treeLock.Unlock()
...@@ -160,8 +158,6 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool) ...@@ -160,8 +158,6 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool)
if ch == nil { if ch == nil {
log.Panicf("trying to del child %q, but not present", k) log.Panicf("trying to del child %q, but not present", k)
} }
// TODO - change name? This does not really mark the
// fuse Forget operation.
ch.fsInode.OnForget() ch.fsInode.OnForget()
} }
...@@ -255,11 +251,6 @@ func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystem ...@@ -255,11 +251,6 @@ func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystem
// ENOENT: the directory containing the mount point does not exist. // ENOENT: the directory containing the mount point does not exist.
// //
// EBUSY: the intended mount point already exists. // EBUSY: the intended mount point already exists.
//
// TODO - would be useful to expose an interface to put all of the
// mount management in FileSystemConnector, so AutoUnionFs and
// MultiZipFs don't have to do it separately, with the risk of
// inconsistencies.
func (me *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status { func (me *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status {
parent.treeLock.Lock() parent.treeLock.Lock()
defer parent.treeLock.Unlock() defer parent.treeLock.Unlock()
......
...@@ -151,17 +151,21 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out ...@@ -151,17 +151,21 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
code = node.fsInode.Truncate(f, input.Size, &header.Context) code = node.fsInode.Truncate(f, input.Size, &header.Context)
} }
if code.Ok() && (input.Valid&(FATTR_ATIME|FATTR_MTIME|FATTR_ATIME_NOW|FATTR_MTIME_NOW) != 0) { if code.Ok() && (input.Valid&(FATTR_ATIME|FATTR_MTIME|FATTR_ATIME_NOW|FATTR_MTIME_NOW) != 0) {
now := uint64(0)
if input.Valid&FATTR_ATIME_NOW != 0 || input.Valid&FATTR_MTIME_NOW != 0 {
now = uint64(time.Nanoseconds())
}
atime := uint64(input.Atime*1e9) + uint64(input.Atimensec) atime := uint64(input.Atime*1e9) + uint64(input.Atimensec)
if input.Valid&FATTR_ATIME_NOW != 0 { if input.Valid&FATTR_ATIME_NOW != 0 {
atime = uint64(time.Nanoseconds()) atime = now
} }
mtime := uint64(input.Mtime*1e9) + uint64(input.Mtimensec) mtime := uint64(input.Mtime*1e9) + uint64(input.Mtimensec)
if input.Valid&FATTR_MTIME_NOW != 0 { if input.Valid&FATTR_MTIME_NOW != 0 {
mtime = uint64(time.Nanoseconds()) mtime = now
} }
// TODO - if using NOW, mtime and atime may differ.
code = node.fsInode.Utimens(f, atime, mtime, &header.Context) code = node.fsInode.Utimens(f, atime, mtime, &header.Context)
} }
......
...@@ -175,3 +175,10 @@ func Linkat(fd1 int, n1 string, fd2 int, n2 string) int { ...@@ -175,3 +175,10 @@ func Linkat(fd1 int, n1 string, fd2 int, n2 string) int {
0, 0) 0, 0)
return int(errNo) return int(errNo)
} }
func init() {
p := syscall.Getpagesize()
if p != PAGESIZE {
log.Panicf("page size incorrect: %d", p)
}
}
...@@ -25,14 +25,13 @@ const ( ...@@ -25,14 +25,13 @@ const (
S_IFLNK = syscall.S_IFLNK S_IFLNK = syscall.S_IFLNK
S_IFIFO = syscall.S_IFIFO S_IFIFO = syscall.S_IFIFO
// TODO - get this from a canonical place.
PAGESIZE = 4096
CUSE_INIT = 4096 CUSE_INIT = 4096
O_ANYWRITE = uint32(os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_TRUNC) O_ANYWRITE = uint32(os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_TRUNC)
) )
const PAGESIZE = 4096
const ( const (
_DEFAULT_BACKGROUND_TASKS = 12 _DEFAULT_BACKGROUND_TASKS = 12
) )
......
...@@ -14,15 +14,11 @@ import ( ...@@ -14,15 +14,11 @@ import (
"time" "time"
) )
// TODO(hanwen): is md5 sufficiently fast?
func filePathHash(path string) string { func filePathHash(path string) string {
dir, base := filepath.Split(path) dir, base := filepath.Split(path)
h := md5.New() h := md5.New()
h.Write([]byte(dir)) h.Write([]byte(dir))
// TODO(hanwen): should use a tighter format, so we can pack
// more results in a readdir() roundtrip.
return fmt.Sprintf("%x-%s", h.Sum()[:8], base) return fmt.Sprintf("%x-%s", h.Sum()[:8], base)
} }
......
...@@ -26,9 +26,7 @@ const ( ...@@ -26,9 +26,7 @@ const (
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// MultiZipFs is a path filesystem that mounts zipfiles. It needs a // MultiZipFs is a path filesystem that mounts zipfiles.
// reference to the FileSystemConnector to be able to execute
// mounts.
type MultiZipFs struct { type MultiZipFs struct {
lock sync.RWMutex lock sync.RWMutex
zips map[string]*MemTreeFs zips map[string]*MemTreeFs
...@@ -87,7 +85,6 @@ func (me *MultiZipFs) GetAttr(name string, context *fuse.Context) (*os.FileInfo, ...@@ -87,7 +85,6 @@ func (me *MultiZipFs) GetAttr(name string, context *fuse.Context) (*os.FileInfo,
} }
if name == "config" { if name == "config" {
// TODO
a.Mode = fuse.S_IFDIR | 0700 a.Mode = fuse.S_IFDIR | 0700
return a, fuse.OK return a, fuse.OK
} }
......
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