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
03c3c9b9
Commit
03c3c9b9
authored
May 03, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UnionFs: implement Utimens.
parent
53e30f5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
fuse/types.go
fuse/types.go
+1
-0
unionfs/unionfs.go
unionfs/unionfs.go
+22
-0
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+17
-0
No files found.
fuse/types.go
View file @
03c3c9b9
...
...
@@ -64,6 +64,7 @@ const (
FUSE_NOTIFY_CODE_MAX
=
4
)
// Ugh - we should fold ns and secs together here.
type
Attr
struct
{
Ino
uint64
Size
uint64
...
...
unionfs/unionfs.go
View file @
03c3c9b9
...
...
@@ -342,6 +342,28 @@ func (me *UnionFs) Truncate(path string, offset uint64) (code fuse.Status) {
return
me
.
fileSystems
[
0
]
.
Truncate
(
path
,
offset
)
}
func
(
me
*
UnionFs
)
Utimens
(
name
string
,
atime
uint64
,
ctime
uint64
)
(
code
fuse
.
Status
)
{
name
=
stripSlash
(
name
)
r
:=
me
.
getBranch
(
name
)
code
=
r
.
code
if
code
==
fuse
.
OK
&&
r
.
branch
>
0
{
code
=
me
.
Promote
(
name
,
r
)
r
.
branch
=
0
}
if
code
==
fuse
.
OK
{
code
=
me
.
fileSystems
[
0
]
.
Utimens
(
name
,
atime
,
ctime
)
}
if
code
==
fuse
.
OK
{
r
.
attr
.
Atime
=
uint64
(
atime
/
1e9
)
r
.
attr
.
Atimensec
=
uint32
(
atime
%
1e9
)
r
.
attr
.
Ctime
=
uint64
(
ctime
/
1e9
)
r
.
attr
.
Ctimensec
=
uint32
(
ctime
%
1e9
)
me
.
branchCache
.
Set
(
name
,
r
)
}
return
code
}
func
(
me
*
UnionFs
)
Chmod
(
name
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
name
=
stripSlash
(
name
)
r
:=
me
.
getBranch
(
name
)
...
...
unionfs/unionfs_test.go
View file @
03c3c9b9
...
...
@@ -133,6 +133,23 @@ func TestSymlink(t *testing.T) {
}
}
func
TestChtimes
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
writeToFile
(
wd
+
"/ro/file"
,
"a"
)
err
:=
os
.
Chtimes
(
wd
+
"/ro/file"
,
42e9
,
43e9
)
CheckSuccess
(
err
)
err
=
os
.
Chtimes
(
wd
+
"/mount/file"
,
82e9
,
83e9
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
wd
+
"/mount/file"
)
if
fi
.
Atime_ns
!=
82e9
||
fi
.
Ctime_ns
!=
83e9
{
t
.
Error
(
"Incorrect timestamp"
,
fi
)
}
}
func
TestChmod
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
...
...
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