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
ad0890e9
Commit
ad0890e9
authored
Sep 29, 2015
by
Jakob Unterwurzacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loopback: Utimens() has identical implementations in darwin and linux
Merge into files.go
parent
8783b8e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
52 deletions
+27
-52
fuse/nodefs/files.go
fuse/nodefs/files.go
+27
-0
fuse/nodefs/files_darwin.go
fuse/nodefs/files_darwin.go
+0
-26
fuse/nodefs/files_linux.go
fuse/nodefs/files_linux.go
+0
-26
No files found.
fuse/nodefs/files.go
View file @
ad0890e9
...
...
@@ -5,6 +5,7 @@ import (
"os"
"sync"
"syscall"
"time"
"github.com/hanwen/go-fuse/fuse"
)
...
...
@@ -200,6 +201,32 @@ func (f *loopbackFile) GetAttr(a *fuse.Attr) fuse.Status {
return
fuse
.
OK
}
const
_UTIME_NOW
=
((
1
<<
30
)
-
1
)
const
_UTIME_OMIT
=
((
1
<<
30
)
-
2
)
func
(
f
*
loopbackFile
)
Utimens
(
a
*
time
.
Time
,
m
*
time
.
Time
)
fuse
.
Status
{
tv
:=
make
([]
syscall
.
Timeval
,
2
)
if
a
==
nil
{
tv
[
0
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
a
.
UnixNano
()
tv
[
0
]
=
syscall
.
NsecToTimeval
(
n
)
}
if
m
==
nil
{
tv
[
1
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
m
.
UnixNano
()
tv
[
1
]
=
syscall
.
NsecToTimeval
(
n
)
}
f
.
lock
.
Lock
()
err
:=
syscall
.
Futimes
(
int
(
f
.
File
.
Fd
()),
tv
)
f
.
lock
.
Unlock
()
return
fuse
.
ToStatus
(
err
)
}
// Allocate, Utimens implemented in files_linux.go
////////////////////////////////////////////////////////////////
...
...
fuse/nodefs/files_darwin.go
View file @
ad0890e9
...
...
@@ -60,29 +60,3 @@ func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status
}
return
fuse
.
OK
}
const
_UTIME_NOW
=
((
1
<<
30
)
-
1
)
const
_UTIME_OMIT
=
((
1
<<
30
)
-
2
)
func
(
f
*
loopbackFile
)
Utimens
(
a
*
time
.
Time
,
m
*
time
.
Time
)
fuse
.
Status
{
tv
:=
make
([]
syscall
.
Timeval
,
2
)
if
a
==
nil
{
tv
[
0
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
a
.
UnixNano
()
tv
[
0
]
=
syscall
.
NsecToTimeval
(
n
)
}
if
m
==
nil
{
tv
[
1
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
m
.
UnixNano
()
tv
[
1
]
=
syscall
.
NsecToTimeval
(
n
)
}
f
.
lock
.
Lock
()
err
:=
syscall
.
Futimes
(
int
(
f
.
File
.
Fd
()),
tv
)
f
.
lock
.
Unlock
()
return
fuse
.
ToStatus
(
err
)
}
fuse/nodefs/files_linux.go
View file @
ad0890e9
...
...
@@ -2,7 +2,6 @@ package nodefs
import
(
"syscall"
"time"
"github.com/hanwen/go-fuse/fuse"
)
...
...
@@ -16,28 +15,3 @@ func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status
}
return
fuse
.
OK
}
const
_UTIME_NOW
=
((
1
<<
30
)
-
1
)
const
_UTIME_OMIT
=
((
1
<<
30
)
-
2
)
func
(
f
*
loopbackFile
)
Utimens
(
a
*
time
.
Time
,
m
*
time
.
Time
)
fuse
.
Status
{
tv
:=
make
([]
syscall
.
Timeval
,
2
)
if
a
==
nil
{
tv
[
0
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
a
.
UnixNano
()
tv
[
0
]
=
syscall
.
NsecToTimeval
(
n
)
}
if
m
==
nil
{
tv
[
1
]
.
Usec
=
_UTIME_OMIT
}
else
{
n
:=
a
.
UnixNano
()
tv
[
1
]
=
syscall
.
NsecToTimeval
(
n
)
}
f
.
lock
.
Lock
()
err
:=
syscall
.
Futimes
(
int
(
f
.
File
.
Fd
()),
tv
)
f
.
lock
.
Unlock
()
return
fuse
.
ToStatus
(
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