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
31adaab5
Commit
31adaab5
authored
May 17, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that tombstone markers are always readable.
Add test.
parent
8070e06a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
4 deletions
+44
-4
unionfs/unionfs.go
unionfs/unionfs.go
+14
-4
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+30
-0
No files found.
unionfs/unionfs.go
View file @
31adaab5
...
...
@@ -208,16 +208,26 @@ func (me *UnionFs) removeDeletion(name string) {
}
}
func
(
me
*
UnionFs
)
putDeletion
(
name
string
)
fuse
.
Status
{
func
(
me
*
UnionFs
)
putDeletion
(
name
string
)
(
code
fuse
.
Status
)
{
marker
:=
me
.
deletionPath
(
name
)
me
.
deletionCache
.
AddEntry
(
path
.
Base
(
marker
))
// Is there a WriteStringToFileOrDie ?
writable
:=
me
.
fileSystems
[
0
]
f
,
code
:=
writable
.
Open
(
marker
,
uint32
(
os
.
O_TRUNC
|
os
.
O_WRONLY
|
os
.
O_CREATE
))
fi
,
code
:=
writable
.
GetAttr
(
marker
)
if
code
.
Ok
()
&&
fi
.
Size
==
int64
(
len
(
name
))
{
return
fuse
.
OK
}
var
f
fuse
.
File
if
code
==
fuse
.
ENOENT
{
f
,
code
=
writable
.
Create
(
marker
,
uint32
(
os
.
O_TRUNC
|
os
.
O_WRONLY
),
0644
)
}
else
{
writable
.
Chmod
(
marker
,
0644
)
f
,
code
=
writable
.
Open
(
marker
,
uint32
(
os
.
O_TRUNC
|
os
.
O_WRONLY
))
}
if
!
code
.
Ok
()
{
log
.
Printf
(
"could not create deletion file %v: %v"
,
marker
,
code
)
log
.
Printf
(
"could not create deletion file %v: %v"
,
marker
,
code
)
return
fuse
.
EPERM
}
defer
f
.
Release
()
...
...
unionfs/unionfs_test.go
View file @
31adaab5
...
...
@@ -178,6 +178,36 @@ func TestChmod(t *testing.T) {
}
}
func
TestDelete
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
writeToFile
(
wd
+
"/ro/file"
,
"a"
)
_
,
err
:=
os
.
Lstat
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file"
)
if
err
==
nil
{
t
.
Fatal
(
"should have disappeared."
)
}
delPath
:=
wd
+
"/rw/"
+
testOpts
.
DeletionDirName
names
:=
dirNames
(
delPath
)
if
len
(
names
)
!=
1
{
t
.
Fatal
(
"Should have 1 deletion"
,
names
)
}
for
k
,
_
:=
range
names
{
c
,
err
:=
ioutil
.
ReadFile
(
delPath
+
"/"
+
k
)
CheckSuccess
(
err
)
if
string
(
c
)
!=
"file"
{
t
.
Fatal
(
"content mismatch"
,
string
(
c
))
}
}
}
func
TestBasic
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
...
...
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