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
7a0e5b38
Commit
7a0e5b38
authored
Aug 30, 2011
by
Manuel Klimek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows autoconfiguration of directories that were symlinked into
the root path.
parent
4c2b5911
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
unionfs/autounion.go
unionfs/autounion.go
+13
-1
unionfs/autounion_test.go
unionfs/autounion_test.go
+24
-1
No files found.
unionfs/autounion.go
View file @
7a0e5b38
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
"syscall"
"syscall"
"sync"
"sync"
"time"
"time"
"io/ioutil"
)
)
// Creates unions for all files under a given directory,
// Creates unions for all files under a given directory,
...
@@ -168,7 +169,18 @@ func (me *AutoUnionFs) VisitFile(path string, f *os.FileInfo) {
...
@@ -168,7 +169,18 @@ func (me *AutoUnionFs) VisitFile(path string, f *os.FileInfo) {
func
(
me
*
AutoUnionFs
)
updateKnownFses
()
{
func
(
me
*
AutoUnionFs
)
updateKnownFses
()
{
log
.
Println
(
"Looking for new filesystems"
)
log
.
Println
(
"Looking for new filesystems"
)
filepath
.
Walk
(
me
.
root
,
me
,
nil
)
// We unroll the first level of entries in the root manually in order
// to allow symbolic links on that level.
directoryEntries
,
err
:=
ioutil
.
ReadDir
(
me
.
root
)
if
err
==
nil
{
for
_
,
dir
:=
range
directoryEntries
{
if
dir
.
IsDirectory
()
||
dir
.
IsSymlink
()
{
path
:=
filepath
.
Join
(
me
.
root
,
dir
.
Name
)
me
.
VisitDir
(
path
,
nil
)
filepath
.
Walk
(
path
,
me
,
nil
)
}
}
}
log
.
Println
(
"Done looking"
)
log
.
Println
(
"Done looking"
)
}
}
...
...
unionfs/autounion_test.go
View file @
7a0e5b38
...
@@ -73,7 +73,7 @@ func TestAutoFsSymlink(t *testing.T) {
...
@@ -73,7 +73,7 @@ func TestAutoFsSymlink(t *testing.T) {
err
:=
os
.
Mkdir
(
wd
+
"/store/backing1"
,
0755
)
err
:=
os
.
Mkdir
(
wd
+
"/store/backing1"
,
0755
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/store/backing1/READONLY"
)
err
=
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/store/backing1/READONLY"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
err
=
os
.
Symlink
(
wd
+
"/store/backing1"
,
wd
+
"/mount/config/manual1"
)
err
=
os
.
Symlink
(
wd
+
"/store/backing1"
,
wd
+
"/mount/config/manual1"
)
...
@@ -109,6 +109,29 @@ func TestAutoFsSymlink(t *testing.T) {
...
@@ -109,6 +109,29 @@ func TestAutoFsSymlink(t *testing.T) {
CheckSuccess
(
err
)
CheckSuccess
(
err
)
}
}
func
TestDetectSymlinkedDirectories
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setup
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/backing1"
,
0755
)
CheckSuccess
(
err
)
err
=
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/backing1/READONLY"
)
CheckSuccess
(
err
)
err
=
os
.
Symlink
(
wd
+
"/backing1"
,
wd
+
"/store/backing1"
)
CheckSuccess
(
err
)
scan
:=
wd
+
"/mount/config/"
+
_SCAN_CONFIG
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
if
err
!=
nil
{
t
.
Error
(
"error writing:"
,
err
)
}
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/backing1"
)
CheckSuccess
(
err
)
}
func
TestExplicitScan
(
t
*
testing
.
T
)
{
func
TestExplicitScan
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setup
(
t
)
wd
,
clean
:=
setup
(
t
)
defer
clean
()
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