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
Levin Zimmermann
go-fuse
Commits
9fa9d995
Commit
9fa9d995
authored
Mar 09, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: some darwin compile cleanups
parent
7373951b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
53 deletions
+63
-53
nodefs/dirstream_darwin.go
nodefs/dirstream_darwin.go
+0
-2
nodefs/loopback.go
nodefs/loopback.go
+1
-51
nodefs/loopback_linux.go
nodefs/loopback_linux.go
+62
-0
No files found.
nodefs/dirstream_darwin.go
View file @
9fa9d995
...
...
@@ -11,7 +11,6 @@ import (
"github.com/hanwen/go-fuse/fuse"
)
// XXX names
type
dirArray
struct
{
Entries
[]
fuse
.
DirEntry
}
...
...
@@ -31,7 +30,6 @@ func (a *dirArray) Close() {
}
func
NewLoopbackDirStream
(
nm
string
)
(
DirStream
,
fuse
.
Status
)
{
// XXX should implement streaming read to make sure the API works.
f
,
err
:=
os
.
Open
(
nm
)
if
err
!=
nil
{
return
nil
,
fuse
.
ToStatus
(
err
)
...
...
nodefs/loopback.go
View file @
9fa9d995
...
...
@@ -151,35 +151,6 @@ func toLoopbackNode(op Operations) *loopbackNode {
return
op
.
(
*
loopbackNode
)
}
func
(
n
*
loopbackNode
)
renameExchange
(
name
string
,
newparent
*
loopbackNode
,
newName
string
)
fuse
.
Status
{
fd1
,
err
:=
syscall
.
Open
(
n
.
path
(),
syscall
.
O_DIRECTORY
,
0
)
if
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
defer
syscall
.
Close
(
fd1
)
fd2
,
err
:=
syscall
.
Open
(
newparent
.
path
(),
syscall
.
O_DIRECTORY
,
0
)
defer
syscall
.
Close
(
fd2
)
if
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Fstat
(
fd1
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
n
)
.
IsRoot
()
&&
InodeOf
(
n
)
.
FileID
()
.
Ino
!=
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
if
err
:=
syscall
.
Fstat
(
fd2
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
newparent
)
.
IsRoot
()
&&
InodeOf
(
newparent
)
.
FileID
()
.
Ino
!=
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
return
fuse
.
ToStatus
(
unix
.
Renameat2
(
fd1
,
name
,
fd2
,
newName
,
unix
.
RENAME_EXCHANGE
))
}
func
(
n
*
loopbackNode
)
Rename
(
ctx
context
.
Context
,
name
string
,
newParent
Operations
,
newName
string
,
flags
uint32
)
fuse
.
Status
{
newParentLoopback
:=
toLoopbackNode
(
newParent
)
if
flags
&
unix
.
RENAME_EXCHANGE
!=
0
{
...
...
@@ -347,26 +318,6 @@ func NewLoopback(root string) Operations {
return
n
}
func
(
n
*
loopbackNode
)
GetXAttr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
sz
,
err
:=
syscall
.
Getxattr
(
n
.
path
(),
attr
,
dest
)
return
uint32
(
sz
),
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
SetXAttr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
fuse
.
Status
{
err
:=
syscall
.
Setxattr
(
n
.
path
(),
attr
,
data
,
int
(
flags
))
return
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
RemoveXAttr
(
ctx
context
.
Context
,
attr
string
)
fuse
.
Status
{
err
:=
syscall
.
Removexattr
(
n
.
path
(),
attr
)
return
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
ListXAttr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
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
{
...
...
@@ -378,9 +329,8 @@ func (n *loopbackNode) Access(ctx context.Context, mask uint32) fuse.Status {
return
fuse
.
ToStatus
(
err
)
}
if
!
internal
.
HasAccess
(
caller
.
Uid
,
caller
.
Gid
,
st
.
Uid
,
st
.
Gid
,
st
.
Mode
,
mask
)
{
if
!
internal
.
HasAccess
(
caller
.
Uid
,
caller
.
Gid
,
st
.
Uid
,
st
.
Gid
,
uint32
(
st
.
Mode
)
,
mask
)
{
return
fuse
.
EACCES
}
return
fuse
.
OK
}
nodefs/loopback_linux.go
0 → 100644
View file @
9fa9d995
// Copyright 2019 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
(
"context"
"syscall"
"github.com/hanwen/go-fuse/fuse"
"golang.org/x/sys/unix"
)
func
(
n
*
loopbackNode
)
GetXAttr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
sz
,
err
:=
syscall
.
Getxattr
(
n
.
path
(),
attr
,
dest
)
return
uint32
(
sz
),
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
SetXAttr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
fuse
.
Status
{
err
:=
syscall
.
Setxattr
(
n
.
path
(),
attr
,
data
,
int
(
flags
))
return
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
RemoveXAttr
(
ctx
context
.
Context
,
attr
string
)
fuse
.
Status
{
err
:=
syscall
.
Removexattr
(
n
.
path
(),
attr
)
return
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
ListXAttr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
sz
,
err
:=
syscall
.
Listxattr
(
n
.
path
(),
dest
)
return
uint32
(
sz
),
fuse
.
ToStatus
(
err
)
}
func
(
n
*
loopbackNode
)
renameExchange
(
name
string
,
newparent
*
loopbackNode
,
newName
string
)
fuse
.
Status
{
fd1
,
err
:=
syscall
.
Open
(
n
.
path
(),
syscall
.
O_DIRECTORY
,
0
)
if
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
defer
syscall
.
Close
(
fd1
)
fd2
,
err
:=
syscall
.
Open
(
newparent
.
path
(),
syscall
.
O_DIRECTORY
,
0
)
defer
syscall
.
Close
(
fd2
)
if
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Fstat
(
fd1
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
n
)
.
IsRoot
()
&&
InodeOf
(
n
)
.
FileID
()
.
Ino
!=
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
if
err
:=
syscall
.
Fstat
(
fd2
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
newparent
)
.
IsRoot
()
&&
InodeOf
(
newparent
)
.
FileID
()
.
Ino
!=
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
return
fuse
.
ToStatus
(
unix
.
Renameat2
(
fd1
,
name
,
fd2
,
newName
,
unix
.
RENAME_EXCHANGE
))
}
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