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
ab5078a6
Commit
ab5078a6
authored
Sep 25, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce Deletable() in node API, rather than hardcoded synthetic variable.
parent
5af9ce62
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
15 deletions
+20
-15
fuse/api.go
fuse/api.go
+7
-1
fuse/defaultnode.go
fuse/defaultnode.go
+4
-0
fuse/fsconnector.go
fuse/fsconnector.go
+1
-1
fuse/inode.go
fuse/inode.go
+2
-11
fuse/memnode.go
fuse/memnode.go
+1
-1
zipfs/memtree.go
zipfs/memtree.go
+5
-1
No files found.
fuse/api.go
View file @
ab5078a6
...
...
@@ -29,8 +29,14 @@ type FsNode interface {
SetInode
(
node
*
Inode
)
Lookup
(
name
string
,
context
*
Context
)
(
fi
*
os
.
FileInfo
,
node
FsNode
,
code
Status
)
OnForget
()
// Deletable() should return true if this inode may be
// discarded from the children list. This will be called from
// within the treeLock critical section, so you cannot look at
// other inodes.
Deletable
()
bool
OnForget
()
// Misc.
Access
(
mode
uint32
,
context
*
Context
)
(
code
Status
)
Readlink
(
c
*
Context
)
([]
byte
,
Status
)
...
...
fuse/defaultnode.go
View file @
ab5078a6
...
...
@@ -39,6 +39,10 @@ func (me *DefaultFsNode) SetInode(node *Inode) {
me
.
inode
=
node
}
func
(
me
*
DefaultFsNode
)
Deletable
()
bool
{
return
true
}
func
(
me
*
DefaultFsNode
)
Inode
()
*
Inode
{
return
me
.
inode
}
...
...
fuse/fsconnector.go
View file @
ab5078a6
...
...
@@ -161,7 +161,7 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool)
ch
.
fsInode
.
OnForget
()
}
if
len
(
n
.
children
)
>
0
||
n
.
lookupCount
>
0
||
n
.
synthetic
{
if
len
(
n
.
children
)
>
0
||
n
.
lookupCount
>
0
||
!
n
.
FsNode
()
.
Deletable
()
{
return
false
}
if
n
==
me
.
rootNode
||
n
.
mountPoint
!=
nil
{
...
...
fuse/inode.go
View file @
ab5078a6
...
...
@@ -52,12 +52,10 @@ type Inode struct {
//
// The lookupCount is exclusively used for managing the
// lifetime of nodeId variable. It is ok for a node to have 0
// == lookupCount. This can happen if the inode is synthetic.
// == lookupCount. This can happen if the inode return false
// for Deletable().
lookupCount
int
// This is to prevent lookupCount==0 node from being dropped.
synthetic
bool
// Non-nil if this inode is a mountpoint, ie. the Root of a
// NodeFileSystem.
mountPoint
*
fileSystemMount
...
...
@@ -135,13 +133,6 @@ func (me *Inode) IsDir() bool {
return
me
.
children
!=
nil
}
// CreateChild() creates node for synthetic use
func
(
me
*
Inode
)
NewSynthetic
(
isDir
bool
,
fsi
FsNode
)
*
Inode
{
ch
:=
me
.
New
(
isDir
,
fsi
)
ch
.
synthetic
=
true
return
ch
}
func
(
me
*
Inode
)
New
(
isDir
bool
,
fsi
FsNode
)
*
Inode
{
ch
:=
newInode
(
isDir
,
fsi
)
ch
.
mount
=
me
.
mount
...
...
fuse/memnode.go
View file @
ab5078a6
...
...
@@ -62,7 +62,7 @@ type memNode struct {
func
(
me
*
memNode
)
newNode
(
isdir
bool
)
*
memNode
{
n
:=
me
.
fs
.
newNode
()
me
.
Inode
()
.
New
Synthetic
(
isdir
,
n
)
me
.
Inode
()
.
New
(
isdir
,
n
)
return
n
}
...
...
zipfs/memtree.go
View file @
ab5078a6
...
...
@@ -92,6 +92,10 @@ func (me *memNode) Open(flags uint32, context *fuse.Context) (fuseFile fuse.File
return
fuse
.
NewDataFile
(
me
.
file
.
Data
()),
fuse
.
OK
}
func
(
me
*
memNode
)
Deletable
()
bool
{
return
false
}
func
(
me
*
memNode
)
GetAttr
(
file
fuse
.
File
,
context
*
fuse
.
Context
)
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
if
me
.
Inode
()
.
IsDir
()
{
return
&
os
.
FileInfo
{
...
...
@@ -114,7 +118,7 @@ func (me *MemTreeFs) addFile(name string, f MemFile) {
fsnode
.
file
=
f
}
child
=
node
.
New
Synthetic
(
fsnode
.
file
==
nil
,
fsnode
)
child
=
node
.
New
(
fsnode
.
file
==
nil
,
fsnode
)
node
.
AddChild
(
c
,
child
)
}
node
=
child
...
...
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