Commit 6dbddc38 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Rename ZipFileFuse to ZipArchiveFileSystem.

parent 0cccae24
...@@ -45,7 +45,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f ...@@ -45,7 +45,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f
fs := NewZipArchiveFileSystem(zipFile) fs := NewZipArchiveFileSystem(zipFile)
if fs == nil { if fs == nil {
// TODO // TODO
log.Println("NewZipFileFuse returned nil") log.Println("NewZipArchiveFileSystem returned nil")
me.zfs.pendingZips[me.Basename] = false, false me.zfs.pendingZips[me.Basename] = false, false
return 0, fuse.ENOSYS return 0, fuse.ENOSYS
} }
...@@ -73,7 +73,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f ...@@ -73,7 +73,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f
type MultiZipFs struct { type MultiZipFs struct {
Connector *fuse.PathFileSystemConnector Connector *fuse.PathFileSystemConnector
lock sync.RWMutex lock sync.RWMutex
zips map[string]*ZipFileFuse zips map[string]*ZipArchiveFileSystem
pendingZips map[string]bool pendingZips map[string]bool
zipFileNames map[string]string zipFileNames map[string]string
...@@ -82,7 +82,7 @@ type MultiZipFs struct { ...@@ -82,7 +82,7 @@ type MultiZipFs struct {
func NewMultiZipFs() *MultiZipFs { func NewMultiZipFs() *MultiZipFs {
m := new(MultiZipFs) m := new(MultiZipFs)
m.zips = make(map[string]*ZipFileFuse) m.zips = make(map[string]*ZipArchiveFileSystem)
m.pendingZips = make(map[string]bool) m.pendingZips = make(map[string]bool)
m.zipFileNames = make(map[string]string) m.zipFileNames = make(map[string]string)
m.Connector = fuse.NewPathFileSystemConnector(m) m.Connector = fuse.NewPathFileSystemConnector(m)
......
...@@ -70,7 +70,7 @@ func (me *ZipDirTree) FindDir(name string) *ZipDirTree { ...@@ -70,7 +70,7 @@ func (me *ZipDirTree) FindDir(name string) *ZipDirTree {
return s return s
} }
type ZipFileFuse struct { type ZipArchiveFileSystem struct {
zipReader *zip.ReadCloser zipReader *zip.ReadCloser
tree *ZipDirTree tree *ZipDirTree
ZipFileName string ZipFileName string
...@@ -100,12 +100,12 @@ func zipFilesToTree(files []*zip.File) *ZipDirTree { ...@@ -100,12 +100,12 @@ func zipFilesToTree(files []*zip.File) *ZipDirTree {
return t return t
} }
func NewZipArchiveFileSystem(name string) *ZipFileFuse { func NewZipArchiveFileSystem(name string) *ZipArchiveFileSystem {
z := new(ZipFileFuse) z := new(ZipArchiveFileSystem)
r, err := zip.OpenReader(name) r, err := zip.OpenReader(name)
if err != nil { if err != nil {
// TODO - return os.Error instead. // TODO - return os.Error instead.
log.Println("NewZipFileFuse(): " + err.String()) log.Println("NewZipArchiveFileSystem(): " + err.String())
return nil return nil
} }
z.ZipFileName = name z.ZipFileName = name
...@@ -117,7 +117,7 @@ func NewZipArchiveFileSystem(name string) *ZipFileFuse { ...@@ -117,7 +117,7 @@ func NewZipArchiveFileSystem(name string) *ZipFileFuse {
const zip_DIRMODE uint32 = fuse.S_IFDIR | 0700 const zip_DIRMODE uint32 = fuse.S_IFDIR | 0700
const zip_FILEMODE uint32 = fuse.S_IFREG | 0600 const zip_FILEMODE uint32 = fuse.S_IFREG | 0600
func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) { func (me *ZipArchiveFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) {
dir, file := me.tree.Lookup(name) dir, file := me.tree.Lookup(name)
if dir == nil { if dir == nil {
return nil, fuse.ENOENT return nil, fuse.ENOENT
...@@ -135,7 +135,7 @@ func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -135,7 +135,7 @@ func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) {
return a, fuse.OK return a, fuse.OK
} }
func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.FuseFile, code fuse.Status) { func (me *ZipArchiveFileSystem) Open(name string, flags uint32) (file fuse.FuseFile, code fuse.Status) {
if flags&fuse.O_ANYWRITE != 0 { if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
...@@ -147,7 +147,7 @@ func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.FuseFile, code ...@@ -147,7 +147,7 @@ func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.FuseFile, code
return NewZipFile(zfile), fuse.OK return NewZipFile(zfile), fuse.OK
} }
func (me *ZipFileFuse) OpenDir(name string) (stream chan fuse.DirEntry, code fuse.Status) { func (me *ZipArchiveFileSystem) OpenDir(name string) (stream chan fuse.DirEntry, code fuse.Status) {
zdir, file := me.tree.Lookup(name) zdir, file := me.tree.Lookup(name)
if file != nil { if file != nil {
return nil, fuse.ENOSYS return nil, fuse.ENOSYS
......
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