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
9e25c19f
Commit
9e25c19f
authored
Mar 24, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LookUpInodeOp.Respond
parent
537c4c3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
fuseops/convert.go
fuseops/convert.go
+46
-0
fuseops/ops.go
fuseops/ops.go
+3
-1
No files found.
fuseops/convert.go
View file @
9e25c19f
...
...
@@ -18,6 +18,8 @@
package
fuseops
import
(
"time"
"github.com/jacobsa/bazilfuse"
"golang.org/x/net/context"
)
...
...
@@ -186,6 +188,50 @@ func Convert(r bazilfuse.Request) (o Op) {
return
}
func
convertAttributes
(
inode
InodeID
,
attr
InodeAttributes
)
bazilfuse
.
Attr
{
return
bazilfuse
.
Attr
{
Inode
:
uint64
(
inode
),
Size
:
attr
.
Size
,
Mode
:
attr
.
Mode
,
Nlink
:
uint32
(
attr
.
Nlink
),
Atime
:
attr
.
Atime
,
Mtime
:
attr
.
Mtime
,
Ctime
:
attr
.
Ctime
,
Crtime
:
attr
.
Crtime
,
Uid
:
attr
.
Uid
,
Gid
:
attr
.
Gid
,
}
}
// Convert an absolute cache expiration time to a relative time from now for
// consumption by fuse.
func
convertExpirationTime
(
t
time
.
Time
)
(
d
time
.
Duration
)
{
// Fuse represents durations as unsigned 64-bit counts of seconds and 32-bit
// counts of nanoseconds (cf. http://goo.gl/EJupJV). The bazil.org/fuse
// package converts time.Duration values to this form in a straightforward
// way (cf. http://goo.gl/FJhV8j).
//
// So negative durations are right out. There is no need to cap the positive
// magnitude, because 2^64 seconds is well longer than the 2^63 ns range of
// time.Duration.
d
=
t
.
Sub
(
time
.
Now
())
if
d
<
0
{
d
=
0
}
return
}
func
convertChildInodeEntry
(
in
*
ChildInodeEntry
,
out
*
bazilfuse
.
LookupResponse
)
{
out
.
Node
=
bazilfuse
.
NodeID
(
in
.
Child
)
out
.
Generation
=
uint64
(
in
.
Generation
)
out
.
Attr
=
convertAttributes
(
in
.
Child
,
in
.
Attributes
)
out
.
AttrValid
=
convertExpirationTime
(
in
.
AttributesExpiration
)
out
.
EntryValid
=
convertExpirationTime
(
in
.
EntryExpiration
)
}
// A helper for embedding common behavior.
type
commonOp
struct
{
ctx
context
.
Context
...
...
fuseops/ops.go
View file @
9e25c19f
...
...
@@ -89,7 +89,9 @@ func (o *LookUpInodeOp) Respond(err error) {
return
}
panic
(
"TODO"
)
resp
:=
bazilfuse
.
LookupResponse
{}
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
)
o
.
r
.
(
*
bazilfuse
.
LookupRequest
)
.
Respond
(
&
resp
)
}
// Refresh the attributes for an inode whose ID was previously returned in a
...
...
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