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
ab0b2f5f
Commit
ab0b2f5f
authored
Sep 17, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop FileSystem.Flush().
Instead, add File.SetInode(), so Files can update inodes if needed.
parent
f9cea038
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
24 deletions
+14
-24
fuse/api.go
fuse/api.go
+3
-3
fuse/default.go
fuse/default.go
+0
-4
fuse/defaultfile.go
fuse/defaultfile.go
+3
-0
fuse/fsmount.go
fuse/fsmount.go
+2
-0
fuse/pathfs.go
fuse/pathfs.go
+6
-9
fuse/switchfs.go
fuse/switchfs.go
+0
-8
No files found.
fuse/api.go
View file @
ab0b2f5f
...
...
@@ -120,9 +120,6 @@ type FileSystem interface {
Open
(
name
string
,
flags
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
,
context
*
Context
)
(
file
File
,
code
Status
)
// Flush() gets called as a file opened for read/write.
Flush
(
name
string
)
Status
// Directory handling
OpenDir
(
name
string
,
context
*
Context
)
(
stream
chan
DirEntry
,
code
Status
)
...
...
@@ -140,6 +137,9 @@ type FileSystem interface {
// TODO - should File be thread safe?
// TODO - should we pass a *Context argument?
type
File
interface
{
// Called upon registering the filehandle in the inode.
SetInode
(
*
Inode
)
Read
(
*
ReadIn
,
BufferPool
)
([]
byte
,
Status
)
Write
(
*
WriteIn
,
[]
byte
)
(
written
uint32
,
code
Status
)
Truncate
(
size
uint64
)
Status
...
...
fuse/default.go
View file @
ab0b2f5f
...
...
@@ -73,10 +73,6 @@ func (me *DefaultFileSystem) Open(name string, flags uint32, context *Context) (
return
nil
,
ENOSYS
}
func
(
me
*
DefaultFileSystem
)
Flush
(
name
string
)
Status
{
return
OK
}
func
(
me
*
DefaultFileSystem
)
OpenDir
(
name
string
,
context
*
Context
)
(
stream
chan
DirEntry
,
status
Status
)
{
return
nil
,
ENOSYS
}
...
...
fuse/defaultfile.go
View file @
ab0b2f5f
...
...
@@ -4,6 +4,9 @@ import (
"os"
)
func
(
me
*
DefaultFile
)
SetInode
(
*
Inode
)
{
}
func
(
me
*
DefaultFile
)
Read
(
*
ReadIn
,
BufferPool
)
([]
byte
,
Status
)
{
return
[]
byte
(
""
),
ENOSYS
}
...
...
fuse/fsmount.go
View file @
ab0b2f5f
...
...
@@ -127,11 +127,13 @@ func (me *fileSystemMount) registerFileHandle(node *Inode, dir rawDir, f File, f
break
}
b
.
WithFlags
.
File
=
withFlags
.
File
b
.
WithFlags
.
FuseFlags
|=
withFlags
.
FuseFlags
b
.
WithFlags
.
Description
+=
withFlags
.
Description
f
=
withFlags
.
File
}
b
.
WithFlags
.
File
.
SetInode
(
node
)
node
.
openFiles
=
append
(
node
.
openFiles
,
b
)
handle
:=
me
.
openFiles
.
Register
(
&
b
.
Handled
,
b
)
return
handle
,
b
...
...
fuse/pathfs.go
View file @
ab0b2f5f
...
...
@@ -82,6 +82,11 @@ func (me *PathNodeFs) Node(name string) *Inode {
return
n
}
func
(
me
*
PathNodeFs
)
Path
(
node
*
Inode
)
string
{
pNode
:=
node
.
FsNode
()
.
(
*
pathInode
)
return
pNode
.
GetPath
()
}
func
(
me
*
PathNodeFs
)
LastNode
(
name
string
)
(
*
Inode
,
[]
string
)
{
if
name
==
""
{
return
me
.
Root
()
.
Inode
(),
nil
...
...
@@ -316,15 +321,7 @@ func (me *pathInode) ListXAttr(context *Context) (attrs []string, code Status) {
}
func
(
me
*
pathInode
)
Flush
(
file
File
,
openFlags
uint32
,
context
*
Context
)
(
code
Status
)
{
code
=
file
.
Flush
()
// TODO - drop this. The filesystem should hook into Flush of the file itself.
if
code
.
Ok
()
&&
openFlags
&
O_ANYWRITE
!=
0
{
// We only signal releases to the FS if the
// open could have changed things.
path
:=
me
.
GetPath
()
code
=
me
.
fs
.
Flush
(
path
)
}
return
code
return
file
.
Flush
()
}
func
(
me
*
pathInode
)
OpenDir
(
context
*
Context
)
(
chan
DirEntry
,
Status
)
{
...
...
fuse/switchfs.go
View file @
ab0b2f5f
...
...
@@ -263,11 +263,3 @@ func (me *SwitchFileSystem) RemoveXAttr(name string, attr string, context *Conte
}
return
fs
.
FileSystem
.
RemoveXAttr
(
name
,
attr
,
context
)
}
func
(
me
*
SwitchFileSystem
)
Flush
(
name
string
)
Status
{
name
,
fs
:=
me
.
findFileSystem
(
name
)
if
fs
==
nil
{
return
ENOENT
}
return
fs
.
FileSystem
.
Flush
(
name
)
}
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