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
5c47ca23
Commit
5c47ca23
authored
Apr 21, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename PathFileSystem to FileSystem.
parent
9c3ac0b4
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
215 additions
and
215 deletions
+215
-215
example/autounionfs/main.go
example/autounionfs/main.go
+1
-1
example/loopback/loopback.go
example/loopback/loopback.go
+6
-6
example/unionfs/main.go
example/unionfs/main.go
+1
-1
example/zipfs/main.go
example/zipfs/main.go
+1
-1
fuse/default.go
fuse/default.go
+24
-24
fuse/default_test.go
fuse/default_test.go
+4
-4
fuse/direntry.go
fuse/direntry.go
+1
-1
fuse/lockingfs.go
fuse/lockingfs.go
+28
-28
fuse/loopback.go
fuse/loopback.go
+2
-2
fuse/loopback_test.go
fuse/loopback_test.go
+5
-5
fuse/pathdebug.go
fuse/pathdebug.go
+5
-5
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+57
-57
fuse/timingfs.go
fuse/timingfs.go
+32
-32
fuse/types.go
fuse/types.go
+4
-4
fuse/wrappedfs.go
fuse/wrappedfs.go
+25
-25
fuse/xattr_test.go
fuse/xattr_test.go
+2
-2
unionfs/autounion.go
unionfs/autounion.go
+3
-3
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/unionfs.go
unionfs/unionfs.go
+5
-5
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+1
-1
zipfs/multizip.go
zipfs/multizip.go
+4
-4
zipfs/zipfs.go
zipfs/zipfs.go
+1
-1
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+1
-1
No files found.
example/autounionfs/main.go
View file @
5c47ca23
...
...
@@ -33,7 +33,7 @@ func main() {
}
gofs
:=
unionfs
.
NewAutoUnionFs
(
flag
.
Arg
(
1
),
options
)
conn
:=
fuse
.
New
Path
FileSystemConnector
(
gofs
)
conn
:=
fuse
.
NewFileSystemConnector
(
gofs
)
mountState
:=
fuse
.
NewMountState
(
conn
)
mountState
.
Debug
=
*
debug
fmt
.
Printf
(
"Mounting...
\n
"
)
...
...
example/loopback/loopback.go
View file @
5c47ca23
...
...
@@ -16,7 +16,7 @@ var _ = runtime.GOMAXPROCS
var
_
=
log
.
Print
type
PathPrintingFs
struct
{
fuse
.
Wrapping
Path
FileSystem
fuse
.
WrappingFileSystem
}
func
(
me
*
PathPrintingFs
)
GetAttr
(
name
string
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
...
...
@@ -35,22 +35,22 @@ func main() {
os
.
Exit
(
2
)
}
var
fs
fuse
.
Path
FileSystem
var
fs
fuse
.
FileSystem
orig
:=
flag
.
Arg
(
1
)
loopbackfs
:=
fuse
.
NewLoopbackFileSystem
(
orig
)
fs
=
loopbackfs
debugFs
:=
new
(
fuse
.
Path
FileSystemDebug
)
debugFs
:=
new
(
fuse
.
FileSystemDebug
)
debugFs
.
Original
=
fs
fs
=
debugFs
timing
:=
fuse
.
NewTiming
Path
FileSystem
(
fs
)
timing
:=
fuse
.
NewTimingFileSystem
(
fs
)
fs
=
timing
var
opts
fuse
.
Path
FileSystemConnectorOptions
var
opts
fuse
.
FileSystemConnectorOptions
loopbackfs
.
FillOptions
(
&
opts
)
conn
:=
fuse
.
New
Path
FileSystemConnector
(
fs
)
conn
:=
fuse
.
NewFileSystemConnector
(
fs
)
debugFs
.
Connector
=
conn
rawTiming
:=
fuse
.
NewTimingRawFileSystem
(
conn
)
...
...
example/unionfs/main.go
View file @
5c47ca23
...
...
@@ -30,7 +30,7 @@ func main() {
}
ufs
:=
unionfs
.
NewUnionFs
(
flag
.
Args
()[
1
:
],
ufsOptions
)
conn
:=
fuse
.
New
Path
FileSystemConnector
(
ufs
)
conn
:=
fuse
.
NewFileSystemConnector
(
ufs
)
mountState
:=
fuse
.
NewMountState
(
conn
)
mountState
.
Debug
=
*
debug
fmt
.
Printf
(
"Mounting...
\n
"
)
...
...
example/zipfs/main.go
View file @
5c47ca23
...
...
@@ -22,7 +22,7 @@ func main() {
}
fs
:=
zipfs
.
NewZipArchiveFileSystem
(
flag
.
Arg
(
1
))
conn
:=
fuse
.
New
Path
FileSystemConnector
(
fs
)
conn
:=
fuse
.
NewFileSystemConnector
(
fs
)
state
:=
fuse
.
NewMountState
(
conn
)
mountPoint
:=
flag
.
Arg
(
0
)
...
...
fuse/default.go
View file @
5c47ca23
...
...
@@ -159,95 +159,95 @@ func (me *DefaultFile) Fsync(*FsyncIn) (code Status) {
}
////////////////////////////////////////////////////////////////
// Default
Path
FileSystem
// DefaultFileSystem
func
(
me
*
Default
Path
FileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
DefaultFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
DefaultFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
DefaultFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
DefaultFileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
DefaultFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
DefaultFileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
return
""
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
DefaultFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
DefaultFileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
DefaultFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
PathFileSystem
)
Mount
(
conn
*
Path
FileSystemConnector
)
Status
{
func
(
me
*
Default
FileSystem
)
Mount
(
conn
*
FileSystemConnector
)
Status
{
return
OK
}
func
(
me
*
Default
Path
FileSystem
)
Unmount
()
{
func
(
me
*
DefaultFileSystem
)
Unmount
()
{
}
func
(
me
*
Default
Path
FileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
Default
Path
FileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
DefaultFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
return
ENOSYS
}
fuse/default_test.go
View file @
5c47ca23
...
...
@@ -18,10 +18,10 @@ func TestRawFs(t *testing.T) {
}
func
TestPathFs
(
t
*
testing
.
T
)
{
var
iface
Path
FileSystem
iface
=
new
(
Default
Path
FileSystem
)
iface
=
new
(
Wrapping
Path
FileSystem
)
iface
=
new
(
Timing
Path
FileSystem
)
var
iface
FileSystem
iface
=
new
(
DefaultFileSystem
)
iface
=
new
(
WrappingFileSystem
)
iface
=
new
(
TimingFileSystem
)
_
=
iface
}
...
...
fuse/direntry.go
View file @
5c47ca23
...
...
@@ -9,7 +9,7 @@ import (
)
var
_
=
fmt
.
Print
// For
Path
FileSystemConnector. The connector determines inodes.
// For FileSystemConnector. The connector determines inodes.
type
DirEntry
struct
{
Mode
uint32
Name
string
...
...
fuse/lockingfs.go
View file @
5c47ca23
...
...
@@ -4,153 +4,153 @@ import (
"sync"
)
// This is a wrapper that makes a
Path
FileSystem threadsafe by
// This is a wrapper that makes a FileSystem threadsafe by
// trivially locking all operations. For improved performance, you
// should probably invent do your own locking inside the file system.
type
Locking
Path
FileSystem
struct
{
type
LockingFileSystem
struct
{
// Should be public so people reusing can access the wrapped
// FS.
Wrapping
Path
FileSystem
WrappingFileSystem
lock
sync
.
Mutex
}
func
NewLocking
PathFileSystem
(
pfs
PathFileSystem
)
*
LockingPath
FileSystem
{
l
:=
new
(
Locking
Path
FileSystem
)
func
NewLocking
FileSystem
(
pfs
FileSystem
)
*
Locking
FileSystem
{
l
:=
new
(
LockingFileSystem
)
l
.
Original
=
pfs
return
l
}
func
(
me
*
Locking
Path
FileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
LockingFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
GetAttr
(
name
)
}
func
(
me
*
Locking
Path
FileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
LockingFileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Readlink
(
name
)
}
func
(
me
*
Locking
Path
FileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
LockingFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Mknod
(
name
,
mode
,
dev
)
}
func
(
me
*
Locking
Path
FileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
LockingFileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Mkdir
(
name
,
mode
)
}
func
(
me
*
Locking
Path
FileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Unlink
(
name
)
}
func
(
me
*
Locking
Path
FileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Rmdir
(
name
)
}
func
(
me
*
Locking
Path
FileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Symlink
(
value
,
linkName
)
}
func
(
me
*
Locking
Path
FileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Rename
(
oldName
,
newName
)
}
func
(
me
*
Locking
Path
FileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Link
(
oldName
,
newName
)
}
func
(
me
*
Locking
Path
FileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Chmod
(
name
,
mode
)
}
func
(
me
*
Locking
Path
FileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Chown
(
name
,
uid
,
gid
)
}
func
(
me
*
Locking
Path
FileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
Locking
Path
FileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Open
(
name
,
flags
)
}
func
(
me
*
Locking
Path
FileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
LockingFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
OpenDir
(
name
)
}
func
(
me
*
Locking
PathFileSystem
)
Mount
(
conn
*
Path
FileSystemConnector
)
Status
{
func
(
me
*
Locking
FileSystem
)
Mount
(
conn
*
FileSystemConnector
)
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Mount
(
conn
)
}
func
(
me
*
Locking
Path
FileSystem
)
Unmount
()
{
func
(
me
*
LockingFileSystem
)
Unmount
()
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
me
.
Original
.
Unmount
()
}
func
(
me
*
Locking
Path
FileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
Locking
Path
FileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
func
(
me
*
Locking
Path
FileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
LockingFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Utimens
(
name
,
AtimeNs
,
CtimeNs
)
}
func
(
me
*
Locking
Path
FileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
LockingFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
Locking
Path
FileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
LockingFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
SetXAttr
(
name
,
attr
,
data
,
flags
)
}
func
(
me
*
Locking
Path
FileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
LockingFileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
ListXAttr
(
name
)
}
func
(
me
*
Locking
Path
FileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
LockingFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
RemoveXAttr
(
name
,
attr
)
...
...
fuse/loopback.go
View file @
5c47ca23
...
...
@@ -18,7 +18,7 @@ var _ = log.Println
type
LoopbackFileSystem
struct
{
root
string
Default
Path
FileSystem
DefaultFileSystem
}
func
NewLoopbackFileSystem
(
root
string
)
(
out
*
LoopbackFileSystem
)
{
...
...
@@ -162,7 +162,7 @@ func (me *LoopbackFileSystem) RemoveXAttr(name string, attr string) Status {
return
Status
(
Removexattr
(
me
.
GetPath
(
name
),
attr
))
}
func
(
me
*
LoopbackFileSystem
)
FillOptions
(
options
*
Path
FileSystemConnectorOptions
)
{
func
(
me
*
LoopbackFileSystem
)
FillOptions
(
options
*
FileSystemConnectorOptions
)
{
// These options are to be compatible with libfuse defaults,
// making benchmarking easier.
options
.
NegativeTimeout
=
1.0
...
...
fuse/loopback_test.go
View file @
5c47ca23
...
...
@@ -34,7 +34,7 @@ type testCase struct {
origSubfile
string
tester
*
testing
.
T
state
*
MountState
connector
*
Path
FileSystemConnector
connector
*
FileSystemConnector
}
// Create and mount filesystem.
...
...
@@ -55,13 +55,13 @@ func (me *testCase) Setup(t *testing.T) {
me
.
origSubdir
=
filepath
.
Join
(
me
.
origDir
,
subdir
)
me
.
origSubfile
=
filepath
.
Join
(
me
.
origSubdir
,
"subfile"
)
var
pfs
Path
FileSystem
var
pfs
FileSystem
pfs
=
NewLoopbackFileSystem
(
me
.
origDir
)
pfs
=
NewTiming
Path
FileSystem
(
pfs
)
pfs
=
NewLocking
Path
FileSystem
(
pfs
)
pfs
=
NewTimingFileSystem
(
pfs
)
pfs
=
NewLockingFileSystem
(
pfs
)
var
rfs
RawFileSystem
me
.
connector
=
New
Path
FileSystemConnector
(
pfs
)
me
.
connector
=
NewFileSystemConnector
(
pfs
)
rfs
=
me
.
connector
rfs
=
NewTimingRawFileSystem
(
rfs
)
rfs
=
NewLockingRawFileSystem
(
rfs
)
...
...
fuse/pathdebug.go
View file @
5c47ca23
...
...
@@ -5,21 +5,21 @@ import (
var
_
=
fmt
.
Println
type
Path
FileSystemDebug
struct
{
type
FileSystemDebug
struct
{
// TODO - use a generic callback system instead.
Connector
*
Path
FileSystemConnector
Connector
*
FileSystemConnector
Wrapping
Path
FileSystem
WrappingFileSystem
}
func
(
me
*
Path
FileSystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
File
,
status
Status
)
{
func
(
me
*
FileSystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
File
,
status
Status
)
{
if
path
==
".debug"
&&
me
.
Connector
!=
nil
{
return
NewReadOnlyFile
([]
byte
(
me
.
Connector
.
DebugString
())),
OK
}
return
me
.
Original
.
Open
(
path
,
flags
)
}
func
(
me
*
Path
FileSystemDebug
)
GetAttr
(
path
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
FileSystemDebug
)
GetAttr
(
path
string
)
(
*
Attr
,
Status
)
{
if
path
==
".debug"
&&
me
.
Connector
!=
nil
{
return
&
Attr
{
Mode
:
S_IFREG
,
...
...
fuse/pathfilesystem.go
View file @
5c47ca23
This diff is collapsed.
Click to expand it.
fuse/timingfs.go
View file @
5c47ca23
...
...
@@ -11,9 +11,9 @@ import (
var
_
=
log
.
Print
var
_
=
fmt
.
Print
// Timing
PathFileSystem is a wrapper to collect timings for a Path
FileSystem
type
Timing
Path
FileSystem
struct
{
Wrapping
Path
FileSystem
// Timing
FileSystem is a wrapper to collect timings for a
FileSystem
type
TimingFileSystem
struct
{
WrappingFileSystem
statisticsLock
sync
.
Mutex
latencies
map
[
string
]
int64
...
...
@@ -21,8 +21,8 @@ type TimingPathFileSystem struct {
pathCounts
map
[
string
]
map
[
string
]
int64
}
func
NewTiming
PathFileSystem
(
fs
PathFileSystem
)
*
TimingPath
FileSystem
{
t
:=
new
(
Timing
Path
FileSystem
)
func
NewTiming
FileSystem
(
fs
FileSystem
)
*
Timing
FileSystem
{
t
:=
new
(
TimingFileSystem
)
t
.
Original
=
fs
t
.
latencies
=
make
(
map
[
string
]
int64
)
t
.
counts
=
make
(
map
[
string
]
int64
)
...
...
@@ -30,7 +30,7 @@ func NewTimingPathFileSystem(fs PathFileSystem) *TimingPathFileSystem {
return
t
}
func
(
me
*
Timing
Path
FileSystem
)
startTimer
(
name
string
,
arg
string
)
(
closure
func
())
{
func
(
me
*
TimingFileSystem
)
startTimer
(
name
string
,
arg
string
)
(
closure
func
())
{
start
:=
time
.
Nanoseconds
()
return
func
()
{
...
...
@@ -50,7 +50,7 @@ func (me *TimingPathFileSystem) startTimer(name string, arg string) (closure fun
}
}
func
(
me
*
Timing
Path
FileSystem
)
OperationCounts
()
map
[
string
]
int64
{
func
(
me
*
TimingFileSystem
)
OperationCounts
()
map
[
string
]
int64
{
me
.
statisticsLock
.
Lock
()
defer
me
.
statisticsLock
.
Unlock
()
...
...
@@ -61,7 +61,7 @@ func (me *TimingPathFileSystem) OperationCounts() map[string]int64 {
return
r
}
func
(
me
*
Timing
Path
FileSystem
)
Latencies
()
map
[
string
]
float64
{
func
(
me
*
TimingFileSystem
)
Latencies
()
map
[
string
]
float64
{
me
.
statisticsLock
.
Lock
()
defer
me
.
statisticsLock
.
Unlock
()
...
...
@@ -72,7 +72,7 @@ func (me *TimingPathFileSystem) Latencies() map[string]float64 {
return
r
}
func
(
me
*
Timing
Path
FileSystem
)
HotPaths
(
operation
string
)
(
paths
[]
string
,
uniquePaths
int
)
{
func
(
me
*
TimingFileSystem
)
HotPaths
(
operation
string
)
(
paths
[]
string
,
uniquePaths
int
)
{
me
.
statisticsLock
.
Lock
()
defer
me
.
statisticsLock
.
Unlock
()
...
...
@@ -86,117 +86,117 @@ func (me *TimingPathFileSystem) HotPaths(operation string) (paths []string, uniq
return
results
,
len
(
counts
)
}
func
(
me
*
Timing
Path
FileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
TimingFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
defer
me
.
startTimer
(
"GetAttr"
,
name
)()
return
me
.
Original
.
GetAttr
(
name
)
}
func
(
me
*
Timing
Path
FileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
TimingFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
defer
me
.
startTimer
(
"GetXAttr"
,
name
)()
return
me
.
Original
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
Timing
Path
FileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
TimingFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
defer
me
.
startTimer
(
"SetXAttr"
,
name
)()
return
me
.
Original
.
SetXAttr
(
name
,
attr
,
data
,
flags
)
}
func
(
me
*
Timing
Path
FileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
TimingFileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
defer
me
.
startTimer
(
"ListXAttr"
,
name
)()
return
me
.
Original
.
ListXAttr
(
name
)
}
func
(
me
*
Timing
Path
FileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
TimingFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
defer
me
.
startTimer
(
"RemoveXAttr"
,
name
)()
return
me
.
Original
.
RemoveXAttr
(
name
,
attr
)
}
func
(
me
*
Timing
Path
FileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
TimingFileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
defer
me
.
startTimer
(
"Readlink"
,
name
)()
return
me
.
Original
.
Readlink
(
name
)
}
func
(
me
*
Timing
Path
FileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
TimingFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
defer
me
.
startTimer
(
"Mknod"
,
name
)()
return
me
.
Original
.
Mknod
(
name
,
mode
,
dev
)
}
func
(
me
*
Timing
Path
FileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
TimingFileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
defer
me
.
startTimer
(
"Mkdir"
,
name
)()
return
me
.
Original
.
Mkdir
(
name
,
mode
)
}
func
(
me
*
Timing
Path
FileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Unlink"
,
name
)()
return
me
.
Original
.
Unlink
(
name
)
}
func
(
me
*
Timing
Path
FileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rmdir"
,
name
)()
return
me
.
Original
.
Rmdir
(
name
)
}
func
(
me
*
Timing
Path
FileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Symlink"
,
linkName
)()
return
me
.
Original
.
Symlink
(
value
,
linkName
)
}
func
(
me
*
Timing
Path
FileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rename"
,
oldName
)()
return
me
.
Original
.
Rename
(
oldName
,
newName
)
}
func
(
me
*
Timing
Path
FileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Link"
,
newName
)()
return
me
.
Original
.
Link
(
oldName
,
newName
)
}
func
(
me
*
Timing
Path
FileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Chmod"
,
name
)()
return
me
.
Original
.
Chmod
(
name
,
mode
)
}
func
(
me
*
Timing
Path
FileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Chown"
,
name
)()
return
me
.
Original
.
Chown
(
name
,
uid
,
gid
)
}
func
(
me
*
Timing
Path
FileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Truncate"
,
name
)()
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
Timing
Path
FileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
defer
me
.
startTimer
(
"Open"
,
name
)()
return
me
.
Original
.
Open
(
name
,
flags
)
}
func
(
me
*
Timing
Path
FileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
TimingFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
defer
me
.
startTimer
(
"OpenDir"
,
name
)()
return
me
.
Original
.
OpenDir
(
name
)
}
func
(
me
*
Timing
PathFileSystem
)
Mount
(
conn
*
Path
FileSystemConnector
)
Status
{
func
(
me
*
Timing
FileSystem
)
Mount
(
conn
*
FileSystemConnector
)
Status
{
defer
me
.
startTimer
(
"Mount"
,
""
)()
return
me
.
Original
.
Mount
(
conn
)
}
func
(
me
*
Timing
Path
FileSystem
)
Unmount
()
{
func
(
me
*
TimingFileSystem
)
Unmount
()
{
defer
me
.
startTimer
(
"Unmount"
,
""
)()
me
.
Original
.
Unmount
()
}
func
(
me
*
Timing
Path
FileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Access"
,
name
)()
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
Timing
Path
FileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
defer
me
.
startTimer
(
"Create"
,
name
)()
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
func
(
me
*
Timing
Path
FileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
TimingFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Utimens"
,
name
)()
return
me
.
Original
.
Utimens
(
name
,
AtimeNs
,
CtimeNs
)
}
fuse/types.go
View file @
5c47ca23
...
...
@@ -498,7 +498,7 @@ type NotifyInvalEntryOut struct {
//
// Typically, each call happens in its own goroutine, so any global
// data should be made thread-safe. Unless you really know what you
// are doing, you should not implement this, but
Path
FileSystem below;
// are doing, you should not implement this, but FileSystem below;
// the details of getting interactions with open files, renames, and
// threading right etc. are somewhat tricky and not very interesting.
type
RawFileSystem
interface
{
...
...
@@ -561,7 +561,7 @@ type RawDir interface {
Release
()
}
type
Path
FileSystem
interface
{
type
FileSystem
interface
{
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
Readlink
(
name
string
)
(
string
,
Status
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
...
...
@@ -586,7 +586,7 @@ type PathFileSystem interface {
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
code
Status
)
// TODO - what is a good interface?
Mount
(
connector
*
Path
FileSystemConnector
)
Status
Mount
(
connector
*
FileSystemConnector
)
Status
Unmount
()
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
...
...
@@ -599,6 +599,6 @@ type PathFileSystem interface {
// Include this struct in your implementation to inherit default nop
// implementations.
type
Default
Path
FileSystem
struct
{}
type
DefaultFileSystem
struct
{}
type
DefaultFile
struct
{}
type
DefaultRawFileSystem
struct
{}
fuse/wrappedfs.go
View file @
5c47ca23
package
fuse
type
Wrapping
Path
FileSystem
struct
{
type
WrappingFileSystem
struct
{
// Should be public so people reusing can access the wrapped
// FS.
Original
Path
FileSystem
Original
FileSystem
}
func
(
me
*
Wrapping
Path
FileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
WrappingFileSystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
return
me
.
Original
.
GetAttr
(
name
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
WrappingFileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
return
me
.
Original
.
Readlink
(
name
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
WrappingFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
return
me
.
Original
.
Mknod
(
name
,
mode
,
dev
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
WrappingFileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
return
me
.
Original
.
Mkdir
(
name
,
mode
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
return
me
.
Original
.
Unlink
(
name
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
return
me
.
Original
.
Rmdir
(
name
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
return
me
.
Original
.
Symlink
(
value
,
linkName
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
me
.
Original
.
Rename
(
oldName
,
newName
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
me
.
Original
.
Link
(
oldName
,
newName
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
me
.
Original
.
Chmod
(
name
,
mode
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
return
me
.
Original
.
Chown
(
name
,
uid
,
gid
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Open
(
name
,
flags
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
WrappingFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
me
.
Original
.
OpenDir
(
name
)
}
func
(
me
*
Wrapping
PathFileSystem
)
Mount
(
conn
*
Path
FileSystemConnector
)
Status
{
func
(
me
*
Wrapping
FileSystem
)
Mount
(
conn
*
FileSystemConnector
)
Status
{
return
me
.
Original
.
Mount
(
conn
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Unmount
()
{
func
(
me
*
WrappingFileSystem
)
Unmount
()
{
me
.
Original
.
Unmount
()
}
func
(
me
*
Wrapping
Path
FileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
WrappingFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
return
me
.
Original
.
Utimens
(
name
,
AtimeNs
,
CtimeNs
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
WrappingFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
return
me
.
Original
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
WrappingFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
return
me
.
Original
.
SetXAttr
(
name
,
attr
,
data
,
flags
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
WrappingFileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
return
me
.
Original
.
ListXAttr
(
name
)
}
func
(
me
*
Wrapping
Path
FileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
WrappingFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
return
me
.
Original
.
RemoveXAttr
(
name
,
attr
)
}
...
...
fuse/xattr_test.go
View file @
5c47ca23
...
...
@@ -15,7 +15,7 @@ type XAttrTestFs struct {
filename
string
attrs
map
[
string
][]
byte
Default
Path
FileSystem
DefaultFileSystem
}
func
NewXAttrFs
(
nm
string
,
m
map
[
string
][]
byte
)
*
XAttrTestFs
{
...
...
@@ -93,7 +93,7 @@ func TestXAttrRead(t *testing.T) {
"user.attr2"
:
[]
byte
(
"val2"
)}
xfs
:=
NewXAttrFs
(
nm
,
golden
)
connector
:=
New
PathFileSystemConnector
(
NewLockingPath
FileSystem
(
xfs
))
connector
:=
New
FileSystemConnector
(
NewLocking
FileSystem
(
xfs
))
mountPoint
:=
MakeTempDir
()
state
:=
NewMountState
(
connector
)
...
...
unionfs/autounion.go
View file @
5c47ca23
...
...
@@ -18,13 +18,13 @@ import (
//
// A union for A/B/C will placed under directory A-B-C.
type
AutoUnionFs
struct
{
fuse
.
Default
Path
FileSystem
fuse
.
DefaultFileSystem
lock
sync
.
RWMutex
knownFileSystems
map
[
string
]
*
UnionFs
root
string
connector
*
fuse
.
Path
FileSystemConnector
connector
*
fuse
.
FileSystemConnector
options
*
AutoUnionFsOptions
}
...
...
@@ -41,7 +41,7 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs {
return
a
}
func
(
me
*
AutoUnionFs
)
Mount
(
connector
*
fuse
.
Path
FileSystemConnector
)
fuse
.
Status
{
func
(
me
*
AutoUnionFs
)
Mount
(
connector
*
fuse
.
FileSystemConnector
)
fuse
.
Status
{
me
.
connector
=
connector
time
.
AfterFunc
(
0.1e9
,
func
()
{
me
.
updateKnownFses
()
})
return
fuse
.
OK
...
...
unionfs/cachingfs.go
View file @
5c47ca23
...
...
@@ -22,7 +22,7 @@ type linkResponse struct {
// Caches readdir and getattr()
type
CachingFileSystem
struct
{
fuse
.
Wrapping
Path
FileSystem
fuse
.
WrappingFileSystem
attributesLock
sync
.
RWMutex
attributes
map
[
string
]
attrResponse
...
...
@@ -34,7 +34,7 @@ type CachingFileSystem struct {
links
map
[
string
]
linkResponse
}
func
NewCachingFileSystem
(
pfs
fuse
.
Path
FileSystem
)
*
CachingFileSystem
{
func
NewCachingFileSystem
(
pfs
fuse
.
FileSystem
)
*
CachingFileSystem
{
c
:=
new
(
CachingFileSystem
)
c
.
Original
=
pfs
c
.
attributes
=
make
(
map
[
string
]
attrResponse
)
...
...
unionfs/unionfs.go
View file @
5c47ca23
...
...
@@ -58,12 +58,12 @@ func filePathHash(path string) string {
*/
type
UnionFs
struct
{
fuse
.
Default
Path
FileSystem
fuse
.
DefaultFileSystem
branches
[]
*
fuse
.
LoopbackFileSystem
// The same, but as interfaces.
fileSystems
[]
fuse
.
Path
FileSystem
fileSystems
[]
fuse
.
FileSystem
// A file-existence cache.
deletionCache
*
DirCache
...
...
@@ -89,7 +89,7 @@ func NewUnionFs(roots []string, options UnionFsOptions) *UnionFs {
g
.
branches
=
append
(
g
.
branches
,
pt
)
// We could use some sort of caching file system here.
g
.
fileSystems
=
append
(
g
.
fileSystems
,
fuse
.
Path
FileSystem
(
pt
))
g
.
fileSystems
=
append
(
g
.
fileSystems
,
fuse
.
FileSystem
(
pt
))
}
deletionDir
:=
g
.
deletionDir
()
...
...
@@ -232,7 +232,7 @@ src *fuse.LoopbackFileSystem) os.Error {
}
////////////////////////////////////////////////////////////////
// Below: implement interface for a
Path
FileSystem.
// Below: implement interface for a FileSystem.
func
(
me
*
UnionFs
)
Mkdir
(
path
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
code
=
me
.
fileSystems
[
0
]
.
Mkdir
(
path
,
mode
)
...
...
@@ -344,7 +344,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
for
i
,
l
:=
range
me
.
fileSystems
{
if
i
>=
dirBranch
{
wg
.
Add
(
1
)
go
func
(
j
int
,
pfs
fuse
.
Path
FileSystem
)
{
go
func
(
j
int
,
pfs
fuse
.
FileSystem
)
{
ch
,
s
:=
pfs
.
OpenDir
(
directory
)
statuses
[
j
]
=
s
for
s
==
fuse
.
OK
{
...
...
unionfs/unionfs_test.go
View file @
5c47ca23
...
...
@@ -40,7 +40,7 @@ func setup(t *testing.T) (workdir string, state *fuse.MountState) {
roots
=
append
(
roots
,
wd
+
"/ro"
)
ufs
:=
NewUnionFs
(
roots
,
testOpts
)
connector
:=
fuse
.
New
Path
FileSystemConnector
(
ufs
)
connector
:=
fuse
.
NewFileSystemConnector
(
ufs
)
state
=
fuse
.
NewMountState
(
connector
)
state
.
Mount
(
wd
+
"/mount"
)
...
...
zipfs/multizip.go
View file @
5c47ca23
...
...
@@ -68,16 +68,16 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f
////////////////////////////////////////////////////////////////
// MultiZipFs is a path filesystem that mounts zipfiles. It needs a
// reference to the
Path
FileSystemConnector to be able to execute
// reference to the FileSystemConnector to be able to execute
// mounts.
type
MultiZipFs
struct
{
Connector
*
fuse
.
Path
FileSystemConnector
Connector
*
fuse
.
FileSystemConnector
lock
sync
.
RWMutex
zips
map
[
string
]
*
ZipArchiveFileSystem
pendingZips
map
[
string
]
bool
zipFileNames
map
[
string
]
string
fuse
.
Default
Path
FileSystem
fuse
.
DefaultFileSystem
}
func
NewMultiZipFs
()
*
MultiZipFs
{
...
...
@@ -85,7 +85,7 @@ func NewMultiZipFs() *MultiZipFs {
m
.
zips
=
make
(
map
[
string
]
*
ZipArchiveFileSystem
)
m
.
pendingZips
=
make
(
map
[
string
]
bool
)
m
.
zipFileNames
=
make
(
map
[
string
]
string
)
m
.
Connector
=
fuse
.
New
Path
FileSystemConnector
(
m
)
m
.
Connector
=
fuse
.
NewFileSystemConnector
(
m
)
return
m
}
...
...
zipfs/zipfs.go
View file @
5c47ca23
...
...
@@ -75,7 +75,7 @@ type ZipArchiveFileSystem struct {
tree
*
ZipDirTree
ZipFileName
string
fuse
.
Default
Path
FileSystem
fuse
.
DefaultFileSystem
}
func
zipFilesToTree
(
files
[]
*
zip
.
File
)
*
ZipDirTree
{
...
...
zipfs/zipfs_test.go
View file @
5c47ca23
...
...
@@ -11,7 +11,7 @@ func TestZipFs(t *testing.T) {
CheckSuccess
(
err
)
zfs
:=
NewZipArchiveFileSystem
(
wd
+
"/test.zip"
)
connector
:=
fuse
.
New
Path
FileSystemConnector
(
zfs
)
connector
:=
fuse
.
NewFileSystemConnector
(
zfs
)
mountPoint
:=
fuse
.
MakeTempDir
()
state
:=
fuse
.
NewMountState
(
connector
)
...
...
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