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
11af8051
Commit
11af8051
authored
Jun 24, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse/nodefs: hide MemNodeFs type, document NewMemNodeFs().
parent
480c7997
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
+19
-20
fuse/nodefs/memnode.go
fuse/nodefs/memnode.go
+18
-19
fuse/nodefs/memnode_test.go
fuse/nodefs/memnode_test.go
+1
-1
No files found.
fuse/nodefs/memnode.go
View file @
11af8051
...
...
@@ -2,7 +2,6 @@ package nodefs
import
(
"fmt"
"log"
"os"
"sync"
"syscall"
...
...
@@ -11,9 +10,17 @@ import (
"github.com/hanwen/go-fuse/fuse"
)
var
_
=
log
.
Println
// NewMemNodeFs creates an in-memory node-based filesystem. Files are
// written into a backing store under the given prefix.
func
NewMemNodeFs
(
prefix
string
)
FileSystem
{
fs
:=
&
memNodeFs
{
backingStorePrefix
:
prefix
,
}
fs
.
root
=
fs
.
newNode
()
return
fs
}
type
M
emNodeFs
struct
{
type
m
emNodeFs
struct
{
backingStorePrefix
string
root
*
memNode
...
...
@@ -21,24 +28,24 @@ type MemNodeFs struct {
nextFree
int
}
func
(
fs
*
M
emNodeFs
)
String
()
string
{
func
(
fs
*
m
emNodeFs
)
String
()
string
{
return
fmt
.
Sprintf
(
"MemNodeFs(%s)"
,
fs
.
backingStorePrefix
)
}
func
(
fs
*
M
emNodeFs
)
Root
()
Node
{
func
(
fs
*
m
emNodeFs
)
Root
()
Node
{
return
fs
.
root
}
func
(
fs
*
M
emNodeFs
)
SetDebug
(
bool
)
{
func
(
fs
*
m
emNodeFs
)
SetDebug
(
bool
)
{
}
func
(
fs
*
M
emNodeFs
)
OnMount
(
*
FileSystemConnector
)
{
func
(
fs
*
m
emNodeFs
)
OnMount
(
*
FileSystemConnector
)
{
}
func
(
fs
*
M
emNodeFs
)
OnUnmount
()
{
func
(
fs
*
m
emNodeFs
)
OnUnmount
()
{
}
func
(
fs
*
M
emNodeFs
)
newNode
()
*
memNode
{
func
(
fs
*
m
emNodeFs
)
newNode
()
*
memNode
{
fs
.
mutex
.
Lock
()
n
:=
&
memNode
{
Node
:
NewDefaultNode
(),
...
...
@@ -53,22 +60,14 @@ func (fs *MemNodeFs) newNode() *memNode {
return
n
}
func
NewMemNodeFs
(
prefix
string
)
*
MemNodeFs
{
me
:=
&
MemNodeFs
{
backingStorePrefix
:
prefix
,
}
me
.
root
=
me
.
newNode
()
return
me
}
func
(
fs
*
MemNodeFs
)
Filename
(
n
*
Inode
)
string
{
func
(
fs
*
memNodeFs
)
Filename
(
n
*
Inode
)
string
{
mn
:=
n
.
Node
()
.
(
*
memNode
)
return
mn
.
filename
()
}
type
memNode
struct
{
Node
fs
*
M
emNodeFs
fs
*
m
emNodeFs
id
int
link
string
...
...
fuse/nodefs/memnode_test.go
View file @
11af8051
...
...
@@ -14,7 +14,7 @@ var _ = log.Println
const
testTtl
=
100
*
time
.
Millisecond
func
setupMemNodeTest
(
t
*
testing
.
T
)
(
wd
string
,
fs
*
MemNodeFs
,
clean
func
())
{
func
setupMemNodeTest
(
t
*
testing
.
T
)
(
wd
string
,
fs
FileSystem
,
clean
func
())
{
tmp
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse-memnode_test"
)
if
err
!=
nil
{
t
.
Fatalf
(
"TempDir failed: %v"
,
err
)
...
...
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