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
4dc22ba2
Commit
4dc22ba2
authored
Jul 23, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use package fuseshim in package fuseops.
parent
81dee67b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
77 deletions
+75
-77
fuseops/common_op.go
fuseops/common_op.go
+6
-6
fuseops/convert.go
fuseops/convert.go
+26
-28
fuseops/ops.go
fuseops/ops.go
+39
-39
fuseops/simple_types.go
fuseops/simple_types.go
+4
-4
No files found.
fuseops/common_op.go
View file @
4dc22ba2
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"reflect"
"reflect"
"strings"
"strings"
"github.com/jacobsa/
bazilfuse
"
"github.com/jacobsa/
fuse/internal/fuseshim
"
"github.com/jacobsa/reqtrace"
"github.com/jacobsa/reqtrace"
"golang.org/x/net/context"
"golang.org/x/net/context"
)
)
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
type
internalOp
interface
{
type
internalOp
interface
{
Op
Op
// Respond to the underlying
bazilfuse
request, successfully.
// Respond to the underlying
fuseshim
request, successfully.
respond
()
respond
()
}
}
...
@@ -42,8 +42,8 @@ type commonOp struct {
...
@@ -42,8 +42,8 @@ type commonOp struct {
// The op in which this struct is embedded.
// The op in which this struct is embedded.
op
internalOp
op
internalOp
// The underlying
bazilfuse
request for this op.
// The underlying
fuseshim
request for this op.
bazilReq
bazilfuse
.
Request
bazilReq
fuseshim
.
Request
// A function that can be used to log debug information about the op. The
// A function that can be used to log debug information about the op. The
// first argument is a call depth.
// first argument is a call depth.
...
@@ -81,7 +81,7 @@ func (o *commonOp) ShortDesc() (desc string) {
...
@@ -81,7 +81,7 @@ func (o *commonOp) ShortDesc() (desc string) {
func
(
o
*
commonOp
)
init
(
func
(
o
*
commonOp
)
init
(
ctx
context
.
Context
,
ctx
context
.
Context
,
op
internalOp
,
op
internalOp
,
bazilReq
bazilfuse
.
Request
,
bazilReq
fuseshim
.
Request
,
debugLog
func
(
int
,
string
,
...
interface
{}),
debugLog
func
(
int
,
string
,
...
interface
{}),
errorLogger
*
log
.
Logger
,
errorLogger
*
log
.
Logger
,
finished
func
(
error
))
{
finished
func
(
error
))
{
...
@@ -122,7 +122,7 @@ func (o *commonOp) Respond(err error) {
...
@@ -122,7 +122,7 @@ func (o *commonOp) Respond(err error) {
// Report that the user is responding.
// Report that the user is responding.
o
.
finished
(
err
)
o
.
finished
(
err
)
// If successful, we should respond to
bazilfuse
with the appropriate struct.
// If successful, we should respond to
fuseshim
with the appropriate struct.
if
err
==
nil
{
if
err
==
nil
{
o
.
op
.
respond
()
o
.
op
.
respond
()
return
return
...
...
fuseops/convert.go
View file @
4dc22ba2
...
@@ -19,14 +19,12 @@ import (
...
@@ -19,14 +19,12 @@ import (
"time"
"time"
"golang.org/x/net/context"
"golang.org/x/net/context"
"github.com/jacobsa/bazilfuse"
)
)
// This function is an implementation detail of the fuse package, and must not
// This function is an implementation detail of the fuse package, and must not
// be called by anyone else.
// be called by anyone else.
//
//
// Convert the supplied
bazilfuse
request struct to an Op. finished will be
// Convert the supplied
fuseshim
request struct to an Op. finished will be
// called with the error supplied to o.Respond when the user invokes that
// called with the error supplied to o.Respond when the user invokes that
// method, before a response is sent to the kernel.
// method, before a response is sent to the kernel.
//
//
...
@@ -36,7 +34,7 @@ import (
...
@@ -36,7 +34,7 @@ import (
// The debug logging function and error logger may be nil.
// The debug logging function and error logger may be nil.
func
Convert
(
func
Convert
(
opCtx
context
.
Context
,
opCtx
context
.
Context
,
r
bazilfuse
.
Request
,
r
fuseshim
.
Request
,
debugLogForOp
func
(
int
,
string
,
...
interface
{}),
debugLogForOp
func
(
int
,
string
,
...
interface
{}),
errorLogger
*
log
.
Logger
,
errorLogger
*
log
.
Logger
,
finished
func
(
error
))
(
o
Op
)
{
finished
func
(
error
))
(
o
Op
)
{
...
@@ -44,7 +42,7 @@ func Convert(
...
@@ -44,7 +42,7 @@ func Convert(
var
io
internalOp
var
io
internalOp
switch
typed
:=
r
.
(
type
)
{
switch
typed
:=
r
.
(
type
)
{
case
*
bazilfuse
.
LookupRequest
:
case
*
fuseshim
.
LookupRequest
:
to
:=
&
LookUpInodeOp
{
to
:=
&
LookUpInodeOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Parent
:
InodeID
(
typed
.
Header
.
Node
),
Parent
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -53,7 +51,7 @@ func Convert(
...
@@ -53,7 +51,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
GetattrRequest
:
case
*
fuseshim
.
GetattrRequest
:
to
:=
&
GetInodeAttributesOp
{
to
:=
&
GetInodeAttributesOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -61,32 +59,32 @@ func Convert(
...
@@ -61,32 +59,32 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
SetattrRequest
:
case
*
fuseshim
.
SetattrRequest
:
to
:=
&
SetInodeAttributesOp
{
to
:=
&
SetInodeAttributesOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
}
}
if
typed
.
Valid
&
bazilfuse
.
SetattrSize
!=
0
{
if
typed
.
Valid
&
fuseshim
.
SetattrSize
!=
0
{
to
.
Size
=
&
typed
.
Size
to
.
Size
=
&
typed
.
Size
}
}
if
typed
.
Valid
&
bazilfuse
.
SetattrMode
!=
0
{
if
typed
.
Valid
&
fuseshim
.
SetattrMode
!=
0
{
to
.
Mode
=
&
typed
.
Mode
to
.
Mode
=
&
typed
.
Mode
}
}
if
typed
.
Valid
&
bazilfuse
.
SetattrAtime
!=
0
{
if
typed
.
Valid
&
fuseshim
.
SetattrAtime
!=
0
{
to
.
Atime
=
&
typed
.
Atime
to
.
Atime
=
&
typed
.
Atime
}
}
if
typed
.
Valid
&
bazilfuse
.
SetattrMtime
!=
0
{
if
typed
.
Valid
&
fuseshim
.
SetattrMtime
!=
0
{
to
.
Mtime
=
&
typed
.
Mtime
to
.
Mtime
=
&
typed
.
Mtime
}
}
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
ForgetRequest
:
case
*
fuseshim
.
ForgetRequest
:
to
:=
&
ForgetInodeOp
{
to
:=
&
ForgetInodeOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -95,7 +93,7 @@ func Convert(
...
@@ -95,7 +93,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
MkdirRequest
:
case
*
fuseshim
.
MkdirRequest
:
to
:=
&
MkDirOp
{
to
:=
&
MkDirOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Parent
:
InodeID
(
typed
.
Header
.
Node
),
Parent
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -105,7 +103,7 @@ func Convert(
...
@@ -105,7 +103,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
CreateRequest
:
case
*
fuseshim
.
CreateRequest
:
to
:=
&
CreateFileOp
{
to
:=
&
CreateFileOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Parent
:
InodeID
(
typed
.
Header
.
Node
),
Parent
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -116,7 +114,7 @@ func Convert(
...
@@ -116,7 +114,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
SymlinkRequest
:
case
*
fuseshim
.
SymlinkRequest
:
to
:=
&
CreateSymlinkOp
{
to
:=
&
CreateSymlinkOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Parent
:
InodeID
(
typed
.
Header
.
Node
),
Parent
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -126,7 +124,7 @@ func Convert(
...
@@ -126,7 +124,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
RenameRequest
:
case
*
fuseshim
.
RenameRequest
:
to
:=
&
RenameOp
{
to
:=
&
RenameOp
{
bfReq
:
typed
,
bfReq
:
typed
,
OldParent
:
InodeID
(
typed
.
Header
.
Node
),
OldParent
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -137,7 +135,7 @@ func Convert(
...
@@ -137,7 +135,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
RemoveRequest
:
case
*
fuseshim
.
RemoveRequest
:
if
typed
.
Dir
{
if
typed
.
Dir
{
to
:=
&
RmDirOp
{
to
:=
&
RmDirOp
{
bfReq
:
typed
,
bfReq
:
typed
,
...
@@ -156,7 +154,7 @@ func Convert(
...
@@ -156,7 +154,7 @@ func Convert(
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
}
}
case
*
bazilfuse
.
OpenRequest
:
case
*
fuseshim
.
OpenRequest
:
if
typed
.
Dir
{
if
typed
.
Dir
{
to
:=
&
OpenDirOp
{
to
:=
&
OpenDirOp
{
bfReq
:
typed
,
bfReq
:
typed
,
...
@@ -175,7 +173,7 @@ func Convert(
...
@@ -175,7 +173,7 @@ func Convert(
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
}
}
case
*
bazilfuse
.
ReadRequest
:
case
*
fuseshim
.
ReadRequest
:
if
typed
.
Dir
{
if
typed
.
Dir
{
to
:=
&
ReadDirOp
{
to
:=
&
ReadDirOp
{
bfReq
:
typed
,
bfReq
:
typed
,
...
@@ -198,7 +196,7 @@ func Convert(
...
@@ -198,7 +196,7 @@ func Convert(
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
}
}
case
*
bazilfuse
.
ReleaseRequest
:
case
*
fuseshim
.
ReleaseRequest
:
if
typed
.
Dir
{
if
typed
.
Dir
{
to
:=
&
ReleaseDirHandleOp
{
to
:=
&
ReleaseDirHandleOp
{
bfReq
:
typed
,
bfReq
:
typed
,
...
@@ -215,7 +213,7 @@ func Convert(
...
@@ -215,7 +213,7 @@ func Convert(
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
}
}
case
*
bazilfuse
.
WriteRequest
:
case
*
fuseshim
.
WriteRequest
:
to
:=
&
WriteFileOp
{
to
:=
&
WriteFileOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -226,7 +224,7 @@ func Convert(
...
@@ -226,7 +224,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
FsyncRequest
:
case
*
fuseshim
.
FsyncRequest
:
// We don't currently support this for directories.
// We don't currently support this for directories.
if
typed
.
Dir
{
if
typed
.
Dir
{
to
:=
&
unknownOp
{}
to
:=
&
unknownOp
{}
...
@@ -242,7 +240,7 @@ func Convert(
...
@@ -242,7 +240,7 @@ func Convert(
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
}
}
case
*
bazilfuse
.
FlushRequest
:
case
*
fuseshim
.
FlushRequest
:
to
:=
&
FlushFileOp
{
to
:=
&
FlushFileOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -251,7 +249,7 @@ func Convert(
...
@@ -251,7 +249,7 @@ func Convert(
io
=
to
io
=
to
co
=
&
to
.
commonOp
co
=
&
to
.
commonOp
case
*
bazilfuse
.
ReadlinkRequest
:
case
*
fuseshim
.
ReadlinkRequest
:
to
:=
&
ReadSymlinkOp
{
to
:=
&
ReadSymlinkOp
{
bfReq
:
typed
,
bfReq
:
typed
,
Inode
:
InodeID
(
typed
.
Header
.
Node
),
Inode
:
InodeID
(
typed
.
Header
.
Node
),
...
@@ -280,8 +278,8 @@ func Convert(
...
@@ -280,8 +278,8 @@ func Convert(
func
convertAttributes
(
func
convertAttributes
(
inode
InodeID
,
inode
InodeID
,
attr
InodeAttributes
,
attr
InodeAttributes
,
expiration
time
.
Time
)
bazilfuse
.
Attr
{
expiration
time
.
Time
)
fuseshim
.
Attr
{
return
bazilfuse
.
Attr
{
return
fuseshim
.
Attr
{
Inode
:
uint64
(
inode
),
Inode
:
uint64
(
inode
),
Size
:
attr
.
Size
,
Size
:
attr
.
Size
,
Mode
:
attr
.
Mode
,
Mode
:
attr
.
Mode
,
...
@@ -317,8 +315,8 @@ func convertExpirationTime(t time.Time) (d time.Duration) {
...
@@ -317,8 +315,8 @@ func convertExpirationTime(t time.Time) (d time.Duration) {
func
convertChildInodeEntry
(
func
convertChildInodeEntry
(
in
*
ChildInodeEntry
,
in
*
ChildInodeEntry
,
out
*
bazilfuse
.
LookupResponse
)
{
out
*
fuseshim
.
LookupResponse
)
{
out
.
Node
=
bazilfuse
.
NodeID
(
in
.
Child
)
out
.
Node
=
fuseshim
.
NodeID
(
in
.
Child
)
out
.
Generation
=
uint64
(
in
.
Generation
)
out
.
Generation
=
uint64
(
in
.
Generation
)
out
.
Attr
=
convertAttributes
(
in
.
Child
,
in
.
Attributes
,
in
.
AttributesExpiration
)
out
.
Attr
=
convertAttributes
(
in
.
Child
,
in
.
Attributes
,
in
.
AttributesExpiration
)
out
.
EntryValid
=
convertExpirationTime
(
in
.
EntryExpiration
)
out
.
EntryValid
=
convertExpirationTime
(
in
.
EntryExpiration
)
...
...
fuseops/ops.go
View file @
4dc22ba2
...
@@ -19,7 +19,7 @@ import (
...
@@ -19,7 +19,7 @@ import (
"os"
"os"
"time"
"time"
"github.com/jacobsa/
bazilfuse
"
"github.com/jacobsa/
fuse/internal/fuseshim
"
"golang.org/x/net/context"
"golang.org/x/net/context"
)
)
...
@@ -55,7 +55,7 @@ type Op interface {
...
@@ -55,7 +55,7 @@ type Op interface {
// when resolving user paths to dentry structs, which are then cached.
// when resolving user paths to dentry structs, which are then cached.
type
LookUpInodeOp
struct
{
type
LookUpInodeOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
LookupRequest
bfReq
*
fuseshim
.
LookupRequest
// The ID of the directory inode to which the child belongs.
// The ID of the directory inode to which the child belongs.
Parent
InodeID
Parent
InodeID
...
@@ -84,7 +84,7 @@ func (o *LookUpInodeOp) ShortDesc() (desc string) {
...
@@ -84,7 +84,7 @@ func (o *LookUpInodeOp) ShortDesc() (desc string) {
}
}
func
(
o
*
LookUpInodeOp
)
respond
()
{
func
(
o
*
LookUpInodeOp
)
respond
()
{
resp
:=
bazilfuse
.
LookupResponse
{}
resp
:=
fuseshim
.
LookupResponse
{}
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
)
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
...
@@ -97,7 +97,7 @@ func (o *LookUpInodeOp) respond() {
...
@@ -97,7 +97,7 @@ func (o *LookUpInodeOp) respond() {
// field of ChildInodeEntry, etc.
// field of ChildInodeEntry, etc.
type
GetInodeAttributesOp
struct
{
type
GetInodeAttributesOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
GetattrRequest
bfReq
*
fuseshim
.
GetattrRequest
// The inode of interest.
// The inode of interest.
Inode
InodeID
Inode
InodeID
...
@@ -110,7 +110,7 @@ type GetInodeAttributesOp struct {
...
@@ -110,7 +110,7 @@ type GetInodeAttributesOp struct {
}
}
func
(
o
*
GetInodeAttributesOp
)
respond
()
{
func
(
o
*
GetInodeAttributesOp
)
respond
()
{
resp
:=
bazilfuse
.
GetattrResponse
{
resp
:=
fuseshim
.
GetattrResponse
{
Attr
:
convertAttributes
(
o
.
Inode
,
o
.
Attributes
,
o
.
AttributesExpiration
),
Attr
:
convertAttributes
(
o
.
Inode
,
o
.
Attributes
,
o
.
AttributesExpiration
),
}
}
...
@@ -124,7 +124,7 @@ func (o *GetInodeAttributesOp) respond() {
...
@@ -124,7 +124,7 @@ func (o *GetInodeAttributesOp) respond() {
// cases like ftrunctate(2).
// cases like ftrunctate(2).
type
SetInodeAttributesOp
struct
{
type
SetInodeAttributesOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
SetattrRequest
bfReq
*
fuseshim
.
SetattrRequest
// The inode of interest.
// The inode of interest.
Inode
InodeID
Inode
InodeID
...
@@ -143,7 +143,7 @@ type SetInodeAttributesOp struct {
...
@@ -143,7 +143,7 @@ type SetInodeAttributesOp struct {
}
}
func
(
o
*
SetInodeAttributesOp
)
respond
()
{
func
(
o
*
SetInodeAttributesOp
)
respond
()
{
resp
:=
bazilfuse
.
SetattrResponse
{
resp
:=
fuseshim
.
SetattrResponse
{
Attr
:
convertAttributes
(
o
.
Inode
,
o
.
Attributes
,
o
.
AttributesExpiration
),
Attr
:
convertAttributes
(
o
.
Inode
,
o
.
Attributes
,
o
.
AttributesExpiration
),
}
}
...
@@ -192,7 +192,7 @@ func (o *SetInodeAttributesOp) respond() {
...
@@ -192,7 +192,7 @@ func (o *SetInodeAttributesOp) respond() {
// implicitly decrementing all lookup counts to zero.
// implicitly decrementing all lookup counts to zero.
type
ForgetInodeOp
struct
{
type
ForgetInodeOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ForgetRequest
bfReq
*
fuseshim
.
ForgetRequest
// The inode whose reference count should be decremented.
// The inode whose reference count should be decremented.
Inode
InodeID
Inode
InodeID
...
@@ -223,7 +223,7 @@ func (o *ForgetInodeOp) respond() {
...
@@ -223,7 +223,7 @@ func (o *ForgetInodeOp) respond() {
// Therefore the file system should return EEXIST if the name already exists.
// Therefore the file system should return EEXIST if the name already exists.
type
MkDirOp
struct
{
type
MkDirOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
MkdirRequest
bfReq
*
fuseshim
.
MkdirRequest
// The ID of parent directory inode within which to create the child.
// The ID of parent directory inode within which to create the child.
Parent
InodeID
Parent
InodeID
...
@@ -245,7 +245,7 @@ func (o *MkDirOp) ShortDesc() (desc string) {
...
@@ -245,7 +245,7 @@ func (o *MkDirOp) ShortDesc() (desc string) {
}
}
func
(
o
*
MkDirOp
)
respond
()
{
func
(
o
*
MkDirOp
)
respond
()
{
resp
:=
bazilfuse
.
MkdirResponse
{}
resp
:=
fuseshim
.
MkdirResponse
{}
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
.
LookupResponse
)
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
.
LookupResponse
)
o
.
bfReq
.
Respond
(
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
...
@@ -264,7 +264,7 @@ func (o *MkDirOp) respond() {
...
@@ -264,7 +264,7 @@ func (o *MkDirOp) respond() {
// Therefore the file system should return EEXIST if the name already exists.
// Therefore the file system should return EEXIST if the name already exists.
type
CreateFileOp
struct
{
type
CreateFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
CreateRequest
bfReq
*
fuseshim
.
CreateRequest
// The ID of parent directory inode within which to create the child file.
// The ID of parent directory inode within which to create the child file.
Parent
InodeID
Parent
InodeID
...
@@ -274,7 +274,7 @@ type CreateFileOp struct {
...
@@ -274,7 +274,7 @@ type CreateFileOp struct {
Mode
os
.
FileMode
Mode
os
.
FileMode
// Flags for the open operation.
// Flags for the open operation.
Flags
bazilfuse
.
OpenFlags
Flags
fuseshim
.
OpenFlags
// Set by the file system: information about the inode that was created.
// Set by the file system: information about the inode that was created.
//
//
...
@@ -299,9 +299,9 @@ func (o *CreateFileOp) ShortDesc() (desc string) {
...
@@ -299,9 +299,9 @@ func (o *CreateFileOp) ShortDesc() (desc string) {
}
}
func
(
o
*
CreateFileOp
)
respond
()
{
func
(
o
*
CreateFileOp
)
respond
()
{
resp
:=
bazilfuse
.
CreateResponse
{
resp
:=
fuseshim
.
CreateResponse
{
OpenResponse
:
bazilfuse
.
OpenResponse
{
OpenResponse
:
fuseshim
.
OpenResponse
{
Handle
:
bazilfuse
.
HandleID
(
o
.
Handle
),
Handle
:
fuseshim
.
HandleID
(
o
.
Handle
),
},
},
}
}
...
@@ -315,7 +315,7 @@ func (o *CreateFileOp) respond() {
...
@@ -315,7 +315,7 @@ func (o *CreateFileOp) respond() {
// return EEXIST (cf. the notes on CreateFileOp and MkDirOp).
// return EEXIST (cf. the notes on CreateFileOp and MkDirOp).
type
CreateSymlinkOp
struct
{
type
CreateSymlinkOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
SymlinkRequest
bfReq
*
fuseshim
.
SymlinkRequest
// The ID of parent directory inode within which to create the child symlink.
// The ID of parent directory inode within which to create the child symlink.
Parent
InodeID
Parent
InodeID
...
@@ -345,7 +345,7 @@ func (o *CreateSymlinkOp) ShortDesc() (desc string) {
...
@@ -345,7 +345,7 @@ func (o *CreateSymlinkOp) ShortDesc() (desc string) {
}
}
func
(
o
*
CreateSymlinkOp
)
respond
()
{
func
(
o
*
CreateSymlinkOp
)
respond
()
{
resp
:=
bazilfuse
.
SymlinkResponse
{}
resp
:=
fuseshim
.
SymlinkResponse
{}
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
.
LookupResponse
)
convertChildInodeEntry
(
&
o
.
Entry
,
&
resp
.
LookupResponse
)
o
.
bfReq
.
Respond
(
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
...
@@ -392,7 +392,7 @@ func (o *CreateSymlinkOp) respond() {
...
@@ -392,7 +392,7 @@ func (o *CreateSymlinkOp) respond() {
//
//
type
RenameOp
struct
{
type
RenameOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
RenameRequest
bfReq
*
fuseshim
.
RenameRequest
// The old parent directory, and the name of the entry within it to be
// The old parent directory, and the name of the entry within it to be
// relocated.
// relocated.
...
@@ -419,7 +419,7 @@ func (o *RenameOp) respond() {
...
@@ -419,7 +419,7 @@ func (o *RenameOp) respond() {
// Sample implementation in ext2: ext2_rmdir (http://goo.gl/B9QmFf)
// Sample implementation in ext2: ext2_rmdir (http://goo.gl/B9QmFf)
type
RmDirOp
struct
{
type
RmDirOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
RemoveRequest
bfReq
*
fuseshim
.
RemoveRequest
// The ID of parent directory inode, and the name of the directory being
// The ID of parent directory inode, and the name of the directory being
// removed within it.
// removed within it.
...
@@ -440,7 +440,7 @@ func (o *RmDirOp) respond() {
...
@@ -440,7 +440,7 @@ func (o *RmDirOp) respond() {
// Sample implementation in ext2: ext2_unlink (http://goo.gl/hY6r6C)
// Sample implementation in ext2: ext2_unlink (http://goo.gl/hY6r6C)
type
UnlinkOp
struct
{
type
UnlinkOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
RemoveRequest
bfReq
*
fuseshim
.
RemoveRequest
// The ID of parent directory inode, and the name of the entry being removed
// The ID of parent directory inode, and the name of the entry being removed
// within it.
// within it.
...
@@ -465,13 +465,13 @@ func (o *UnlinkOp) respond() {
...
@@ -465,13 +465,13 @@ func (o *UnlinkOp) respond() {
// https://github.com/osxfuse/osxfuse/issues/199).
// https://github.com/osxfuse/osxfuse/issues/199).
type
OpenDirOp
struct
{
type
OpenDirOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
OpenRequest
bfReq
*
fuseshim
.
OpenRequest
// The ID of the inode to be opened.
// The ID of the inode to be opened.
Inode
InodeID
Inode
InodeID
// Mode and options flags.
// Mode and options flags.
Flags
bazilfuse
.
OpenFlags
Flags
fuseshim
.
OpenFlags
// Set by the file system: an opaque ID that will be echoed in follow-up
// Set by the file system: an opaque ID that will be echoed in follow-up
// calls for this directory using the same struct file in the kernel. In
// calls for this directory using the same struct file in the kernel. In
...
@@ -485,8 +485,8 @@ type OpenDirOp struct {
...
@@ -485,8 +485,8 @@ type OpenDirOp struct {
}
}
func
(
o
*
OpenDirOp
)
respond
()
{
func
(
o
*
OpenDirOp
)
respond
()
{
resp
:=
bazilfuse
.
OpenResponse
{
resp
:=
fuseshim
.
OpenResponse
{
Handle
:
bazilfuse
.
HandleID
(
o
.
Handle
),
Handle
:
fuseshim
.
HandleID
(
o
.
Handle
),
}
}
o
.
bfReq
.
Respond
(
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
...
@@ -496,7 +496,7 @@ func (o *OpenDirOp) respond() {
...
@@ -496,7 +496,7 @@ func (o *OpenDirOp) respond() {
// Read entries from a directory previously opened with OpenDir.
// Read entries from a directory previously opened with OpenDir.
type
ReadDirOp
struct
{
type
ReadDirOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ReadRequest
bfReq
*
fuseshim
.
ReadRequest
// The directory inode that we are reading, and the handle previously
// The directory inode that we are reading, and the handle previously
// returned by OpenDir when opening that inode.
// returned by OpenDir when opening that inode.
...
@@ -585,7 +585,7 @@ type ReadDirOp struct {
...
@@ -585,7 +585,7 @@ type ReadDirOp struct {
}
}
func
(
o
*
ReadDirOp
)
respond
()
{
func
(
o
*
ReadDirOp
)
respond
()
{
resp
:=
bazilfuse
.
ReadResponse
{
resp
:=
fuseshim
.
ReadResponse
{
Data
:
o
.
Data
,
Data
:
o
.
Data
,
}
}
...
@@ -603,7 +603,7 @@ func (o *ReadDirOp) respond() {
...
@@ -603,7 +603,7 @@ func (o *ReadDirOp) respond() {
// Errors from this op are ignored by the kernel (cf. http://goo.gl/RL38Do).
// Errors from this op are ignored by the kernel (cf. http://goo.gl/RL38Do).
type
ReleaseDirHandleOp
struct
{
type
ReleaseDirHandleOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ReleaseRequest
bfReq
*
fuseshim
.
ReleaseRequest
// The handle ID to be released. The kernel guarantees that this ID will not
// The handle ID to be released. The kernel guarantees that this ID will not
// be used in further calls to the file system (unless it is reissued by the
// be used in further calls to the file system (unless it is reissued by the
...
@@ -628,13 +628,13 @@ func (o *ReleaseDirHandleOp) respond() {
...
@@ -628,13 +628,13 @@ func (o *ReleaseDirHandleOp) respond() {
// (cf.https://github.com/osxfuse/osxfuse/issues/199).
// (cf.https://github.com/osxfuse/osxfuse/issues/199).
type
OpenFileOp
struct
{
type
OpenFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
OpenRequest
bfReq
*
fuseshim
.
OpenRequest
// The ID of the inode to be opened.
// The ID of the inode to be opened.
Inode
InodeID
Inode
InodeID
// Mode and options flags.
// Mode and options flags.
Flags
bazilfuse
.
OpenFlags
Flags
fuseshim
.
OpenFlags
// An opaque ID that will be echoed in follow-up calls for this file using
// An opaque ID that will be echoed in follow-up calls for this file using
// the same struct file in the kernel. In practice this usually means
// the same struct file in the kernel. In practice this usually means
...
@@ -647,8 +647,8 @@ type OpenFileOp struct {
...
@@ -647,8 +647,8 @@ type OpenFileOp struct {
}
}
func
(
o
*
OpenFileOp
)
respond
()
{
func
(
o
*
OpenFileOp
)
respond
()
{
resp
:=
bazilfuse
.
OpenResponse
{
resp
:=
fuseshim
.
OpenResponse
{
Handle
:
bazilfuse
.
HandleID
(
o
.
Handle
),
Handle
:
fuseshim
.
HandleID
(
o
.
Handle
),
}
}
o
.
bfReq
.
Respond
(
&
resp
)
o
.
bfReq
.
Respond
(
&
resp
)
...
@@ -662,7 +662,7 @@ func (o *OpenFileOp) respond() {
...
@@ -662,7 +662,7 @@ func (o *OpenFileOp) respond() {
// more.
// more.
type
ReadFileOp
struct
{
type
ReadFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ReadRequest
bfReq
*
fuseshim
.
ReadRequest
// The file inode that we are reading, and the handle previously returned by
// The file inode that we are reading, and the handle previously returned by
// CreateFile or OpenFile when opening that inode.
// CreateFile or OpenFile when opening that inode.
...
@@ -686,7 +686,7 @@ type ReadFileOp struct {
...
@@ -686,7 +686,7 @@ type ReadFileOp struct {
}
}
func
(
o
*
ReadFileOp
)
respond
()
{
func
(
o
*
ReadFileOp
)
respond
()
{
resp
:=
bazilfuse
.
ReadResponse
{
resp
:=
fuseshim
.
ReadResponse
{
Data
:
o
.
Data
,
Data
:
o
.
Data
,
}
}
...
@@ -727,7 +727,7 @@ func (o *ReadFileOp) respond() {
...
@@ -727,7 +727,7 @@ func (o *ReadFileOp) respond() {
// concurrent requests".)
// concurrent requests".)
type
WriteFileOp
struct
{
type
WriteFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
WriteRequest
bfReq
*
fuseshim
.
WriteRequest
// The file inode that we are modifying, and the handle previously returned
// The file inode that we are modifying, and the handle previously returned
// by CreateFile or OpenFile when opening that inode.
// by CreateFile or OpenFile when opening that inode.
...
@@ -766,7 +766,7 @@ type WriteFileOp struct {
...
@@ -766,7 +766,7 @@ type WriteFileOp struct {
}
}
func
(
o
*
WriteFileOp
)
respond
()
{
func
(
o
*
WriteFileOp
)
respond
()
{
resp
:=
bazilfuse
.
WriteResponse
{
resp
:=
fuseshim
.
WriteResponse
{
Size
:
len
(
o
.
Data
),
Size
:
len
(
o
.
Data
),
}
}
...
@@ -792,7 +792,7 @@ func (o *WriteFileOp) respond() {
...
@@ -792,7 +792,7 @@ func (o *WriteFileOp) respond() {
// file (but which is not used in "real" file systems).
// file (but which is not used in "real" file systems).
type
SyncFileOp
struct
{
type
SyncFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
FsyncRequest
bfReq
*
fuseshim
.
FsyncRequest
// The file and handle being sync'd.
// The file and handle being sync'd.
Inode
InodeID
Inode
InodeID
...
@@ -853,7 +853,7 @@ func (o *SyncFileOp) respond() {
...
@@ -853,7 +853,7 @@ func (o *SyncFileOp) respond() {
// return any errors that occur.
// return any errors that occur.
type
FlushFileOp
struct
{
type
FlushFileOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
FlushRequest
bfReq
*
fuseshim
.
FlushRequest
// The file and handle being flushed.
// The file and handle being flushed.
Inode
InodeID
Inode
InodeID
...
@@ -875,7 +875,7 @@ func (o *FlushFileOp) respond() {
...
@@ -875,7 +875,7 @@ func (o *FlushFileOp) respond() {
// Errors from this op are ignored by the kernel (cf. http://goo.gl/RL38Do).
// Errors from this op are ignored by the kernel (cf. http://goo.gl/RL38Do).
type
ReleaseFileHandleOp
struct
{
type
ReleaseFileHandleOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ReleaseRequest
bfReq
*
fuseshim
.
ReleaseRequest
// The handle ID to be released. The kernel guarantees that this ID will not
// The handle ID to be released. The kernel guarantees that this ID will not
// be used in further calls to the file system (unless it is reissued by the
// be used in further calls to the file system (unless it is reissued by the
...
@@ -910,7 +910,7 @@ func (o *unknownOp) respond() {
...
@@ -910,7 +910,7 @@ func (o *unknownOp) respond() {
// Read the target of a symlink inode.
// Read the target of a symlink inode.
type
ReadSymlinkOp
struct
{
type
ReadSymlinkOp
struct
{
commonOp
commonOp
bfReq
*
bazilfuse
.
ReadlinkRequest
bfReq
*
fuseshim
.
ReadlinkRequest
// The symlink inode that we are reading.
// The symlink inode that we are reading.
Inode
InodeID
Inode
InodeID
...
...
fuseops/simple_types.go
View file @
4dc22ba2
...
@@ -19,7 +19,7 @@ import (
...
@@ -19,7 +19,7 @@ import (
"os"
"os"
"time"
"time"
"github.com/jacobsa/
bazilfuse
"
"github.com/jacobsa/
fuse/internal/fuseshim
"
)
)
// A 64-bit number used to uniquely identify a file or directory in the file
// A 64-bit number used to uniquely identify a file or directory in the file
...
@@ -38,7 +38,7 @@ const RootInodeID = 1
...
@@ -38,7 +38,7 @@ const RootInodeID = 1
func
init
()
{
func
init
()
{
// Make sure the constant above is correct. We do this at runtime rather than
// Make sure the constant above is correct. We do this at runtime rather than
// defining the constant in terms of
bazilfuse
.RootID for two reasons:
// defining the constant in terms of
fuseshim
.RootID for two reasons:
//
//
// 1. Users can more clearly see that the root ID is low and can therefore
// 1. Users can more clearly see that the root ID is low and can therefore
// be used as e.g. an array index, with space reserved up to the root.
// be used as e.g. an array index, with space reserved up to the root.
...
@@ -46,12 +46,12 @@ func init() {
...
@@ -46,12 +46,12 @@ func init() {
// 2. The constant can be untyped and can therefore more easily be used as
// 2. The constant can be untyped and can therefore more easily be used as
// an array index.
// an array index.
//
//
if
RootInodeID
!=
bazilfuse
.
RootID
{
if
RootInodeID
!=
fuseshim
.
RootID
{
panic
(
panic
(
fmt
.
Sprintf
(
fmt
.
Sprintf
(
"Oops, RootInodeID is wrong: %v vs. %v"
,
"Oops, RootInodeID is wrong: %v vs. %v"
,
RootInodeID
,
RootInodeID
,
bazilfuse
.
RootID
))
fuseshim
.
RootID
))
}
}
}
}
...
...
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