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
9c09165d
Commit
9c09165d
authored
Sep 05, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Mount/Unmount to OnMount/OnUnmount.
Add PathNodeFs.Mount/Unmount methods.
parent
f9ab0286
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
57 additions
and
50 deletions
+57
-50
fuse/api.go
fuse/api.go
+4
-4
fuse/default.go
fuse/default.go
+2
-2
fuse/defaultnode.go
fuse/defaultnode.go
+3
-2
fuse/fsconnector.go
fuse/fsconnector.go
+3
-3
fuse/lockingfs.go
fuse/lockingfs.go
+4
-4
fuse/loggingfs.go
fuse/loggingfs.go
+6
-6
fuse/pathfs.go
fuse/pathfs.go
+13
-3
fuse/readonlyfs.go
fuse/readonlyfs.go
+4
-4
fuse/switchfs.go
fuse/switchfs.go
+4
-4
fuse/timingfs.go
fuse/timingfs.go
+6
-6
unionfs/autounion.go
unionfs/autounion.go
+3
-5
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
zipfs/memtree.go
zipfs/memtree.go
+1
-1
zipfs/multizip.go
zipfs/multizip.go
+3
-5
No files found.
fuse/api.go
View file @
9c09165d
...
...
@@ -17,8 +17,8 @@ import (
// to represent fits in memory: you can construct FsNode at mount
// time, and the filesystem will be ready.
type
NodeFileSystem
interface
{
Unmount
()
Mount
(
conn
*
FileSystemConnector
)
On
Unmount
()
On
Mount
(
conn
*
FileSystemConnector
)
StatFs
()
*
StatfsOut
Root
()
FsNode
}
...
...
@@ -104,8 +104,8 @@ type FileSystem interface {
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
,
context
*
Context
)
Status
// Called after mount.
Mount
(
nodeFs
*
PathNodeFs
,
connector
*
FileSystemConnector
)
Unmount
()
OnMount
(
nodeFs
*
PathNodeFs
)
On
Unmount
()
// File handling. If opening for writing, the file's mtime
// should be updated too.
...
...
fuse/default.go
View file @
9c09165d
...
...
@@ -81,10 +81,10 @@ func (me *DefaultFileSystem) OpenDir(name string, context *Context) (stream chan
return
nil
,
ENOSYS
}
func
(
me
*
DefaultFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
func
(
me
*
DefaultFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
}
func
(
me
*
DefaultFileSystem
)
Unmount
()
{
func
(
me
*
DefaultFileSystem
)
On
Unmount
()
{
}
func
(
me
*
DefaultFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
fuse/defaultnode.go
View file @
9c09165d
...
...
@@ -8,10 +8,11 @@ type DefaultNodeFileSystem struct {
root
DefaultFsNode
}
func
(
me
*
DefaultNodeFileSystem
)
Unmount
()
{
func
(
me
*
DefaultNodeFileSystem
)
On
Unmount
()
{
}
func
(
me
*
DefaultNodeFileSystem
)
Mount
(
conn
*
FileSystemConnector
)
{
func
(
me
*
DefaultNodeFileSystem
)
OnMount
(
conn
*
FileSystemConnector
)
{
}
func
(
me
*
DefaultNodeFileSystem
)
StatFs
()
*
StatfsOut
{
...
...
fuse/fsconnector.go
View file @
9c09165d
...
...
@@ -225,7 +225,7 @@ func (me *FileSystemConnector) findInode(fullPath string) *Inode {
func
(
me
*
FileSystemConnector
)
MountRoot
(
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
{
me
.
rootNode
.
mountFs
(
nodeFs
,
opts
)
nodeFs
.
Mount
(
me
)
nodeFs
.
On
Mount
(
me
)
me
.
verify
()
}
...
...
@@ -270,8 +270,8 @@ func (me *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFile
log
.
Println
(
"Mount: "
,
nodeFs
,
"on subdir"
,
name
,
"parent"
,
parent
.
nodeId
)
}
nodeFs
.
Mount
(
me
)
me
.
verify
()
nodeFs
.
OnMount
(
me
)
return
OK
}
...
...
@@ -309,7 +309,7 @@ func (me *FileSystemConnector) Unmount(node *Inode) Status {
parentNode
.
mounts
[
name
]
=
nil
,
false
parentNode
.
children
[
name
]
=
nil
,
false
mount
.
fs
.
Unmount
()
mount
.
fs
.
On
Unmount
()
me
.
fsInit
.
EntryNotify
(
parentNode
.
nodeId
,
name
)
...
...
fuse/lockingfs.go
View file @
9c09165d
...
...
@@ -95,14 +95,14 @@ func (me *LockingFileSystem) OpenDir(name string, context *Context) (stream chan
return
me
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
LockingFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
func
(
me
*
LockingFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
defer
me
.
locked
()()
me
.
FileSystem
.
Mount
(
nodeFs
,
conn
)
me
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
me
*
LockingFileSystem
)
Unmount
()
{
func
(
me
*
LockingFileSystem
)
On
Unmount
()
{
defer
me
.
locked
()()
me
.
FileSystem
.
Unmount
()
me
.
FileSystem
.
On
Unmount
()
}
func
(
me
*
LockingFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
fuse/loggingfs.go
View file @
9c09165d
...
...
@@ -114,14 +114,14 @@ func (me *LoggingFileSystem) OpenDir(name string, context *Context) (stream chan
return
me
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
LoggingFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
me
.
Print
(
"Mount"
,
""
)
me
.
FileSystem
.
Mount
(
nodeFs
,
conn
)
func
(
me
*
LoggingFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
me
.
Print
(
"
On
Mount"
,
""
)
me
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
me
*
LoggingFileSystem
)
Unmount
()
{
me
.
Print
(
"Unmount"
,
""
)
me
.
FileSystem
.
Unmount
()
func
(
me
*
LoggingFileSystem
)
On
Unmount
()
{
me
.
Print
(
"
On
Unmount"
,
""
)
me
.
FileSystem
.
On
Unmount
()
}
func
(
me
*
LoggingFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
fuse/pathfs.go
View file @
9c09165d
...
...
@@ -12,13 +12,23 @@ var _ = log.Println
type
PathNodeFs
struct
{
fs
FileSystem
root
*
pathInode
connector
*
FileSystemConnector
}
func
(
me
*
PathNodeFs
)
Unmount
()
{
func
(
me
*
PathNodeFs
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
Status
{
return
me
.
connector
.
Mount
(
parent
,
name
,
nodeFs
,
opts
)
}
func
(
me
*
PathNodeFs
)
Mount
(
conn
*
FileSystemConnector
)
{
me
.
fs
.
Mount
(
me
,
conn
)
func
(
me
*
PathNodeFs
)
Unmount
(
node
*
Inode
)
Status
{
return
me
.
connector
.
Unmount
(
node
)
}
func
(
me
*
PathNodeFs
)
OnUnmount
()
{
}
func
(
me
*
PathNodeFs
)
OnMount
(
conn
*
FileSystemConnector
)
{
me
.
connector
=
conn
me
.
fs
.
OnMount
(
me
)
}
func
(
me
*
PathNodeFs
)
StatFs
()
*
StatfsOut
{
...
...
fuse/readonlyfs.go
View file @
9c09165d
...
...
@@ -69,12 +69,12 @@ func (me *ReadonlyFileSystem) OpenDir(name string, context *Context) (stream cha
return
me
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
ReadonlyFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
me
.
FileSystem
.
Mount
(
nodeFs
,
conn
)
func
(
me
*
ReadonlyFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
me
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
me
*
ReadonlyFileSystem
)
Unmount
()
{
me
.
FileSystem
.
Unmount
()
func
(
me
*
ReadonlyFileSystem
)
On
Unmount
()
{
me
.
FileSystem
.
On
Unmount
()
}
func
(
me
*
ReadonlyFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
fuse/switchfs.go
View file @
9c09165d
...
...
@@ -196,15 +196,15 @@ func (me *SwitchFileSystem) OpenDir(name string, context *Context) (stream chan
return
fs
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
SwitchFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
func
(
me
*
SwitchFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
for
_
,
fs
:=
range
me
.
fileSystems
{
fs
.
FileSystem
.
Mount
(
nodeFs
,
conn
)
fs
.
FileSystem
.
OnMount
(
nodeFs
)
}
}
func
(
me
*
SwitchFileSystem
)
Unmount
()
{
func
(
me
*
SwitchFileSystem
)
On
Unmount
()
{
for
_
,
fs
:=
range
me
.
fileSystems
{
fs
.
FileSystem
.
Unmount
()
fs
.
FileSystem
.
On
Unmount
()
}
}
...
...
fuse/timingfs.go
View file @
9c09165d
...
...
@@ -135,14 +135,14 @@ func (me *TimingFileSystem) OpenDir(name string, context *Context) (stream chan
return
me
.
FileSystem
.
OpenDir
(
name
,
context
)
}
func
(
me
*
TimingFileSystem
)
Mount
(
nodeFs
*
PathNodeFs
,
conn
*
FileSystemConnector
)
{
defer
me
.
startTimer
(
"Mount"
,
""
)()
me
.
FileSystem
.
Mount
(
nodeFs
,
conn
)
func
(
me
*
TimingFileSystem
)
OnMount
(
nodeFs
*
PathNodeFs
)
{
defer
me
.
startTimer
(
"
On
Mount"
,
""
)()
me
.
FileSystem
.
OnMount
(
nodeFs
)
}
func
(
me
*
TimingFileSystem
)
Unmount
()
{
defer
me
.
startTimer
(
"Unmount"
,
""
)()
me
.
FileSystem
.
Unmount
()
func
(
me
*
TimingFileSystem
)
On
Unmount
()
{
defer
me
.
startTimer
(
"
On
Unmount"
,
""
)()
me
.
FileSystem
.
On
Unmount
()
}
func
(
me
*
TimingFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
unionfs/autounion.go
View file @
9c09165d
...
...
@@ -31,7 +31,6 @@ type AutoUnionFs struct {
nameRootMap
map
[
string
]
string
root
string
connector
*
fuse
.
FileSystemConnector
nodeFs
*
fuse
.
PathNodeFs
options
*
AutoUnionFsOptions
}
...
...
@@ -70,9 +69,8 @@ func (me *AutoUnionFs) Name() string {
return
fmt
.
Sprintf
(
"AutoUnionFs(%s)"
,
me
.
root
)
}
func
(
me
*
AutoUnionFs
)
Mount
(
nodeFs
*
fuse
.
PathNodeFs
,
connector
*
fuse
.
FileSystemConnector
)
{
func
(
me
*
AutoUnionFs
)
OnMount
(
nodeFs
*
fuse
.
PathNodeFs
)
{
me
.
nodeFs
=
nodeFs
me
.
connector
=
connector
if
me
.
options
.
UpdateOnMount
{
time
.
AfterFunc
(
0.1e9
,
func
()
{
me
.
updateKnownFses
()
})
}
...
...
@@ -113,7 +111,7 @@ func (me *AutoUnionFs) createFs(name string, roots []string) fuse.Status {
log
.
Printf
(
"Adding workspace %v for roots %v"
,
name
,
ufs
.
Name
())
nfs
:=
fuse
.
NewPathNodeFs
(
ufs
)
code
:=
me
.
connector
.
Mount
(
me
.
nodeFs
.
Root
()
.
Inode
(),
name
,
nfs
,
&
me
.
options
.
FileSystemOptions
)
code
:=
me
.
nodeFs
.
Mount
(
me
.
nodeFs
.
Root
()
.
Inode
(),
name
,
nfs
,
&
me
.
options
.
FileSystemOptions
)
if
code
.
Ok
()
{
me
.
knownFileSystems
[
name
]
=
knownFs
{
ufs
,
...
...
@@ -133,7 +131,7 @@ func (me *AutoUnionFs) rmFs(name string) (code fuse.Status) {
return
fuse
.
ENOENT
}
code
=
me
.
connector
.
Unmount
(
known
.
PathNodeFs
.
Root
()
.
Inode
())
code
=
me
.
nodeFs
.
Unmount
(
known
.
PathNodeFs
.
Root
()
.
Inode
())
if
code
.
Ok
()
{
me
.
knownFileSystems
[
name
]
=
knownFs
{},
false
me
.
nameRootMap
[
name
]
=
""
,
false
...
...
unionfs/unionfs.go
View file @
9c09165d
...
...
@@ -103,7 +103,7 @@ func NewUnionFs(fileSystems []fuse.FileSystem, options UnionFsOptions) *UnionFs
return
g
}
func
(
me
*
UnionFs
)
Mount
(
nodeFs
*
fuse
.
PathNodeFs
,
connector
*
fuse
.
FileSystemConnector
)
{
func
(
me
*
UnionFs
)
OnMount
(
nodeFs
*
fuse
.
PathNodeFs
)
{
me
.
nodeFs
=
nodeFs
}
...
...
zipfs/memtree.go
View file @
9c09165d
...
...
@@ -31,7 +31,7 @@ func NewMemTreeFs() *MemTreeFs {
return
d
}
func
(
me
*
MemTreeFs
)
Mount
(
conn
*
fuse
.
FileSystemConnector
)
{
func
(
me
*
MemTreeFs
)
On
Mount
(
conn
*
fuse
.
FileSystemConnector
)
{
for
k
,
v
:=
range
me
.
files
{
me
.
addFile
(
k
,
v
)
}
...
...
zipfs/multizip.go
View file @
9c09165d
...
...
@@ -30,7 +30,6 @@ const (
// reference to the FileSystemConnector to be able to execute
// mounts.
type
MultiZipFs
struct
{
Connector
*
fuse
.
FileSystemConnector
lock
sync
.
RWMutex
zips
map
[
string
]
*
MemTreeFs
dirZipFileMap
map
[
string
]
string
...
...
@@ -50,9 +49,8 @@ func (me *MultiZipFs) Name() string {
return
"MultiZipFs"
}
func
(
me
*
MultiZipFs
)
Mount
(
nodeFs
*
fuse
.
PathNodeFs
,
connector
*
fuse
.
FileSystemConnector
)
{
func
(
me
*
MultiZipFs
)
OnMount
(
nodeFs
*
fuse
.
PathNodeFs
)
{
me
.
nodeFs
=
nodeFs
me
.
Connector
=
connector
}
func
(
me
*
MultiZipFs
)
OpenDir
(
name
string
,
context
*
fuse
.
Context
)
(
stream
chan
fuse
.
DirEntry
,
code
fuse
.
Status
)
{
...
...
@@ -123,7 +121,7 @@ func (me *MultiZipFs) Unlink(name string, context *fuse.Context) (code fuse.Stat
zfs
,
ok
:=
me
.
zips
[
basename
]
if
ok
{
code
=
me
.
Connector
.
Unmount
(
zfs
.
Root
()
.
Inode
())
code
=
me
.
nodeFs
.
Unmount
(
zfs
.
Root
()
.
Inode
())
if
!
code
.
Ok
()
{
return
code
}
...
...
@@ -173,7 +171,7 @@ func (me *MultiZipFs) Symlink(value string, linkName string, context *fuse.Conte
return
fuse
.
EINVAL
}
code
=
me
.
Connector
.
Mount
(
me
.
nodeFs
.
Root
()
.
Inode
(),
base
,
fs
,
nil
)
code
=
me
.
nodeFs
.
Mount
(
me
.
nodeFs
.
Root
()
.
Inode
(),
base
,
fs
,
nil
)
if
!
code
.
Ok
()
{
return
code
}
...
...
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