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
20b75240
Commit
20b75240
authored
Feb 23, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: use AttrOut for GetAttr
parent
e5194406
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
14 deletions
+15
-14
nodefs/api.go
nodefs/api.go
+2
-2
nodefs/bridge.go
nodefs/bridge.go
+9
-8
nodefs/default.go
nodefs/default.go
+1
-1
nodefs/files.go
nodefs/files.go
+1
-1
nodefs/loopback.go
nodefs/loopback.go
+2
-2
No files found.
nodefs/api.go
View file @
20b75240
...
...
@@ -121,7 +121,7 @@ type Node interface {
// The methods below may be called on closed files, due to
// concurrency. In that case, you should return EBADF.
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
)
fuse
.
Status
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
Out
)
fuse
.
Status
/*
NOSUBMIT - fold into a setattr method, or expand methods?
...
...
@@ -162,7 +162,7 @@ type File interface {
// The methods below may be called on closed files, due to
// concurrency. In that case, you should return EBADF.
// TODO - fold into a setattr method?
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
Attr
)
fuse
.
Status
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
Attr
Out
)
fuse
.
Status
Truncate
(
ctx
context
.
Context
,
size
uint64
)
fuse
.
Status
Chown
(
ctx
context
.
Context
,
uid
uint32
,
gid
uint32
)
fuse
.
Status
Chmod
(
ctx
context
.
Context
,
perms
uint32
)
fuse
.
Status
...
...
nodefs/bridge.go
View file @
20b75240
...
...
@@ -267,8 +267,13 @@ func (b *rawBridge) Create(input *fuse.CreateIn, name string, out *fuse.CreateOu
out
.
OpenFlags
=
flags
f
.
GetAttr
(
ctx
,
&
out
.
Attr
)
var
temp
fuse
.
AttrOut
f
.
GetAttr
(
ctx
,
&
temp
)
out
.
Attr
=
temp
.
Attr
out
.
AttrValid
=
temp
.
AttrValid
out
.
AttrValidNsec
=
temp
.
AttrValidNsec
b
.
setEntryOutTimeout
(
&
out
.
EntryOut
)
if
out
.
Attr
.
Mode
&^
07777
!=
fuse
.
S_IFREG
{
log
.
Panicf
(
"Create: mode must be S_IFREG (%o), got %o"
,
fuse
.
S_IFREG
,
out
.
Attr
.
Mode
)
}
...
...
@@ -287,7 +292,7 @@ func (b *rawBridge) unregisterNode(nodeid uint64) {
func
(
b
*
rawBridge
)
SetDebug
(
debug
bool
)
{}
func
(
b
*
rawBridge
)
GetAttr
(
input
*
fuse
.
GetAttrIn
,
out
*
fuse
.
AttrOut
)
(
code
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
GetAttr
(
input
*
fuse
.
GetAttrIn
,
out
*
fuse
.
AttrOut
)
fuse
.
Status
{
n
,
fEntry
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
())
f
:=
fEntry
.
file
...
...
@@ -295,8 +300,7 @@ func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse
f
=
nil
}
dest
:=
&
out
.
Attr
code
=
n
.
node
.
GetAttr
(
context
.
TODO
(),
f
,
dest
)
code
=
n
.
node
.
GetAttr
(
context
.
TODO
(),
f
,
out
)
if
out
.
Nlink
==
0
{
// With Nlink == 0, newer kernels will refuse link
// operations.
...
...
@@ -377,10 +381,7 @@ func (b *rawBridge) SetAttr(input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse
// Must call GetAttr(); the filesystem may override some of
// the changes we effect here.
attr
:=
&
out
.
Attr
// should take AttrOut
code
=
n
.
node
.
GetAttr
(
ctx
,
f
,
attr
)
code
=
n
.
node
.
GetAttr
(
ctx
,
f
,
out
)
b
.
setAttrTimeout
(
out
)
return
code
}
...
...
nodefs/default.go
View file @
20b75240
...
...
@@ -93,7 +93,7 @@ func (n *DefaultNode) Allocate(ctx context.Context, f File, off uint64, size uin
return
fuse
.
ENOSYS
}
func
(
n
*
DefaultNode
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
)
fuse
.
Status
{
func
(
n
*
DefaultNode
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
Out
)
fuse
.
Status
{
if
f
!=
nil
{
f
.
GetAttr
(
ctx
,
out
)
}
...
...
nodefs/files.go
View file @
20b75240
...
...
@@ -152,7 +152,7 @@ func (f *loopbackFile) Chown(ctx context.Context, uid uint32, gid uint32) fuse.S
return
r
}
func
(
f
*
loopbackFile
)
GetAttr
(
ctx
context
.
Context
,
a
*
fuse
.
Attr
)
fuse
.
Status
{
func
(
f
*
loopbackFile
)
GetAttr
(
ctx
context
.
Context
,
a
*
fuse
.
Attr
Out
)
fuse
.
Status
{
st
:=
syscall
.
Stat_t
{}
f
.
mu
.
Lock
()
err
:=
syscall
.
Fstat
(
int
(
f
.
File
.
Fd
()),
&
st
)
...
...
nodefs/loopback.go
View file @
20b75240
...
...
@@ -19,7 +19,7 @@ type loopbackRoot struct {
root
string
}
func
(
n
*
loopbackRoot
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
)
fuse
.
Status
{
func
(
n
*
loopbackRoot
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
Out
)
fuse
.
Status
{
var
err
error
=
nil
st
:=
syscall
.
Stat_t
{}
err
=
syscall
.
Stat
(
n
.
root
,
&
st
)
...
...
@@ -175,7 +175,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh File, fuseFla
return
NewLoopbackFile
(
f
),
0
,
fuse
.
OK
}
func
(
n
*
loopbackNode
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
)
fuse
.
Status
{
func
(
n
*
loopbackNode
)
GetAttr
(
ctx
context
.
Context
,
f
File
,
out
*
fuse
.
Attr
Out
)
fuse
.
Status
{
if
f
!=
nil
{
return
f
.
GetAttr
(
ctx
,
out
)
}
...
...
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