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
b3ea7e6b
Commit
b3ea7e6b
authored
Jul 06, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
4cc77e52
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
37 deletions
+36
-37
fuse/mountstate.go
fuse/mountstate.go
+2
-2
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+8
-8
fuse/switchfs.go
fuse/switchfs.go
+3
-4
fuse/switchfs_test.go
fuse/switchfs_test.go
+21
-21
unionfs/autounion.go
unionfs/autounion.go
+1
-1
unionfs/cachingfs.go
unionfs/cachingfs.go
+1
-1
No files found.
fuse/mountstate.go
View file @
b3ea7e6b
...
...
@@ -33,7 +33,7 @@ type MountState struct {
*
LatencyMap
opts
*
MountOptions
opts
*
MountOptions
kernelSettings
InitIn
}
...
...
@@ -53,7 +53,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) os.Error {
}
}
me
.
opts
=
opts
optStr
:=
""
if
opts
.
AllowOther
{
optStr
=
"allow_other"
...
...
fuse/pathfilesystem.go
View file @
b3ea7e6b
...
...
@@ -78,11 +78,11 @@ func (me *fileSystemMount) registerFileHandle(node *inode, dir rawDir, f File, f
node
.
OpenCountMutex
.
Lock
()
defer
node
.
OpenCountMutex
.
Unlock
()
b
:=
&
openedFile
{
dir
:
dir
,
file
:
f
,
inode
:
node
,
dir
:
dir
,
file
:
f
,
inode
:
node
,
fileSystemMount
:
me
,
Flags
:
flags
,
Flags
:
flags
,
}
node
.
OpenCount
++
return
me
.
openFiles
.
Register
(
&
b
.
Handled
)
...
...
@@ -133,8 +133,8 @@ type inode struct {
// Can only be called on untouched inodes.
func
(
me
*
inode
)
mountFs
(
fs
FileSystem
,
opts
*
FileSystemOptions
)
{
me
.
mountPoint
=
&
fileSystemMount
{
fs
:
fs
,
openFiles
:
NewHandleMap
(),
fs
:
fs
,
openFiles
:
NewHandleMap
(),
mountInode
:
me
,
options
:
opts
,
}
...
...
@@ -497,8 +497,8 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil
me
.
mountRoot
(
fs
,
opts
)
return
OK
}
dirParent
,
base
:=
filepath
.
Split
(
mountPoint
)
dirParent
,
base
:=
filepath
.
Split
(
mountPoint
)
parent
:=
me
.
findInode
(
dirParent
)
if
parent
==
nil
{
log
.
Println
(
"Could not find mountpoint parent:"
,
dirParent
)
...
...
fuse/switchfs.go
View file @
b3ea7e6b
...
...
@@ -65,7 +65,7 @@ func NewSwitchFileSystem(fsMap []SwitchedFileSystem) *SwitchFileSystem {
// numbers of switched filesystems.
func
(
me
*
SwitchFileSystem
)
findFileSystem
(
path
string
)
(
string
,
*
SwitchedFileSystem
)
{
for
_
,
swFs
:=
range
me
.
fileSystems
{
if
swFs
.
Prefix
==
""
||
swFs
.
Prefix
==
path
||
strings
.
HasPrefix
(
path
,
swFs
.
Prefix
+
string
(
filepath
.
Separator
))
{
if
swFs
.
Prefix
==
""
||
swFs
.
Prefix
==
path
||
strings
.
HasPrefix
(
path
,
swFs
.
Prefix
+
string
(
filepath
.
Separator
))
{
if
swFs
.
StripPrefix
{
path
=
strings
.
TrimLeft
(
path
[
len
(
swFs
.
Prefix
)
:
],
string
(
filepath
.
Separator
))
}
...
...
@@ -135,7 +135,7 @@ func (me *SwitchFileSystem) Symlink(value string, linkName string) (code Status)
func
(
me
*
SwitchFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
oldName
,
fs1
:=
me
.
findFileSystem
(
oldName
)
newName
,
fs2
:=
me
.
findFileSystem
(
newName
)
if
fs1
!=
fs2
{
if
fs1
!=
fs2
{
return
syscall
.
EXDEV
}
if
fs1
==
nil
{
...
...
@@ -147,7 +147,7 @@ func (me *SwitchFileSystem) Rename(oldName string, newName string) (code Status)
func
(
me
*
SwitchFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
oldName
,
fs1
:=
me
.
findFileSystem
(
oldName
)
newName
,
fs2
:=
me
.
findFileSystem
(
newName
)
if
fs1
!=
fs2
{
if
fs1
!=
fs2
{
return
syscall
.
EXDEV
}
if
fs1
==
nil
{
...
...
@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status {
}
return
fs
.
FileSystem
.
Flush
(
name
)
}
fuse/switchfs_test.go
View file @
b3ea7e6b
...
...
@@ -7,14 +7,14 @@ import (
func
TestSwitchFsSlash
(
t
*
testing
.
T
)
{
fsMap
:=
[]
SwitchedFileSystem
{
SwitchedFileSystem
{
Prefix
:
""
},
SwitchedFileSystem
{
Prefix
:
"/home"
},
SwitchedFileSystem
{
Prefix
:
"usr/"
},
SwitchedFileSystem
{
Prefix
:
"/home"
},
SwitchedFileSystem
{
Prefix
:
"usr/"
},
}
sfs
:=
NewSwitchFileSystem
(
fsMap
)
for
path
,
expectPrefix
:=
range
map
[
string
]
string
{
for
path
,
expectPrefix
:=
range
map
[
string
]
string
{
"home/foo/bar"
:
"home"
,
"usr/local"
:
"usr"
,
"usr/local"
:
"usr"
,
}
{
_
,
fs
:=
sfs
.
findFileSystem
(
path
)
if
fs
.
Prefix
!=
expectPrefix
{
...
...
@@ -26,21 +26,21 @@ func TestSwitchFsSlash(t *testing.T) {
func
TestSwitchFs
(
t
*
testing
.
T
)
{
fsMap
:=
[]
SwitchedFileSystem
{
SwitchedFileSystem
{
Prefix
:
""
},
SwitchedFileSystem
{
Prefix
:
"home/foo"
},
SwitchedFileSystem
{
Prefix
:
"home"
},
SwitchedFileSystem
{
Prefix
:
"usr"
},
SwitchedFileSystem
{
Prefix
:
"home/foo"
},
SwitchedFileSystem
{
Prefix
:
"home"
},
SwitchedFileSystem
{
Prefix
:
"usr"
},
}
sfs
:=
NewSwitchFileSystem
(
fsMap
)
for
path
,
expectPrefix
:=
range
map
[
string
]
string
{
"xyz"
:
""
,
"home/foo/bar"
:
"home/foo"
,
for
path
,
expectPrefix
:=
range
map
[
string
]
string
{
"xyz"
:
""
,
"home/foo/bar"
:
"home/foo"
,
"home/fooz/bar"
:
"home"
,
"home/efg"
:
"home"
,
"lib"
:
""
,
"abc"
:
""
,
"usr/local"
:
"usr"
,
"home/efg"
:
"home"
,
"lib"
:
""
,
"abc"
:
""
,
"usr/local"
:
"usr"
,
}
{
_
,
fs
:=
sfs
.
findFileSystem
(
path
)
if
fs
.
Prefix
!=
expectPrefix
{
...
...
@@ -53,19 +53,19 @@ func TestSwitchFs(t *testing.T) {
func
TestSwitchFsStrip
(
t
*
testing
.
T
)
{
fsMap
:=
[]
SwitchedFileSystem
{
SwitchedFileSystem
{
Prefix
:
""
},
SwitchedFileSystem
{
Prefix
:
"dev"
,
StripPrefix
:
true
},
SwitchedFileSystem
{
Prefix
:
"home"
,
StripPrefix
:
false
},
SwitchedFileSystem
{
Prefix
:
"dev"
,
StripPrefix
:
true
},
SwitchedFileSystem
{
Prefix
:
"home"
,
StripPrefix
:
false
},
}
sfs
:=
NewSwitchFileSystem
(
fsMap
)
// Don't check for inputs ending in '/' since Go-FUSE never
// generates them.
for
path
,
expectPath
:=
range
map
[
string
]
string
{
"xyz"
:
"xyz"
,
for
path
,
expectPath
:=
range
map
[
string
]
string
{
"xyz"
:
"xyz"
,
"home/foo/bar"
:
"home/foo/bar"
,
"home"
:
"home"
,
"dev/null"
:
"null"
,
"dev"
:
""
,
"home"
:
"home"
,
"dev/null"
:
"null"
,
"dev"
:
""
,
}
{
stripPath
,
_
:=
sfs
.
findFileSystem
(
path
)
if
stripPath
!=
expectPath
{
...
...
unionfs/autounion.go
View file @
b3ea7e6b
...
...
@@ -76,7 +76,7 @@ func (me *AutoUnionFs) addAutomaticFs(roots []string) {
}
}
func
(
me
*
AutoUnionFs
)
createFs
(
name
string
,
roots
[]
string
)
(
fuse
.
Status
)
{
func
(
me
*
AutoUnionFs
)
createFs
(
name
string
,
roots
[]
string
)
fuse
.
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
...
...
unionfs/cachingfs.go
View file @
b3ea7e6b
...
...
@@ -109,7 +109,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) {
Mode
:
fuse
.
S_IFREG
|
0777
,
},
fuse
.
OK
}
r
:=
me
.
attributes
.
Get
(
name
)
.
(
*
attrResponse
)
return
r
.
FileInfo
,
r
.
Status
}
...
...
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