Commit c0420307 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d793fdaf
...@@ -26,9 +26,11 @@ XXX doc ...@@ -26,9 +26,11 @@ XXX doc
import os, sys, hashlib, tempfile, subprocess, time import os, sys, hashlib, tempfile, subprocess, time
import logging as log import logging as log
from os.path import dirname from os.path import dirname
from golang import go, chan, select, default
from errno import ENOENT, EEXIST from errno import ENOENT, EEXIST
from golang import go, chan, select, default
from golang.gcompat import qq
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
...@@ -162,6 +164,9 @@ def _start(zurl): ...@@ -162,6 +164,9 @@ def _start(zurl):
else: else:
# TODO read .wcfs and verify it = zurl # TODO read .wcfs and verify it = zurl
res = f res = f
dotwcfs = f.read()
if dotwcfs != zurl:
raise RuntimeError(".wcfs != zurl (%s != %s)" % (qq(dotwcfs), qq(zurl)))
break break
...@@ -228,7 +233,7 @@ def _mntpt_4zurl(zurl): ...@@ -228,7 +233,7 @@ def _mntpt_4zurl(zurl):
_mkdir_p(mntpt) _mkdir_p(mntpt)
return mntpt return mntpt
# mkdir -p # mkdir -p.
def _mkdir_p(path): def _mkdir_p(path):
try: try:
os.makedirs(path) os.makedirs(path)
......
...@@ -263,6 +263,12 @@ func NewStaticFile(data []byte) *StaticFile { ...@@ -263,6 +263,12 @@ func NewStaticFile(data []byte) *StaticFile {
return &StaticFile{Node: nodefs.NewDefaultNode(), data: data} return &StaticFile{Node: nodefs.NewDefaultNode(), data: data}
} }
func (f *StaticFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.Status {
out.Size = uint64(len(f.data))
out.Mode = fuse.S_IFREG | 0644
return fuse.OK
}
func (f *StaticFile) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context) (fuse.ReadResult, fuse.Status) { func (f *StaticFile) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context) (fuse.ReadResult, fuse.Status) {
l := int64(len(f.data)) l := int64(len(f.data))
end := off + l end := off + l
...@@ -286,7 +292,7 @@ func mkfile(parent nodefs.Node, name string, child nodefs.Node) { ...@@ -286,7 +292,7 @@ func mkfile(parent nodefs.Node, name string, child nodefs.Node) {
func main() { func main() {
log.SetPrefix("wcfs: ") log.SetPrefix("wcfs: ")
debug := flag.Bool("d", false, "debug") debug := flag.Bool("d", true, "debug")
flag.Parse() flag.Parse()
if len(flag.Args()) != 2 { if len(flag.Args()) != 2 {
log.Fatalf("Usage: %s zurl mntpt", os.Args[0]) log.Fatalf("Usage: %s zurl mntpt", os.Args[0])
......
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