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
dba1cecd
Commit
dba1cecd
authored
Aug 30, 2011
by
hanwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3 from klimek/klimek-symlink
Allows autoconfiguration of symlinked directories
parents
141bcbf2
7a0e5b38
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 @
dba1cecd
...
...
@@ -10,6 +10,7 @@ import (
"syscall"
"sync"
"time"
"io/ioutil"
)
// Creates unions for all files under a given directory,
...
...
@@ -168,7 +169,18 @@ func (me *AutoUnionFs) VisitFile(path string, f *os.FileInfo) {
func
(
me
*
AutoUnionFs
)
updateKnownFses
()
{
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"
)
}
...
...
unionfs/autounion_test.go
View file @
dba1cecd
...
...
@@ -73,7 +73,7 @@ func TestAutoFsSymlink(t *testing.T) {
err
:=
os
.
Mkdir
(
wd
+
"/store/backing1"
,
0755
)
CheckSuccess
(
err
)
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/store/backing1/READONLY"
)
err
=
os
.
Symlink
(
wd
+
"/ro"
,
wd
+
"/store/backing1/READONLY"
)
CheckSuccess
(
err
)
err
=
os
.
Symlink
(
wd
+
"/store/backing1"
,
wd
+
"/mount/config/manual1"
)
...
...
@@ -109,6 +109,29 @@ func TestAutoFsSymlink(t *testing.T) {
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
)
{
wd
,
clean
:=
setup
(
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