Commit 7475c1f3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Create directories and files in r/w storage that are writable.

Make all tests freeze r/o storage before commencing.
parent a764b4d5
......@@ -278,6 +278,15 @@ func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Co
if srcResult.attr.IsRegular() {
code = fuse.CopyFile(sourceFs, writable, name, name, context)
if code.Ok() {
code = writable.Chmod(name, srcResult.attr.Mode & 07777 | 0200, context)
}
if code.Ok() {
code = writable.Utimens(name, uint64(srcResult.attr.Atime_ns),
uint64(srcResult.attr.Mtime_ns), context)
}
files := me.nodeFs.AllFiles(name, 0)
for _, fileWrapper := range files {
if !code.Ok() {
......@@ -312,12 +321,13 @@ func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Co
code = writable.Symlink(link, name, context)
}
} else if srcResult.attr.IsDirectory() {
code = writable.Mkdir(name, 0755, context)
code = writable.Mkdir(name, srcResult.attr.Mode & 07777 | 0200, context)
} else {
log.Println("Unknown file type:", srcResult.attr)
return fuse.ENOSYS
}
if !code.Ok() {
me.branchCache.GetFresh(name)
return code
......@@ -625,9 +635,9 @@ func (me *UnionFs) promoteDirsTo(filename string) fuse.Status {
j := len(todo) - i - 1
d := todo[j]
r := results[j]
code := me.fileSystems[0].Mkdir(d, r.attr.Mode&07777, nil)
code := me.fileSystems[0].Mkdir(d, r.attr.Mode&07777 | 0200, nil)
if code != fuse.OK {
log.Println("Error creating dir leading to path", d, code)
log.Println("Error creating dir leading to path", d, code, me.fileSystems[0])
return fuse.EPERM
}
......
This diff is collapsed.
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