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
148d3830
Commit
148d3830
authored
Nov 25, 2015
by
Eliot Courtney
Committed by
Han-Wen Nienhuys
Dec 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fsync handling to FileSystemConnector.
parent
d36ee9dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
fuse/nodefs/fsops.go
fuse/nodefs/fsops.go
+7
-0
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+18
-2
No files found.
fuse/nodefs/fsops.go
View file @
148d3830
...
...
@@ -21,6 +21,13 @@ func (c *FileSystemConnector) RawFS() fuse.RawFileSystem {
type
rawBridge
FileSystemConnector
func
(
c
*
rawBridge
)
Fsync
(
input
*
fuse
.
FsyncIn
)
fuse
.
Status
{
node
:=
c
.
toInode
(
input
.
NodeId
)
opened
:=
node
.
mount
.
getOpenedFile
(
input
.
Fh
)
if
opened
!=
nil
{
return
opened
.
WithFlags
.
File
.
Fsync
(
int
(
input
.
FsyncFlags
))
}
return
fuse
.
ENOSYS
}
...
...
fuse/test/fsetattr_test.go
View file @
148d3830
...
...
@@ -18,6 +18,7 @@ type MutableDataFile struct {
data
[]
byte
fuse
.
Attr
GetAttrCalled
bool
FsyncCalled
bool
}
func
(
f
*
MutableDataFile
)
String
()
string
{
...
...
@@ -86,6 +87,11 @@ func (f *MutableDataFile) Chmod(perms uint32) fuse.Status {
return
fuse
.
OK
}
func
(
f
*
MutableDataFile
)
Fsync
(
flags
int
)
fuse
.
Status
{
f
.
FsyncCalled
=
true
return
fuse
.
OK
}
////////////////
// This FS only supports a single r/w file called "/file".
...
...
@@ -181,9 +187,10 @@ func TestDataReadLarge(t *testing.T) {
}
func
TestFSetAttr
(
t
*
testing
.
T
)
{
f
s
:=
pathfs
.
NewLockingFileSystem
(
&
FSetAttrFs
{
f
SetAttrFs
:=
&
FSetAttrFs
{
FileSystem
:
pathfs
.
NewDefaultFileSystem
(),
})
}
fs
:=
pathfs
.
NewLockingFileSystem
(
fSetAttrFs
)
dir
,
clean
:=
setupFAttrTest
(
t
,
fs
)
defer
clean
()
...
...
@@ -245,5 +252,14 @@ func TestFSetAttr(t *testing.T) {
if
i1
!=
i2
{
t
.
Errorf
(
"f.Lstat().Ino = %d. Returned %d before."
,
i2
,
i1
)
}
if
code
:=
syscall
.
Fsync
(
int
(
f
.
Fd
()));
code
!=
nil
{
t
.
Error
(
"Fsync failed:"
,
os
.
NewSyscallError
(
"Fsync"
,
code
))
}
if
!
fSetAttrFs
.
file
.
FsyncCalled
{
t
.
Error
(
"Fsync was not called"
)
}
// TODO - test chown if run as root.
}
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