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
1f07b43d
Commit
1f07b43d
authored
May 03, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use promoteDirsTo() for Rename and Mkdir too.
parent
03c3c9b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
24 deletions
+45
-24
unionfs/unionfs.go
unionfs/unionfs.go
+28
-24
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+17
-0
No files found.
unionfs/unionfs.go
View file @
1f07b43d
...
...
@@ -310,7 +310,11 @@ func (me *UnionFs) Mkdir(path string, mode uint32) (code fuse.Status) {
if
r
.
code
!=
fuse
.
ENOENT
{
return
syscall
.
EEXIST
}
code
=
me
.
fileSystems
[
0
]
.
Mkdir
(
path
,
mode
)
code
=
me
.
promoteDirsTo
(
path
)
if
code
==
fuse
.
OK
{
code
=
me
.
fileSystems
[
0
]
.
Mkdir
(
path
,
mode
)
}
if
code
==
fuse
.
OK
{
me
.
removeDeletion
(
path
)
attr
:=
&
fuse
.
Attr
{
...
...
@@ -619,36 +623,36 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
return
stream
,
fuse
.
OK
}
func
(
me
*
UnionFs
)
Rename
(
src
string
,
dst
string
)
(
status
fuse
.
Status
)
{
func
(
me
*
UnionFs
)
Rename
(
src
string
,
dst
string
)
(
code
fuse
.
Status
)
{
srcResult
:=
me
.
getBranch
(
src
)
if
srcResult
.
code
!=
fuse
.
OK
{
return
srcResult
.
code
code
=
srcResult
.
code
if
code
==
fuse
.
OK
{
code
=
srcResult
.
code
}
if
srcResult
.
branch
>
0
{
code
:=
me
.
Promote
(
src
,
srcResult
)
if
code
!=
fuse
.
OK
{
return
code
}
if
code
==
fuse
.
OK
&&
srcResult
.
branch
>
0
{
code
=
me
.
Promote
(
src
,
srcResult
)
}
code
:=
me
.
fileSystems
[
0
]
.
Rename
(
src
,
dst
)
if
code
!=
fuse
.
OK
{
return
code
if
code
==
fuse
.
OK
{
code
=
me
.
promoteDirsTo
(
dst
)
}
me
.
removeDeletion
(
dst
)
srcResult
.
branch
=
0
me
.
branchCache
.
Set
(
dst
,
srcResult
)
if
srcResult
.
branch
==
0
{
srcResult
:=
me
.
branchCache
.
GetFresh
(
src
)
if
srcResult
.
(
branchResult
)
.
branch
>
0
{
if
code
==
fuse
.
OK
{
code
=
me
.
fileSystems
[
0
]
.
Rename
(
src
,
dst
)
}
if
code
==
fuse
.
OK
{
me
.
removeDeletion
(
dst
)
srcResult
.
branch
=
0
me
.
branchCache
.
Set
(
dst
,
srcResult
)
if
srcResult
.
branch
==
0
{
srcResult
:=
me
.
branchCache
.
GetFresh
(
src
)
if
srcResult
.
(
branchResult
)
.
branch
>
0
{
code
=
me
.
putDeletion
(
src
)
}
}
else
{
code
=
me
.
putDeletion
(
src
)
}
}
else
{
code
=
me
.
putDeletion
(
src
)
}
return
code
}
...
...
unionfs/unionfs_test.go
View file @
1f07b43d
...
...
@@ -266,6 +266,7 @@ func TestOpenUndeletes(t *testing.T) {
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
}
func
TestMkdir
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
...
...
@@ -278,6 +279,22 @@ func TestMkdir(t *testing.T) {
CheckSuccess
(
err
)
}
func
TestMkdirPromote
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
dirname
:=
wd
+
"/ro/subdir/subdir2"
err
:=
os
.
MkdirAll
(
dirname
,
0755
)
CheckSuccess
(
err
)
err
=
os
.
Mkdir
(
wd
+
"/mount/subdir/subdir2/dir3"
,
0755
)
CheckSuccess
(
err
)
fi
,
_
:=
os
.
Lstat
(
wd
+
"/rw/subdir/subdir2/dir3"
)
CheckSuccess
(
err
)
if
fi
==
nil
||
!
fi
.
IsDirectory
()
{
t
.
Error
(
"is not a directory: "
,
fi
)
}
}
func
TestRename
(
t
*
testing
.
T
)
{
type
Config
struct
{
f1_ro
bool
...
...
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