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
02a3917c
Commit
02a3917c
authored
Mar 09, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: support Access
parent
6217b933
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
4 deletions
+26
-4
nodefs/api.go
nodefs/api.go
+1
-0
nodefs/bridge.go
nodefs/bridge.go
+2
-1
nodefs/default.go
nodefs/default.go
+4
-0
nodefs/loopback.go
nodefs/loopback.go
+19
-3
No files found.
nodefs/api.go
View file @
02a3917c
...
...
@@ -102,6 +102,7 @@ type Operations interface {
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
fuse
.
Status
Access
(
ctx
context
.
Context
,
mask
uint32
)
fuse
.
Status
// File locking
GetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
(
status
fuse
.
Status
)
SetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
status
fuse
.
Status
)
...
...
nodefs/bridge.go
View file @
02a3917c
...
...
@@ -408,7 +408,8 @@ func (b *rawBridge) Readlink(cancel <-chan struct{}, header *fuse.InHeader) (out
}
func
(
b
*
rawBridge
)
Access
(
cancel
<-
chan
struct
{},
input
*
fuse
.
AccessIn
)
(
status
fuse
.
Status
)
{
return
fuse
.
ENOSYS
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
return
n
.
node
.
Access
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
input
.
Mask
)
}
// Extended attributes.
...
...
nodefs/default.go
View file @
02a3917c
...
...
@@ -227,6 +227,10 @@ func (n *DefaultOperations) RemoveXAttr(ctx context.Context, attr string) fuse.S
return
fuse
.
ENOATTR
}
func
(
n
*
DefaultOperations
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
fuse
.
Status
{
return
fuse
.
ENOSYS
}
func
(
n
*
DefaultOperations
)
ListXAttr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
return
0
,
fuse
.
OK
}
...
...
nodefs/loopback.go
View file @
02a3917c
...
...
@@ -6,17 +6,15 @@ package nodefs
import
(
"context"
"log"
"os"
"path/filepath"
"sync"
"syscall"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/internal"
)
var
_
=
log
.
Printf
type
loopbackRoot
struct
{
loopbackNode
...
...
@@ -339,3 +337,21 @@ func (n *loopbackNode) ListXAttr(ctx context.Context, dest []byte) (uint32, fuse
sz
,
err
:=
syscall
.
Listxattr
(
n
.
path
(),
dest
)
return
uint32
(
sz
),
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
fuse
.
Status
{
caller
,
ok
:=
fuse
.
FromContext
(
ctx
)
if
!
ok
{
return
fuse
.
EACCES
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Stat
(
n
.
path
(),
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
internal
.
HasAccess
(
caller
.
Uid
,
caller
.
Gid
,
st
.
Uid
,
st
.
Gid
,
st
.
Mode
,
mask
)
{
return
fuse
.
EACCES
}
return
fuse
.
OK
}
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