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
2d65aab9
Commit
2d65aab9
authored
Jun 20, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
ed34f5da
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
83 additions
and
86 deletions
+83
-86
fuse/api.go
fuse/api.go
+1
-1
fuse/fuse.go
fuse/fuse.go
+1
-0
fuse/loopback_test.go
fuse/loopback_test.go
+10
-10
fuse/misc.go
fuse/misc.go
+2
-3
fuse/mount.go
fuse/mount.go
+2
-2
fuse/mountstate.go
fuse/mountstate.go
+1
-1
fuse/owner_test.go
fuse/owner_test.go
+2
-3
fuse/pathdebug.go
fuse/pathdebug.go
+2
-2
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+19
-19
fuse/pathops.go
fuse/pathops.go
+0
-1
unionfs/autounion.go
unionfs/autounion.go
+9
-9
unionfs/autounion_test.go
unionfs/autounion_test.go
+6
-6
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/dircache.go
unionfs/dircache.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+24
-25
No files found.
fuse/api.go
View file @
2d65aab9
fuse/fuse.go
View file @
2d65aab9
package
fuse
import
(
"os"
"fmt"
...
...
fuse/loopback_test.go
View file @
2d65aab9
...
...
@@ -680,7 +680,7 @@ func TestRecursiveMount(t *testing.T) {
t
.
Error
(
"expect EBUSY"
)
}
err
=
os
.
Rename
(
ts
.
mountPoint
+
"/mnt"
,
ts
.
mountPoint
+
"/foobar"
)
err
=
os
.
Rename
(
ts
.
mountPoint
+
"/mnt"
,
ts
.
mountPoint
+
"/foobar"
)
CheckSuccess
(
err
)
f
.
Close
()
...
...
fuse/misc.go
View file @
2d65aab9
...
...
@@ -189,4 +189,3 @@ func CurrentOwner() *Owner {
Gid
:
uint32
(
os
.
Getgid
()),
}
}
fuse/mount.go
View file @
2d65aab9
fuse/mountstate.go
View file @
2d65aab9
fuse/owner_test.go
View file @
2d65aab9
...
...
@@ -70,4 +70,3 @@ func TestOwnerOverride(t *testing.T) {
t
.
Fatal
(
"Should use current uid for mount"
,
fi
.
Uid
,
fi
.
Gid
)
}
}
fuse/pathdebug.go
View file @
2d65aab9
...
...
@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if
path
==
DebugDir
{
return
&
os
.
FileInfo
{
Mode
:
S_IFDIR
|
0755
,
},
OK
},
OK
}
c
:=
me
.
getContent
(
path
)
if
c
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
S_IFREG
|
0644
,
Size
:
int64
(
len
(
c
)),
},
OK
},
OK
}
return
nil
,
ENOENT
}
...
...
fuse/pathfilesystem.go
View file @
2d65aab9
fuse/pathops.go
View file @
2d65aab9
...
...
@@ -492,4 +492,3 @@ func (me *FileSystemConnector) Ioctl(header *InHeader, input *IoctlIn) (out *Ioc
}
return
f
.
Ioctl
(
input
)
}
unionfs/autounion.go
View file @
2d65aab9
...
...
@@ -283,7 +283,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
if
me
.
getUnionFs
(
path
)
!=
nil
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
},
fuse
.
OK
},
fuse
.
OK
}
return
nil
,
fuse
.
ENOENT
...
...
@@ -306,13 +306,13 @@ func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Statu
func
(
me
*
AutoUnionFs
)
Open
(
path
string
,
flags
uint32
)
(
fuse
.
File
,
fuse
.
Status
)
{
if
path
==
filepath
.
Join
(
_STATUS
,
_VERSION
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
return
nil
,
fuse
.
EPERM
}
return
fuse
.
NewReadOnlyFile
([]
byte
(
fuse
.
Version
())),
fuse
.
OK
}
if
path
==
filepath
.
Join
(
_CONFIG
,
_SCAN_CONFIG
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
me
.
updateKnownFses
()
}
return
fuse
.
NewDevNullFile
(),
fuse
.
OK
...
...
unionfs/autounion_test.go
View file @
2d65aab9
...
...
@@ -44,7 +44,7 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile
(
wd
+
"/ro/file2"
,
"file2"
)
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
CheckSuccess
(
err
)
state
.
Debug
=
true
conn
.
Debug
=
true
...
...
@@ -60,7 +60,7 @@ func TestVersion(t *testing.T) {
wd
,
clean
:=
setup
(
t
)
defer
clean
()
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/status/gounionfs_version"
)
c
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/status/gounionfs_version"
)
CheckSuccess
(
err
)
if
len
(
c
)
==
0
{
t
.
Fatal
(
"No version found."
)
...
...
@@ -91,7 +91,7 @@ func TestAutoFsSymlink(t *testing.T) {
time
.
Sleep
(
2
*
entryTtl
*
1e9
)
scan
:=
wd
+
"/mount/config/"
+
_SCAN_CONFIG
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
if
err
!=
nil
{
t
.
Error
(
"error writing:"
,
err
)
}
...
...
@@ -128,7 +128,7 @@ func TestExplicitScan(t *testing.T) {
t
.
Error
(
".scan_config missing:"
,
err
)
}
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
err
=
ioutil
.
WriteFile
(
scan
,
[]
byte
(
"something"
),
0644
)
if
err
!=
nil
{
t
.
Error
(
"error writing:"
,
err
)
}
...
...
unionfs/cachingfs.go
View file @
2d65aab9
...
...
@@ -136,10 +136,10 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
c
.
links
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
readLink
(
fs
,
n
)
},
ttlNs
)
c
.
xattr
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
getXAttr
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
c
.
files
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
openFile
(
fs
,
n
)
},
ttlNs
)
},
ttlNs
)
return
c
}
...
...
unionfs/dircache.go
View file @
2d65aab9
unionfs/unionfs.go
View file @
2d65aab9
...
...
@@ -570,7 +570,7 @@ func (me *UnionFs) GetAttr(name string) (a *os.FileInfo, s fuse.Status) {
if
name
==
_DROP_CACHE
{
return
&
os
.
FileInfo
{
Mode
:
fuse
.
S_IFREG
|
0777
,
},
fuse
.
OK
},
fuse
.
OK
}
if
name
==
me
.
options
.
DeletionDirName
{
return
nil
,
fuse
.
ENOENT
...
...
unionfs/unionfs_test.go
View file @
2d65aab9
...
...
@@ -48,7 +48,7 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
NegativeTimeout
:
entryTtl
,
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
state
.
Debug
=
true
go
state
.
Loop
(
false
)
...
...
@@ -123,13 +123,13 @@ func TestAutocreateDeletionDir(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Remove
(
wd
+
"/rw/DELETIONS"
)
err
:=
os
.
Remove
(
wd
+
"/rw/DELETIONS"
)
CheckSuccess
(
err
)
err
=
os
.
Mkdir
(
wd
+
"/mount/dir"
,
0755
)
CheckSuccess
(
err
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount/dir"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount/dir"
)
CheckSuccess
(
err
)
}
...
...
@@ -498,7 +498,7 @@ func TestRemoveAll(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
err
:=
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
CheckSuccess
(
err
)
contents
:=
"hello"
...
...
@@ -506,7 +506,7 @@ func TestRemoveAll(t *testing.T) {
err
=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
contents
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
RemoveAll
(
wd
+
"/mount/dir"
)
err
=
os
.
RemoveAll
(
wd
+
"/mount/dir"
)
if
err
!=
nil
{
t
.
Error
(
"Should delete all"
)
}
...
...
@@ -527,7 +527,7 @@ func TestDropCache(t *testing.T) {
wd
,
clean
:=
setupUfs
(
t
)
defer
clean
()
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"bla"
),
0644
)
err
:=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"bla"
),
0644
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/.drop_cache"
)
...
...
@@ -539,14 +539,14 @@ func TestDropCache(t *testing.T) {
t
.
Fatal
(
"unexpected names"
,
names
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file2"
,
[]
byte
(
"blabla"
),
0644
)
names2
,
err
:=
Readdirnames
(
wd
+
"/mount"
)
CheckSuccess
(
err
)
if
len
(
names2
)
!=
len
(
names
)
{
t
.
Fatal
(
"mismatch"
,
names2
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/.drop_cache"
,
[]
byte
(
"does not matter"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/.drop_cache"
,
[]
byte
(
"does not matter"
),
0644
)
CheckSuccess
(
err
)
names2
,
err
=
Readdirnames
(
wd
+
"/mount"
)
if
len
(
names2
)
!=
2
{
...
...
@@ -568,7 +568,7 @@ func TestDisappearing(t *testing.T) {
os
.
Mkdir
(
wd
+
"/ro"
,
0700
)
fuse
.
CheckSuccess
(
err
)
wrFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/rw"
)
wrFs
:=
fuse
.
NewLoopbackFileSystem
(
wd
+
"/rw"
)
var
fses
[]
fuse
.
FileSystem
fses
=
append
(
fses
,
wrFs
)
fses
=
append
(
fses
,
fuse
.
NewLoopbackFileSystem
(
wd
+
"/ro"
))
...
...
@@ -580,7 +580,7 @@ func TestDisappearing(t *testing.T) {
NegativeTimeout
:
entryTtl
,
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
defer
state
.
Unmount
()
state
.
Debug
=
true
...
...
@@ -588,23 +588,23 @@ func TestDisappearing(t *testing.T) {
log
.
Println
(
"TestDisappearing2"
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/ro/file"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
err
=
os
.
Remove
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
oldRoot
:=
wrFs
.
Root
wrFs
.
Root
=
"/dev/null"
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
if
err
==
nil
{
t
.
Fatal
(
"Readdir should have failed"
)
}
log
.
Println
(
"expected readdir failure:"
,
err
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
if
err
==
nil
{
t
.
Fatal
(
"write should have failed"
)
}
...
...
@@ -612,15 +612,14 @@ func TestDisappearing(t *testing.T) {
// Restore, and wait for caches to catch up.
wrFs
.
Root
=
oldRoot
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
time
.
Sleep
(
1.5
*
entryTtl
*
1e9
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
_
,
err
=
ioutil
.
ReadDir
(
wd
+
"/mount"
)
if
err
!=
nil
{
t
.
Fatal
(
"Readdir should succeed"
,
err
)
}
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file2"
,
[]
byte
(
"blabla"
),
0644
)
if
err
!=
nil
{
t
.
Fatal
(
"write should succeed"
,
err
)
}
}
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