Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
a7d2944d
Commit
a7d2944d
authored
Mar 06, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support changing mtime.
parent
1698f160
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
samples/memfs/fs.go
samples/memfs/fs.go
+1
-1
samples/memfs/inode.go
samples/memfs/inode.go
+10
-1
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+1
-1
No files found.
samples/memfs/fs.go
View file @
a7d2944d
...
...
@@ -281,7 +281,7 @@ func (fs *memFS) SetInodeAttributes(
defer
inode
.
mu
.
Unlock
()
// Handle the request.
inode
.
SetAttributes
(
req
.
Size
,
req
.
Mode
)
inode
.
SetAttributes
(
req
.
Size
,
req
.
Mode
,
req
.
Mtime
)
// Fill in the response.
resp
.
Attributes
=
inode
.
attributes
...
...
samples/memfs/inode.go
View file @
a7d2944d
...
...
@@ -18,6 +18,7 @@ import (
"fmt"
"io"
"os"
"time"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseutil"
...
...
@@ -373,7 +374,10 @@ func (inode *inode) WriteAt(p []byte, off int64) (n int, err error) {
// Update attributes from non-nil parameters.
//
// EXCLUSIVE_LOCKS_REQUIRED(inode.mu)
func
(
inode
*
inode
)
SetAttributes
(
size
*
uint64
,
mode
*
os
.
FileMode
)
{
func
(
inode
*
inode
)
SetAttributes
(
size
*
uint64
,
mode
*
os
.
FileMode
,
mtime
*
time
.
Time
)
{
// Update the modification time.
inode
.
attributes
.
Mtime
=
inode
.
clock
.
Now
()
...
...
@@ -397,4 +401,9 @@ func (inode *inode) SetAttributes(size *uint64, mode *os.FileMode) {
if
mode
!=
nil
{
inode
.
attributes
.
Mode
=
*
mode
}
// Change mtime?
if
mtime
!=
nil
{
inode
.
attributes
.
Mtime
=
*
mtime
}
}
samples/memfs/memfs_test.go
View file @
a7d2944d
...
...
@@ -968,7 +968,7 @@ func (t *MemFSTest) Chtimes() {
AssertEq
(
nil
,
err
)
// Chtimes it.
expectedMtime
:=
time
.
Now
()
.
Add
(
123
*
time
.
Millis
econd
)
expectedMtime
:=
time
.
Now
()
.
Add
(
123
*
time
.
Second
)
.
Round
(
time
.
S
econd
)
err
=
os
.
Chtimes
(
fileName
,
time
.
Time
{},
expectedMtime
)
AssertEq
(
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