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
e8c28231
Commit
e8c28231
authored
13 years ago
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uniformize writing of FileSystem (was: Filesystem as well).
parent
8caf9e25
No related merge requests found
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
264 additions
and
264 deletions
+264
-264
fuse/default.go
fuse/default.go
+24
-24
fuse/default_test.go
fuse/default_test.go
+7
-7
fuse/lockingfs.go
fuse/lockingfs.go
+65
-65
fuse/loopback.go
fuse/loopback.go
+1
-1
fuse/loopback_test.go
fuse/loopback_test.go
+5
-5
fuse/pathdebug.go
fuse/pathdebug.go
+4
-4
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+4
-4
fuse/timingfs.go
fuse/timingfs.go
+32
-32
fuse/timingrawfs.go
fuse/timingrawfs.go
+40
-40
fuse/types.go
fuse/types.go
+2
-2
fuse/wrappedfs.go
fuse/wrappedfs.go
+59
-59
fuse/xattr_test.go
fuse/xattr_test.go
+2
-2
unionfs/autounion.go
unionfs/autounion.go
+10
-10
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-2
unionfs/unionfs.go
unionfs/unionfs.go
+5
-5
zipfs/multizip.go
zipfs/multizip.go
+1
-1
zipfs/zipfs.go
zipfs/zipfs.go
+1
-1
No files found.
fuse/default.go
View file @
e8c28231
...
...
@@ -159,95 +159,95 @@ func (me *DefaultFuseFile) Fsync(*FsyncIn) (code Status) {
}
////////////////////////////////////////////////////////////////
// DefaultPathFile
s
ystem
// DefaultPathFile
S
ystem
func
(
me
*
DefaultPathFile
s
ystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
DefaultPathFile
S
ystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
DefaultPathFile
S
ystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
return
""
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
DefaultPathFile
S
ystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
DefaultPathFile
S
ystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Unlink
(
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Open
(
name
string
,
flags
uint32
)
(
file
FuseFile
,
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Open
(
name
string
,
flags
uint32
)
(
file
FuseFile
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Mount
(
conn
*
PathFileSystemConnector
)
Status
{
func
(
me
*
DefaultPathFile
S
ystem
)
Mount
(
conn
*
PathFileSystemConnector
)
Status
{
return
OK
}
func
(
me
*
DefaultPathFile
s
ystem
)
Unmount
()
{
func
(
me
*
DefaultPathFile
S
ystem
)
Unmount
()
{
}
func
(
me
*
DefaultPathFile
s
ystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
FuseFile
,
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
FuseFile
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultPathFile
s
ystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
DefaultPathFile
S
ystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
return
ENOSYS
}
This diff is collapsed.
Click to expand it.
fuse/default_test.go
View file @
e8c28231
package
fuse
// Make sure library supplied File
s
ystems support the
// Make sure library supplied File
S
ystems support the
// required interface.
import
(
...
...
@@ -11,17 +11,17 @@ func TestRawFs(t *testing.T) {
var
iface
RawFileSystem
iface
=
new
(
DefaultRawFuseFileSystem
)
iface
=
new
(
WrappingRawFile
s
ystem
)
iface
=
new
(
TimingRawFile
s
ystem
)
iface
=
new
(
WrappingRawFile
S
ystem
)
iface
=
new
(
TimingRawFile
S
ystem
)
_
=
iface
}
func
TestPathFs
(
t
*
testing
.
T
)
{
var
iface
PathFile
s
ystem
iface
=
new
(
DefaultPathFile
s
ystem
)
iface
=
new
(
WrappingPathFile
s
ystem
)
iface
=
new
(
TimingPathFile
s
ystem
)
var
iface
PathFile
S
ystem
iface
=
new
(
DefaultPathFile
S
ystem
)
iface
=
new
(
WrappingPathFile
S
ystem
)
iface
=
new
(
TimingPathFile
S
ystem
)
_
=
iface
}
...
...
This diff is collapsed.
Click to expand it.
fuse/lockingfs.go
View file @
e8c28231
This diff is collapsed.
Click to expand it.
fuse/loopback.go
View file @
e8c28231
...
...
@@ -18,7 +18,7 @@ var _ = log.Println
type
LoopbackFileSystem
struct
{
root
string
DefaultPathFile
s
ystem
DefaultPathFile
S
ystem
}
func
NewLoopbackFileSystem
(
root
string
)
(
out
*
LoopbackFileSystem
)
{
...
...
This diff is collapsed.
Click to expand it.
fuse/loopback_test.go
View file @
e8c28231
...
...
@@ -54,16 +54,16 @@ func (me *testCase) Setup(t *testing.T) {
me
.
origSubdir
=
filepath
.
Join
(
me
.
origDir
,
subdir
)
me
.
origSubfile
=
filepath
.
Join
(
me
.
origSubdir
,
"subfile"
)
var
pfs
PathFile
s
ystem
var
pfs
PathFile
S
ystem
pfs
=
NewLoopbackFileSystem
(
me
.
origDir
)
pfs
=
NewTimingPathFile
s
ystem
(
pfs
)
pfs
=
NewLockingPathFile
s
ystem
(
pfs
)
pfs
=
NewTimingPathFile
S
ystem
(
pfs
)
pfs
=
NewLockingPathFile
S
ystem
(
pfs
)
var
rfs
RawFileSystem
me
.
connector
=
NewPathFileSystemConnector
(
pfs
)
rfs
=
me
.
connector
rfs
=
NewTimingRawFile
s
ystem
(
rfs
)
rfs
=
NewLockingRawFile
s
ystem
(
rfs
)
rfs
=
NewTimingRawFile
S
ystem
(
rfs
)
rfs
=
NewLockingRawFile
S
ystem
(
rfs
)
me
.
connector
.
Debug
=
true
me
.
state
=
NewMountState
(
rfs
)
...
...
This diff is collapsed.
Click to expand it.
fuse/pathdebug.go
View file @
e8c28231
...
...
@@ -5,21 +5,21 @@ import (
var
_
=
fmt
.
Println
type
PathFile
s
ystemDebug
struct
{
type
PathFile
S
ystemDebug
struct
{
// TODO - use a generic callback system instead.
Connector
*
PathFileSystemConnector
WrappingPathFile
s
ystem
WrappingPathFile
S
ystem
}
func
(
me
*
PathFile
s
ystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
FuseFile
,
status
Status
)
{
func
(
me
*
PathFile
S
ystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
FuseFile
,
status
Status
)
{
if
path
==
".debug"
&&
me
.
Connector
!=
nil
{
return
NewReadOnlyFile
([]
byte
(
me
.
Connector
.
DebugString
())),
OK
}
return
me
.
Original
.
Open
(
path
,
flags
)
}
func
(
me
*
PathFile
s
ystemDebug
)
GetAttr
(
path
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
PathFile
S
ystemDebug
)
GetAttr
(
path
string
)
(
*
Attr
,
Status
)
{
if
path
==
".debug"
&&
me
.
Connector
!=
nil
{
return
&
Attr
{
Mode
:
S_IFREG
,
...
...
This diff is collapsed.
Click to expand it.
fuse/pathfilesystem.go
View file @
e8c28231
...
...
@@ -11,7 +11,7 @@ import (
type
mountData
struct
{
// If non-nil the file system mounted here.
fs
PathFile
s
ystem
fs
PathFile
S
ystem
// Protects the variables below.
mutex
sync
.
RWMutex
...
...
@@ -20,7 +20,7 @@ type mountData struct {
unmountPending
bool
}
func
newMount
(
fs
PathFile
s
ystem
)
*
mountData
{
func
newMount
(
fs
PathFile
S
ystem
)
*
mountData
{
return
&
mountData
{
fs
:
fs
}
}
...
...
@@ -378,7 +378,7 @@ func EmptyPathFileSystemConnector() (out *PathFileSystemConnector) {
return
out
;
}
func
NewPathFileSystemConnector
(
fs
PathFile
s
ystem
)
(
out
*
PathFileSystemConnector
)
{
func
NewPathFileSystemConnector
(
fs
PathFile
S
ystem
)
(
out
*
PathFileSystemConnector
)
{
out
=
EmptyPathFileSystemConnector
()
if
code
:=
out
.
Mount
(
"/"
,
fs
);
code
!=
OK
{
panic
(
"root mount failed."
)
...
...
@@ -392,7 +392,7 @@ func (me *PathFileSystemConnector) SetOptions(opts PathFileSystemConnectorOption
me
.
options
=
opts
}
func
(
me
*
PathFileSystemConnector
)
Mount
(
mountPoint
string
,
fs
PathFile
s
ystem
)
Status
{
func
(
me
*
PathFileSystemConnector
)
Mount
(
mountPoint
string
,
fs
PathFile
S
ystem
)
Status
{
var
node
*
inode
if
mountPoint
!=
"/"
{
...
...
This diff is collapsed.
Click to expand it.
fuse/timingfs.go
View file @
e8c28231
...
...
@@ -11,9 +11,9 @@ import (
var
_
=
log
.
Print
var
_
=
fmt
.
Print
// TimingPathFile
system is a wrapper to collect timings for a PathFiles
ystem
type
TimingPathFile
s
ystem
struct
{
WrappingPathFile
s
ystem
// TimingPathFile
System is a wrapper to collect timings for a PathFileS
ystem
type
TimingPathFile
S
ystem
struct
{
WrappingPathFile
S
ystem
statisticsLock
sync
.
Mutex
latencies
map
[
string
]
int64
...
...
@@ -21,8 +21,8 @@ type TimingPathFilesystem struct {
pathCounts
map
[
string
]
map
[
string
]
int64
}
func
NewTimingPathFile
system
(
fs
PathFilesystem
)
*
TimingPathFiles
ystem
{
t
:=
new
(
TimingPathFile
s
ystem
)
func
NewTimingPathFile
System
(
fs
PathFileSystem
)
*
TimingPathFileS
ystem
{
t
:=
new
(
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
startTimer
(
name
string
,
arg
string
)
(
closure
func
())
{
func
(
me
*
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
OperationCounts
()
map
[
string
]
int64
{
func
(
me
*
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
Latencies
()
map
[
string
]
float64
{
func
(
me
*
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
HotPaths
(
operation
string
)
(
paths
[]
string
,
uniquePaths
int
)
{
func
(
me
*
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
{
defer
me
.
startTimer
(
"GetAttr"
,
name
)()
return
me
.
Original
.
GetAttr
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
defer
me
.
startTimer
(
"GetXAttr"
,
name
)()
return
me
.
Original
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
TimingPathFile
s
ystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
func
(
me
*
TimingPathFile
S
ystem
)
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
*
TimingPathFile
s
ystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
defer
me
.
startTimer
(
"ListXAttr"
,
name
)()
return
me
.
Original
.
ListXAttr
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
func
(
me
*
TimingPathFile
S
ystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
defer
me
.
startTimer
(
"RemoveXAttr"
,
name
)()
return
me
.
Original
.
RemoveXAttr
(
name
,
attr
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
defer
me
.
startTimer
(
"Readlink"
,
name
)()
return
me
.
Original
.
Readlink
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
func
(
me
*
TimingPathFile
S
ystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
defer
me
.
startTimer
(
"Mknod"
,
name
)()
return
me
.
Original
.
Mknod
(
name
,
mode
,
dev
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
func
(
me
*
TimingPathFile
S
ystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
defer
me
.
startTimer
(
"Mkdir"
,
name
)()
return
me
.
Original
.
Mkdir
(
name
,
mode
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Unlink
(
name
string
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Unlink
(
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Unlink"
,
name
)()
return
me
.
Original
.
Unlink
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rmdir"
,
name
)()
return
me
.
Original
.
Rmdir
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Symlink"
,
linkName
)()
return
me
.
Original
.
Symlink
(
value
,
linkName
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rename"
,
oldName
)()
return
me
.
Original
.
Rename
(
oldName
,
newName
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Link"
,
newName
)()
return
me
.
Original
.
Link
(
oldName
,
newName
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Chmod"
,
name
)()
return
me
.
Original
.
Chmod
(
name
,
mode
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Chown"
,
name
)()
return
me
.
Original
.
Chown
(
name
,
uid
,
gid
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Truncate"
,
name
)()
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Open
(
name
string
,
flags
uint32
)
(
file
FuseFile
,
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Open
(
name
string
,
flags
uint32
)
(
file
FuseFile
,
code
Status
)
{
defer
me
.
startTimer
(
"Open"
,
name
)()
return
me
.
Original
.
Open
(
name
,
flags
)
}
func
(
me
*
TimingPathFile
s
ystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
defer
me
.
startTimer
(
"OpenDir"
,
name
)()
return
me
.
Original
.
OpenDir
(
name
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Mount
(
conn
*
PathFileSystemConnector
)
Status
{
func
(
me
*
TimingPathFile
S
ystem
)
Mount
(
conn
*
PathFileSystemConnector
)
Status
{
defer
me
.
startTimer
(
"Mount"
,
""
)()
return
me
.
Original
.
Mount
(
conn
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Unmount
()
{
func
(
me
*
TimingPathFile
S
ystem
)
Unmount
()
{
defer
me
.
startTimer
(
"Unmount"
,
""
)()
me
.
Original
.
Unmount
()
}
func
(
me
*
TimingPathFile
s
ystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Access"
,
name
)()
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
FuseFile
,
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
FuseFile
,
code
Status
)
{
defer
me
.
startTimer
(
"Create"
,
name
)()
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
func
(
me
*
TimingPathFile
s
ystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
func
(
me
*
TimingPathFile
S
ystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Utimens"
,
name
)()
return
me
.
Original
.
Utimens
(
name
,
AtimeNs
,
CtimeNs
)
}
This diff is collapsed.
Click to expand it.
fuse/timingrawfs.go
View file @
e8c28231
This diff is collapsed.
Click to expand it.
fuse/types.go
View file @
e8c28231
...
...
@@ -558,7 +558,7 @@ type RawFuseDir interface {
Release
()
}
type
PathFile
s
ystem
interface
{
type
PathFile
S
ystem
interface
{
GetAttr
(
name
string
)
(
*
Attr
,
Status
)
Readlink
(
name
string
)
(
string
,
Status
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
...
...
@@ -596,6 +596,6 @@ type PathFilesystem interface {
// Include this struct in your implementation to inherit default nop
// implementations.
type
DefaultPathFile
s
ystem
struct
{}
type
DefaultPathFile
S
ystem
struct
{}
type
DefaultFuseFile
struct
{}
type
DefaultRawFuseFileSystem
struct
{}
This diff is collapsed.
Click to expand it.
fuse/wrappedfs.go
View file @
e8c28231
This diff is collapsed.
Click to expand it.
fuse/xattr_test.go
View file @
e8c28231
...
...
@@ -15,7 +15,7 @@ type XAttrTestFs struct {
filename
string
attrs
map
[
string
][]
byte
DefaultPathFile
s
ystem
DefaultPathFile
S
ystem
}
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
:=
NewPathFileSystemConnector
(
NewLockingPathFile
s
ystem
(
xfs
))
connector
:=
NewPathFileSystemConnector
(
NewLockingPathFile
S
ystem
(
xfs
))
mountPoint
:=
MakeTempDir
()
state
:=
NewMountState
(
connector
)
...
...
This diff is collapsed.
Click to expand it.
unionfs/autounion.go
View file @
e8c28231
...
...
@@ -18,10 +18,10 @@ import (
//
// A union for A/B/C will placed under directory A-B-C.
type
AutoUnionFs
struct
{
fuse
.
DefaultPathFile
s
ystem
fuse
.
DefaultPathFile
S
ystem
lock
sync
.
RWMutex
knownFile
s
ystems
map
[
string
]
*
UnionFs
knownFile
S
ystems
map
[
string
]
*
UnionFs
root
string
connector
*
fuse
.
PathFileSystemConnector
...
...
@@ -35,7 +35,7 @@ type AutoUnionFsOptions struct {
func
NewAutoUnionFs
(
directory
string
,
options
AutoUnionFsOptions
)
*
AutoUnionFs
{
a
:=
new
(
AutoUnionFs
)
a
.
knownFile
s
ystems
=
make
(
map
[
string
]
*
UnionFs
)
a
.
knownFile
S
ystems
=
make
(
map
[
string
]
*
UnionFs
)
a
.
options
=
&
options
a
.
root
=
directory
return
a
...
...
@@ -58,10 +58,10 @@ func (me *AutoUnionFs) addFs(roots []string) {
me
.
lock
.
Lock
()
var
gofs
*
UnionFs
if
me
.
knownFile
s
ystems
[
name
]
==
nil
{
if
me
.
knownFile
S
ystems
[
name
]
==
nil
{
log
.
Println
(
"Adding UnionFs for roots"
,
roots
)
gofs
=
NewUnionFs
(
roots
,
me
.
options
.
UnionFsOptions
)
me
.
knownFile
s
ystems
[
name
]
=
gofs
me
.
knownFile
S
ystems
[
name
]
=
gofs
}
me
.
lock
.
Unlock
()
...
...
@@ -103,7 +103,7 @@ func (me *AutoUnionFs) Readlink(path string) (out string, code fuse.Status) {
name
:=
comps
[
1
]
me
.
lock
.
RLock
()
defer
me
.
lock
.
RUnlock
()
fs
:=
me
.
knownFile
s
ystems
[
name
]
fs
:=
me
.
knownFile
S
ystems
[
name
]
if
fs
==
nil
{
return
""
,
fuse
.
ENOENT
}
...
...
@@ -137,7 +137,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*fuse.Attr, fuse.Status) {
me
.
lock
.
RLock
()
defer
me
.
lock
.
RUnlock
()
if
len
(
comps
)
>
1
&&
comps
[
0
]
==
"config"
{
fs
:=
me
.
knownFile
s
ystems
[
comps
[
1
]]
fs
:=
me
.
knownFile
S
ystems
[
comps
[
1
]]
if
fs
==
nil
{
return
nil
,
fuse
.
ENOENT
...
...
@@ -149,7 +149,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*fuse.Attr, fuse.Status) {
return
a
,
fuse
.
OK
}
if
me
.
knownFile
s
ystems
[
path
]
!=
nil
{
if
me
.
knownFile
S
ystems
[
path
]
!=
nil
{
return
&
fuse
.
Attr
{
Mode
:
fuse
.
S_IFDIR
|
0755
,
},
fuse
.
OK
...
...
@@ -189,8 +189,8 @@ func (me *AutoUnionFs) OpenDir(name string) (stream chan fuse.DirEntry, status f
me
.
lock
.
RLock
()
defer
me
.
lock
.
RUnlock
()
stream
=
make
(
chan
fuse
.
DirEntry
,
len
(
me
.
knownFile
s
ystems
)
+
5
)
for
k
,
_
:=
range
me
.
knownFile
s
ystems
{
stream
=
make
(
chan
fuse
.
DirEntry
,
len
(
me
.
knownFile
S
ystems
)
+
5
)
for
k
,
_
:=
range
me
.
knownFile
S
ystems
{
mode
:=
fuse
.
S_IFDIR
|
0755
if
name
==
"config"
{
mode
=
syscall
.
S_IFLNK
|
0644
...
...
This diff is collapsed.
Click to expand it.
unionfs/cachingfs.go
View file @
e8c28231
...
...
@@ -22,7 +22,7 @@ type linkResponse struct {
// Caches readdir and getattr()
type
CachingFileSystem
struct
{
fuse
.
WrappingPathFile
s
ystem
fuse
.
WrappingPathFile
S
ystem
attributesLock
sync
.
RWMutex
attributes
map
[
string
]
attrResponse
...
...
@@ -34,7 +34,7 @@ type CachingFileSystem struct {
links
map
[
string
]
linkResponse
}
func
NewCachingFileSystem
(
pfs
fuse
.
PathFile
s
ystem
)
*
CachingFileSystem
{
func
NewCachingFileSystem
(
pfs
fuse
.
PathFile
S
ystem
)
*
CachingFileSystem
{
c
:=
new
(
CachingFileSystem
)
c
.
Original
=
pfs
c
.
attributes
=
make
(
map
[
string
]
attrResponse
)
...
...
This diff is collapsed.
Click to expand it.
unionfs/unionfs.go
View file @
e8c28231
...
...
@@ -58,12 +58,12 @@ func filePathHash(path string) string {
*/
type
UnionFs
struct
{
fuse
.
DefaultPathFile
s
ystem
fuse
.
DefaultPathFile
S
ystem
branches
[]
*
fuse
.
LoopbackFileSystem
// The same, but as interfaces.
fileSystems
[]
fuse
.
PathFile
s
ystem
fileSystems
[]
fuse
.
PathFile
S
ystem
// 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
.
PathFile
s
ystem
(
pt
))
g
.
fileSystems
=
append
(
g
.
fileSystems
,
fuse
.
PathFile
S
ystem
(
pt
))
}
deletionDir
:=
g
.
deletionDir
()
...
...
@@ -232,7 +232,7 @@ src *fuse.LoopbackFileSystem) os.Error {
}
////////////////////////////////////////////////////////////////
// Below: implement interface for a PathFile
s
ystem.
// Below: implement interface for a PathFile
S
ystem.
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
.
PathFile
s
ystem
)
{
go
func
(
j
int
,
pfs
fuse
.
PathFile
S
ystem
)
{
ch
,
s
:=
pfs
.
OpenDir
(
directory
)
statuses
[
j
]
=
s
for
s
==
fuse
.
OK
{
...
...
This diff is collapsed.
Click to expand it.
zipfs/multizip.go
View file @
e8c28231
...
...
@@ -77,7 +77,7 @@ type MultiZipFs struct {
pendingZips
map
[
string
]
bool
zipFileNames
map
[
string
]
string
fuse
.
DefaultPathFile
s
ystem
fuse
.
DefaultPathFile
S
ystem
}
func
NewMultiZipFs
()
*
MultiZipFs
{
...
...
This diff is collapsed.
Click to expand it.
zipfs/zipfs.go
View file @
e8c28231
...
...
@@ -75,7 +75,7 @@ type ZipFileFuse struct {
tree
*
ZipDirTree
ZipFileName
string
fuse
.
DefaultPathFile
s
ystem
fuse
.
DefaultPathFile
S
ystem
}
func
zipFilesToTree
(
files
[]
*
zip
.
File
)
*
ZipDirTree
{
...
...
This diff is collapsed.
Click to expand it.
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