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
1e311fd7
Commit
1e311fd7
authored
Aug 19, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FilesystemConnector.Notify() which chooses between entry and inode
notify automatically.
parent
130d5381
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+31
-8
No files found.
fuse/pathfilesystem.go
View file @
1e311fd7
...
...
@@ -470,16 +470,16 @@ func (me *FileSystemConnector) unlinkUpdate(parent *inode, name string) {
// Walk the file system starting from the root. Will return nil if
// node not found.
func
(
me
*
FileSystemConnector
)
find
Inode
(
fullPath
string
)
*
inode
{
func
(
me
*
FileSystemConnector
)
find
LastKnownInode
(
fullPath
string
)
(
*
inode
,
[]
string
)
{
if
fullPath
==
""
{
return
me
.
rootNode
return
me
.
rootNode
,
nil
}
fullPath
=
strings
.
TrimLeft
(
filepath
.
Clean
(
fullPath
),
"/"
)
comps
:=
strings
.
Split
(
fullPath
,
"/"
)
node
:=
me
.
rootNode
for
_
,
component
:=
range
comps
{
for
i
,
component
:=
range
comps
{
if
len
(
component
)
==
0
{
continue
}
...
...
@@ -489,12 +489,22 @@ func (me *FileSystemConnector) findInode(fullPath string) *inode {
defer
node
.
mountPoint
.
treeLock
.
RUnlock
()
}
node
=
node
.
Children
[
component
]
if
node
==
nil
{
return
nil
next
:=
node
.
Children
[
component
]
if
next
==
nil
{
return
node
,
comps
[
i
:
]
}
node
=
next
}
return
node
,
nil
}
func
(
me
*
FileSystemConnector
)
findInode
(
fullPath
string
)
*
inode
{
n
,
rest
:=
me
.
findLastKnownInode
(
fullPath
)
if
len
(
rest
)
>
0
{
return
nil
}
return
n
ode
return
n
}
////////////////////////////////////////////////////////////////
...
...
@@ -703,3 +713,16 @@ func (me *FileSystemConnector) EntryNotify(dir string, name string) Status {
return
me
.
fsInit
.
EntryNotify
(
node
.
NodeId
,
name
)
}
func
(
me
*
FileSystemConnector
)
Notify
(
path
string
)
Status
{
node
,
rest
:=
me
.
findLastKnownInode
(
path
)
if
len
(
rest
)
>
0
{
return
me
.
fsInit
.
EntryNotify
(
node
.
NodeId
,
rest
[
0
])
}
out
:=
NotifyInvalInodeOut
{
Ino
:
node
.
NodeId
,
}
return
me
.
fsInit
.
InodeNotify
(
&
out
)
}
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