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() {
conn
.
SetDebug
(
*
debug
)
state
.
SetDebug
(
*
debug
)
gofs
.
SetMountState
(
state
)
gofs
.
SetFileSystemConnector
(
conn
)
state
.
Serve
()
time
.
Sleep
(
1
*
time
.
Second
)
}
fuse/nodefs/fsconnector.go
View file @
fab46421
...
...
@@ -76,6 +76,11 @@ func NewFileSystemConnector(nodeFs FileSystem, opts *Options) (c *FileSystemConn
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.
func
(
c
*
FileSystemConnector
)
SetDebug
(
debug
bool
)
{
c
.
debug
=
debug
...
...
fuse/pathfs/pathfs.go
View file @
fab46421
...
...
@@ -105,6 +105,10 @@ func (fs *PathNodeFs) String() string {
return
name
}
func
(
fs
*
PathNodeFs
)
Connector
()
*
nodefs
.
FileSystemConnector
{
return
fs
.
connector
}
func
(
fs
*
PathNodeFs
)
OnMount
(
conn
*
nodefs
.
FileSystemConnector
)
{
fs
.
connector
=
conn
fs
.
fs
.
OnMount
(
fs
)
...
...
unionfs/autounion.go
View file @
fab46421
...
...
@@ -37,9 +37,6 @@ type autoUnionFs struct {
nodeFs
*
pathfs
.
PathNodeFs
options
*
AutoUnionFsOptions
mountState
*
fuse
.
Server
connector
*
nodefs
.
FileSystemConnector
}
type
AutoUnionFsOptions
struct
{
...
...
@@ -66,15 +63,7 @@ const (
_SCAN_CONFIG
=
".scan_config"
)
// A pathfs.FileSystem that we can hookup with MountState and
// FileSystemConnector
type
RootFileSystem
interface
{
SetMountState
(
state
*
fuse
.
Server
)
SetFileSystemConnector
(
conn
*
nodefs
.
FileSystemConnector
)
pathfs
.
FileSystem
}
func
NewAutoUnionFs
(
directory
string
,
options
AutoUnionFsOptions
)
RootFileSystem
{
func
NewAutoUnionFs
(
directory
string
,
options
AutoUnionFsOptions
)
pathfs
.
FileSystem
{
if
options
.
HideReadonly
{
options
.
HiddenFiles
=
append
(
options
.
HiddenFiles
,
_READONLY
)
}
...
...
@@ -285,8 +274,10 @@ func (fs *autoUnionFs) SetDebug(b bool) {
// about race conditions here.
fs
.
debug
=
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
{
...
...
@@ -391,31 +382,22 @@ func (fs *autoUnionFs) StatusDir() (stream []fuse.DirEntry, status fuse.Status)
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
{
if
fs
.
mountState
==
nil
{
conn
:=
fs
.
nodeFs
.
Connector
()
if
conn
.
Server
()
==
nil
{
return
"autoUnionFs.mountState not set"
}
setting
:=
fs
.
mountState
.
KernelSettings
()
setting
:=
conn
.
Server
()
.
KernelSettings
()
msg
:=
fmt
.
Sprintf
(
"Version: %v
\n
"
+
"Bufferpool: %v
\n
"
+
"Kernel: %v
\n
"
,
fuse
.
Version
(),
fs
.
mountState
.
DebugData
(),
conn
.
Server
()
.
DebugData
(),
&
setting
)
if
fs
.
connector
!=
nil
{
msg
+=
fmt
.
Sprintf
(
"Live inodes: %d
\n
"
,
fs
.
connector
.
InodeHandleCount
())
if
conn
!=
nil
{
msg
+=
fmt
.
Sprintf
(
"Live inodes: %d
\n
"
,
conn
.
InodeHandleCount
())
}
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