Fixed package fuse.
parent
e59dbd14f4
commit
3755e3c1a1
|
@ -26,7 +26,6 @@ import (
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jacobsa/fuse/fuseops"
|
|
||||||
"github.com/jacobsa/fuse/internal/buffer"
|
"github.com/jacobsa/fuse/internal/buffer"
|
||||||
"github.com/jacobsa/fuse/internal/fusekernel"
|
"github.com/jacobsa/fuse/internal/fusekernel"
|
||||||
)
|
)
|
||||||
|
@ -90,7 +89,7 @@ type Connection struct {
|
||||||
// context that the user uses to reply to the op.
|
// context that the user uses to reply to the op.
|
||||||
type opState struct {
|
type opState struct {
|
||||||
inMsg *buffer.InMessage
|
inMsg *buffer.InMessage
|
||||||
op fuseops.Op
|
op interface{}
|
||||||
opID uint32 // For logging
|
opID uint32 // For logging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +395,7 @@ func (c *Connection) writeMessage(msg []byte) (err error) {
|
||||||
// /dev/fuse. It must not be called multiple times concurrently.
|
// /dev/fuse. It must not be called multiple times concurrently.
|
||||||
//
|
//
|
||||||
// LOCKS_EXCLUDED(c.mu)
|
// LOCKS_EXCLUDED(c.mu)
|
||||||
func (c *Connection) ReadOp() (ctx context.Context, op fuseops.Op, err error) {
|
func (c *Connection) ReadOp() (ctx context.Context, op interface{}, err error) {
|
||||||
// Keep going until we find a request we know how to convert.
|
// Keep going until we find a request we know how to convert.
|
||||||
for {
|
for {
|
||||||
// Read the next message from the kernel.
|
// Read the next message from the kernel.
|
||||||
|
|
|
@ -27,13 +27,13 @@ import (
|
||||||
"github.com/jacobsa/fuse/internal/fusekernel"
|
"github.com/jacobsa/fuse/internal/fusekernel"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Convert a kernel message to an appropriate implementation of fuseops.Op. If
|
// Convert a kernel message to an appropriate op. If the op is unknown, a
|
||||||
// the op is unknown, a special unexported type will be used.
|
// special unexported type will be used.
|
||||||
//
|
//
|
||||||
// The caller is responsible for arranging for the message to be destroyed.
|
// The caller is responsible for arranging for the message to be destroyed.
|
||||||
func convertInMessage(
|
func convertInMessage(
|
||||||
m *buffer.InMessage,
|
m *buffer.InMessage,
|
||||||
protocol fusekernel.Protocol) (o fuseops.Op, err error) {
|
protocol fusekernel.Protocol) (o interface{}, err error) {
|
||||||
switch m.Header().Opcode {
|
switch m.Header().Opcode {
|
||||||
case fusekernel.OpLookup:
|
case fusekernel.OpLookup:
|
||||||
buf := m.ConsumeBytes(m.Len())
|
buf := m.ConsumeBytes(m.Len())
|
||||||
|
|
4
ops.go
4
ops.go
|
@ -28,7 +28,7 @@ import (
|
||||||
// response, return a nil response.
|
// response, return a nil response.
|
||||||
func kernelResponse(
|
func kernelResponse(
|
||||||
fuseID uint64,
|
fuseID uint64,
|
||||||
op fuseops.Op,
|
op interface{},
|
||||||
opErr error,
|
opErr error,
|
||||||
protocol fusekernel.Protocol) (msg []byte) {
|
protocol fusekernel.Protocol) (msg []byte) {
|
||||||
// If the user replied with an error, create room enough just for the result
|
// If the user replied with an error, create room enough just for the result
|
||||||
|
@ -59,7 +59,7 @@ func kernelResponse(
|
||||||
// Like kernelResponse, but assumes the user replied with a nil error to the
|
// Like kernelResponse, but assumes the user replied with a nil error to the
|
||||||
// op.
|
// op.
|
||||||
func kernelResponseForOp(
|
func kernelResponseForOp(
|
||||||
op fuseops.Op,
|
op interface{},
|
||||||
protocol fusekernel.Protocol) (b buffer.OutMessage) {
|
protocol fusekernel.Protocol) (b buffer.OutMessage) {
|
||||||
// Create the appropriate output message
|
// Create the appropriate output message
|
||||||
switch o := op.(type) {
|
switch o := op.(type) {
|
||||||
|
|
Loading…
Reference in New Issue