Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
a911e23f
Commit
a911e23f
authored
May 07, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use os.FileInfo iso. fuse.Attr for GetAttr results.
This conveniently puts all timestamps in one int64 variable.
parent
13584d14
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
69 additions
and
80 deletions
+69
-80
example/loopback/loopback.go
example/loopback/loopback.go
+0
-9
fuse/api.go
fuse/api.go
+5
-2
fuse/default.go
fuse/default.go
+3
-2
fuse/files.go
fuse/files.go
+2
-4
fuse/fsetattr_test.go
fuse/fsetattr_test.go
+7
-9
fuse/lockingfs.go
fuse/lockingfs.go
+2
-1
fuse/loopback.go
fuse/loopback.go
+3
-6
fuse/pathdebug.go
fuse/pathdebug.go
+5
-4
fuse/pathops.go
fuse/pathops.go
+10
-12
fuse/timingfs.go
fuse/timingfs.go
+2
-1
fuse/xattr_test.go
fuse/xattr_test.go
+2
-2
unionfs/autounion.go
unionfs/autounion.go
+6
-6
unionfs/cachingfs.go
unionfs/cachingfs.go
+5
-4
unionfs/unionfs.go
unionfs/unionfs.go
+10
-12
zipfs/multizip.go
zipfs/multizip.go
+4
-3
zipfs/zipfs.go
zipfs/zipfs.go
+3
-3
No files found.
example/loopback/loopback.go
View file @
a911e23f
...
...
@@ -15,15 +15,6 @@ import (
var
_
=
runtime
.
GOMAXPROCS
var
_
=
log
.
Print
type
PathPrintingFs
struct
{
fuse
.
FileSystem
}
func
(
me
*
PathPrintingFs
)
GetAttr
(
name
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
log
.
Println
(
name
)
return
me
.
FileSystem
.
GetAttr
(
name
)
}
func
main
()
{
// Scans the arg list and sets up flags
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debugging messages."
)
...
...
fuse/api.go
View file @
a911e23f
// The fuse package provides APIs to implement filesystems in
// userspace, using libfuse on Linux.
package
fuse
import
(
"os"
)
// Types for users to implement.
...
...
@@ -14,7 +17,7 @@ package fuse
// required methods.
type
FileSystem
interface
{
// Attributes
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
Utimens
(
name
string
,
AtimeNs
uint64
,
MtimeNs
uint64
)
(
code
Status
)
...
...
@@ -68,7 +71,7 @@ type File interface {
Release
()
Fsync
(
*
FsyncIn
)
(
code
Status
)
GetAttr
()
(
*
Attr
,
Status
)
GetAttr
()
(
*
os
.
FileInfo
,
Status
)
Chown
(
uid
uint32
,
gid
uint32
)
Status
Chmod
(
perms
uint32
)
Status
...
...
fuse/default.go
View file @
a911e23f
...
...
@@ -3,6 +3,7 @@ package fuse
import
(
"fmt"
"log"
"os"
)
var
_
=
log
.
Println
...
...
@@ -152,7 +153,7 @@ func (me *DefaultFile) Release() {
}
func
(
me
*
DefaultFile
)
GetAttr
()
(
*
Attr
,
Status
)
{
func
(
me
*
DefaultFile
)
GetAttr
()
(
*
os
.
FileInfo
,
Status
)
{
return
nil
,
ENOSYS
}
...
...
@@ -183,7 +184,7 @@ func (me *DefaultFile) Ioctl(input *IoctlIn) (output *IoctlOut, data []byte, cod
////////////////////////////////////////////////////////////////
// DefaultFileSystem
func
(
me
*
DefaultFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
DefaultFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
return
nil
,
ENOSYS
}
...
...
fuse/files.go
View file @
a911e23f
...
...
@@ -101,13 +101,11 @@ func (me *LoopbackFile) Chown(uid uint32, gid uint32) Status {
return
OsErrorToErrno
(
me
.
file
.
Chown
(
int
(
uid
),
int
(
gid
)))
}
func
(
me
*
LoopbackFile
)
GetAttr
()
(
*
Attr
,
Status
)
{
func
(
me
*
LoopbackFile
)
GetAttr
()
(
*
os
.
FileInfo
,
Status
)
{
fi
,
err
:=
me
.
file
.
Stat
()
if
err
!=
nil
{
return
nil
,
OsErrorToErrno
(
err
)
}
a
:=
&
Attr
{}
CopyFileInfo
(
fi
,
a
)
return
a
,
OK
return
fi
,
OK
}
fuse/fsetattr_test.go
View file @
a911e23f
...
...
@@ -40,15 +40,13 @@ func (me *MutableDataFile) Release() {
}
func
(
me
*
MutableDataFile
)
getAttr
()
*
Attr
{
a
:=
&
Attr
{}
CopyFileInfo
(
&
me
.
FileInfo
,
a
)
a
.
Size
=
uint64
(
len
(
me
.
data
))
return
a
func
(
me
*
MutableDataFile
)
getAttr
()
*
os
.
FileInfo
{
f
:=
me
.
FileInfo
f
.
Size
=
int64
(
len
(
me
.
data
))
return
&
f
}
func
(
me
*
MutableDataFile
)
GetAttr
()
(
*
Attr
,
Status
)
{
func
(
me
*
MutableDataFile
)
GetAttr
()
(
*
os
.
FileInfo
,
Status
)
{
me
.
GetAttrCalled
=
true
return
me
.
getAttr
(),
OK
}
...
...
@@ -90,9 +88,9 @@ func (me *FSetAttrFs) GetXAttr(name string, attr string) ([]byte, Status) {
return
nil
,
syscall
.
ENODATA
}
func
(
me
*
FSetAttrFs
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
FSetAttrFs
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
if
name
==
""
{
return
&
Attr
{
Mode
:
S_IFDIR
|
0700
},
OK
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0700
},
OK
}
if
name
==
"file"
&&
me
.
file
!=
nil
{
a
:=
me
.
file
.
getAttr
()
...
...
fuse/lockingfs.go
View file @
a911e23f
package
fuse
import
(
"os"
"sync"
)
...
...
@@ -25,7 +26,7 @@ func (me *LockingFileSystem) locked() func() {
return
func
()
{
me
.
lock
.
Unlock
()
}
}
func
(
me
*
LockingFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
LockingFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
defer
me
.
locked
()()
return
me
.
FileSystem
.
GetAttr
(
name
)
}
...
...
fuse/loopback.go
View file @
a911e23f
...
...
@@ -32,16 +32,13 @@ func (me *LoopbackFileSystem) GetPath(relPath string) string {
return
filepath
.
Join
(
me
.
root
,
relPath
)
}
func
(
me
*
LoopbackFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
LoopbackFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
fullPath
:=
me
.
GetPath
(
name
)
fi
,
err
:=
os
.
Lstat
(
fullPath
)
if
err
!=
nil
{
return
nil
,
ENOENT
return
nil
,
OsErrorToErrno
(
err
)
}
out
:=
new
(
Attr
)
CopyFileInfo
(
fi
,
out
)
return
out
,
OK
return
fi
,
OK
}
func
(
me
*
LoopbackFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
...
...
fuse/pathdebug.go
View file @
a911e23f
...
...
@@ -3,6 +3,7 @@ package fuse
import
(
"fmt"
"log"
"os"
"path/filepath"
"sort"
"strings"
...
...
@@ -71,20 +72,20 @@ func (me *FileSystemDebug) GetXAttr(name string, attr string) ([]byte, Status) {
return
me
.
FileSystem
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
FileSystemDebug
)
GetAttr
(
path
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
FileSystemDebug
)
GetAttr
(
path
string
)
(
*
os
.
FileInfo
,
Status
)
{
if
!
strings
.
HasPrefix
(
path
,
DebugDir
)
{
return
me
.
FileSystem
.
GetAttr
(
path
)
}
if
path
==
DebugDir
{
return
&
Attr
{
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0755
,
},
OK
}
c
:=
me
.
getContent
(
path
)
if
c
!=
nil
{
return
&
Attr
{
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Size
:
u
int64
(
len
(
c
)),
Size
:
int64
(
len
(
c
)),
},
OK
}
return
nil
,
ENOENT
...
...
fuse/pathops.go
View file @
a911e23f
...
...
@@ -46,7 +46,7 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
}
fullPath
=
filepath
.
Join
(
fullPath
,
name
)
attr
,
err
:=
mount
.
fs
.
GetAttr
(
fullPath
)
fi
,
err
:=
mount
.
fs
.
GetAttr
(
fullPath
)
if
err
==
ENOENT
&&
mount
.
options
.
NegativeTimeout
>
0.0
{
return
NegativeEntry
(
mount
.
options
.
NegativeTimeout
),
OK
,
nil
...
...
@@ -56,7 +56,7 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
return
nil
,
err
,
nil
}
data
:=
me
.
lookupUpdate
(
parent
,
name
,
attr
.
Mode
&
S_IFDIR
!=
0
)
data
:=
me
.
lookupUpdate
(
parent
,
name
,
fi
.
Mode
&
S_IFDIR
!=
0
)
data
.
LookupCount
+=
lookupCount
out
=
&
EntryOut
{
...
...
@@ -65,7 +65,7 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
}
SplitNs
(
mount
.
options
.
EntryTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
SplitNs
(
mount
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
out
.
Attr
=
*
attr
CopyFileInfo
(
fi
,
&
out
.
Attr
)
out
.
Attr
.
Ino
=
data
.
NodeId
return
out
,
OK
,
data
}
...
...
@@ -77,15 +77,14 @@ func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn) {
func
(
me
*
FileSystemConnector
)
GetAttr
(
header
*
InHeader
,
input
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
if
input
.
Flags
&
FUSE_GETATTR_FH
!=
0
{
f
,
mount
,
_
:=
me
.
getFile
(
input
.
Fh
)
attr
,
err
:=
f
.
GetAttr
()
fi
,
err
:=
f
.
GetAttr
()
if
err
!=
OK
&&
err
!=
ENOSYS
{
return
nil
,
err
}
if
attr
!=
nil
{
out
=
&
AttrOut
{
Attr
:
*
attr
,
}
if
fi
!=
nil
{
out
=
&
AttrOut
{}
CopyFileInfo
(
fi
,
&
out
.
Attr
)
out
.
Attr
.
Ino
=
header
.
NodeId
SplitNs
(
mount
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
...
...
@@ -98,14 +97,13 @@ func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out
return
nil
,
ENOENT
}
attr
,
err
:=
mount
.
fs
.
GetAttr
(
fullPath
)
fi
,
err
:=
mount
.
fs
.
GetAttr
(
fullPath
)
if
err
!=
OK
{
return
nil
,
err
}
out
=
&
AttrOut
{
Attr
:
*
attr
,
}
out
=
&
AttrOut
{}
CopyFileInfo
(
fi
,
&
out
.
Attr
)
out
.
Attr
.
Ino
=
header
.
NodeId
SplitNs
(
mount
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
...
...
fuse/timingfs.go
View file @
a911e23f
...
...
@@ -3,6 +3,7 @@ package fuse
import
(
"time"
"log"
"os"
"fmt"
)
...
...
@@ -44,7 +45,7 @@ func (me *TimingFileSystem) HotPaths(operation string) (paths []string) {
return
me
.
LatencyMap
.
TopArgs
(
operation
)
}
func
(
me
*
TimingFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
TimingFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
defer
me
.
startTimer
(
"GetAttr"
,
name
)()
return
me
.
FileSystem
.
GetAttr
(
name
)
}
...
...
fuse/xattr_test.go
View file @
a911e23f
...
...
@@ -25,8 +25,8 @@ func NewXAttrFs(nm string, m map[string][]byte) *XAttrTestFs {
return
x
}
func
(
me
*
XAttrTestFs
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
a
:=
new
(
Attr
)
func
(
me
*
XAttrTestFs
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
a
:=
&
os
.
FileInfo
{}
if
name
==
""
||
name
==
"/"
{
a
.
Mode
=
S_IFDIR
|
0700
return
a
,
OK
...
...
unionfs/autounion.go
View file @
a911e23f
...
...
@@ -225,23 +225,23 @@ func (me *AutoUnionFs) GetXAttr(name string, attr string) ([]byte, fuse.Status)
return
nil
,
syscall
.
ENODATA
}
func
(
me
*
AutoUnionFs
)
GetAttr
(
path
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
func
(
me
*
AutoUnionFs
)
GetAttr
(
path
string
)
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
if
path
==
""
||
path
==
_CONFIG
||
path
==
_STATUS
{
a
:=
&
fuse
.
Attr
{
a
:=
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
}
return
a
,
fuse
.
OK
}
if
path
==
filepath
.
Join
(
_STATUS
,
_VERSION
)
{
a
:=
&
fuse
.
Attr
{
a
:=
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0644
,
}
return
a
,
fuse
.
OK
}
if
path
==
filepath
.
Join
(
_STATUS
,
_ROOT
)
{
a
:=
&
fuse
.
Attr
{
a
:=
&
os
.
FileInfo
{
Mode
:
syscall
.
S_IFLNK
|
0644
,
}
return
a
,
fuse
.
OK
...
...
@@ -256,14 +256,14 @@ func (me *AutoUnionFs) GetAttr(path string) (*fuse.Attr, fuse.Status) {
return
nil
,
fuse
.
ENOENT
}
a
:=
&
fuse
.
Attr
{
a
:=
&
os
.
FileInfo
{
Mode
:
syscall
.
S_IFLNK
|
0644
,
}
return
a
,
fuse
.
OK
}
if
me
.
getUnionFs
(
path
)
!=
nil
{
return
&
fuse
.
Attr
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
},
fuse
.
OK
}
...
...
unionfs/cachingfs.go
View file @
a911e23f
...
...
@@ -3,12 +3,13 @@ package unionfs
import
(
"fmt"
"github.com/hanwen/go-fuse/fuse"
"os"
)
var
_
=
fmt
.
Println
type
attrResponse
struct
{
*
fuse
.
Attr
*
os
.
FileInfo
fuse
.
Status
}
...
...
@@ -52,7 +53,7 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse {
func
getAttr
(
fs
fuse
.
FileSystem
,
name
string
)
*
attrResponse
{
a
,
code
:=
fs
.
GetAttr
(
name
)
return
&
attrResponse
{
Attr
:
a
,
FileInfo
:
a
,
Status
:
code
,
}
}
...
...
@@ -74,9 +75,9 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
return
c
}
func
(
me
*
CachingFileSystem
)
GetAttr
(
name
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
func
(
me
*
CachingFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
r
:=
me
.
attributes
.
Get
(
name
)
.
(
*
attrResponse
)
return
r
.
Attr
,
r
.
Status
return
r
.
FileInfo
,
r
.
Status
}
func
(
me
*
CachingFileSystem
)
Readlink
(
name
string
)
(
string
,
fuse
.
Status
)
{
...
...
unionfs/unionfs.go
View file @
a911e23f
...
...
@@ -136,7 +136,7 @@ func (me *UnionFs) getBranch(name string) branchResult {
}
type
branchResult
struct
{
attr
*
fuse
.
Attr
attr
*
os
.
FileInfo
code
fuse
.
Status
branch
int
}
...
...
@@ -317,7 +317,7 @@ func (me *UnionFs) Mkdir(path string, mode uint32) (code fuse.Status) {
}
if
code
.
Ok
()
{
me
.
removeDeletion
(
path
)
attr
:=
&
fuse
.
Attr
{
attr
:=
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
mode
,
}
me
.
branchCache
.
Set
(
path
,
branchResult
{
attr
,
fuse
.
OK
,
0
})
...
...
@@ -345,7 +345,7 @@ func (me *UnionFs) Truncate(path string, offset uint64) (code fuse.Status) {
code
=
me
.
fileSystems
[
0
]
.
Truncate
(
path
,
offset
)
}
if
code
.
Ok
()
{
r
.
attr
.
Size
=
offset
r
.
attr
.
Size
=
int64
(
offset
)
me
.
branchCache
.
Set
(
path
,
r
)
}
return
code
...
...
@@ -364,10 +364,8 @@ func (me *UnionFs) Utimens(name string, atime uint64, mtime uint64) (code fuse.S
code
=
me
.
fileSystems
[
0
]
.
Utimens
(
name
,
atime
,
mtime
)
}
if
code
.
Ok
()
{
r
.
attr
.
Atime
=
uint64
(
atime
/
1e9
)
r
.
attr
.
Atimensec
=
uint32
(
atime
%
1e9
)
r
.
attr
.
Mtime
=
uint64
(
mtime
/
1e9
)
r
.
attr
.
Mtimensec
=
uint32
(
mtime
%
1e9
)
r
.
attr
.
Atime_ns
=
int64
(
atime
)
r
.
attr
.
Mtime_ns
=
int64
(
mtime
)
me
.
branchCache
.
Set
(
name
,
r
)
}
return
code
...
...
@@ -384,7 +382,7 @@ func (me *UnionFs) Chown(name string, uid uint32, gid uint32) (code fuse.Status)
return
fuse
.
EPERM
}
if
r
.
attr
.
Owner
.
Uid
!=
uid
||
r
.
attr
.
Owner
.
Gid
!=
gid
{
if
r
.
attr
.
Uid
!=
int
(
uid
)
||
r
.
attr
.
Gid
!=
int
(
gid
)
{
if
r
.
branch
>
0
{
code
:=
me
.
Promote
(
name
,
r
)
if
code
!=
fuse
.
OK
{
...
...
@@ -394,8 +392,8 @@ func (me *UnionFs) Chown(name string, uid uint32, gid uint32) (code fuse.Status)
}
me
.
fileSystems
[
0
]
.
Chown
(
name
,
uid
,
gid
)
}
r
.
attr
.
Owner
.
Uid
=
uid
r
.
attr
.
Owner
.
Gid
=
gid
r
.
attr
.
Uid
=
int
(
uid
)
r
.
attr
.
Gid
=
int
(
gid
)
me
.
branchCache
.
Set
(
name
,
r
)
return
fuse
.
OK
}
...
...
@@ -526,7 +524,7 @@ func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse
if
code
.
Ok
()
{
me
.
removeDeletion
(
name
)
a
:=
fuse
.
Attr
{
a
:=
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
mode
,
}
me
.
branchCache
.
Set
(
name
,
branchResult
{
&
a
,
fuse
.
OK
,
0
})
...
...
@@ -534,7 +532,7 @@ func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse
return
fuseFile
,
code
}
func
(
me
*
UnionFs
)
GetAttr
(
name
string
)
(
a
*
fuse
.
Attr
,
s
fuse
.
Status
)
{
func
(
me
*
UnionFs
)
GetAttr
(
name
string
)
(
a
*
os
.
FileInfo
,
s
fuse
.
Status
)
{
if
name
==
_READONLY
{
return
nil
,
fuse
.
ENOENT
}
...
...
zipfs/multizip.go
View file @
a911e23f
...
...
@@ -13,6 +13,7 @@ path/to/zipfile to /config/zipmount
import
(
"github.com/hanwen/go-fuse/fuse"
"log"
"os"
"path/filepath"
"sync"
"strings"
...
...
@@ -127,8 +128,8 @@ func (me *MultiZipFs) OpenDir(name string) (stream chan fuse.DirEntry, code fuse
return
stream
,
fuse
.
OK
}
func
(
me
*
MultiZipFs
)
GetAttr
(
name
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
a
:=
new
(
fuse
.
Attr
)
func
(
me
*
MultiZipFs
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
a
:=
&
os
.
FileInfo
{}
if
name
==
""
{
// Should not write in top dir.
a
.
Mode
=
fuse
.
S_IFDIR
|
0500
...
...
@@ -156,7 +157,7 @@ func (me *MultiZipFs) GetAttr(name string) (*fuse.Attr, fuse.Status) {
a
.
Mode
=
submode
entry
,
hasDir
:=
me
.
zips
[
base
]
if
hasDir
{
a
.
Size
=
u
int64
(
len
(
entry
.
ZipFileName
))
a
.
Size
=
int64
(
len
(
entry
.
ZipFileName
))
return
a
,
fuse
.
OK
}
_
,
hasDir
=
me
.
pendingZips
[
base
]
...
...
zipfs/zipfs.go
View file @
a911e23f
...
...
@@ -117,19 +117,19 @@ func NewZipArchiveFileSystem(name string) (*ZipArchiveFileSystem, os.Error) {
const
zip_DIRMODE
uint32
=
fuse
.
S_IFDIR
|
0700
const
zip_FILEMODE
uint32
=
fuse
.
S_IFREG
|
0600
func
(
me
*
ZipArchiveFileSystem
)
GetAttr
(
name
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
func
(
me
*
ZipArchiveFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
dir
,
file
:=
me
.
tree
.
Lookup
(
name
)
if
dir
==
nil
{
return
nil
,
fuse
.
ENOENT
}
a
:=
new
(
fuse
.
Attr
)
a
:=
&
os
.
FileInfo
{}
if
file
==
nil
{
a
.
Mode
=
zip_DIRMODE
}
else
{
// TODO - do something intelligent with timestamps.
a
.
Mode
=
zip_FILEMODE
a
.
Size
=
u
int64
(
file
.
UncompressedSize
)
a
.
Size
=
int64
(
file
.
UncompressedSize
)
}
return
a
,
fuse
.
OK
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment