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
Kirill Smelkov
go-fuse
Commits
fab46421
Commit
fab46421
authored
Jul 03, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: expose Connector in pathfs.FileSystem, expose Server in nodefs.FileSystemConnector.
parent
137fa1b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
32 deletions
+20
-32
example/autounionfs/main.go
example/autounionfs/main.go
+0
-3
fuse/nodefs/fsconnector.go
fuse/nodefs/fsconnector.go
+5
-0
fuse/pathfs/pathfs.go
fuse/pathfs/pathfs.go
+4
-0
unionfs/autounion.go
unionfs/autounion.go
+11
-29
No files found.
example/autounionfs/main.go
View file @
fab46421
...
@@ -72,9 +72,6 @@ func main() {
...
@@ -72,9 +72,6 @@ func main() {
conn
.
SetDebug
(
*
debug
)
conn
.
SetDebug
(
*
debug
)
state
.
SetDebug
(
*
debug
)
state
.
SetDebug
(
*
debug
)
gofs
.
SetMountState
(
state
)
gofs
.
SetFileSystemConnector
(
conn
)
state
.
Serve
()
state
.
Serve
()
time
.
Sleep
(
1
*
time
.
Second
)
time
.
Sleep
(
1
*
time
.
Second
)
}
}
fuse/nodefs/fsconnector.go
View file @
fab46421
...
@@ -76,6 +76,11 @@ func NewFileSystemConnector(nodeFs FileSystem, opts *Options) (c *FileSystemConn
...
@@ -76,6 +76,11 @@ func NewFileSystemConnector(nodeFs FileSystem, opts *Options) (c *FileSystemConn
return
c
return
c
}
}
// Server returns the fuse.Server that talking to the kernel.
func
(
c
*
FileSystemConnector
)
Server
()
*
fuse
.
Server
{
return
c
.
server
}
// SetDebug toggles printing of debug information.
// SetDebug toggles printing of debug information.
func
(
c
*
FileSystemConnector
)
SetDebug
(
debug
bool
)
{
func
(
c
*
FileSystemConnector
)
SetDebug
(
debug
bool
)
{
c
.
debug
=
debug
c
.
debug
=
debug
...
...
fuse/pathfs/pathfs.go
View file @
fab46421
...
@@ -105,6 +105,10 @@ func (fs *PathNodeFs) String() string {
...
@@ -105,6 +105,10 @@ func (fs *PathNodeFs) String() string {
return
name
return
name
}
}
func
(
fs
*
PathNodeFs
)
Connector
()
*
nodefs
.
FileSystemConnector
{
return
fs
.
connector
}
func
(
fs
*
PathNodeFs
)
OnMount
(
conn
*
nodefs
.
FileSystemConnector
)
{
func
(
fs
*
PathNodeFs
)
OnMount
(
conn
*
nodefs
.
FileSystemConnector
)
{
fs
.
connector
=
conn
fs
.
connector
=
conn
fs
.
fs
.
OnMount
(
fs
)
fs
.
fs
.
OnMount
(
fs
)
...
...
unionfs/autounion.go
View file @
fab46421
...
@@ -37,9 +37,6 @@ type autoUnionFs struct {
...
@@ -37,9 +37,6 @@ type autoUnionFs struct {
nodeFs
*
pathfs
.
PathNodeFs
nodeFs
*
pathfs
.
PathNodeFs
options
*
AutoUnionFsOptions
options
*
AutoUnionFsOptions
mountState
*
fuse
.
Server
connector
*
nodefs
.
FileSystemConnector
}
}
type
AutoUnionFsOptions
struct
{
type
AutoUnionFsOptions
struct
{
...
@@ -66,15 +63,7 @@ const (
...
@@ -66,15 +63,7 @@ const (
_SCAN_CONFIG
=
".scan_config"
_SCAN_CONFIG
=
".scan_config"
)
)
// A pathfs.FileSystem that we can hookup with MountState and
func
NewAutoUnionFs
(
directory
string
,
options
AutoUnionFsOptions
)
pathfs
.
FileSystem
{
// FileSystemConnector
type
RootFileSystem
interface
{
SetMountState
(
state
*
fuse
.
Server
)
SetFileSystemConnector
(
conn
*
nodefs
.
FileSystemConnector
)
pathfs
.
FileSystem
}
func
NewAutoUnionFs
(
directory
string
,
options
AutoUnionFsOptions
)
RootFileSystem
{
if
options
.
HideReadonly
{
if
options
.
HideReadonly
{
options
.
HiddenFiles
=
append
(
options
.
HiddenFiles
,
_READONLY
)
options
.
HiddenFiles
=
append
(
options
.
HiddenFiles
,
_READONLY
)
}
}
...
@@ -285,8 +274,10 @@ func (fs *autoUnionFs) SetDebug(b bool) {
...
@@ -285,8 +274,10 @@ func (fs *autoUnionFs) SetDebug(b bool) {
// about race conditions here.
// about race conditions here.
fs
.
debug
=
b
fs
.
debug
=
b
fs
.
nodeFs
.
SetDebug
(
b
)
fs
.
nodeFs
.
SetDebug
(
b
)
fs
.
connector
.
SetDebug
(
b
)
fs
.
mountState
.
SetDebug
(
b
)
conn
:=
fs
.
nodeFs
.
Connector
()
conn
.
SetDebug
(
b
)
conn
.
Server
()
.
SetDebug
(
b
)
}
}
func
(
fs
*
autoUnionFs
)
hasDebug
()
bool
{
func
(
fs
*
autoUnionFs
)
hasDebug
()
bool
{
...
@@ -391,31 +382,22 @@ func (fs *autoUnionFs) StatusDir() (stream []fuse.DirEntry, status fuse.Status)
...
@@ -391,31 +382,22 @@ func (fs *autoUnionFs) StatusDir() (stream []fuse.DirEntry, status fuse.Status)
return
stream
,
fuse
.
OK
return
stream
,
fuse
.
OK
}
}
// SetMountState stores the MountState, which is necessary for
// retrieving debug data.
func
(
fs
*
autoUnionFs
)
SetMountState
(
state
*
fuse
.
Server
)
{
fs
.
mountState
=
state
}
func
(
fs
*
autoUnionFs
)
SetFileSystemConnector
(
conn
*
nodefs
.
FileSystemConnector
)
{
fs
.
connector
=
conn
}
func
(
fs
*
autoUnionFs
)
DebugData
()
string
{
func
(
fs
*
autoUnionFs
)
DebugData
()
string
{
if
fs
.
mountState
==
nil
{
conn
:=
fs
.
nodeFs
.
Connector
()
if
conn
.
Server
()
==
nil
{
return
"autoUnionFs.mountState not set"
return
"autoUnionFs.mountState not set"
}
}
setting
:=
fs
.
mountState
.
KernelSettings
()
setting
:=
conn
.
Server
()
.
KernelSettings
()
msg
:=
fmt
.
Sprintf
(
msg
:=
fmt
.
Sprintf
(
"Version: %v
\n
"
+
"Version: %v
\n
"
+
"Bufferpool: %v
\n
"
+
"Bufferpool: %v
\n
"
+
"Kernel: %v
\n
"
,
"Kernel: %v
\n
"
,
fuse
.
Version
(),
fuse
.
Version
(),
fs
.
mountState
.
DebugData
(),
conn
.
Server
()
.
DebugData
(),
&
setting
)
&
setting
)
if
fs
.
connector
!=
nil
{
if
conn
!=
nil
{
msg
+=
fmt
.
Sprintf
(
"Live inodes: %d
\n
"
,
fs
.
connector
.
InodeHandleCount
())
msg
+=
fmt
.
Sprintf
(
"Live inodes: %d
\n
"
,
conn
.
InodeHandleCount
())
}
}
return
msg
return
msg
...
...
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