vendor: roll back bazil.org/fuse to the last version which supports macOS #4393

Roll back the bazil.org/fuse update to give us some time to explore
alternatives for macOS.

See upstream issue: https://github.com/bazil/fuse/issues/224
This commit is contained in:
Nick Craig-Wood 2020-06-29 14:28:52 +01:00
parent ec4e0e4d58
commit 2aed3bf9ab
25 changed files with 1003 additions and 1414 deletions

5
go.mod
View File

@ -3,7 +3,7 @@ module github.com/rclone/rclone
go 1.14
require (
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05
bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512
cloud.google.com/go v0.59.0 // indirect
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.10.0
@ -20,6 +20,8 @@ require (
github.com/coreos/go-semver v0.3.0
github.com/djherbis/times v1.2.0
github.com/dropbox/dropbox-sdk-go-unofficial v5.6.0+incompatible
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/hanwen/go-fuse/v2 v2.0.3
@ -49,6 +51,7 @@ require (
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
github.com/stephens2424/writerset v1.0.2 // indirect
github.com/stretchr/testify v1.6.1
github.com/t3rm1n4l/go-mega v0.0.0-20200416171014-ffad7fcb44b8
github.com/xanzy/ssh-agent v0.2.1

4
go.sum
View File

@ -1,3 +1,7 @@
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc h1:utDghgcjE8u+EBjHOgYT+dJPcnDF05KqWMBcjuJy510=
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512 h1:SRsZGA7aFnCZETmov57jwPrWuTmaZK6+4R4v5FUe1/c=
bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05 h1:UrYe9YkT4Wpm6D+zByEyCJQzDqTPXqTDUI7bZ41i9VE=
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05/go.mod h1:h0h5FBYpXThbvSfTqthw+0I4nmHnhTHkO5BoOHsBWqg=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=

17
vendor/bazil.org/fuse/error_darwin.go generated vendored Normal file
View File

@ -0,0 +1,17 @@
package fuse
import (
"syscall"
)
const (
ENOATTR = Errno(syscall.ENOATTR)
)
const (
errNoXattr = ENOATTR
)
func init() {
errnoNames[errNoXattr] = "ENOATTR"
}

11
vendor/bazil.org/fuse/error_std.go generated vendored
View File

@ -4,16 +4,17 @@ package fuse
// across platforms.
//
// getxattr return value for "extended attribute does not exist" is
// ENODATA on Linux and apparently at least NetBSD. There may be a
// #define ENOATTR on Linux too, but the value is ENODATA in the
// actual syscalls. FreeBSD and OpenBSD have no ENODATA, only ENOATTR.
// ENOATTR is not in any of the standards, ENODATA exists but is only
// used for STREAMs.
// ENOATTR on OS X, and ENODATA on Linux and apparently at least
// NetBSD. There may be a #define ENOATTR on Linux too, but the value
// is ENODATA in the actual syscalls. FreeBSD and OpenBSD have no
// ENODATA, only ENOATTR. ENOATTR is not in any of the standards,
// ENODATA exists but is only used for STREAMs.
//
// Each platform will define it a errNoXattr constant, and this file
// will enforce that it implements the right interfaces and hide the
// implementation.
//
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/getxattr.2.html
// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013090.html
// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013097.html
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

476
vendor/bazil.org/fuse/fs/serve.go generated vendored
View File

@ -6,7 +6,6 @@ import (
"bytes"
"context"
"encoding/binary"
"errors"
"fmt"
"hash/fnv"
"io"
@ -20,7 +19,6 @@ import (
"bazil.org/fuse"
"bazil.org/fuse/fuseutil"
"golang.org/x/sys/unix"
)
const (
@ -258,6 +256,7 @@ func nodeAttr(ctx context.Context, n Node, attr *fuse.Attr) error {
attr.Atime = startTime
attr.Mtime = startTime
attr.Ctime = startTime
attr.Crtime = startTime
if err := n.Attr(ctx, attr); err != nil {
return err
}
@ -323,86 +322,6 @@ type HandleReleaser interface {
Release(ctx context.Context, req *fuse.ReleaseRequest) error
}
type HandlePoller interface {
// Poll checks whether the handle is currently ready for I/O, and
// may request a wakeup when it is.
//
// Poll should always return quickly. Clients waiting for
// readiness can be woken up by passing the return value of
// PollRequest.Wakeup to fs.Server.NotifyPollWakeup or
// fuse.Conn.NotifyPollWakeup.
//
// To allow supporting poll for only some of your Nodes/Handles,
// the default behavior is to report immediate readiness. If your
// FS does not support polling and you want to minimize needless
// requests and log noise, implement NodePoller and return
// syscall.ENOSYS.
//
// The Go runtime uses epoll-based I/O whenever possible, even for
// regular files.
Poll(ctx context.Context, req *fuse.PollRequest, resp *fuse.PollResponse) error
}
type NodePoller interface {
// Poll checks whether the node is currently ready for I/O, and
// may request a wakeup when it is. See HandlePoller.
Poll(ctx context.Context, req *fuse.PollRequest, resp *fuse.PollResponse) error
}
// HandleLocker contains the common operations for all kinds of file
// locks. See also lock family specific interfaces: HandleFlockLocker,
// HandlePOSIXLocker.
type HandleLocker interface {
// Lock tries to acquire a lock on a byte range of the node. If a
// conflicting lock is already held, returns syscall.EAGAIN.
//
// LockRequest.LockOwner is a file-unique identifier for this
// lock, and will be seen in calls releasing this lock
// (UnlockRequest, ReleaseRequest, FlushRequest) and also
// in e.g. ReadRequest, WriteRequest.
Lock(ctx context.Context, req *fuse.LockRequest) error
// LockWait acquires a lock on a byte range of the node, waiting
// until the lock can be obtained (or context is canceled).
LockWait(ctx context.Context, req *fuse.LockWaitRequest) error
// Unlock releases the lock on a byte range of the node. Locks can
// be released also implicitly, see HandleFlockLocker and
// HandlePOSIXLocker.
Unlock(ctx context.Context, req *fuse.UnlockRequest) error
// QueryLock returns the current state of locks held for the byte
// range of the node.
//
// See QueryLockRequest for details on how to respond.
//
// To simplify implementing this method, resp.Lock is prefilled to
// have Lock.Type F_UNLCK, and the whole struct should be
// overwritten for in case of conflicting locks.
QueryLock(ctx context.Context, req *fuse.QueryLockRequest, resp *fuse.QueryLockResponse) error
}
// HandleFlockLocker describes locking behavior unique to flock (BSD)
// locks. See HandleLocker.
type HandleFlockLocker interface {
HandleLocker
// Flock unlocking can also happen implicitly as part of Release,
// in which case Unlock is not called, and Release will have
// ReleaseFlags bit ReleaseFlockUnlock set.
HandleReleaser
}
// HandlePOSIXLocker describes locking behavior unique to POSIX (fcntl
// F_SETLK) locks. See HandleLocker.
type HandlePOSIXLocker interface {
HandleLocker
// POSIX unlocking can also happen implicitly as part of Flush,
// in which case Unlock is not called.
HandleFlusher
}
type Config struct {
// Function to send debug log messages to. If nil, use fuse.Debug.
// Note that changing this or fuse.Debug may not affect existing
@ -429,7 +348,6 @@ func New(conn *fuse.Conn, config *Config) *Server {
conn: conn,
req: map[fuse.RequestID]*serveRequest{},
nodeRef: map[Node]fuse.NodeID{},
notifyWait: map[fuse.RequestID]chan<- *fuse.NotifyReply{},
dynamicInode: GenerateDynamicInode,
}
if config != nil {
@ -462,11 +380,6 @@ type Server struct {
freeHandle []fuse.HandleID
nodeGen uint64
// pending notify upcalls to kernel
notifyMu sync.Mutex
notifySeq fuse.RequestID
notifyWait map[fuse.RequestID]chan<- *fuse.NotifyReply
// Used to ensure worker goroutines finish before Serve returns
wg sync.WaitGroup
}
@ -557,6 +470,12 @@ type serveHandle struct {
readData []byte
}
// NodeRef is deprecated. It remains here to decrease code churn on
// FUSE library users. You may remove it from your program now;
// returning the same Node values are now recognized automatically,
// without needing NodeRef.
type NodeRef struct{}
func (c *Server) saveNode(inode uint64, node Node) (id fuse.NodeID, gen uint64) {
c.meta.Lock()
defer c.meta.Unlock()
@ -603,14 +522,11 @@ type nodeRefcountDropBug struct {
Node fuse.NodeID
}
func (n nodeRefcountDropBug) String() string {
func (n *nodeRefcountDropBug) String() string {
return fmt.Sprintf("bug: trying to drop %d of %d references to %v", n.N, n.Refs, n.Node)
}
// dropNode decreases reference count for node with id by n.
// If reference count dropped to zero, returns true.
// Note that node is not guaranteed to be non-nil.
func (c *Server) dropNode(id fuse.NodeID, n uint64) (node Node, forget bool) {
func (c *Server) dropNode(id fuse.NodeID, n uint64) (forget bool) {
c.meta.Lock()
defer c.meta.Unlock()
snode := c.node[id]
@ -623,7 +539,7 @@ func (c *Server) dropNode(id fuse.NodeID, n uint64) (node Node, forget bool) {
// we may end up triggering Forget twice, but that's better
// than not even once, and that's the best we can do
return nil, true
return true
}
if n > snode.refs {
@ -637,9 +553,9 @@ func (c *Server) dropNode(id fuse.NodeID, n uint64) (node Node, forget bool) {
c.node[id] = nil
delete(c.nodeRef, snode.node)
c.freeNode = append(c.freeNode, id)
return snode.node, true
return true
}
return nil, false
return false
}
func (c *Server) dropHandle(id fuse.HandleID) {
@ -675,6 +591,8 @@ func (c *Server) getHandle(id fuse.HandleID) (shandle *serveHandle) {
}
type request struct {
Op string
Request *fuse.Header
In interface{} `json:",omitempty"`
}
@ -757,57 +675,6 @@ func (n notification) String() string {
return buf.String()
}
type notificationRequest struct {
ID fuse.RequestID
Op string
Node fuse.NodeID
Out interface{} `json:",omitempty"`
}
func (n notificationRequest) String() string {
var buf bytes.Buffer
fmt.Fprintf(&buf, ">> %s [ID=%d] %v", n.Op, n.ID, n.Node)
if n.Out != nil {
// make sure (seemingly) empty values are readable
switch n.Out.(type) {
case string:
fmt.Fprintf(&buf, " %q", n.Out)
case []byte:
fmt.Fprintf(&buf, " [% x]", n.Out)
default:
fmt.Fprintf(&buf, " %s", n.Out)
}
}
return buf.String()
}
type notificationResponse struct {
ID fuse.RequestID
Op string
In interface{} `json:",omitempty"`
Err string `json:",omitempty"`
}
func (n notificationResponse) String() string {
var buf bytes.Buffer
fmt.Fprintf(&buf, "<< [ID=%d] %s", n.ID, n.Op)
if n.In != nil {
// make sure (seemingly) empty values are readable
switch n.In.(type) {
case string:
fmt.Fprintf(&buf, " %q", n.In)
case []byte:
fmt.Fprintf(&buf, " [% x]", n.In)
default:
fmt.Fprintf(&buf, " %s", n.In)
}
}
if n.Err != "" {
fmt.Fprintf(&buf, " Err:%v", n.Err)
}
return buf.String()
}
type logMissingNode struct {
MaxNode fuse.NodeID
}
@ -896,15 +763,6 @@ func initLookupResponse(s *fuse.LookupResponse) {
s.EntryValid = entryValidTime
}
type logDuplicateRequestID struct {
New fuse.Request
Old fuse.Request
}
func (m *logDuplicateRequestID) String() string {
return fmt.Sprintf("Duplicate request: new %v, old %v", m.New, m.Old)
}
func (c *Server) serve(r fuse.Request) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -915,15 +773,11 @@ func (c *Server) serve(r fuse.Request) {
req := &serveRequest{Request: r, cancel: cancel}
switch r.(type) {
case *fuse.NotifyReply:
// don't log NotifyReply here, they're logged by the recipient
// as soon as we have decoded them to the right types
default:
c.debug(request{
Op: opName(r),
Request: r.Hdr(),
In: r,
})
}
var node Node
var snode *serveNode
c.meta.Lock()
@ -951,13 +805,15 @@ func (c *Server) serve(r fuse.Request) {
}
node = snode.node
}
if old, found := c.req[hdr.ID]; found {
c.debug(logDuplicateRequestID{
New: req.Request,
Old: old.Request,
})
}
if c.req[hdr.ID] != nil {
// This happens with OSXFUSE. Assume it's okay and
// that we'll never see an interrupt for this one.
// Otherwise everything wedges. TODO: Report to OSXFUSE?
//
// TODO this might have been because of missing done() calls
} else {
c.req[hdr.ID] = req
}
c.meta.Unlock()
// Call this before responding.
@ -1314,7 +1170,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode,
return nil
case *fuse.ForgetRequest:
_, forget := c.dropNode(r.Hdr().Node, r.N)
forget := c.dropNode(r.Hdr().Node, r.N)
if forget {
n, ok := node.(NodeForgetter)
if ok {
@ -1325,38 +1181,6 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode,
r.Respond()
return nil
case *fuse.BatchForgetRequest:
// BatchForgetRequest is hard to unit test, as it
// fundamentally relies on something unprivileged userspace
// has little control over. A root-only, Linux-only test could
// be written with `echo 2 >/proc/sys/vm/drop_caches`, but
// that would still rely on timing, the number of batches and
// operation spread over them could vary, it wouldn't run in a
// typical container regardless of privileges, and it would
// degrade performance for the rest of the machine. It would
// still probably be worth doing, just not the most fun.
// node is nil here because BatchForget as a message is not
// aimed at a any one node
for _, item := range r.Forget {
node, forget := c.dropNode(item.NodeID, item.N)
// node can be nil here if kernel vs our refcount were out
// of sync and multiple Forgets raced each other
if node == nil {
// nothing we can do about that
continue
}
if forget {
n, ok := node.(NodeForgetter)
if ok {
n.Forget()
}
}
}
done(nil)
r.Respond()
return nil
// Handle operations.
case *fuse.ReadRequest:
shandle := c.getHandle(r.Handle)
@ -1552,129 +1376,17 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode,
r.Respond()
return nil
case *fuse.PollRequest:
shandle := c.getHandle(r.Handle)
if shandle == nil {
return syscall.ESTALE
}
s := &fuse.PollResponse{}
if h, ok := shandle.handle.(HandlePoller); ok {
if err := h.Poll(ctx, r, s); err != nil {
return err
}
done(s)
r.Respond(s)
return nil
}
if n, ok := node.(NodePoller); ok {
if err := n.Poll(ctx, r, s); err != nil {
return err
}
done(s)
r.Respond(s)
return nil
}
// fallback to always claim ready
s.REvents = fuse.DefaultPollMask
done(s)
r.Respond(s)
return nil
case *fuse.NotifyReply:
c.notifyMu.Lock()
w, ok := c.notifyWait[r.Hdr().ID]
if ok {
delete(c.notifyWait, r.Hdr().ID)
}
c.notifyMu.Unlock()
if !ok {
c.debug(notificationResponse{
ID: r.Hdr().ID,
Op: "NotifyReply",
Err: "unknown ID",
})
return nil
}
w <- r
return nil
case *fuse.LockRequest:
shandle := c.getHandle(r.Handle)
if shandle == nil {
return syscall.ESTALE
}
h, ok := shandle.handle.(HandleLocker)
if !ok {
return syscall.ENOTSUP
}
if err := h.Lock(ctx, r); err != nil {
return err
}
done(nil)
r.Respond()
return nil
case *fuse.LockWaitRequest:
shandle := c.getHandle(r.Handle)
if shandle == nil {
return syscall.ESTALE
}
h, ok := shandle.handle.(HandleLocker)
if !ok {
return syscall.ENOTSUP
}
if err := h.LockWait(ctx, r); err != nil {
return err
}
done(nil)
r.Respond()
return nil
case *fuse.UnlockRequest:
shandle := c.getHandle(r.Handle)
if shandle == nil {
return syscall.ESTALE
}
h, ok := shandle.handle.(HandleLocker)
if !ok {
return syscall.ENOTSUP
}
if err := h.Unlock(ctx, r); err != nil {
return err
}
done(nil)
r.Respond()
return nil
case *fuse.QueryLockRequest:
shandle := c.getHandle(r.Handle)
if shandle == nil {
return syscall.ESTALE
}
h, ok := shandle.handle.(HandleLocker)
if !ok {
return syscall.ENOTSUP
}
s := &fuse.QueryLockResponse{
Lock: fuse.FileLock{
Type: unix.F_UNLCK,
},
}
if err := h.QueryLock(ctx, r, s); err != nil {
return err
}
done(s)
r.Respond(s)
return nil
/* case *FsyncdirRequest:
return ENOSYS
case *GetlkRequest, *SetlkRequest, *SetlkwRequest:
return ENOSYS
case *BmapRequest:
return ENOSYS
case *SetvolnameRequest, *GetxtimesRequest, *ExchangeRequest:
return ENOSYS
*/
}
@ -1810,132 +1522,6 @@ func (s *Server) InvalidateEntry(parent Node, name string) error {
return err
}
type notifyStoreRetrieveDetail struct {
Off uint64
Size uint64
}
func (i notifyStoreRetrieveDetail) String() string {
return fmt.Sprintf("Off:%d Size:%d", i.Off, i.Size)
}
type notifyRetrieveReplyDetail struct {
Size uint64
}
func (i notifyRetrieveReplyDetail) String() string {
return fmt.Sprintf("Size:%d", i.Size)
}
// NotifyStore puts data into the kernel page cache.
//
// Returns fuse.ErrNotCached if the kernel is not currently caching
// the node.
func (s *Server) NotifyStore(node Node, offset uint64, data []byte) error {
s.meta.Lock()
id, ok := s.nodeRef[node]
if ok {
snode := s.node[id]
snode.wg.Add(1)
defer snode.wg.Done()
}
s.meta.Unlock()
if !ok {
// This is what the kernel would have said, if we had been
// able to send this message; it's not cached.
return fuse.ErrNotCached
}
// Delay logging until after we can record the error too. We
// consider a /dev/fuse write to be instantaneous enough to not
// need separate before and after messages.
err := s.conn.NotifyStore(id, offset, data)
s.debug(notification{
Op: "NotifyStore",
Node: id,
Out: notifyStoreRetrieveDetail{
Off: offset,
Size: uint64(len(data)),
},
Err: errstr(err),
})
return err
}
// NotifyRetrieve gets data from the kernel page cache.
//
// Returns fuse.ErrNotCached if the kernel is not currently caching
// the node.
func (s *Server) NotifyRetrieve(node Node, offset uint64, size uint32) ([]byte, error) {
s.meta.Lock()
id, ok := s.nodeRef[node]
if ok {
snode := s.node[id]
snode.wg.Add(1)
defer snode.wg.Done()
}
s.meta.Unlock()
if !ok {
// This is what the kernel would have said, if we had been
// able to send this message; it's not cached.
return nil, fuse.ErrNotCached
}
ch := make(chan *fuse.NotifyReply, 1)
s.notifyMu.Lock()
const wraparoundThreshold = 1 << 63
if s.notifySeq > wraparoundThreshold {
s.notifyMu.Unlock()
return nil, errors.New("running out of notify sequence numbers")
}
s.notifySeq++
seq := s.notifySeq
s.notifyWait[seq] = ch
s.notifyMu.Unlock()
s.debug(notificationRequest{
ID: seq,
Op: "NotifyRetrieve",
Node: id,
Out: notifyStoreRetrieveDetail{
Off: offset,
Size: uint64(size),
},
})
retrieval, err := s.conn.NotifyRetrieve(seq, id, offset, size)
if err != nil {
s.debug(notificationResponse{
ID: seq,
Op: "NotifyRetrieve",
Err: errstr(err),
})
return nil, err
}
reply := <-ch
data := retrieval.Finish(reply)
s.debug(notificationResponse{
ID: seq,
Op: "NotifyRetrieve",
In: notifyRetrieveReplyDetail{
Size: uint64(len(data)),
},
})
return data, nil
}
func (s *Server) NotifyPollWakeup(wakeup fuse.PollWakeup) error {
// Delay logging until after we can record the error too. We
// consider a /dev/fuse write to be instantaneous enough to not
// need separate before and after messages.
err := s.conn.NotifyPollWakeup(wakeup)
s.debug(notification{
Op: "NotifyPollWakeup",
Out: wakeup,
Err: errstr(err),
})
return err
}
// DataHandle returns a read-only Handle that satisfies reads
// using the given data.
func DataHandle(data []byte) Handle {

2
vendor/bazil.org/fuse/fs/tree.go generated vendored
View File

@ -76,7 +76,7 @@ func (t *tree) add(name string, n Node) {
}
func (t *tree) Attr(ctx context.Context, a *fuse.Attr) error {
a.Mode = os.ModeDir | 0o555
a.Mode = os.ModeDir | 0555
return nil
}

721
vendor/bazil.org/fuse/fuse.go generated vendored

File diff suppressed because it is too large Load Diff

9
vendor/bazil.org/fuse/fuse_darwin.go generated vendored Normal file
View File

@ -0,0 +1,9 @@
package fuse
// Maximum file write size we are prepared to receive from the kernel.
//
// This value has to be >=16MB or OSXFUSE (3.4.0 observed) will
// forcibly close the /dev/fuse file descriptor on a Setxattr with a
// 16MB value. See TestSetxattr16MB and
// https://github.com/bazil/fuse/issues/42
const maxWrite = 16 * 1024 * 1024

311
vendor/bazil.org/fuse/fuse_kernel.go generated vendored
View File

@ -39,41 +39,20 @@ import (
"fmt"
"syscall"
"unsafe"
"golang.org/x/sys/unix"
)
// The FUSE version implemented by the package.
const (
protoVersionMinMajor = 7
protoVersionMinMinor = 17
protoVersionMinMinor = 8
protoVersionMaxMajor = 7
protoVersionMaxMinor = 17
protoVersionMaxMinor = 12
)
const (
rootID = 1
)
type attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
AtimeNsec uint32
MtimeNsec uint32
CtimeNsec uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint32
Blksize uint32
_ uint32
}
type kstatfs struct {
Blocks uint64
Bfree uint64
@ -87,6 +66,13 @@ type kstatfs struct {
Spare [6]uint32
}
type fileLock struct {
Start uint64
End uint64
Type uint32
Pid uint32
}
// GetattrFlags are bit flags that can be seen in GetattrRequest.
type GetattrFlags uint32
@ -115,17 +101,16 @@ const (
SetattrAtime SetattrValid = 1 << 4
SetattrMtime SetattrValid = 1 << 5
SetattrHandle SetattrValid = 1 << 6
// Linux only(?)
SetattrAtimeNow SetattrValid = 1 << 7
SetattrMtimeNow SetattrValid = 1 << 8
SetattrLockOwner SetattrValid = 1 << 9 // http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg27852.html
// Deprecated: Not used, OS X remnant.
// OS X only
SetattrCrtime SetattrValid = 1 << 28
// Deprecated: Not used, OS X remnant.
SetattrChgtime SetattrValid = 1 << 29
// Deprecated: Not used, OS X remnant.
SetattrBkuptime SetattrValid = 1 << 30
// Deprecated: Not used, OS X remnant.
SetattrFlags SetattrValid = 1 << 31
)
@ -139,18 +124,10 @@ func (fl SetattrValid) Handle() bool { return fl&SetattrHandle != 0 }
func (fl SetattrValid) AtimeNow() bool { return fl&SetattrAtimeNow != 0 }
func (fl SetattrValid) MtimeNow() bool { return fl&SetattrMtimeNow != 0 }
func (fl SetattrValid) LockOwner() bool { return fl&SetattrLockOwner != 0 }
// Deprecated: Not used, OS X remnant.
func (fl SetattrValid) Crtime() bool { return false }
// Deprecated: Not used, OS X remnant.
func (fl SetattrValid) Chgtime() bool { return false }
// Deprecated: Not used, OS X remnant.
func (fl SetattrValid) Bkuptime() bool { return false }
// Deprecated: Not used, OS X remnant.
func (fl SetattrValid) Flags() bool { return false }
func (fl SetattrValid) Crtime() bool { return fl&SetattrCrtime != 0 }
func (fl SetattrValid) Chgtime() bool { return fl&SetattrChgtime != 0 }
func (fl SetattrValid) Bkuptime() bool { return fl&SetattrBkuptime != 0 }
func (fl SetattrValid) Flags() bool { return fl&SetattrFlags != 0 }
func (fl SetattrValid) String() string {
return flagString(uint32(fl), setattrValidNames)
@ -167,6 +144,10 @@ var setattrValidNames = []flagName{
{uint32(SetattrAtimeNow), "SetattrAtimeNow"},
{uint32(SetattrMtimeNow), "SetattrMtimeNow"},
{uint32(SetattrLockOwner), "SetattrLockOwner"},
{uint32(SetattrCrtime), "SetattrCrtime"},
{uint32(SetattrChgtime), "SetattrChgtime"},
{uint32(SetattrBkuptime), "SetattrBkuptime"},
{uint32(SetattrFlags), "SetattrFlags"},
}
// Flags that can be seen in OpenRequest.Flags.
@ -179,7 +160,7 @@ const (
OpenReadWrite OpenFlags = syscall.O_RDWR
// File was opened in append-only mode, all writes will go to end
// of file. FreeBSD does not provide this information.
// of file. OS X does not provide this information.
OpenAppend OpenFlags = syscall.O_APPEND
OpenCreate OpenFlags = syscall.O_CREAT
OpenDirectory OpenFlags = syscall.O_DIRECTORY
@ -251,12 +232,10 @@ type OpenResponseFlags uint32
const (
OpenDirectIO OpenResponseFlags = 1 << 0 // bypass page cache for this open file
OpenKeepCache OpenResponseFlags = 1 << 1 // don't invalidate the data cache on open
OpenNonSeekable OpenResponseFlags = 1 << 2 // mark the file as non-seekable (not supported on FreeBSD)
OpenNonSeekable OpenResponseFlags = 1 << 2 // mark the file as non-seekable (not supported on OS X or FreeBSD)
// Deprecated: Not used, OS X remnant.
OpenPurgeAttr OpenResponseFlags = 1 << 30
// Deprecated: Not used, OS X remnant.
OpenPurgeUBC OpenResponseFlags = 1 << 31
OpenPurgeAttr OpenResponseFlags = 1 << 30 // OS X
OpenPurgeUBC OpenResponseFlags = 1 << 31 // OS X
)
func (fl OpenResponseFlags) String() string {
@ -267,6 +246,8 @@ var openResponseFlagNames = []flagName{
{uint32(OpenDirectIO), "OpenDirectIO"},
{uint32(OpenKeepCache), "OpenKeepCache"},
{uint32(OpenNonSeekable), "OpenNonSeekable"},
{uint32(OpenPurgeAttr), "OpenPurgeAttr"},
{uint32(OpenPurgeUBC), "OpenPurgeUBC"},
}
// The InitFlags are used in the Init exchange.
@ -274,12 +255,12 @@ type InitFlags uint32
const (
InitAsyncRead InitFlags = 1 << 0
InitPOSIXLocks InitFlags = 1 << 1
InitPosixLocks InitFlags = 1 << 1
InitFileOps InitFlags = 1 << 2
InitAtomicTrunc InitFlags = 1 << 3
InitExportSupport InitFlags = 1 << 4
InitBigWrites InitFlags = 1 << 5
// Do not mask file access modes with umask.
// Do not mask file access modes with umask. Not supported on OS X.
InitDontMask InitFlags = 1 << 6
InitSpliceWrite InitFlags = 1 << 7
InitSpliceMove InitFlags = 1 << 8
@ -293,12 +274,9 @@ const (
InitWritebackCache InitFlags = 1 << 16
InitNoOpenSupport InitFlags = 1 << 17
// Deprecated: Not used, OS X remnant.
InitCaseSensitive InitFlags = 1 << 29
// Deprecated: Not used, OS X remnant.
InitVolRename InitFlags = 1 << 30
// Deprecated: Not used, OS X remnant.
InitXtimes InitFlags = 1 << 31
InitCaseSensitive InitFlags = 1 << 29 // OS X only
InitVolRename InitFlags = 1 << 30 // OS X only
InitXtimes InitFlags = 1 << 31 // OS X only
)
type flagName struct {
@ -308,7 +286,7 @@ type flagName struct {
var initFlagNames = []flagName{
{uint32(InitAsyncRead), "InitAsyncRead"},
{uint32(InitPOSIXLocks), "InitPOSIXLocks"},
{uint32(InitPosixLocks), "InitPosixLocks"},
{uint32(InitFileOps), "InitFileOps"},
{uint32(InitAtomicTrunc), "InitAtomicTrunc"},
{uint32(InitExportSupport), "InitExportSupport"},
@ -325,6 +303,10 @@ var initFlagNames = []flagName{
{uint32(InitAsyncDIO), "InitAsyncDIO"},
{uint32(InitWritebackCache), "InitWritebackCache"},
{uint32(InitNoOpenSupport), "InitNoOpenSupport"},
{uint32(InitCaseSensitive), "InitCaseSensitive"},
{uint32(InitVolRename), "InitVolRename"},
{uint32(InitXtimes), "InitXtimes"},
}
func (fl InitFlags) String() string {
@ -355,7 +337,6 @@ type ReleaseFlags uint32
const (
ReleaseFlush ReleaseFlags = 1 << 0
ReleaseFlockUnlock ReleaseFlags = 1 << 1
)
func (fl ReleaseFlags) String() string {
@ -364,7 +345,6 @@ func (fl ReleaseFlags) String() string {
var releaseFlagNames = []flagName{
{uint32(ReleaseFlush), "ReleaseFlush"},
{uint32(ReleaseFlockUnlock), "ReleaseFlockUnlock"},
}
// Opcodes
@ -405,10 +385,13 @@ const (
opInterrupt = 36
opBmap = 37
opDestroy = 38
opIoctl = 39
opPoll = 40
opNotifyReply = 41
opBatchForget = 42
opIoctl = 39 // Linux?
opPoll = 40 // Linux?
// OS X
opSetvolname = 61
opGetxtimes = 62
opExchange = 63
)
type entryOut struct {
@ -434,16 +417,6 @@ type forgetIn struct {
Nlookup uint64
}
type forgetOne struct {
NodeID uint64
Nlookup uint64
}
type batchForgetIn struct {
Count uint32
_ uint32
}
type getattrIn struct {
GetattrFlags uint32
_ uint32
@ -466,6 +439,14 @@ func attrOutSize(p Protocol) uintptr {
}
}
// OS X
type getxtimesOut struct {
Bkuptime uint64
Crtime uint64
BkuptimeNsec uint32
CrtimeNsec uint32
}
type mknodIn struct {
Mode uint32
Rdev uint32
@ -503,16 +484,24 @@ type renameIn struct {
// "oldname\x00newname\x00" follows
}
// OS X
type exchangeIn struct {
Olddir uint64
Newdir uint64
Options uint64
// "oldname\x00newname\x00" follows
}
type linkIn struct {
Oldnodeid uint64
}
type setattrIn struct {
type setattrInCommon struct {
Valid uint32
_ uint32
Fh uint64
Size uint64
LockOwner uint64
LockOwner uint64 // unused on OS X?
Atime uint64
Mtime uint64
Unused2 uint64
@ -557,12 +546,12 @@ type releaseIn struct {
Fh uint64
Flags uint32
ReleaseFlags uint32
LockOwner uint64
LockOwner uint32
}
type flushIn struct {
Fh uint64
_ uint32
FlushFlags uint32
_ uint32
LockOwner uint64
}
@ -654,70 +643,29 @@ type fsyncIn struct {
_ uint32
}
type setxattrIn struct {
type setxattrInCommon struct {
Size uint32
Flags uint32
}
type getxattrIn struct {
func (setxattrInCommon) position() uint32 {
return 0
}
type getxattrInCommon struct {
Size uint32
_ uint32
}
func (getxattrInCommon) position() uint32 {
return 0
}
type getxattrOut struct {
Size uint32
_ uint32
}
// The LockFlags are passed in LockRequest or LockWaitRequest.
type LockFlags uint32
const (
// BSD-style flock lock (not POSIX lock)
LockFlock LockFlags = 1 << 0
)
var lockFlagNames = []flagName{
{uint32(LockFlock), "LockFlock"},
}
func (fl LockFlags) String() string {
return flagString(uint32(fl), lockFlagNames)
}
type LockType uint32
const (
// It seems FreeBSD FUSE passes these through using its local
// values, not whatever Linux enshrined into the protocol. It's
// unclear what the intended behavior is.
LockRead LockType = unix.F_RDLCK
LockWrite LockType = unix.F_WRLCK
LockUnlock LockType = unix.F_UNLCK
)
var lockTypeNames = map[LockType]string{
LockRead: "LockRead",
LockWrite: "LockWrite",
LockUnlock: "LockUnlock",
}
func (l LockType) String() string {
s, ok := lockTypeNames[l]
if ok {
return s
}
return fmt.Sprintf("LockType(%d)", l)
}
type fileLock struct {
Start uint64
End uint64
Type uint32
PID uint32
}
type lkIn struct {
Fh uint64
Owner uint64
@ -726,6 +674,15 @@ type lkIn struct {
_ uint32
}
func lkInSize(p Protocol) uintptr {
switch {
case p.LT(Protocol{7, 9}):
return unsafe.Offsetof(lkIn{}.LkFlags)
default:
return unsafe.Sizeof(lkIn{})
}
}
type lkOut struct {
Lk fileLock
}
@ -749,8 +706,7 @@ type initOut struct {
Minor uint32
MaxReadahead uint32
Flags uint32
MaxBackground uint16
CongestionThreshold uint16
Unused uint32
MaxWrite uint32
}
@ -792,6 +748,7 @@ type dirent struct {
Off uint64
Namelen uint32
Type uint32
Name [0]byte
}
const direntSize = 8 + 8 + 4 + 4
@ -800,8 +757,6 @@ const (
notifyCodePoll int32 = 1
notifyCodeInvalInode int32 = 2
notifyCodeInvalEntry int32 = 3
notifyCodeStore int32 = 4
notifyCodeRetrieve int32 = 5
)
type notifyInvalInodeOut struct {
@ -815,101 +770,3 @@ type notifyInvalEntryOut struct {
Namelen uint32
_ uint32
}
type notifyStoreOut struct {
Nodeid uint64
Offset uint64
Size uint32
_ uint32
}
type notifyRetrieveOut struct {
NotifyUnique uint64
Nodeid uint64
Offset uint64
Size uint32
_ uint32
}
type notifyRetrieveIn struct {
// matches writeIn
_ uint64
Offset uint64
Size uint32
_ uint32
_ uint64
_ uint64
}
// PollFlags are passed in PollRequest.Flags
type PollFlags uint32
const (
// PollScheduleNotify requests that a poll notification is done
// once the node is ready.
PollScheduleNotify PollFlags = 1 << 0
)
var pollFlagNames = []flagName{
{uint32(PollScheduleNotify), "PollScheduleNotify"},
}
func (fl PollFlags) String() string {
return flagString(uint32(fl), pollFlagNames)
}
type PollEvents uint32
const (
PollIn PollEvents = 0x0000_0001
PollPriority PollEvents = 0x0000_0002
PollOut PollEvents = 0x0000_0004
PollError PollEvents = 0x0000_0008
PollHangup PollEvents = 0x0000_0010
// PollInvalid doesn't seem to be used in the FUSE protocol.
PollInvalid PollEvents = 0x0000_0020
PollReadNormal PollEvents = 0x0000_0040
PollReadOutOfBand PollEvents = 0x0000_0080
PollWriteNormal PollEvents = 0x0000_0100
PollWriteOutOfBand PollEvents = 0x0000_0200
PollMessage PollEvents = 0x0000_0400
PollReadHangup PollEvents = 0x0000_2000
DefaultPollMask = PollIn | PollOut | PollReadNormal | PollWriteNormal
)
var pollEventNames = []flagName{
{uint32(PollIn), "PollIn"},
{uint32(PollPriority), "PollPriority"},
{uint32(PollOut), "PollOut"},
{uint32(PollError), "PollError"},
{uint32(PollHangup), "PollHangup"},
{uint32(PollInvalid), "PollInvalid"},
{uint32(PollReadNormal), "PollReadNormal"},
{uint32(PollReadOutOfBand), "PollReadOutOfBand"},
{uint32(PollWriteNormal), "PollWriteNormal"},
{uint32(PollWriteOutOfBand), "PollWriteOutOfBand"},
{uint32(PollMessage), "PollMessage"},
{uint32(PollReadHangup), "PollReadHangup"},
}
func (fl PollEvents) String() string {
return flagString(uint32(fl), pollEventNames)
}
type pollIn struct {
Fh uint64
Kh uint64
Flags uint32
Events uint32
}
type pollOut struct {
REvents uint32
_ uint32
}
type notifyPollWakeupOut struct {
Kh uint64
}

88
vendor/bazil.org/fuse/fuse_kernel_darwin.go generated vendored Normal file
View File

@ -0,0 +1,88 @@
package fuse
import (
"time"
)
type attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
Crtime_ uint64 // OS X only
AtimeNsec uint32
MtimeNsec uint32
CtimeNsec uint32
CrtimeNsec uint32 // OS X only
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint32
Flags_ uint32 // OS X only; see chflags(2)
Blksize uint32
padding uint32
}
func (a *attr) SetCrtime(s uint64, ns uint32) {
a.Crtime_, a.CrtimeNsec = s, ns
}
func (a *attr) SetFlags(f uint32) {
a.Flags_ = f
}
type setattrIn struct {
setattrInCommon
// OS X only
Bkuptime_ uint64
Chgtime_ uint64
Crtime uint64
BkuptimeNsec uint32
ChgtimeNsec uint32
CrtimeNsec uint32
Flags_ uint32 // see chflags(2)
}
func (in *setattrIn) BkupTime() time.Time {
return time.Unix(int64(in.Bkuptime_), int64(in.BkuptimeNsec))
}
func (in *setattrIn) Chgtime() time.Time {
return time.Unix(int64(in.Chgtime_), int64(in.ChgtimeNsec))
}
func (in *setattrIn) Flags() uint32 {
return in.Flags_
}
func openFlags(flags uint32) OpenFlags {
return OpenFlags(flags)
}
type getxattrIn struct {
getxattrInCommon
// OS X only
Position uint32
Padding uint32
}
func (g *getxattrIn) position() uint32 {
return g.Position
}
type setxattrIn struct {
setxattrInCommon
// OS X only
Position uint32
Padding uint32
}
func (s *setxattrIn) position() uint32 {
return s.Position
}

View File

@ -1,5 +1,62 @@
package fuse
import "time"
type attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
AtimeNsec uint32
MtimeNsec uint32
CtimeNsec uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint32
Blksize uint32
padding uint32
}
func (a *attr) Crtime() time.Time {
return time.Time{}
}
func (a *attr) SetCrtime(s uint64, ns uint32) {
// ignored on freebsd
}
func (a *attr) SetFlags(f uint32) {
// ignored on freebsd
}
type setattrIn struct {
setattrInCommon
}
func (in *setattrIn) BkupTime() time.Time {
return time.Time{}
}
func (in *setattrIn) Chgtime() time.Time {
return time.Time{}
}
func (in *setattrIn) Flags() uint32 {
return 0
}
func openFlags(flags uint32) OpenFlags {
return OpenFlags(flags)
}
type getxattrIn struct {
getxattrInCommon
}
type setxattrIn struct {
setxattrInCommon
}

View File

@ -1,5 +1,54 @@
package fuse
import "time"
type attr struct {
Ino uint64
Size uint64
Blocks uint64
Atime uint64
Mtime uint64
Ctime uint64
AtimeNsec uint32
MtimeNsec uint32
CtimeNsec uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint32
Blksize uint32
_ uint32
}
func (a *attr) Crtime() time.Time {
return time.Time{}
}
func (a *attr) SetCrtime(s uint64, ns uint32) {
// Ignored on Linux.
}
func (a *attr) SetFlags(f uint32) {
// Ignored on Linux.
}
type setattrIn struct {
setattrInCommon
}
func (in *setattrIn) BkupTime() time.Time {
return time.Time{}
}
func (in *setattrIn) Chgtime() time.Time {
return time.Time{}
}
func (in *setattrIn) Flags() uint32 {
return 0
}
func openFlags(flags uint32) OpenFlags {
// on amd64, the 32-bit O_LARGEFILE flag is always seen;
// on i386, the flag probably depends on the app
@ -11,3 +60,11 @@ func openFlags(flags uint32) OpenFlags {
return OpenFlags(flags)
}
type getxattrIn struct {
getxattrInCommon
}
type setxattrIn struct {
setxattrInCommon
}

1
vendor/bazil.org/fuse/fuse_kernel_std.go generated vendored Normal file
View File

@ -0,0 +1 @@
package fuse

4
vendor/bazil.org/fuse/go.mod generated vendored
View File

@ -3,10 +3,6 @@ module bazil.org/fuse
go 1.13
require (
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/stephens2424/writerset v1.0.2 // indirect
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66 // indirect
)

35
vendor/bazil.org/fuse/go.sum generated vendored
View File

@ -1,39 +1,4 @@
github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813 h1:NgO45/5mBLRVfiXerEFzH6ikcZ7DNRPS639xFg3ENzU=
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s=
github.com/stephens2424/writerset v1.0.2 h1:znRLgU6g8RS5euYRcy004XeE4W+Tu44kALzy7ghPif8=
github.com/stephens2424/writerset v1.0.2/go.mod h1:aS2JhsMn6eA7e82oNmW4rfsgAOp9COBTTl8mzkwADnc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 h1:gSbV7h1NRL2G1xTg/owz62CST1oJBmxy4QpMMregXVQ=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66 h1:EqVh9e7SxFnv93tWN3j33DpFAMKlFhaqI736Yp4kynk=
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

6
vendor/bazil.org/fuse/mount.go generated vendored
View File

@ -9,7 +9,11 @@ import (
)
var (
// Deprecated: Never used, OS X remnant.
// ErrOSXFUSENotFound is returned from Mount when the OSXFUSE
// installation is not detected.
//
// Only happens on OS X. Make sure OSXFUSE is installed, or see
// OSXFUSELocations for customization.
ErrOSXFUSENotFound = errors.New("cannot locate OSXFUSE")
)

208
vendor/bazil.org/fuse/mount_darwin.go generated vendored Normal file
View File

@ -0,0 +1,208 @@
package fuse
import (
"errors"
"fmt"
"log"
"os"
"os/exec"
"path"
"strconv"
"strings"
"sync"
"syscall"
)
var (
errNoAvail = errors.New("no available fuse devices")
errNotLoaded = errors.New("osxfuse is not loaded")
)
func loadOSXFUSE(bin string) error {
cmd := exec.Command(bin)
cmd.Dir = "/"
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
return err
}
func openOSXFUSEDev(devPrefix string) (*os.File, error) {
var f *os.File
var err error
for i := uint64(0); ; i++ {
path := devPrefix + strconv.FormatUint(i, 10)
f, err = os.OpenFile(path, os.O_RDWR, 0000)
if os.IsNotExist(err) {
if i == 0 {
// not even the first device was found -> fuse is not loaded
return nil, errNotLoaded
}
// we've run out of kernel-provided devices
return nil, errNoAvail
}
if err2, ok := err.(*os.PathError); ok && err2.Err == syscall.EBUSY {
// try the next one
continue
}
if err != nil {
return nil, err
}
return f, nil
}
}
func handleMountOSXFUSE(helperName string, errCh chan<- error) func(line string) (ignore bool) {
var noMountpointPrefix = helperName + `: `
const noMountpointSuffix = `: No such file or directory`
return func(line string) (ignore bool) {
if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) {
// re-extract it from the error message in case some layer
// changed the path
mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)]
err := &MountpointDoesNotExistError{
Path: mountpoint,
}
select {
case errCh <- err:
return true
default:
// not the first error; fall back to logging it
return false
}
}
return false
}
}
// isBoringMountOSXFUSEError returns whether the Wait error is
// uninteresting; exit status 64 is.
func isBoringMountOSXFUSEError(err error) bool {
if err, ok := err.(*exec.ExitError); ok && err.Exited() {
if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 64 {
return true
}
}
return false
}
func callMount(bin string, daemonVar string, dir string, conf *mountConfig, f *os.File, ready chan<- struct{}, errp *error) error {
for k, v := range conf.options {
if strings.Contains(k, ",") || strings.Contains(v, ",") {
// Silly limitation but the mount helper does not
// understand any escaping. See TestMountOptionCommaError.
return fmt.Errorf("mount options cannot contain commas on darwin: %q=%q", k, v)
}
}
cmd := exec.Command(
bin,
"-o", conf.getOptions(),
// Tell osxfuse-kext how large our buffer is. It must split
// writes larger than this into multiple writes.
//
// OSXFUSE seems to ignore InitResponse.MaxWrite, and uses
// this instead.
"-o", "iosize="+strconv.FormatUint(maxWrite, 10),
// refers to fd passed in cmd.ExtraFiles
"3",
dir,
)
cmd.ExtraFiles = []*os.File{f}
cmd.Env = os.Environ()
// OSXFUSE <3.3.0
cmd.Env = append(cmd.Env, "MOUNT_FUSEFS_CALL_BY_LIB=")
// OSXFUSE >=3.3.0
cmd.Env = append(cmd.Env, "MOUNT_OSXFUSE_CALL_BY_LIB=")
daemon := os.Args[0]
if daemonVar != "" {
cmd.Env = append(cmd.Env, daemonVar+"="+daemon)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err)
}
stderr, err := cmd.StderrPipe()
if err != nil {
return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err)
}
if err := cmd.Start(); err != nil {
return fmt.Errorf("mount_osxfusefs: %v", err)
}
helperErrCh := make(chan error, 1)
go func() {
var wg sync.WaitGroup
wg.Add(2)
go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout)
helperName := path.Base(bin)
go lineLogger(&wg, "mount helper error", handleMountOSXFUSE(helperName, helperErrCh), stderr)
wg.Wait()
if err := cmd.Wait(); err != nil {
// see if we have a better error to report
select {
case helperErr := <-helperErrCh:
// log the Wait error if it's not what we expected
if !isBoringMountOSXFUSEError(err) {
log.Printf("mount helper failed: %v", err)
}
// and now return what we grabbed from stderr as the real
// error
*errp = helperErr
close(ready)
return
default:
// nope, fall back to generic message
}
*errp = fmt.Errorf("mount_osxfusefs: %v", err)
close(ready)
return
}
*errp = nil
close(ready)
}()
return nil
}
func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) {
locations := conf.osxfuseLocations
if locations == nil {
locations = []OSXFUSEPaths{
OSXFUSELocationV3,
OSXFUSELocationV2,
}
}
for _, loc := range locations {
if _, err := os.Stat(loc.Mount); os.IsNotExist(err) {
// try the other locations
continue
}
f, err := openOSXFUSEDev(loc.DevicePrefix)
if err == errNotLoaded {
err = loadOSXFUSE(loc.Load)
if err != nil {
return nil, err
}
// try again
f, err = openOSXFUSEDev(loc.DevicePrefix)
}
if err != nil {
return nil, err
}
err = callMount(loc.Mount, loc.DaemonVar, dir, conf, f, ready, errp)
if err != nil {
f.Close()
return nil, err
}
return f, nil
}
return nil, ErrOSXFUSENotFound
}

View File

@ -47,7 +47,7 @@ func isBoringMountFusefsError(err error) bool {
return false
}
func mount(dir string, conf *mountConfig) (*os.File, error) {
func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) {
for k, v := range conf.options {
if strings.Contains(k, ",") || strings.Contains(v, ",") {
// Silly limitation but the mount helper does not
@ -56,8 +56,9 @@ func mount(dir string, conf *mountConfig) (*os.File, error) {
}
}
f, err := os.OpenFile("/dev/fuse", os.O_RDWR, 0o000)
f, err := os.OpenFile("/dev/fuse", os.O_RDWR, 0000)
if err != nil {
*errp = err
return nil, err
}
@ -105,5 +106,6 @@ func mount(dir string, conf *mountConfig) (*os.File, error) {
return nil, fmt.Errorf("mount_fusefs: %v", err)
}
close(ready)
return f, nil
}

View File

@ -55,7 +55,10 @@ func isBoringFusermountError(err error) bool {
return false
}
func mount(dir string, conf *mountConfig) (fusefd *os.File, err error) {
func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (fusefd *os.File, err error) {
// linux mount is never delayed
close(ready)
fds, err := syscall.Socketpair(syscall.AF_FILE, syscall.SOCK_STREAM, 0)
if err != nil {
return nil, fmt.Errorf("socketpair error: %v", err)

148
vendor/bazil.org/fuse/options.go generated vendored
View File

@ -1,6 +1,7 @@
package fuse
import (
"errors"
"strings"
)
@ -14,8 +15,7 @@ type mountConfig struct {
options map[string]string
maxReadahead uint32
initFlags InitFlags
maxBackground uint16
congestionThreshold uint16
osxfuseLocations []OSXFUSEPaths
}
func escapeComma(s string) string {
@ -59,6 +59,7 @@ func FSName(name string) MountOption {
// `fuse`. The type in a list of mounted file systems will look like
// `fuse.foo`.
//
// OS X ignores this option.
// FreeBSD ignores this option.
func Subtype(fstype string) MountOption {
return func(conf *mountConfig) error {
@ -67,40 +68,82 @@ func Subtype(fstype string) MountOption {
}
}
// Deprecated: Ignored, OS X remnant.
// LocalVolume sets the volume to be local (instead of network),
// changing the behavior of Finder, Spotlight, and such.
//
// OS X only. Others ignore this option.
func LocalVolume() MountOption {
return dummyOption
return localVolume
}
// Deprecated: Ignored, OS X remnant.
// VolumeName sets the volume name shown in Finder.
//
// OS X only. Others ignore this option.
func VolumeName(name string) MountOption {
return dummyOption
return volumeName(name)
}
// Deprecated: Ignored, OS X remnant.
// NoAppleDouble makes OSXFUSE disallow files with names used by OS X
// to store extended attributes on file systems that do not support
// them natively.
//
// Such file names are:
//
// ._*
// .DS_Store
//
// OS X only. Others ignore this option.
func NoAppleDouble() MountOption {
return dummyOption
return noAppleDouble
}
// Deprecated: Ignored, OS X remnant.
// NoAppleXattr makes OSXFUSE disallow extended attributes with the
// prefix "com.apple.". This disables persistent Finder state and
// other such information.
//
// OS X only. Others ignore this option.
func NoAppleXattr() MountOption {
return dummyOption
return noAppleXattr
}
// Deprecated: Ignored, OS X remnant.
// NoBrowse makes OSXFUSE mark the volume as non-browsable, so that
// Finder won't automatically browse it.
//
// OS X only. Others ignore this option.
func NoBrowse() MountOption {
return dummyOption
return noBrowse
}
// Deprecated: Ignored, OS X remnant.
// ExclCreate causes O_EXCL flag to be set for only "truly" exclusive creates,
// i.e. create calls for which the initiator explicitly set the O_EXCL flag.
//
// OSXFUSE expects all create calls to return EEXIST in case the file
// already exists, regardless of whether O_EXCL was specified or not.
// To ensure this behavior, it normally sets OpenExclusive for all
// Create calls, regardless of whether the original call had it set.
// For distributed filesystems, that may force every file create to be
// a distributed consensus action, causing undesirable delays.
//
// This option makes the FUSE filesystem see the original flag value,
// and better decide when to ensure global consensus.
//
// Note that returning EEXIST on existing file create is still
// expected with OSXFUSE, regardless of the presence of the
// OpenExclusive flag.
//
// For more information, see
// https://github.com/osxfuse/osxfuse/issues/209
//
// OS X only. Others ignore this options.
// Requires OSXFUSE 3.4.1 or newer.
func ExclCreate() MountOption {
return dummyOption
return exclCreate
}
// DaemonTimeout sets the time in seconds between a request and a reply before
// the FUSE mount is declared dead.
//
// FreeBSD only. Others ignore this option.
// OS X and FreeBSD only. Others ignore this option.
func DaemonTimeout(name string) MountOption {
return daemonTimeout(name)
}
@ -188,7 +231,8 @@ func WritebackCache() MountOption {
}
}
// Deprecated: Not used, OS X remnant.
// OSXFUSEPaths describes the paths used by an installed OSXFUSE
// version. See OSXFUSELocationV3 for typical values.
type OSXFUSEPaths struct {
// Prefix for the device file. At mount time, an incrementing
// number is suffixed until a free FUSE device is found.
@ -203,7 +247,7 @@ type OSXFUSEPaths struct {
DaemonVar string
}
// Deprecated: Not used, OS X remnant.
// Default paths for OSXFUSE. See OSXFUSELocations.
var (
OSXFUSELocationV3 = OSXFUSEPaths{
DevicePrefix: "/dev/osxfuse",
@ -219,9 +263,24 @@ var (
}
)
// Deprecated: Ignored, OS X remnant.
// OSXFUSELocations sets where to look for OSXFUSE files. The
// arguments are all the possible locations. The previous locations
// are replaced.
//
// Without this option, OSXFUSELocationV3 and OSXFUSELocationV2 are
// used.
//
// OS X only. Others ignore this option.
func OSXFUSELocations(paths ...OSXFUSEPaths) MountOption {
return dummyOption
return func(conf *mountConfig) error {
if len(paths) == 0 {
return errors.New("must specify at least one location for OSXFUSELocations")
}
// replace previous values, but make a copy so there's no
// worries about caller mutating their slice
conf.osxfuseLocations = append(conf.osxfuseLocations[:0], paths...)
return nil
}
}
// AllowNonEmptyMount allows the mounting over a non-empty directory.
@ -235,54 +294,3 @@ func AllowNonEmptyMount() MountOption {
return nil
}
}
// MaxBackground sets the maximum number of FUSE requests the kernel
// will submit in the background. Background requests are used when an
// immediate answer is not needed. This may help with request latency.
//
// On Linux, this can be adjusted on the fly with
// /sys/fs/fuse/connections/CONN/max_background
func MaxBackground(n uint16) MountOption {
return func(conf *mountConfig) error {
conf.maxBackground = n
return nil
}
}
// CongestionThreshold sets the number of outstanding background FUSE
// requests beyond which the kernel considers the filesystem
// congested. This may help with request latency.
//
// On Linux, this can be adjusted on the fly with
// /sys/fs/fuse/connections/CONN/congestion_threshold
func CongestionThreshold(n uint16) MountOption {
// TODO to test this, we'd have to figure out our connection id
// and read /sys
return func(conf *mountConfig) error {
conf.congestionThreshold = n
return nil
}
}
// LockingFlock enables flock-based (BSD) locking. This is mostly
// useful for distributed filesystems with global locking. Without
// this, kernel manages local locking automatically.
func LockingFlock() MountOption {
return func(conf *mountConfig) error {
conf.initFlags |= InitFlockLocks
return nil
}
}
// LockingPOSIX enables flock-based (BSD) locking. This is mostly
// useful for distributed filesystems with global locking. Without
// this, kernel manages local locking automatically.
//
// Beware POSIX locks are a broken API with unintuitive behavior for
// callers.
func LockingPOSIX() MountOption {
return func(conf *mountConfig) error {
conf.initFlags |= InitPOSIXLocks
return nil
}
}

40
vendor/bazil.org/fuse/options_darwin.go generated vendored Normal file
View File

@ -0,0 +1,40 @@
package fuse
func localVolume(conf *mountConfig) error {
conf.options["local"] = ""
return nil
}
func volumeName(name string) MountOption {
return func(conf *mountConfig) error {
conf.options["volname"] = name
return nil
}
}
func daemonTimeout(name string) MountOption {
return func(conf *mountConfig) error {
conf.options["daemon_timeout"] = name
return nil
}
}
func noAppleXattr(conf *mountConfig) error {
conf.options["noapplexattr"] = ""
return nil
}
func noAppleDouble(conf *mountConfig) error {
conf.options["noappledouble"] = ""
return nil
}
func exclCreate(conf *mountConfig) error {
conf.options["excl_create"] = ""
return nil
}
func noBrowse(conf *mountConfig) error {
conf.options["nobrowse"] = ""
return nil
}

View File

@ -1,8 +1,32 @@
package fuse
func localVolume(conf *mountConfig) error {
return nil
}
func volumeName(name string) MountOption {
return dummyOption
}
func daemonTimeout(name string) MountOption {
return func(conf *mountConfig) error {
conf.options["timeout"] = name
return nil
}
}
func noAppleXattr(conf *mountConfig) error {
return nil
}
func noAppleDouble(conf *mountConfig) error {
return nil
}
func exclCreate(conf *mountConfig) error {
return nil
}
func noBrowse(conf *mountConfig) error {
return nil
}

View File

@ -1,5 +1,29 @@
package fuse
func localVolume(conf *mountConfig) error {
return nil
}
func volumeName(name string) MountOption {
return dummyOption
}
func daemonTimeout(name string) MountOption {
return dummyOption
}
func noAppleXattr(conf *mountConfig) error {
return nil
}
func noAppleDouble(conf *mountConfig) error {
return nil
}
func exclCreate(conf *mountConfig) error {
return nil
}
func noBrowse(conf *mountConfig) error {
return nil
}

42
vendor/bazil.org/fuse/protocol.go generated vendored
View File

@ -26,56 +26,50 @@ func (a Protocol) GE(b Protocol) bool {
(a.Major == b.Major && a.Minor >= b.Minor)
}
func (a Protocol) is79() bool {
return a.GE(Protocol{7, 9})
}
// HasAttrBlockSize returns whether Attr.BlockSize is respected by the
// kernel.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasAttrBlockSize() bool {
return true
return a.is79()
}
// HasReadWriteFlags returns whether ReadRequest/WriteRequest
// fields Flags and FileFlags are valid.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasReadWriteFlags() bool {
return true
return a.is79()
}
// HasGetattrFlags returns whether GetattrRequest field Flags is
// valid.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasGetattrFlags() bool {
return true
return a.is79()
}
func (a Protocol) is710() bool {
return a.GE(Protocol{7, 10})
}
// HasOpenNonSeekable returns whether OpenResponse field Flags flag
// OpenNonSeekable is supported.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasOpenNonSeekable() bool {
return true
return a.is710()
}
func (a Protocol) is712() bool {
return a.GE(Protocol{7, 12})
}
// HasUmask returns whether CreateRequest/MkdirRequest/MknodRequest
// field Umask is valid.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasUmask() bool {
return true
return a.is712()
}
// HasInvalidate returns whether InvalidateNode/InvalidateEntry are
// supported.
//
// Deprecated: Guaranteed to be true with our minimum supported
// protocol version.
func (a Protocol) HasInvalidate() bool {
return true
return a.is712()
}

8
vendor/modules.txt vendored
View File

@ -1,4 +1,4 @@
# bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05
# bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512
## explicit
bazil.org/fuse
bazil.org/fuse/fs
@ -116,6 +116,10 @@ github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common
# github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813
## explicit
# github.com/elazarl/go-bindata-assetfs v1.0.0
## explicit
# github.com/gogo/protobuf v1.3.1
## explicit
github.com/gogo/protobuf/proto
@ -275,6 +279,8 @@ github.com/spf13/cobra/doc
# github.com/spf13/pflag v1.0.5
## explicit
github.com/spf13/pflag
# github.com/stephens2424/writerset v1.0.2
## explicit
# github.com/stretchr/testify v1.6.1
## explicit
github.com/stretchr/testify/assert