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
4df83d57
Commit
4df83d57
authored
Aug 28, 2024
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs: reorganize code
Change-Id: I91a375cc2956b2ead0ad3a4a5b2a0c66a4c327e2
parent
e0a0b09a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
65 deletions
+63
-65
fs/bridge.go
fs/bridge.go
+63
-65
No files found.
fs/bridge.go
View file @
4df83d57
...
@@ -422,13 +422,12 @@ func (b *rawBridge) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name s
...
@@ -422,13 +422,12 @@ func (b *rawBridge) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name s
func
(
b
*
rawBridge
)
Mkdir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
MkdirIn
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Mkdir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
MkdirIn
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
var
child
*
Inode
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
var
errno
syscall
.
Errno
mops
,
ok
:=
parent
.
ops
.
(
NodeMkdirer
)
if
mops
,
ok
:=
parent
.
ops
.
(
NodeMkdirer
);
ok
{
if
!
ok
{
child
,
errno
=
mops
.
Mkdir
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
out
)
}
else
{
return
fuse
.
ENOTSUP
return
fuse
.
ENOTSUP
}
}
child
,
errno
:=
mops
.
Mkdir
(
ctx
,
name
,
input
.
Mode
,
out
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
...
@@ -451,14 +450,12 @@ func (b *rawBridge) Mkdir(cancel <-chan struct{}, input *fuse.MkdirIn, name stri
...
@@ -451,14 +450,12 @@ func (b *rawBridge) Mkdir(cancel <-chan struct{}, input *fuse.MkdirIn, name stri
func
(
b
*
rawBridge
)
Mknod
(
cancel
<-
chan
struct
{},
input
*
fuse
.
MknodIn
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Mknod
(
cancel
<-
chan
struct
{},
input
*
fuse
.
MknodIn
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
var
child
*
Inode
mops
,
ok
:=
parent
.
ops
.
(
NodeMknoder
)
var
errno
syscall
.
Errno
if
!
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
NodeMknoder
);
ok
{
child
,
errno
=
mops
.
Mknod
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
input
.
Rdev
,
out
)
}
else
{
return
fuse
.
ENOTSUP
return
fuse
.
ENOTSUP
}
}
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
child
,
errno
:=
mops
.
Mknod
(
ctx
,
name
,
input
.
Mode
,
input
.
Rdev
,
out
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
}
}
...
@@ -470,18 +467,14 @@ func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name stri
...
@@ -470,18 +467,14 @@ func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name stri
}
}
func
(
b
*
rawBridge
)
Create
(
cancel
<-
chan
struct
{},
input
*
fuse
.
CreateIn
,
name
string
,
out
*
fuse
.
CreateOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Create
(
cancel
<-
chan
struct
{},
input
*
fuse
.
CreateIn
,
name
string
,
out
*
fuse
.
CreateOut
)
fuse
.
Status
{
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
var
child
*
Inode
mops
,
ok
:=
parent
.
ops
.
(
NodeCreater
)
var
errno
syscall
.
Errno
if
!
ok
{
var
f
FileHandle
var
flags
uint32
if
mops
,
ok
:=
parent
.
ops
.
(
NodeCreater
);
ok
{
child
,
f
,
flags
,
errno
=
mops
.
Create
(
ctx
,
name
,
input
.
Flags
,
input
.
Mode
,
&
out
.
EntryOut
)
}
else
{
return
fuse
.
EROFS
return
fuse
.
EROFS
}
}
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
child
,
f
,
flags
,
errno
:=
mops
.
Create
(
ctx
,
name
,
input
.
Flags
,
input
.
Mode
,
&
out
.
EntryOut
)
if
errno
!=
0
{
if
errno
!=
0
{
if
b
.
options
.
NegativeTimeout
!=
nil
{
if
b
.
options
.
NegativeTimeout
!=
nil
{
...
@@ -632,8 +625,13 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
...
@@ -632,8 +625,13 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
target
,
_
:=
b
.
inode
(
input
.
Oldnodeid
,
0
)
target
,
_
:=
b
.
inode
(
input
.
Oldnodeid
,
0
)
if
mops
,
ok
:=
parent
.
ops
.
(
NodeLinker
);
ok
{
mops
,
ok
:=
parent
.
ops
.
(
NodeLinker
)
child
,
errno
:=
mops
.
Link
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
target
.
ops
,
name
,
out
)
if
!
ok
{
return
fuse
.
ENOTSUP
}
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
child
,
errno
:=
mops
.
Link
(
ctx
,
target
.
ops
,
name
,
out
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
}
}
...
@@ -642,15 +640,17 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
...
@@ -642,15 +640,17 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
child
.
setEntryOut
(
out
)
child
.
setEntryOut
(
out
)
b
.
setEntryOutTimeout
(
out
)
b
.
setEntryOutTimeout
(
out
)
return
fuse
.
OK
return
fuse
.
OK
}
return
fuse
.
ENOTSUP
}
}
func
(
b
*
rawBridge
)
Symlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
target
string
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Symlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
target
string
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
mops
,
ok
:=
parent
.
ops
.
(
NodeSymlinker
);
ok
{
mops
,
ok
:=
parent
.
ops
.
(
NodeSymlinker
)
child
,
status
:=
mops
.
Symlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
target
,
name
,
out
)
if
!
ok
{
return
fuse
.
ENOTSUP
}
ctx
:=
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
}
child
,
status
:=
mops
.
Symlink
(
ctx
,
target
,
name
,
out
)
if
status
!=
0
{
if
status
!=
0
{
return
errnoToStatus
(
status
)
return
errnoToStatus
(
status
)
}
}
...
@@ -659,24 +659,22 @@ func (b *rawBridge) Symlink(cancel <-chan struct{}, header *fuse.InHeader, targe
...
@@ -659,24 +659,22 @@ func (b *rawBridge) Symlink(cancel <-chan struct{}, header *fuse.InHeader, targe
child
.
setEntryOut
(
out
)
child
.
setEntryOut
(
out
)
b
.
setEntryOutTimeout
(
out
)
b
.
setEntryOutTimeout
(
out
)
return
fuse
.
OK
return
fuse
.
OK
}
return
fuse
.
ENOTSUP
}
}
func
(
b
*
rawBridge
)
Readlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
)
(
out
[]
byte
,
status
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
Readlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
)
(
out
[]
byte
,
status
fuse
.
Status
)
{
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
linker
,
ok
:=
n
.
ops
.
(
NodeReadlinker
);
ok
{
linker
,
ok
:=
n
.
ops
.
(
NodeReadlinker
)
result
,
errno
:=
linker
.
Readlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
})
if
!
ok
{
return
nil
,
fuse
.
ENOTSUP
}
ctx
:=
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
}
result
,
errno
:=
linker
.
Readlink
(
ctx
)
if
errno
!=
0
{
if
errno
!=
0
{
return
nil
,
errnoToStatus
(
errno
)
return
nil
,
errnoToStatus
(
errno
)
}
}
return
result
,
fuse
.
OK
return
result
,
fuse
.
OK
}
return
nil
,
fuse
.
ENOTSUP
}
}
func
(
b
*
rawBridge
)
Access
(
cancel
<-
chan
struct
{},
input
*
fuse
.
AccessIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Access
(
cancel
<-
chan
struct
{},
input
*
fuse
.
AccessIn
)
fuse
.
Status
{
...
@@ -742,7 +740,10 @@ func (b *rawBridge) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, a
...
@@ -742,7 +740,10 @@ func (b *rawBridge) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, a
func
(
b
*
rawBridge
)
Open
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Open
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
if
op
,
ok
:=
n
.
ops
.
(
NodeOpener
);
ok
{
op
,
ok
:=
n
.
ops
.
(
NodeOpener
)
if
!
ok
{
return
fuse
.
ENOTSUP
}
f
,
flags
,
errno
:=
op
.
Open
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
input
.
Flags
)
f
,
flags
,
errno
:=
op
.
Open
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
input
.
Flags
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
...
@@ -758,9 +759,6 @@ func (b *rawBridge) Open(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.O
...
@@ -758,9 +759,6 @@ func (b *rawBridge) Open(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.O
b
.
addBackingID
(
n
,
f
,
out
)
b
.
addBackingID
(
n
,
f
,
out
)
}
}
return
fuse
.
OK
return
fuse
.
OK
}
return
fuse
.
ENOTSUP
}
}
// must hold bridge.mu
// must hold bridge.mu
...
...
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