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
Kirill Smelkov
go-fuse
Commits
8278f60e
Commit
8278f60e
authored
Sep 29, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
336fe3bc
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
63 deletions
+60
-63
example/unionfs/main.go
example/unionfs/main.go
+1
-1
fuse/files.go
fuse/files.go
+0
-1
fuse/fsconnector.go
fuse/fsconnector.go
+1
-1
fuse/fsops.go
fuse/fsops.go
+1
-1
fuse/loopback_test.go
fuse/loopback_test.go
+3
-3
fuse/memnode.go
fuse/memnode.go
+1
-1
fuse/opcode.go
fuse/opcode.go
+9
-9
fuse/prefixfs.go
fuse/prefixfs.go
+1
-1
unionfs/memunionfs.go
unionfs/memunionfs.go
+8
-9
unionfs/memunionfs_test.go
unionfs/memunionfs_test.go
+15
-15
unionfs/unionfs.go
unionfs/unionfs.go
+3
-4
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+17
-17
No files found.
example/unionfs/main.go
View file @
8278f60e
...
...
@@ -30,7 +30,7 @@ func main() {
var
nodeFs
fuse
.
NodeFileSystem
if
*
mem
{
nodeFs
=
unionfs
.
NewMemUnionFs
(
flag
.
Arg
(
1
)
+
"/"
,
&
fuse
.
LoopbackFileSystem
{
Root
:
flag
.
Arg
(
2
)})
flag
.
Arg
(
1
)
+
"/"
,
&
fuse
.
LoopbackFileSystem
{
Root
:
flag
.
Arg
(
2
)})
}
else
{
ufsOptions
:=
unionfs
.
UnionFsOptions
{
DeletionCacheTTLSecs
:
*
delcache_ttl
,
...
...
fuse/files.go
View file @
8278f60e
...
...
@@ -59,7 +59,6 @@ func (me *DevNullFile) String() string {
return
"DevNullFile"
}
func
(
me
*
DevNullFile
)
Read
(
input
*
ReadIn
,
bp
BufferPool
)
([]
byte
,
Status
)
{
return
[]
byte
{},
OK
}
...
...
fuse/fsconnector.go
View file @
8278f60e
...
...
@@ -192,7 +192,7 @@ func (me *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []s
node
.
treeLock
.
RLock
()
defer
node
.
treeLock
.
RUnlock
()
}
for
i
,
component
:=
range
comps
{
if
len
(
component
)
==
0
{
continue
...
...
fuse/fsops.go
View file @
8278f60e
...
...
@@ -66,7 +66,7 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry
out
.
NodeId
=
me
.
lookupUpdate
(
child
)
out
.
Generation
=
1
out
.
Ino
=
out
.
NodeId
return
out
,
OK
}
...
...
fuse/loopback_test.go
View file @
8278f60e
...
...
@@ -714,14 +714,14 @@ func TestFStatFs(t *testing.T) {
fOrig
,
err
:=
os
.
OpenFile
(
ts
.
orig
+
"/file"
,
os
.
O_CREATE
|
os
.
O_TRUNC
|
os
.
O_RDWR
,
0644
)
CheckSuccess
(
err
)
defer
fOrig
.
Close
()
empty
:=
syscall
.
Statfs_t
{}
s1
:=
empty
errno
:=
syscall
.
Fstatfs
(
fOrig
.
Fd
(),
&
s1
)
if
errno
!=
0
{
t
.
Fatal
(
"statfs orig"
,
err
)
}
fMnt
,
err
:=
os
.
OpenFile
(
ts
.
mnt
+
"/file"
,
os
.
O_RDWR
,
0644
)
CheckSuccess
(
err
)
defer
fMnt
.
Close
()
...
...
@@ -731,7 +731,7 @@ func TestFStatFs(t *testing.T) {
if
errno
!=
0
{
t
.
Fatal
(
"statfs mnt"
,
err
)
}
clearStatfs
(
&
s1
)
clearStatfs
(
&
s2
)
if
fmt
.
Sprintf
(
"%v"
,
s2
)
!=
fmt
.
Sprintf
(
"%v"
,
s1
)
{
...
...
fuse/memnode.go
View file @
8278f60e
...
...
@@ -13,7 +13,7 @@ var _ = log.Println
type
MemNodeFs
struct
{
DefaultNodeFileSystem
backingStorePrefix
string
root
*
memNode
root
*
memNode
mutex
sync
.
Mutex
nextFree
int
...
...
fuse/opcode.go
View file @
8278f60e
...
...
@@ -302,13 +302,13 @@ type operationFunc func(*MountState, *request)
type
castPointerFunc
func
(
unsafe
.
Pointer
)
interface
{}
type
operationHandler
struct
{
Name
string
Func
operationFunc
InputSize
uintptr
OutputSize
uintptr
DecodeIn
castPointerFunc
DecodeOut
castPointerFunc
FileNames
int
Name
string
Func
operationFunc
InputSize
uintptr
OutputSize
uintptr
DecodeIn
castPointerFunc
DecodeOut
castPointerFunc
FileNames
int
FileNameOut
bool
}
...
...
@@ -339,11 +339,11 @@ func init() {
operationHandlers
[
i
]
=
&
operationHandler
{
Name
:
"UNKNOWN"
}
}
fileOps
:=
[]
opcode
{
_OP_READLINK
,
_OP_NOTIFY_ENTRY
}
fileOps
:=
[]
opcode
{
_OP_READLINK
,
_OP_NOTIFY_ENTRY
}
for
_
,
op
:=
range
fileOps
{
operationHandlers
[
op
]
.
FileNameOut
=
true
}
for
op
,
sz
:=
range
map
[
opcode
]
uintptr
{
_OP_FORGET
:
unsafe
.
Sizeof
(
ForgetIn
{}),
_OP_GETATTR
:
unsafe
.
Sizeof
(
GetAttrIn
{}),
...
...
fuse/prefixfs.go
View file @
8278f60e
...
...
@@ -14,7 +14,7 @@ type PrefixFileSystem struct {
func
(
me
*
PrefixFileSystem
)
prefixed
(
n
string
)
string
{
return
filepath
.
Join
(
me
.
Prefix
,
n
)
}
}
func
(
me
*
PrefixFileSystem
)
GetAttr
(
name
string
,
context
*
Context
)
(
*
os
.
FileInfo
,
Status
)
{
return
me
.
FileSystem
.
GetAttr
(
me
.
prefixed
(
name
),
context
)
...
...
unionfs/memunionfs.go
View file @
8278f60e
...
...
@@ -20,9 +20,9 @@ type MemUnionFs struct {
backingStore
string
root
*
memNode
connector
*
fuse
.
FileSystemConnector
mutex
sync
.
RWMutex
cond
*
sync
.
Cond
nextFree
int
mutex
sync
.
RWMutex
cond
*
sync
.
Cond
nextFree
int
readonly
fuse
.
FileSystem
...
...
@@ -31,7 +31,7 @@ type MemUnionFs struct {
// All paths that have been renamed or deleted will be marked
// here. After deletion, entries may be recreated, but they
// will be treated as new.
deleted
map
[
string
]
bool
deleted
map
[
string
]
bool
}
type
memNode
struct
{
...
...
@@ -87,7 +87,7 @@ func (me *MemUnionFs) Reap() map[string]*Result {
todo
:=
[]
string
{
name
}
for
len
(
todo
)
>
0
{
l
:=
len
(
todo
)
-
1
l
:=
len
(
todo
)
-
1
n
:=
todo
[
l
]
todo
=
todo
[
:
l
]
...
...
@@ -95,7 +95,7 @@ func (me *MemUnionFs) Reap() map[string]*Result {
for
e
:=
range
s
{
full
:=
filepath
.
Join
(
n
,
e
.
Name
)
m
[
full
]
=
&
Result
{}
if
e
.
Mode
&
fuse
.
S_IFDIR
!=
0
{
if
e
.
Mode
&
fuse
.
S_IFDIR
!=
0
{
todo
=
append
(
todo
,
full
)
}
}
...
...
@@ -137,7 +137,7 @@ func (me *MemUnionFs) Update(results map[string]*Result) {
}
sort
.
Strings
(
del
)
for
i
:=
len
(
del
)
-
1
;
i
>=
0
;
i
--
{
for
i
:=
len
(
del
)
-
1
;
i
>=
0
;
i
--
{
n
:=
del
[
i
]
dir
,
base
:=
filepath
.
Split
(
n
)
dir
=
strings
.
TrimRight
(
dir
,
"/"
)
...
...
@@ -600,7 +600,7 @@ func (me *memNode) Reap(path string, results map[string]*Result) {
if
me
.
changed
{
info
:=
me
.
info
results
[
path
]
=
&
Result
{
FileInfo
:
&
info
,
FileInfo
:
&
info
,
Link
:
me
.
link
,
Backing
:
me
.
backing
,
Original
:
me
.
original
,
...
...
@@ -633,4 +633,3 @@ func (me *memNode) Clear(path string) {
mn
.
Clear
(
p
)
}
}
unionfs/memunionfs_test.go
View file @
8278f60e
...
...
@@ -32,7 +32,7 @@ func setupMemUfs(t *testing.T) (workdir string, ufs *MemUnionFs, cleanup func())
os
.
Mkdir
(
wd
+
"/ro"
,
0700
)
fuse
.
CheckSuccess
(
err
)
roFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/ro"
)
roFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/ro"
)
memFs
:=
NewMemUnionFs
(
wd
+
"/backing"
,
roFs
)
// We configure timeouts are smaller, so we can check for
...
...
@@ -84,7 +84,7 @@ func TestMemUnionFsSymlinkPromote(t *testing.T) {
err
=
os
.
Symlink
(
"/foobar"
,
wd
+
"/mount/subdir/link"
)
CheckSuccess
(
err
)
r
:=
ufs
.
Reap
()
if
len
(
r
)
!=
2
||
r
[
"subdir"
]
==
nil
||
r
[
"subdir/link"
]
==
nil
||
r
[
"subdir/link"
]
.
Link
!=
"/foobar"
{
t
.
Errorf
(
"expect 1 symlink reap result: %v"
,
r
)
...
...
@@ -231,7 +231,7 @@ func TestMemUnionFsSubdirCreate(t *testing.T) {
writeToFile
(
wd
+
"/mount/subdir/sub2/file"
,
"other-content"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/subdir/sub2/file"
)
CheckSuccess
(
err
)
r
:=
ufs
.
Reap
()
if
r
[
"subdir/sub2/file"
]
==
nil
||
r
[
"subdir/sub2/file"
]
.
Backing
==
""
{
t
.
Errorf
(
"expect 1 file reap result: %v"
,
r
)
...
...
@@ -245,7 +245,7 @@ func TestMemUnionFsCreate(t *testing.T) {
writeToFile
(
wd
+
"/mount/file.txt"
,
"hello"
)
_
,
err
:=
os
.
Lstat
(
wd
+
"/mount/file.txt"
)
CheckSuccess
(
err
)
r
:=
ufs
.
Reap
()
if
r
[
"file.txt"
]
==
nil
||
r
[
"file.txt"
]
.
Backing
==
""
{
t
.
Errorf
(
"expect 1 file reap result: %v"
,
r
)
...
...
@@ -292,7 +292,7 @@ func TestMemUnionFsMkdirPromote(t *testing.T) {
CheckSuccess
(
err
)
r
:=
ufs
.
Reap
()
if
r
[
"subdir/subdir2/dir3"
]
==
nil
||
r
[
"subdir/subdir2/dir3"
]
.
FileInfo
.
Mode
&
fuse
.
S_IFDIR
==
0
{
if
r
[
"subdir/subdir2/dir3"
]
==
nil
||
r
[
"subdir/subdir2/dir3"
]
.
FileInfo
.
Mode
&
fuse
.
S_IFDIR
==
0
{
t
.
Errorf
(
"expect 1 file reap result: %v"
,
r
)
}
}
...
...
@@ -504,7 +504,7 @@ func TestMemUnionFsDoubleOpen(t *testing.T) {
func
TestMemUnionFsUpdate
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file1"
,
[]
byte
(
"blablabla"
),
0644
)
CheckSuccess
(
err
)
...
...
@@ -516,14 +516,14 @@ func TestMemUnionFsUpdate(t *testing.T) {
if
fi
,
_
:=
os
.
Lstat
(
wd
+
"/mount/symlink"
);
fi
!=
nil
{
t
.
Fatal
(
"symlink should not exist"
,
fi
)
}
err
=
os
.
Remove
(
wd
+
"/ro/file1"
)
err
=
os
.
Remove
(
wd
+
"/ro/file1"
)
CheckSuccess
(
err
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file2"
,
[]
byte
(
"foobar"
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
Symlink
(
"target"
,
wd
+
"/ro/symlink"
)
err
=
os
.
Symlink
(
"target"
,
wd
+
"/ro/symlink"
)
CheckSuccess
(
err
)
// Still have cached attributes.
fi
,
err
:=
os
.
Lstat
(
wd
+
"/mount/file1"
)
CheckSuccess
(
err
)
...
...
@@ -538,7 +538,7 @@ func TestMemUnionFsUpdate(t *testing.T) {
CheckSuccess
(
err
)
roSymlinkFi
,
err
:=
os
.
Lstat
(
wd
+
"/ro/symlink"
)
CheckSuccess
(
err
)
updates
:=
map
[
string
]
*
Result
{
"file1"
:
&
Result
{
nil
,
""
,
""
,
""
,
...
...
@@ -702,7 +702,7 @@ func TestMemUnionFsRenameDirBasic(t *testing.T) {
if
r
[
"dir"
]
==
nil
||
r
[
"dir"
]
.
FileInfo
!=
nil
||
r
[
"renamed/subdir"
]
==
nil
||
!
r
[
"renamed/subdir"
]
.
FileInfo
.
IsDirectory
()
{
t
.
Errorf
(
"Reap should del dir, and add renamed/subdir: %v"
,
r
)
}
if
err
=
os
.
Mkdir
(
wd
+
"/mount/dir"
,
0755
);
err
!=
nil
{
t
.
Errorf
(
"mkdir should succeed %v"
,
err
)
}
...
...
@@ -782,11 +782,11 @@ func TestMemUnionGc(t *testing.T) {
writeToFile
(
wd
+
"/mount/file1"
,
"other-content"
)
writeToFile
(
wd
+
"/mount/file2"
,
"other-content"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file1"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file1"
)
CheckSuccess
(
err
)
ufs
.
Clear
()
entries
,
err
:=
ioutil
.
ReadDir
(
wd
+
"/backing"
)
entries
,
err
:=
ioutil
.
ReadDir
(
wd
+
"/backing"
)
CheckSuccess
(
err
)
if
len
(
entries
)
!=
0
{
t
.
Fatalf
(
"should have 1 file after backing store gc: %v"
,
entries
)
...
...
unionfs/unionfs.go
View file @
8278f60e
...
...
@@ -280,7 +280,7 @@ func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Co
code
=
fuse
.
CopyFile
(
sourceFs
,
writable
,
name
,
name
,
context
)
if
code
.
Ok
()
{
code
=
writable
.
Chmod
(
name
,
srcResult
.
attr
.
Mode
&
07777
|
0200
,
context
)
code
=
writable
.
Chmod
(
name
,
srcResult
.
attr
.
Mode
&
07777
|
0200
,
context
)
}
if
code
.
Ok
()
{
code
=
writable
.
Utimens
(
name
,
uint64
(
srcResult
.
attr
.
Atime_ns
),
...
...
@@ -321,13 +321,12 @@ 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
,
srcResult
.
attr
.
Mode
&
07777
|
0200
,
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
...
...
@@ -635,7 +634,7 @@ 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
|
0200
,
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
,
me
.
fileSystems
[
0
])
return
fuse
.
EPERM
...
...
unionfs/unionfs_test.go
View file @
8278f60e
...
...
@@ -31,8 +31,8 @@ func freezeRo(dir string) {
err
:=
filepath
.
Walk
(
dir
,
func
(
path
string
,
fi
*
os
.
FileInfo
,
err
os
.
Error
)
os
.
Error
{
return
os
.
Chmod
(
path
,
(
fi
.
Mode
&
0777
)
&^
0222
)
})
return
os
.
Chmod
(
path
,
(
fi
.
Mode
&
0777
)
&^
0222
)
})
CheckSuccess
(
err
)
}
...
...
@@ -493,7 +493,7 @@ func TestUnionFsRenameDirAllSourcesGone(t *testing.T) {
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/dir/file.txt"
,
[]
byte
{
42
},
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
err
=
os
.
Rename
(
wd
+
"/mount/dir"
,
wd
+
"/mount/renamed"
)
CheckSuccess
(
err
)
...
...
@@ -515,7 +515,7 @@ func TestUnionFsRenameDirWithDeletions(t *testing.T) {
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/dir/subdir/file.txt"
,
[]
byte
{
42
},
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
if
fi
,
_
:=
os
.
Lstat
(
wd
+
"/mount/dir/subdir/file.txt"
);
fi
==
nil
||
!
fi
.
IsRegular
()
{
t
.
Fatalf
(
"%s/mount/dir/subdir/file.txt should be file: %v"
,
wd
,
fi
)
...
...
@@ -582,7 +582,7 @@ func TestUnionFsWritableDir(t *testing.T) {
dirname
:=
wd
+
"/ro/subdir"
err
:=
os
.
Mkdir
(
dirname
,
0555
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
fi
,
err
:=
os
.
Lstat
(
wd
+
"/mount/subdir"
)
CheckSuccess
(
err
)
...
...
@@ -599,7 +599,7 @@ func TestUnionFsWriteAccess(t *testing.T) {
// No write perms.
err
:=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
"foo"
),
0444
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
errno
:=
syscall
.
Access
(
wd
+
"/mount/file"
,
fuse
.
W_OK
)
if
errno
!=
0
{
...
...
@@ -616,7 +616,7 @@ func TestUnionFsLink(t *testing.T) {
fn
:=
wd
+
"/ro/file"
err
:=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
content
),
0666
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
err
=
os
.
Link
(
wd
+
"/mount/file"
,
wd
+
"/mount/linked"
)
CheckSuccess
(
err
)
...
...
@@ -640,7 +640,7 @@ func TestUnionFsTruncate(t *testing.T) {
defer
clean
()
writeToFile
(
wd
+
"/ro/file"
,
"hello"
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
os
.
Truncate
(
wd
+
"/mount/file"
,
2
)
content
:=
readFromFile
(
wd
+
"/mount/file"
)
...
...
@@ -718,7 +718,7 @@ func TestUnionFsRemoveAll(t *testing.T) {
fn
:=
wd
+
"/ro/dir/subdir/y"
err
=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
contents
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
err
=
os
.
RemoveAll
(
wd
+
"/mount/dir"
)
if
err
!=
nil
{
...
...
@@ -749,7 +749,7 @@ func TestUnionFsRmRf(t *testing.T) {
fn
:=
wd
+
"/ro/dir/subdir/y"
err
=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
contents
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
bin
,
err
:=
exec
.
LookPath
(
"rm"
)
CheckSuccess
(
err
)
...
...
@@ -788,7 +788,7 @@ func TestUnionFsDropDeletionCache(t *testing.T) {
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"bla"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
...
...
@@ -887,7 +887,7 @@ func TestUnionFsDisappearing(t *testing.T) {
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
...
...
@@ -928,7 +928,7 @@ func TestUnionFsDeletedGetAttr(t *testing.T) {
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
f
,
err
:=
os
.
Open
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
...
...
@@ -947,7 +947,7 @@ func TestUnionFsDoubleOpen(t *testing.T) {
defer
clean
()
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blablabla"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
roFile
,
err
:=
os
.
Open
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
...
...
@@ -985,7 +985,7 @@ func TestUnionFsFdLeak(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blablabla"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
contents
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
...
...
@@ -1091,7 +1091,7 @@ func TestUnionFsPromoteDirTimeStamp(t *testing.T) {
CheckSuccess
(
err
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/subdir/file"
,
[]
byte
(
"hello"
),
0644
)
CheckSuccess
(
err
)
freezeRo
(
wd
+
"/ro"
)
freezeRo
(
wd
+
"/ro"
)
err
=
os
.
Chmod
(
wd
+
"/mount/subdir/file"
,
0060
)
CheckSuccess
(
err
)
...
...
@@ -1107,7 +1107,7 @@ func TestUnionFsPromoteDirTimeStamp(t *testing.T) {
t
.
Errorf
(
"Changed timestamps on promoted subdir: ro %d rw %d"
,
fRo
.
Mtime_ns
,
fRw
.
Mtime_ns
)
}
if
fRo
.
Mode
|
0200
!=
fRw
.
Mode
{
if
fRo
.
Mode
|
0200
!=
fRw
.
Mode
{
t
.
Errorf
(
"Changed mode ro: %o, rw: %o"
,
fRo
.
Mode
,
fRw
.
Mode
)
}
}
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