Support removing roots from FUSE

Change-Id: I6929d416a6bbdad396da01210e86cb78b1f0c90b
This commit is contained in:
Dustin Sallings 2013-12-18 23:08:10 -08:00
parent 32ee48d919
commit f9b9e39f6f
1 changed files with 24 additions and 0 deletions

View File

@ -63,6 +63,30 @@ func (n *rootsDir) ReadDir(intr fuse.Intr) ([]fuse.Dirent, fuse.Error) {
return ents, nil
}
func (n *rootsDir) Remove(req *fuse.RemoveRequest, intr fuse.Intr) fuse.Error {
n.mu.Lock()
defer n.mu.Unlock()
if err := n.condRefresh(); err != nil {
return err
}
br := n.m[req.Name]
if !br.Valid() {
return fuse.ENOENT
}
claim := schema.NewDelAttributeClaim(br, "camliRoot", "")
_, err := n.fs.client.UploadAndSignBlob(claim)
if err != nil {
log.Println("rootsDir.Remove:", err)
return fuse.EIO
}
delete(n.m, req.Name)
return nil
}
func (n *rootsDir) Lookup(name string, intr fuse.Intr) (fuse.Node, fuse.Error) {
log.Printf("fs.roots: Lookup(%q)", name)
n.mu.Lock()