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
Levin Zimmermann
go-fuse
Commits
50967bcd
Commit
50967bcd
authored
Apr 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SetAttr for timestamps and uid/gid.
parent
f6be67e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
fuse/loopback_test.go
fuse/loopback_test.go
+13
-1
fuse/pathops.go
fuse/pathops.go
+7
-5
No files found.
fuse/loopback_test.go
View file @
50967bcd
...
...
@@ -122,6 +122,18 @@ func (me *testCase) testOpenUnreadable() {
}
}
func
(
me
*
testCase
)
testTouch
()
{
log
.
Println
(
"testTouch"
)
me
.
writeOrigFile
()
err
:=
os
.
Chtimes
(
me
.
mountFile
,
42e9
,
43e9
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
me
.
mountFile
)
CheckSuccess
(
err
)
if
fi
.
Atime_ns
!=
42e9
||
fi
.
Mtime_ns
!=
43e9
{
me
.
tester
.
Errorf
(
"Got wrong timestamps %v"
,
fi
)
}
}
func
(
me
*
testCase
)
testReadThrough
()
{
me
.
writeOrigFile
()
...
...
@@ -558,7 +570,6 @@ func TestMount(t *testing.T) {
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
defer
ts
.
Cleanup
()
ts
.
testOverwriteRename
()
ts
.
testDelRename
()
ts
.
testOpenUnreadable
()
...
...
@@ -573,6 +584,7 @@ func TestMount(t *testing.T) {
ts
.
testFSync
()
ts
.
testLargeRead
()
ts
.
testLargeDirRead
()
ts
.
testTouch
()
}
func
TestReadOnly
(
t
*
testing
.
T
)
{
...
...
fuse/pathops.go
View file @
50967bcd
...
...
@@ -6,6 +6,7 @@ import (
"log"
"bytes"
"path/filepath"
"time"
)
...
...
@@ -257,21 +258,22 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
if
input
.
Valid
&
FATTR_MODE
!=
0
{
err
=
mount
.
fs
.
Chmod
(
fullPath
,
input
.
Mode
)
}
if
err
!
=
OK
&&
(
input
.
Valid
&
FATTR_UID
!=
0
||
input
.
Valid
&
FATTR_GID
!=
0
)
{
if
err
=
=
OK
&&
(
input
.
Valid
&
FATTR_UID
!=
0
||
input
.
Valid
&
FATTR_GID
!=
0
)
{
// TODO - can we get just FATTR_GID but not FATTR_UID ?
err
=
mount
.
fs
.
Chown
(
fullPath
,
uint32
(
input
.
Uid
),
uint32
(
input
.
Gid
))
}
if
input
.
Valid
&
FATTR_SIZE
!=
0
{
mount
.
fs
.
Truncate
(
fullPath
,
input
.
Size
)
}
if
err
!=
OK
&&
(
input
.
Valid
&
FATTR_ATIME
!=
0
||
input
.
Valid
&
FATTR_MTIME
!=
0
)
{
if
err
==
OK
&&
(
input
.
Valid
&
FATTR_ATIME
!=
0
||
input
.
Valid
&
FATTR_MTIME
!=
0
)
{
err
=
mount
.
fs
.
Utimens
(
fullPath
,
uint64
(
input
.
Atime
*
1e9
)
+
uint64
(
input
.
Atimensec
),
uint64
(
input
.
Mtime
*
1e9
)
+
uint64
(
input
.
Mtimensec
))
}
if
err
!
=
OK
&&
(
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
||
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
)
{
// TODO - should set time to now. Maybe just reuse
// Utimens() ? Go has no UTIME_NOW unfortunately.
if
err
=
=
OK
&&
(
input
.
Valid
&
FATTR_ATIME_NOW
!=
0
||
input
.
Valid
&
FATTR_MTIME_NOW
!=
0
)
{
ns
:=
time
.
Nanoseconds
()
err
=
mount
.
fs
.
Utimens
(
fullPath
,
uint64
(
ns
),
uint64
(
ns
))
}
if
err
!=
OK
{
return
nil
,
err
...
...
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