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
2d65aab9
Commit
2d65aab9
authored
Jun 20, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
ed34f5da
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
88 additions
and
91 deletions
+88
-91
fuse/api.go
fuse/api.go
+1
-1
fuse/fuse.go
fuse/fuse.go
+1
-0
fuse/loopback_test.go
fuse/loopback_test.go
+10
-10
fuse/misc.go
fuse/misc.go
+2
-3
fuse/mount.go
fuse/mount.go
+2
-2
fuse/mountstate.go
fuse/mountstate.go
+1
-1
fuse/owner_test.go
fuse/owner_test.go
+2
-3
fuse/pathdebug.go
fuse/pathdebug.go
+2
-2
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+19
-19
fuse/pathops.go
fuse/pathops.go
+0
-1
unionfs/autounion.go
unionfs/autounion.go
+9
-9
unionfs/autounion_test.go
unionfs/autounion_test.go
+6
-6
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/dircache.go
unionfs/dircache.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+24
-25
zipfs/multizip_test.go
zipfs/multizip_test.go
+4
-4
zipfs/tarfs.go
zipfs/tarfs.go
+1
-1
No files found.
fuse/api.go
View file @
2d65aab9
...
...
@@ -97,7 +97,7 @@ type FileSystemOptions struct {
}
type
MountOptions
struct
{
AllowOther
bool
AllowOther
bool
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
...
...
fuse/fuse.go
View file @
2d65aab9
package
fuse
import
(
"os"
"fmt"
...
...
fuse/loopback_test.go
View file @
2d65aab9
...
...
@@ -65,10 +65,10 @@ func (me *testCase) Setup(t *testing.T) {
var
rfs
RawFileSystem
me
.
connector
=
NewFileSystemConnector
(
pfs
,
&
FileSystemOptions
{
EntryTimeout
:
testTtl
,
AttrTimeout
:
testTtl
,
NegativeTimeout
:
0.0
,
})
EntryTimeout
:
testTtl
,
AttrTimeout
:
testTtl
,
NegativeTimeout
:
0.0
,
})
rfs
=
me
.
connector
rfs
=
NewTimingRawFileSystem
(
rfs
)
rfs
=
NewLockingRawFileSystem
(
rfs
)
...
...
@@ -601,7 +601,7 @@ func TestLargeRead(t *testing.T) {
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
defer
ts
.
Cleanup
()
ts
.
testLargeRead
()
}
...
...
@@ -609,7 +609,7 @@ func TestLargeDirRead(t *testing.T) {
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
defer
ts
.
Cleanup
()
ts
.
testLargeDirRead
()
}
...
...
@@ -680,9 +680,9 @@ func TestRecursiveMount(t *testing.T) {
t
.
Error
(
"expect EBUSY"
)
}
err
=
os
.
Rename
(
ts
.
mountPoint
+
"/mnt"
,
ts
.
mountPoint
+
"/foobar"
)
err
=
os
.
Rename
(
ts
.
mountPoint
+
"/mnt"
,
ts
.
mountPoint
+
"/foobar"
)
CheckSuccess
(
err
)
f
.
Close
()
log
.
Println
(
"Waiting for kernel to flush file-close to fuse..."
)
...
...
@@ -702,11 +702,11 @@ func TestDeletedUnmount(t *testing.T) {
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
defer
ts
.
Cleanup
()
submnt
:=
filepath
.
Join
(
ts
.
mountPoint
,
"mnt"
)
err
:=
os
.
Mkdir
(
submnt
,
0777
)
CheckSuccess
(
err
)
pfs2
:=
NewLoopbackFileSystem
(
ts
.
origDir
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
pfs2
,
nil
)
if
!
code
.
Ok
()
{
...
...
fuse/misc.go
View file @
2d65aab9
...
...
@@ -185,8 +185,7 @@ func ReverseJoin(rev_components []string, sep string) string {
func
CurrentOwner
()
*
Owner
{
return
&
Owner
{
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
}
}
fuse/mount.go
View file @
2d65aab9
...
...
@@ -50,13 +50,13 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
}
mountPoint
=
filepath
.
Clean
(
filepath
.
Join
(
cwd
,
mountPoint
))
}
cmd
:=
[]
string
{
"/bin/fusermount"
,
mountPoint
}
if
options
!=
""
{
cmd
=
append
(
cmd
,
"-o"
)
cmd
=
append
(
cmd
,
options
)
}
proc
,
err
:=
os
.
StartProcess
(
"/bin/fusermount"
,
cmd
,
&
os
.
ProcAttr
{
...
...
fuse/mountstate.go
View file @
2d65aab9
...
...
@@ -51,7 +51,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) os.Error {
if
opts
!=
nil
&&
opts
.
AllowOther
{
optStr
=
"allow_other"
}
file
,
mp
,
err
:=
mount
(
mountPoint
,
optStr
)
if
err
!=
nil
{
return
err
...
...
fuse/owner_test.go
View file @
2d65aab9
...
...
@@ -20,8 +20,8 @@ func (me *ownerFs) GetAttr(name string) (*os.FileInfo, Status) {
}
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Uid
:
_RANDOM_OWNER
,
Gid
:
_RANDOM_OWNER
,
Uid
:
_RANDOM_OWNER
,
Gid
:
_RANDOM_OWNER
,
},
OK
}
...
...
@@ -70,4 +70,3 @@ func TestOwnerOverride(t *testing.T) {
t
.
Fatal
(
"Should use current uid for mount"
,
fi
.
Uid
,
fi
.
Gid
)
}
}
fuse/pathdebug.go
View file @
2d65aab9
...
...
@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if
path
==
DebugDir
{
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0755
,
},
OK
},
OK
}
c
:=
me
.
getContent
(
path
)
if
c
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Size
:
int64
(
len
(
c
)),
},
OK
},
OK
}
return
nil
,
ENOENT
}
...
...
fuse/pathfilesystem.go
View file @
2d65aab9
...
...
@@ -58,9 +58,9 @@ type mountData struct {
// Protects parent/child relations within the mount.
// treeLock should be acquired before openFilesLock
treeLock
sync
.
RWMutex
// Protects openFiles
openFilesLock
sync
.
RWMutex
openFilesLock
sync
.
RWMutex
// Open files/directories.
openFiles
map
[
uint64
]
*
fileBridge
...
...
@@ -68,7 +68,7 @@ type mountData struct {
func
newMount
(
fs
FileSystem
)
*
mountData
{
return
&
mountData
{
fs
:
fs
,
fs
:
fs
,
openFiles
:
make
(
map
[
uint64
]
*
fileBridge
),
}
}
...
...
@@ -126,14 +126,14 @@ type inode struct {
// Protected by openFilesLock.
// TODO - verify() this variable too.
OpenCount
int
OpenCount
int
// Non-nil if this is a mountpoint.
mountPoint
*
mountData
mountPoint
*
mountData
// The point under which this node is. Should be non-nil for
// all nodes.
mount
*
mountData
mount
*
mountData
}
// TotalOpenCount counts open files. It should only be entered from
...
...
@@ -143,7 +143,7 @@ func (me *inode) TotalOpenCount() int {
if
me
.
mountPoint
!=
nil
{
me
.
mountPoint
.
treeLock
.
RLock
()
defer
me
.
mountPoint
.
treeLock
.
RUnlock
()
me
.
mountPoint
.
openFilesLock
.
RLock
()
defer
me
.
mountPoint
.
openFilesLock
.
RUnlock
()
...
...
@@ -164,12 +164,12 @@ func (me *inode) TotalMountCount() int {
if
me
.
mountPoint
.
unmountPending
{
return
0
}
o
++
me
.
mountPoint
.
treeLock
.
RLock
()
defer
me
.
mountPoint
.
treeLock
.
RUnlock
()
}
for
_
,
v
:=
range
me
.
Children
{
o
+=
v
.
TotalMountCount
()
}
...
...
@@ -196,7 +196,7 @@ func (me *inode) verify(cur *mountData) {
if
me
.
mount
!=
cur
{
panic
(
fmt
.
Sprintf
(
"me.mount not set correctly %v %v"
,
me
.
mount
,
cur
))
}
for
n
,
ch
:=
range
me
.
Children
{
if
ch
==
nil
{
panic
(
"Found nil child."
)
...
...
@@ -230,7 +230,7 @@ func (me *inode) GetPath() (path string, mount *mountData) {
// Deleted node. Treat as if the filesystem was unmounted.
return
".deleted"
,
nil
}
rev_components
:=
make
([]
string
,
0
,
10
)
inode
:=
me
...
...
@@ -292,7 +292,7 @@ func NewFileSystemOptions() *FileSystemOptions {
NegativeTimeout
:
0.0
,
AttrTimeout
:
1.0
,
EntryTimeout
:
1.0
,
Owner
:
CurrentOwner
(),
Owner
:
CurrentOwner
(),
}
}
...
...
@@ -402,7 +402,7 @@ func (me *FileSystemConnector) forgetUpdate(nodeId uint64, forgetCount int) {
defer
me
.
verify
()
node
:=
me
.
getInodeData
(
nodeId
)
node
.
LookupCount
-=
forgetCount
me
.
considerDropInode
(
node
)
}
...
...
@@ -410,15 +410,15 @@ func (me *FileSystemConnector) forgetUpdate(nodeId uint64, forgetCount int) {
func
(
me
*
FileSystemConnector
)
considerDropInode
(
n
*
inode
)
{
n
.
mount
.
treeLock
.
Lock
()
defer
n
.
mount
.
treeLock
.
Unlock
()
if
n
.
LookupCount
<=
0
&&
len
(
n
.
Children
)
==
0
&&
(
n
.
mountPoint
==
nil
||
n
.
mountPoint
.
unmountPending
)
&&
n
.
OpenCount
<=
0
{
n
.
setParent
(
nil
)
me
.
inodeMapMutex
.
Lock
()
defer
me
.
inodeMapMutex
.
Unlock
()
me
.
inodeMapMutex
.
Lock
()
defer
me
.
inodeMapMutex
.
Unlock
()
me
.
inodeMap
[
n
.
NodeId
]
=
nil
,
false
}
}
}
func
(
me
*
FileSystemConnector
)
renameUpdate
(
oldParent
*
inode
,
oldName
string
,
newParent
*
inode
,
newName
string
)
{
...
...
@@ -470,7 +470,7 @@ func (me *FileSystemConnector) findInode(fullPath string) *inode {
node
.
mountPoint
.
treeLock
.
RLock
()
defer
node
.
mountPoint
.
treeLock
.
RUnlock
()
}
node
=
node
.
Children
[
component
]
if
node
==
nil
{
return
nil
...
...
@@ -525,7 +525,7 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil
if
node
!=
me
.
rootNode
{
node
.
mount
.
treeLock
.
RUnlock
()
}
if
hasChildren
{
return
EBUSY
}
...
...
fuse/pathops.go
View file @
2d65aab9
...
...
@@ -492,4 +492,3 @@ func (me *FileSystemConnector) Ioctl(header *InHeader, input *IoctlIn) (out *Ioc
}
return
f
.
Ioctl
(
input
)
}
unionfs/autounion.go
View file @
2d65aab9
...
...
@@ -39,11 +39,11 @@ type AutoUnionFsOptions struct {
}
const
(
_READONLY
=
"READONLY"
_STATUS
=
"status"
_CONFIG
=
"config"
_ROOT
=
"root"
_VERSION
=
"gounionfs_version"
_READONLY
=
"READONLY"
_STATUS
=
"status"
_CONFIG
=
"config"
_ROOT
=
"root"
_VERSION
=
"gounionfs_version"
_SCAN_CONFIG
=
".scan_config"
)
...
...
@@ -258,7 +258,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
}
return
a
,
fuse
.
OK
}
if
path
==
filepath
.
Join
(
_CONFIG
,
_SCAN_CONFIG
)
{
a
:=
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0644
,
...
...
@@ -283,7 +283,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
if
me
.
getUnionFs
(
path
)
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
},
fuse
.
OK
},
fuse
.
OK
}
return
nil
,
fuse
.
ENOENT
...
...
@@ -306,13 +306,13 @@ func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Statu
func
(
me
*
AutoUnionFs
)
Open
(
path
string
,
flags
uint32
)
(
fuse
.
File
,
fuse
.
Status
)
{
if
path
==
filepath
.
Join
(
_STATUS
,
_VERSION
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
return
nil
,
fuse
.
EPERM
}
return
fuse
.
NewReadOnlyFile
([]
byte
(
fuse
.
Version
())),
fuse
.
OK
}
if
path
==
filepath
.
Join
(
_CONFIG
,
_SCAN_CONFIG
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
me
.
updateKnownFses
()
}
return
fuse
.
NewDevNullFile
(),
fuse
.
OK
...
...
unionfs/autounion_test.go
View file @
2d65aab9
...
...
@@ -44,7 +44,7 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile
(
wd
+
"/ro/file2"
,
"file2"
)
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
CheckSuccess
(
err
)
state
.
Debug
=
true
conn
.
Debug
=
true
...
...
@@ -60,7 +60,7 @@ func TestVersion(t *testing.T) {
wd
,
clean
:=
setup
(
t
)
defer
clean
()
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/status/gounionfs_version"
)
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/status/gounionfs_version"
)
CheckSuccess
(
err
)
if
len
(
c
)
==
0
{
t
.
Fatal
(
"No version found."
)
...
...
@@ -91,7 +91,7 @@ func TestAutoFsSymlink(t *testing.T) {
time
.
Sleep
(
2
*
entryTtl
*
1e9
)
scan
:=
wd
+
"/mount/config/"
+
_SCAN_CONFIG
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
if
err
!=
nil
{
t
.
Error
(
"error writing:"
,
err
)
}
...
...
@@ -127,12 +127,12 @@ func TestExplicitScan(t *testing.T) {
if
err
!=
nil
{
t
.
Error
(
".scan_config missing:"
,
err
)
}
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
if
err
!=
nil
{
t
.
Error
(
"error writing:"
,
err
)
}
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/backing1"
)
if
err
!=
nil
{
t
.
Error
(
"Should have workspace backing1:"
,
err
)
...
...
unionfs/cachingfs.go
View file @
2d65aab9
...
...
@@ -136,10 +136,10 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
c
.
links
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
readLink
(
fs
,
n
)
},
ttlNs
)
c
.
xattr
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
getXAttr
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
c
.
files
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
openFile
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
return
c
}
...
...
unionfs/dircache.go
View file @
2d65aab9
...
...
@@ -16,7 +16,7 @@ func newDirnameMap(fs fuse.FileSystem, dir string) map[string]bool {
log
.
Printf
(
"newDirnameMap(): %v %v"
,
dir
,
code
)
return
nil
}
result
:=
make
(
map
[
string
]
bool
)
for
e
:=
range
stream
{
if
e
.
Mode
&
fuse
.
S_IFREG
!=
0
{
...
...
unionfs/unionfs.go
View file @
2d65aab9
...
...
@@ -570,7 +570,7 @@ func (me *UnionFs) GetAttr(name string) (a *os.FileInfo, s fuse.Status) {
if
name
==
_DROP_CACHE
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0777
,
},
fuse
.
OK
},
fuse
.
OK
}
if
name
==
me
.
options
.
DeletionDirName
{
return
nil
,
fuse
.
ENOENT
...
...
unionfs/unionfs_test.go
View file @
2d65aab9
...
...
@@ -48,7 +48,7 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
NegativeTimeout
:
entryTtl
,
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
state
.
Debug
=
true
go
state
.
Loop
(
false
)
...
...
@@ -123,13 +123,13 @@ func TestAutocreateDeletionDir(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Remove
(
wd
+
"/rw/DELETIONS"
)
err
:=
os
.
Remove
(
wd
+
"/rw/DELETIONS"
)
CheckSuccess
(
err
)
err
=
os
.
Mkdir
(
wd
+
"/mount/dir"
,
0755
)
CheckSuccess
(
err
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount/dir"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount/dir"
)
CheckSuccess
(
err
)
}
...
...
@@ -498,7 +498,7 @@ func TestRemoveAll(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
err
:=
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
CheckSuccess
(
err
)
contents
:=
"hello"
...
...
@@ -506,7 +506,7 @@ func TestRemoveAll(t *testing.T) {
err
=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
contents
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
RemoveAll
(
wd
+
"/mount/dir"
)
err
=
os
.
RemoveAll
(
wd
+
"/mount/dir"
)
if
err
!=
nil
{
t
.
Error
(
"Should delete all"
)
}
...
...
@@ -527,7 +527,7 @@ func TestDropCache(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"bla"
),
0644
)
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"bla"
),
0644
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/.drop_cache"
)
...
...
@@ -535,18 +535,18 @@ func TestDropCache(t *testing.T) {
names
,
err
:=
Readdirnames
(
wd
+
"/mount"
)
CheckSuccess
(
err
)
if
len
(
names
)
!=
1
||
names
[
0
]
!=
"file"
{
if
len
(
names
)
!=
1
||
names
[
0
]
!=
"file"
{
t
.
Fatal
(
"unexpected names"
,
names
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file2"
,
[]
byte
(
"blabla"
),
0644
)
names2
,
err
:=
Readdirnames
(
wd
+
"/mount"
)
CheckSuccess
(
err
)
if
len
(
names2
)
!=
len
(
names
)
{
t
.
Fatal
(
"mismatch"
,
names2
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/.drop_cache"
,
[]
byte
(
"does not matter"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/.drop_cache"
,
[]
byte
(
"does not matter"
),
0644
)
CheckSuccess
(
err
)
names2
,
err
=
Readdirnames
(
wd
+
"/mount"
)
if
len
(
names2
)
!=
2
{
...
...
@@ -568,19 +568,19 @@ func TestDisappearing(t *testing.T) {
os
.
Mkdir
(
wd
+
"/ro"
,
0700
)
fuse
.
CheckSuccess
(
err
)
wrFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/rw"
)
wrFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/rw"
)
var
fses
[]
fuse
.
FileSystem
fses
=
append
(
fses
,
wrFs
)
fses
=
append
(
fses
,
fuse
.
NewLoopbackFileSystem
(
wd
+
"/ro"
))
ufs
:=
NewUnionFs
(
"testFs"
,
fses
,
testOpts
)
opts
:=
&
fuse
.
FileSystemOptions
{
EntryTimeout
:
entryTtl
,
AttrTimeout
:
entryTtl
,
NegativeTimeout
:
entryTtl
,
EntryTimeout
:
entryTtl
,
AttrTimeout
:
entryTtl
,
NegativeTimeout
:
entryTtl
,
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
defer
state
.
Unmount
()
state
.
Debug
=
true
...
...
@@ -588,23 +588,23 @@ func TestDisappearing(t *testing.T) {
log
.
Println
(
"TestDisappearing2"
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
oldRoot
:=
wrFs
.
Root
wrFs
.
Root
=
"/dev/null"
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
if
err
==
nil
{
t
.
Fatal
(
"Readdir should have failed"
)
t
.
Fatal
(
"Readdir should have failed"
)
}
log
.
Println
(
"expected readdir failure:"
,
err
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
if
err
==
nil
{
t
.
Fatal
(
"write should have failed"
)
}
...
...
@@ -612,15 +612,14 @@ func TestDisappearing(t *testing.T) {
// Restore, and wait for caches to catch up.
wrFs
.
Root
=
oldRoot
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
if
err
!=
nil
{
t
.
Fatal
(
"Readdir should succeed"
,
err
)
t
.
Fatal
(
"Readdir should succeed"
,
err
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
if
err
!=
nil
{
t
.
Fatal
(
"write should succeed"
,
err
)
}
}
zipfs/multizip_test.go
View file @
2d65aab9
...
...
@@ -21,15 +21,15 @@ func TestMultiZipFs(t *testing.T) {
fs
:=
NewMultiZipFs
()
mountPoint
:=
fuse
.
MakeTempDir
()
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
mountPoint
,
fs
,
&
fuse
.
FileSystemOptions
{
EntryTimeout
:
testTtl
,
AttrTimeout
:
testTtl
,
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
mountPoint
,
fs
,
&
fuse
.
FileSystemOptions
{
EntryTimeout
:
testTtl
,
AttrTimeout
:
testTtl
,
NegativeTimeout
:
0.0
,
})
defer
os
.
RemoveAll
(
mountPoint
)
CheckSuccess
(
err
)
defer
state
.
Unmount
()
state
.
Debug
=
true
go
state
.
Loop
(
true
)
...
...
zipfs/tarfs.go
View file @
2d65aab9
...
...
@@ -73,7 +73,7 @@ func NewTarTree(r io.Reader) *MemTree {
hdr
.
Name
=
*
longName
longName
=
nil
}
comps
:=
strings
.
Split
(
filepath
.
Clean
(
hdr
.
Name
),
"/"
,
-
1
)
base
:=
""
if
!
strings
.
HasSuffix
(
hdr
.
Name
,
"/"
)
{
...
...
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