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
137fa1b9
Commit
137fa1b9
authored
Jun 30, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse/nodefs: more doc cleanups.
parent
fcf1e909
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
fuse/nodefs/api.go
fuse/nodefs/api.go
+0
-3
fuse/nodefs/fsconnector.go
fuse/nodefs/fsconnector.go
+21
-17
No files found.
fuse/nodefs/api.go
View file @
137fa1b9
...
@@ -98,9 +98,6 @@ type Node interface {
...
@@ -98,9 +98,6 @@ type Node interface {
// A File object should be returned from FileSystem.Open and
// A File object should be returned from FileSystem.Open and
// FileSystem.Create. Include the NewDefaultFile return value into
// FileSystem.Create. Include the NewDefaultFile return value into
// the struct to inherit a default null implementation.
// the struct to inherit a default null implementation.
//
// TODO - should File be thread safe?
// TODO - should we pass a *fuse.Context argument?
type
File
interface
{
type
File
interface
{
// Called upon registering the filehandle in the inode.
// Called upon registering the filehandle in the inode.
SetInode
(
*
Inode
)
SetInode
(
*
Inode
)
...
...
fuse/nodefs/fsconnector.go
View file @
137fa1b9
...
@@ -19,9 +19,9 @@ import (
...
@@ -19,9 +19,9 @@ import (
// Tests should set to true.
// Tests should set to true.
var
paranoia
=
false
var
paranoia
=
false
// FilesystemConnector t
hat translates the raw FUSE protocol
// FilesystemConnector t
ranslates the raw FUSE protocol (serialized
//
(serialized structs of uint32/uint64) to operations on Go objects
//
structs of uint32/uint64) to operations on Go objects representing
//
representing
files and directories.
// files and directories.
type
FileSystemConnector
struct
{
type
FileSystemConnector
struct
{
// Used as the generation inodes. This must be 64-bit aligned,
// Used as the generation inodes. This must be 64-bit aligned,
// for sync/atomic on i386 to work properly.
// for sync/atomic on i386 to work properly.
...
@@ -52,6 +52,8 @@ func NewOptions() *Options {
...
@@ -52,6 +52,8 @@ func NewOptions() *Options {
}
}
}
}
// NewFileSystemConnector creates a FileSystemConnector with the given
// options.
func
NewFileSystemConnector
(
nodeFs
FileSystem
,
opts
*
Options
)
(
c
*
FileSystemConnector
)
{
func
NewFileSystemConnector
(
nodeFs
FileSystem
,
opts
*
Options
)
(
c
*
FileSystemConnector
)
{
c
=
new
(
FileSystemConnector
)
c
=
new
(
FileSystemConnector
)
if
opts
==
nil
{
if
opts
==
nil
{
...
@@ -220,6 +222,8 @@ func (c *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []st
...
@@ -220,6 +222,8 @@ func (c *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []st
return
node
,
nil
return
node
,
nil
}
}
// Follows the path from the given parent. The path should be '/'
// separated without leading slash.
func
(
c
*
FileSystemConnector
)
LookupNode
(
parent
*
Inode
,
path
string
)
*
Inode
{
func
(
c
*
FileSystemConnector
)
LookupNode
(
parent
*
Inode
,
path
string
)
*
Inode
{
// TODO - this is broken. The internalLookups will cause
// TODO - this is broken. The internalLookups will cause
// Nlookup increments that the kernel does not know about.
// Nlookup increments that the kernel does not know about.
...
@@ -251,14 +255,10 @@ func (c *FileSystemConnector) mountRoot(nodeFs FileSystem, opts *Options) {
...
@@ -251,14 +255,10 @@ func (c *FileSystemConnector) mountRoot(nodeFs FileSystem, opts *Options) {
// Mount() generates a synthetic directory node, and mounts the file
// Mount() generates a synthetic directory node, and mounts the file
// system there. If opts is nil, the mount options of the root file
// system there. If opts is nil, the mount options of the root file
// system are inherited. The encompassing filesystem should pretend
// system are inherited. The encompassing filesystem should pretend
// the mount point does not exist. If it does, it will generate an
// the mount point does not exist.
// Inode with the same, which will cause Mount() to return EBUSY.
//
//
// Return values:
// It returns ENOENT if the directory containing the mount point does
//
// not exist, and EBUSY if the intended mount point already exists.
// ENOENT: the directory containing the mount point does not exist.
//
// EBUSY: the intended mount point already exists.
func
(
c
*
FileSystemConnector
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
FileSystem
,
opts
*
Options
)
fuse
.
Status
{
func
(
c
*
FileSystemConnector
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
FileSystem
,
opts
*
Options
)
fuse
.
Status
{
defer
c
.
verify
()
defer
c
.
verify
()
parent
.
mount
.
treeLock
.
Lock
()
parent
.
mount
.
treeLock
.
Lock
()
...
@@ -286,13 +286,9 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs FileSyste
...
@@ -286,13 +286,9 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs FileSyste
return
fuse
.
OK
return
fuse
.
OK
}
}
// Unmount() tries to unmount the given inode.
// Unmount() tries to unmount the given inode. It returns EINVAL if the
//
// path does not exist, or is not a mount point, and EBUSY if there
// Returns the following error codes:
// are open files or submounts below this node.
//
// EINVAL: path does not exist, or is not a mount point.
//
// EBUSY: there are open files, or submounts below this node.
func
(
c
*
FileSystemConnector
)
Unmount
(
node
*
Inode
)
fuse
.
Status
{
func
(
c
*
FileSystemConnector
)
Unmount
(
node
*
Inode
)
fuse
.
Status
{
// TODO - racy.
// TODO - racy.
if
node
.
mountPoint
==
nil
{
if
node
.
mountPoint
==
nil
{
...
@@ -362,6 +358,9 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
...
@@ -362,6 +358,9 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
return
fuse
.
OK
return
fuse
.
OK
}
}
// FileNotify notifies the kernel that data and metadata of this inode
// has changed. After this call completes, the kernel will issue a
// new GetAttr requests for metadata and new Read calls for content.
func
(
c
*
FileSystemConnector
)
FileNotify
(
node
*
Inode
,
off
int64
,
length
int64
)
fuse
.
Status
{
func
(
c
*
FileSystemConnector
)
FileNotify
(
node
*
Inode
,
off
int64
,
length
int64
)
fuse
.
Status
{
var
nId
uint64
var
nId
uint64
if
node
==
c
.
rootNode
{
if
node
==
c
.
rootNode
{
...
@@ -376,6 +375,9 @@ func (c *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) f
...
@@ -376,6 +375,9 @@ func (c *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) f
return
c
.
server
.
InodeNotify
(
nId
,
off
,
length
)
return
c
.
server
.
InodeNotify
(
nId
,
off
,
length
)
}
}
// EntryNotify makes the kernel forget the entry data from the given
// name from a directory. After this call, the kernel will issue a
// new lookup request for the given name when necessary.
func
(
c
*
FileSystemConnector
)
EntryNotify
(
node
*
Inode
,
name
string
)
fuse
.
Status
{
func
(
c
*
FileSystemConnector
)
EntryNotify
(
node
*
Inode
,
name
string
)
fuse
.
Status
{
var
nId
uint64
var
nId
uint64
if
node
==
c
.
rootNode
{
if
node
==
c
.
rootNode
{
...
@@ -390,6 +392,8 @@ func (c *FileSystemConnector) EntryNotify(node *Inode, name string) fuse.Status
...
@@ -390,6 +392,8 @@ func (c *FileSystemConnector) EntryNotify(node *Inode, name string) fuse.Status
return
c
.
server
.
EntryNotify
(
nId
,
name
)
return
c
.
server
.
EntryNotify
(
nId
,
name
)
}
}
// DeleteNotify signals to the kernel that the named entry in dir for
// the child disappeared.
func
(
c
*
FileSystemConnector
)
DeleteNotify
(
dir
*
Inode
,
child
*
Inode
,
name
string
)
fuse
.
Status
{
func
(
c
*
FileSystemConnector
)
DeleteNotify
(
dir
*
Inode
,
child
*
Inode
,
name
string
)
fuse
.
Status
{
var
nId
uint64
var
nId
uint64
...
...
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