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
dc73e9f1
Commit
dc73e9f1
authored
Feb 05, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: add SetAttrTimeout, SetEntryTimeout, SetTimeout to AttrOut/EntryOut
parent
d0fca860
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
17 deletions
+23
-17
fuse/nodefs/fsmount.go
fuse/nodefs/fsmount.go
+4
-4
fuse/nodefs/nodefs.go
fuse/nodefs/nodefs.go
+0
-13
fuse/types.go
fuse/types.go
+19
-0
No files found.
fuse/nodefs/fsmount.go
View file @
dc73e9f1
...
@@ -64,8 +64,8 @@ func (m *fileSystemMount) setOwner(attr *fuse.Attr) {
...
@@ -64,8 +64,8 @@ func (m *fileSystemMount) setOwner(attr *fuse.Attr) {
}
}
func
(
m
*
fileSystemMount
)
fillEntry
(
out
*
fuse
.
EntryOut
)
{
func
(
m
*
fileSystemMount
)
fillEntry
(
out
*
fuse
.
EntryOut
)
{
splitDuration
(
m
.
options
.
EntryTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
out
.
SetEntryTimeout
(
m
.
options
.
EntryTimeout
)
splitDuration
(
m
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
out
.
SetAttrTimeout
(
m
.
options
.
AttrTimeout
)
m
.
setOwner
(
&
out
.
Attr
)
m
.
setOwner
(
&
out
.
Attr
)
if
out
.
Mode
&
fuse
.
S_IFDIR
==
0
&&
out
.
Nlink
==
0
{
if
out
.
Mode
&
fuse
.
S_IFDIR
==
0
&&
out
.
Nlink
==
0
{
out
.
Nlink
=
1
out
.
Nlink
=
1
...
@@ -73,7 +73,7 @@ func (m *fileSystemMount) fillEntry(out *fuse.EntryOut) {
...
@@ -73,7 +73,7 @@ func (m *fileSystemMount) fillEntry(out *fuse.EntryOut) {
}
}
func
(
m
*
fileSystemMount
)
fillAttr
(
out
*
fuse
.
AttrOut
,
nodeId
uint64
)
{
func
(
m
*
fileSystemMount
)
fillAttr
(
out
*
fuse
.
AttrOut
,
nodeId
uint64
)
{
splitDuration
(
m
.
options
.
AttrTimeout
,
&
out
.
AttrValid
,
&
out
.
AttrValidNsec
)
out
.
SetTimeout
(
m
.
options
.
AttrTimeout
)
m
.
setOwner
(
&
out
.
Attr
)
m
.
setOwner
(
&
out
.
Attr
)
if
out
.
Ino
==
0
{
if
out
.
Ino
==
0
{
out
.
Ino
=
nodeId
out
.
Ino
=
nodeId
...
@@ -179,7 +179,7 @@ func (m *fileSystemMount) registerFileHandle(node *Inode, dir *connectorDir, f F
...
@@ -179,7 +179,7 @@ func (m *fileSystemMount) registerFileHandle(node *Inode, dir *connectorDir, f F
func
(
m
*
fileSystemMount
)
negativeEntry
(
out
*
fuse
.
EntryOut
)
bool
{
func
(
m
*
fileSystemMount
)
negativeEntry
(
out
*
fuse
.
EntryOut
)
bool
{
if
m
.
options
.
NegativeTimeout
>
0.0
{
if
m
.
options
.
NegativeTimeout
>
0.0
{
out
.
NodeId
=
0
out
.
NodeId
=
0
splitDuration
(
m
.
options
.
NegativeTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
out
.
SetEntryTimeout
(
m
.
options
.
NegativeTimeout
)
return
true
return
true
}
}
return
false
return
false
...
...
fuse/nodefs/nodefs.go
deleted
100644 → 0
View file @
d0fca860
// Copyright 2016 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
nodefs
import
"time"
func
splitDuration
(
dt
time
.
Duration
,
secs
*
uint64
,
nsecs
*
uint32
)
{
ns
:=
int64
(
dt
)
*
nsecs
=
uint32
(
ns
%
1e9
)
*
secs
=
uint64
(
ns
/
1e9
)
}
fuse/types.go
View file @
dc73e9f1
...
@@ -7,6 +7,7 @@ package fuse
...
@@ -7,6 +7,7 @@ package fuse
import
(
import
(
"io"
"io"
"syscall"
"syscall"
"time"
)
)
const
(
const
(
...
@@ -433,6 +434,18 @@ type EntryOut struct {
...
@@ -433,6 +434,18 @@ type EntryOut struct {
Attr
Attr
}
}
func
(
o
*
EntryOut
)
SetEntryTimeout
(
dt
time
.
Duration
)
{
ns
:=
int64
(
dt
)
o
.
EntryValidNsec
=
uint32
(
ns
%
1e9
)
o
.
EntryValid
=
uint64
(
ns
/
1e9
)
}
func
(
o
*
EntryOut
)
SetAttrTimeout
(
dt
time
.
Duration
)
{
ns
:=
int64
(
dt
)
o
.
AttrValidNsec
=
uint32
(
ns
%
1e9
)
o
.
AttrValid
=
uint64
(
ns
/
1e9
)
}
type
AttrOut
struct
{
type
AttrOut
struct
{
AttrValid
uint64
AttrValid
uint64
AttrValidNsec
uint32
AttrValidNsec
uint32
...
@@ -440,6 +453,12 @@ type AttrOut struct {
...
@@ -440,6 +453,12 @@ type AttrOut struct {
Attr
Attr
}
}
func
(
o
*
AttrOut
)
SetTimeout
(
dt
time
.
Duration
)
{
ns
:=
int64
(
dt
)
o
.
AttrValidNsec
=
uint32
(
ns
%
1e9
)
o
.
AttrValid
=
uint64
(
ns
/
1e9
)
}
type
CreateOut
struct
{
type
CreateOut
struct
{
EntryOut
EntryOut
OpenOut
OpenOut
...
...
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