diff --git a/go.mod b/go.mod index 35cea6ae..5ee58d75 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module github.com/containerd/continuity go 1.13 require ( - bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 + // 5883e5a4b512fe2e32f915b1c66a1ddfef81cb3f is the last version to support macOS + // see https://github.com/bazil/fuse/commit/60eaf8f021ce00e5c52529cdcba1067e13c1c2c2 + bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512 github.com/dustin/go-humanize v1.0.0 github.com/golang/protobuf v1.3.5 github.com/opencontainers/go-digest v1.0.0 diff --git a/go.sum b/go.sum index a99faabd..c85814ad 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 h1:SC+c6A1qTFstO9qmB86mPV2IpYme/2ZoEQ0hrP+wo+Q= -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +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= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -98,6 +98,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +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/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -127,6 +129,7 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/bazil.org/fuse/LICENSE b/vendor/bazil.org/fuse/LICENSE index 4ac7cd83..70840eeb 100644 --- a/vendor/bazil.org/fuse/LICENSE +++ b/vendor/bazil.org/fuse/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2015 Tommi Virtanen. +Copyright (c) 2013-2019 Tommi Virtanen. Copyright (c) 2009, 2011, 2012 The Go Authors. All rights reserved. diff --git a/vendor/bazil.org/fuse/fs/serve.go b/vendor/bazil.org/fuse/fs/serve.go index e9fc5659..b754e3f9 100644 --- a/vendor/bazil.org/fuse/fs/serve.go +++ b/vendor/bazil.org/fuse/fs/serve.go @@ -3,6 +3,8 @@ package fs // import "bazil.org/fuse/fs" import ( + "bytes" + "context" "encoding/binary" "fmt" "hash/fnv" @@ -12,14 +14,9 @@ import ( "runtime" "strings" "sync" + "syscall" "time" - "golang.org/x/net/context" -) - -import ( - "bytes" - "bazil.org/fuse" "bazil.org/fuse/fuseutil" ) @@ -71,6 +68,9 @@ type FSInodeGenerator interface { // // Implementing this is useful to e.g. constrain the range of // inode values used for dynamic inodes. + // + // Non-zero return values should be greater than 1, as that is + // always used for the root inode. GenerateInode(parentInode uint64, name string) uint64 } @@ -205,7 +205,7 @@ type NodeForgetter interface { // method calls. // // Forget is not necessarily seen on unmount, as all nodes are - // implicitly forgotten as part part of the unmount. + // implicitly forgotten as part of the unmount. Forget() } @@ -435,8 +435,6 @@ func Serve(c *fuse.Conn, fs FS) error { return server.Serve(fs) } -type nothing struct{} - type serveRequest struct { Request fuse.Request cancel func() @@ -470,7 +468,6 @@ func (sn *serveNode) attr(ctx context.Context, attr *fuse.Attr) error { type serveHandle struct { handle Handle readData []byte - nodeID fuse.NodeID } // NodeRef is deprecated. It remains here to decrease code churn on @@ -504,9 +501,9 @@ func (c *Server) saveNode(inode uint64, node Node) (id fuse.NodeID, gen uint64) return id, sn.generation } -func (c *Server) saveHandle(handle Handle, nodeID fuse.NodeID) (id fuse.HandleID) { +func (c *Server) saveHandle(handle Handle) (id fuse.HandleID) { c.meta.Lock() - shandle := &serveHandle{handle: handle, nodeID: nodeID} + shandle := &serveHandle{handle: handle} if n := len(c.freeHandle); n > 0 { id = c.freeHandle[n-1] c.freeHandle = c.freeHandle[:n-1] @@ -759,7 +756,7 @@ func (e handleNotReaderError) Error() string { var _ fuse.ErrorNumber = handleNotReaderError{} func (e handleNotReaderError) Errno() fuse.Errno { - return fuse.ENOTSUP + return fuse.Errno(syscall.ENOTSUP) } func initLookupResponse(s *fuse.LookupResponse) { @@ -791,10 +788,11 @@ func (c *Server) serve(r fuse.Request) { } if snode == nil { c.meta.Unlock() + err := syscall.ESTALE c.debug(response{ Op: opName(r), Request: logResponseHeader{ID: hdr.ID}, - Error: fuse.ESTALE.ErrnoName(), + Error: fuse.Errno(err).ErrnoName(), // this is the only place that sets both Error and // Out; not sure if i want to do that; might get rid // of len(c.node) things altogether @@ -802,7 +800,7 @@ func (c *Server) serve(r fuse.Request) { MaxNode: fuse.NodeID(len(c.node)), }, }) - r.RespondError(fuse.ESTALE) + r.RespondError(err) return } node = snode.node @@ -827,17 +825,12 @@ func (c *Server) serve(r fuse.Request) { Request: logResponseHeader{ID: hdr.ID}, } if err, ok := resp.(error); ok { - msg.Error = err.Error() - if ferr, ok := err.(fuse.ErrorNumber); ok { - errno := ferr.Errno() - msg.Errno = errno.ErrnoName() - if errno == err { - // it's just a fuse.Errno with no extra detail; - // skip the textual message for log readability - msg.Error = "" - } - } else { - msg.Errno = fuse.DefaultErrno.ErrnoName() + errno := fuse.ToErrno(err) + msg.Errno = errno.ErrnoName() + if errno != err && syscall.Errno(errno) != err { + // if it's more than just a fuse.Errno or a + // syscall.Errno, log extra detail + msg.Error = err.Error() } } else { msg.Out = resp @@ -890,7 +883,7 @@ func (c *Server) serve(r fuse.Request) { // // Decent write-up on role of EINTR: // http://250bpm.com/blog:12 - err = fuse.EINTR + err = syscall.EINTR default: // nothing } @@ -910,7 +903,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, // Note: To FUSE, ENOSYS means "this server never implements this request." // It would be inappropriate to return ENOSYS for other operations in this // switch that might only be unavailable in some contexts, not all. - return fuse.ENOSYS + return syscall.ENOSYS case *fuse.StatfsRequest: s := &fuse.StatfsResponse{} @@ -959,7 +952,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, initLookupResponse(&s.LookupResponse) n, ok := node.(NodeSymlinker) if !ok { - return fuse.EIO // XXX or EPERM like Mkdir? + return syscall.EIO // XXX or EPERM like Mkdir? } n2, err := n.Symlink(ctx, r) if err != nil { @@ -975,7 +968,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.ReadlinkRequest: n, ok := node.(NodeReadlinker) if !ok { - return fuse.EIO /// XXX or EPERM? + return syscall.EIO /// XXX or EPERM? } target, err := n.Readlink(ctx, r) if err != nil { @@ -988,7 +981,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.LinkRequest: n, ok := node.(NodeLinker) if !ok { - return fuse.EIO /// XXX or EPERM? + return syscall.EIO /// XXX or EPERM? } c.meta.Lock() var oldNode *serveNode @@ -1001,7 +994,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, Request: r.Hdr(), In: r, }) - return fuse.EIO + return syscall.EIO } n2, err := n.Link(ctx, r, oldNode.node) if err != nil { @@ -1019,7 +1012,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.RemoveRequest: n, ok := node.(NodeRemover) if !ok { - return fuse.EIO /// XXX or EPERM? + return syscall.EIO /// XXX or EPERM? } err := n.Remove(ctx, r) if err != nil { @@ -1049,7 +1042,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, } else if n, ok := node.(NodeRequestLookuper); ok { n2, err = n.Lookup(ctx, r, s) } else { - return fuse.ENOENT + return syscall.ENOENT } if err != nil { return err @@ -1066,7 +1059,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, initLookupResponse(&s.LookupResponse) n, ok := node.(NodeMkdirer) if !ok { - return fuse.EPERM + return syscall.EPERM } n2, err := n.Mkdir(ctx, r) if err != nil { @@ -1091,7 +1084,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, } else { h2 = node } - s.Handle = c.saveHandle(h2, r.Hdr().Node) + s.Handle = c.saveHandle(h2) done(s) r.Respond(s) return nil @@ -1100,7 +1093,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, n, ok := node.(NodeCreater) if !ok { // If we send back ENOSYS, FUSE will try mknod+open. - return fuse.EPERM + return syscall.EPERM } s := &fuse.CreateResponse{OpenResponse: fuse.OpenResponse{}} initLookupResponse(&s.LookupResponse) @@ -1111,7 +1104,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { return err } - s.Handle = c.saveHandle(h2, r.Hdr().Node) + s.Handle = c.saveHandle(h2) done(s) r.Respond(s) return nil @@ -1119,7 +1112,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.GetxattrRequest: n, ok := node.(NodeGetxattrer) if !ok { - return fuse.ENOTSUP + return syscall.ENOTSUP } s := &fuse.GetxattrResponse{} err := n.Getxattr(ctx, r, s) @@ -1127,7 +1120,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, return err } if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return fuse.ERANGE + return syscall.ERANGE } done(s) r.Respond(s) @@ -1136,7 +1129,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.ListxattrRequest: n, ok := node.(NodeListxattrer) if !ok { - return fuse.ENOTSUP + return syscall.ENOTSUP } s := &fuse.ListxattrResponse{} err := n.Listxattr(ctx, r, s) @@ -1144,7 +1137,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, return err } if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return fuse.ERANGE + return syscall.ERANGE } done(s) r.Respond(s) @@ -1153,7 +1146,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.SetxattrRequest: n, ok := node.(NodeSetxattrer) if !ok { - return fuse.ENOTSUP + return syscall.ENOTSUP } err := n.Setxattr(ctx, r) if err != nil { @@ -1166,7 +1159,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.RemovexattrRequest: n, ok := node.(NodeRemovexattrer) if !ok { - return fuse.ENOTSUP + return syscall.ENOTSUP } err := n.Removexattr(ctx, r) if err != nil { @@ -1192,7 +1185,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.ReadRequest: shandle := c.getHandle(r.Handle) if shandle == nil { - return fuse.ESTALE + return syscall.ESTALE } handle := shandle.handle @@ -1257,7 +1250,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.WriteRequest: shandle := c.getHandle(r.Handle) if shandle == nil { - return fuse.ESTALE + return syscall.ESTALE } s := &fuse.WriteResponse{} @@ -1269,12 +1262,12 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, r.Respond(s) return nil } - return fuse.EIO + return syscall.EIO case *fuse.FlushRequest: shandle := c.getHandle(r.Handle) if shandle == nil { - return fuse.ESTALE + return syscall.ESTALE } handle := shandle.handle @@ -1290,7 +1283,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.ReleaseRequest: shandle := c.getHandle(r.Handle) if shandle == nil { - return fuse.ESTALE + return syscall.ESTALE } handle := shandle.handle @@ -1326,11 +1319,11 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, Request: r.Hdr(), In: r, }) - return fuse.EIO + return syscall.EIO } n, ok := node.(NodeRenamer) if !ok { - return fuse.EIO // XXX or EPERM like Mkdir? + return syscall.EIO // XXX or EPERM like Mkdir? } err := n.Rename(ctx, r, newDirNode.node) if err != nil { @@ -1343,7 +1336,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.MknodRequest: n, ok := node.(NodeMknoder) if !ok { - return fuse.EIO + return syscall.EIO } n2, err := n.Mknod(ctx, r) if err != nil { @@ -1361,7 +1354,7 @@ func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, case *fuse.FsyncRequest: n, ok := node.(NodeFsyncer) if !ok { - return fuse.EIO + return syscall.EIO } err := n.Fsync(ctx, r) if err != nil { @@ -1557,11 +1550,12 @@ func GenerateDynamicInode(parent uint64, name string) uint64 { var inode uint64 for { inode = h.Sum64() - if inode != 0 { + if inode > 1 { break } - // there's a tiny probability that result is zero; change the - // input a little and try again + // there's a tiny probability that result is zero or the + // hardcoded root inode 1; change the input a little and try + // again _, _ = h.Write([]byte{'x'}) } return inode diff --git a/vendor/bazil.org/fuse/fs/tree.go b/vendor/bazil.org/fuse/fs/tree.go index 7e078045..329be138 100644 --- a/vendor/bazil.org/fuse/fs/tree.go +++ b/vendor/bazil.org/fuse/fs/tree.go @@ -3,14 +3,12 @@ package fs import ( + "context" "os" pathpkg "path" "strings" + "syscall" - "golang.org/x/net/context" -) - -import ( "bazil.org/fuse" ) @@ -87,7 +85,7 @@ func (t *tree) Lookup(ctx context.Context, name string) (Node, error) { if n != nil { return n, nil } - return nil, fuse.ENOENT + return nil, syscall.ENOENT } func (t *tree) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { diff --git a/vendor/bazil.org/fuse/fuse.go b/vendor/bazil.org/fuse/fuse.go index 6db0ef29..b774a25c 100644 --- a/vendor/bazil.org/fuse/fuse.go +++ b/vendor/bazil.org/fuse/fuse.go @@ -79,7 +79,7 @@ // is cancelled and no longer needed, the context will be cancelled. // Blocking operations should select on a receive from ctx.Done() and attempt to // abort the operation early if the receive succeeds (meaning the channel is closed). -// To indicate that the operation failed because it was aborted, return fuse.EINTR. +// To indicate that the operation failed because it was aborted, return syscall.EINTR. // // If an operation does not block for an indefinite amount of time, supporting // cancellation is not necessary. @@ -90,8 +90,8 @@ // inspect req.Pid, req.Uid, and req.Gid as necessary to implement // permission checking. The kernel FUSE layer normally prevents other // users from accessing the FUSE file system (to change this, see -// AllowOther, AllowRoot), but does not enforce access modes (to -// change this, see DefaultPermissions). +// AllowOther), but does not enforce access modes (to change this, see +// DefaultPermissions). // // Mount Options // @@ -323,6 +323,8 @@ type ErrorNumber interface { Errno() Errno } +// Deprecated: Return a syscall.Errno directly. See ToErrno for exact +// rules. const ( // ENOSYS indicates that the call is not supported. ENOSYS = Errno(syscall.ENOSYS) @@ -348,13 +350,14 @@ const ( const DefaultErrno = EIO var errnoNames = map[Errno]string{ - ENOSYS: "ENOSYS", - ESTALE: "ESTALE", - ENOENT: "ENOENT", - EIO: "EIO", - EPERM: "EPERM", - EINTR: "EINTR", - EEXIST: "EEXIST", + ENOSYS: "ENOSYS", + ESTALE: "ESTALE", + ENOENT: "ENOENT", + EIO: "EIO", + EPERM: "EPERM", + EINTR: "EINTR", + EEXIST: "EEXIST", + Errno(syscall.ENAMETOOLONG): "ENAMETOOLONG", } // Errno implements Error and ErrorNumber using a syscall.Errno. @@ -390,11 +393,28 @@ func (e Errno) MarshalText() ([]byte, error) { return []byte(s), nil } -func (h *Header) RespondError(err error) { - errno := DefaultErrno - if ferr, ok := err.(ErrorNumber); ok { - errno = ferr.Errno() +// ToErrno converts arbitrary errors to Errno. +// +// If the underlying type of err is syscall.Errno, it is used +// directly. No unwrapping is done, to prevent wrong errors from +// leaking via e.g. *os.PathError. +// +// If err unwraps to implement ErrorNumber, that is used. +// +// Finally, returns DefaultErrno. +func ToErrno(err error) Errno { + if err, ok := err.(syscall.Errno); ok { + return Errno(err) } + var errnum ErrorNumber + if errors.As(err, &errnum) { + return Errno(errnum.Errno()) + } + return DefaultErrno +} + +func (h *Header) RespondError(err error) { + errno := ToErrno(err) // FUSE uses negative errors! // TODO: File bug report against OSXFUSE: positive error causes kernel panic. buf := newBuffer(0) @@ -495,9 +515,15 @@ func fileMode(unixMode uint32) os.FileMode { mode |= os.ModeSymlink case syscall.S_IFSOCK: mode |= os.ModeSocket + case 0: + // apparently there's plenty of times when the FUSE request + // does not contain the file type + mode |= os.ModeIrregular default: - // no idea - mode |= os.ModeDevice + // not just unavailable in the kernel codepath; known to + // kernel but unrecognized by us + Debug(fmt.Sprintf("unrecognized file mode type: %04o", unixMode)) + mode |= os.ModeIrregular } if unixMode&syscall.S_ISUID != 0 { mode |= os.ModeSetuid @@ -1004,7 +1030,12 @@ loop: } case opBmap: - panic("opBmap") + // bmap asks to map a byte offset within a file to a single + // uint64. On Linux, it triggers only with blkdev fuse mounts, + // that claim to be backed by an actual block device. FreeBSD + // seems to send it for just any fuse mount, whether there's a + // block device involved or not. + goto unrecognized case opDestroy: req = &DestroyRequest{ @@ -1262,6 +1293,7 @@ func (r *StatfsRequest) Respond(resp *StatfsResponse) { Bfree: resp.Bfree, Bavail: resp.Bavail, Files: resp.Files, + Ffree: resp.Ffree, Bsize: resp.Bsize, Namelen: resp.Namelen, Frsize: resp.Frsize, @@ -1383,8 +1415,6 @@ func (a *Attr) attr(out *attr, proto Protocol) { if proto.GE(Protocol{7, 9}) { out.Blksize = a.BlockSize } - - return } // A GetattrRequest asks for the metadata for the file denoted by r.Node. @@ -1463,7 +1493,7 @@ type GetxattrResponse struct { } func (r *GetxattrResponse) String() string { - return fmt.Sprintf("Getxattr %x", r.Xattr) + return fmt.Sprintf("Getxattr %q", r.Xattr) } // A ListxattrRequest asks to list the extended attributes associated with r.Node. @@ -1499,7 +1529,7 @@ type ListxattrResponse struct { } func (r *ListxattrResponse) String() string { - return fmt.Sprintf("Listxattr %x", r.Xattr) + return fmt.Sprintf("Listxattr %q", r.Xattr) } // Append adds an extended attribute name to the response. @@ -1564,7 +1594,7 @@ func trunc(b []byte, max int) ([]byte, string) { func (r *SetxattrRequest) String() string { xattr, tail := trunc(r.Xattr, 16) - return fmt.Sprintf("Setxattr [%s] %q %x%s fl=%v @%#x", &r.Header, r.Name, xattr, tail, r.Flags, r.Position) + return fmt.Sprintf("Setxattr [%s] %q %q%s fl=%v @%#x", &r.Header, r.Name, xattr, tail, r.Flags, r.Position) } // Respond replies to the request, indicating that the extended attribute was set. @@ -1985,9 +2015,14 @@ type SetattrRequest struct { Size uint64 Atime time.Time Mtime time.Time - Mode os.FileMode - Uid uint32 - Gid uint32 + // Mode is the file mode to set (when valid). + // + // The type of the node (as in os.ModeType, os.ModeDir etc) is not + // guaranteed to be sent by the kernel, in which case + // os.ModeIrregular will be set. + Mode os.FileMode + Uid uint32 + Gid uint32 // OS X only Bkuptime time.Time diff --git a/vendor/bazil.org/fuse/fuse_kernel.go b/vendor/bazil.org/fuse/fuse_kernel.go index 87c5ca1d..416d32aa 100644 --- a/vendor/bazil.org/fuse/fuse_kernel.go +++ b/vendor/bazil.org/fuse/fuse_kernel.go @@ -232,7 +232,7 @@ 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 OS X) + OpenNonSeekable OpenResponseFlags = 1 << 2 // mark the file as non-seekable (not supported on OS X or FreeBSD) OpenPurgeAttr OpenResponseFlags = 1 << 30 // OS X OpenPurgeUBC OpenResponseFlags = 1 << 31 // OS X @@ -633,8 +633,6 @@ func (fl WriteFlags) String() string { return flagString(uint32(fl), writeFlagNames) } -const compatStatfsSize = 48 - type statfsOut struct { St kstatfs } diff --git a/vendor/bazil.org/fuse/fuse_kernel_linux.go b/vendor/bazil.org/fuse/fuse_kernel_linux.go index d3ba8661..fe603de9 100644 --- a/vendor/bazil.org/fuse/fuse_kernel_linux.go +++ b/vendor/bazil.org/fuse/fuse_kernel_linux.go @@ -18,7 +18,7 @@ type attr struct { Gid uint32 Rdev uint32 Blksize uint32 - padding uint32 + _ uint32 } func (a *attr) Crtime() time.Time { diff --git a/vendor/bazil.org/fuse/go.mod b/vendor/bazil.org/fuse/go.mod new file mode 100644 index 00000000..a80fda91 --- /dev/null +++ b/vendor/bazil.org/fuse/go.mod @@ -0,0 +1,8 @@ +module bazil.org/fuse + +go 1.13 + +require ( + github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c + golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 +) diff --git a/vendor/bazil.org/fuse/go.sum b/vendor/bazil.org/fuse/go.sum new file mode 100644 index 00000000..ef81dc7c --- /dev/null +++ b/vendor/bazil.org/fuse/go.sum @@ -0,0 +1,4 @@ +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= +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= diff --git a/vendor/bazil.org/fuse/options.go b/vendor/bazil.org/fuse/options.go index 65ce8a54..f09ffd4e 100644 --- a/vendor/bazil.org/fuse/options.go +++ b/vendor/bazil.org/fuse/options.go @@ -106,6 +106,14 @@ func NoAppleXattr() MountOption { return noAppleXattr } +// 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 noBrowse +} + // 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. // @@ -140,36 +148,14 @@ func DaemonTimeout(name string) MountOption { return daemonTimeout(name) } -var ErrCannotCombineAllowOtherAndAllowRoot = errors.New("cannot combine AllowOther and AllowRoot") - // AllowOther allows other users to access the file system. -// -// Only one of AllowOther or AllowRoot can be used. func AllowOther() MountOption { return func(conf *mountConfig) error { - if _, ok := conf.options["allow_root"]; ok { - return ErrCannotCombineAllowOtherAndAllowRoot - } conf.options["allow_other"] = "" return nil } } -// AllowRoot allows other users to access the file system. -// -// Only one of AllowOther or AllowRoot can be used. -// -// FreeBSD ignores this option. -func AllowRoot() MountOption { - return func(conf *mountConfig) error { - if _, ok := conf.options["allow_other"]; ok { - return ErrCannotCombineAllowOtherAndAllowRoot - } - conf.options["allow_root"] = "" - return nil - } -} - // AllowDev enables interpreting character or block special devices on the // filesystem. func AllowDev() MountOption { @@ -193,7 +179,7 @@ func AllowSUID() MountOption { // // Without this option, the Node itself decides what is and is not // allowed. This is normally ok because FUSE file systems cannot be -// accessed by other users without AllowOther/AllowRoot. +// accessed by other users without AllowOther. // // FreeBSD ignores this option. func DefaultPermissions() MountOption { diff --git a/vendor/bazil.org/fuse/options_darwin.go b/vendor/bazil.org/fuse/options_darwin.go index faa9d78e..a85e64cb 100644 --- a/vendor/bazil.org/fuse/options_darwin.go +++ b/vendor/bazil.org/fuse/options_darwin.go @@ -33,3 +33,8 @@ func exclCreate(conf *mountConfig) error { conf.options["excl_create"] = "" return nil } + +func noBrowse(conf *mountConfig) error { + conf.options["nobrowse"] = "" + return nil +} diff --git a/vendor/bazil.org/fuse/options_freebsd.go b/vendor/bazil.org/fuse/options_freebsd.go index 7c164b13..2c956e7f 100644 --- a/vendor/bazil.org/fuse/options_freebsd.go +++ b/vendor/bazil.org/fuse/options_freebsd.go @@ -26,3 +26,7 @@ func noAppleDouble(conf *mountConfig) error { func exclCreate(conf *mountConfig) error { return nil } + +func noBrowse(conf *mountConfig) error { + return nil +} diff --git a/vendor/bazil.org/fuse/options_linux.go b/vendor/bazil.org/fuse/options_linux.go index 13f0896d..2c925b18 100644 --- a/vendor/bazil.org/fuse/options_linux.go +++ b/vendor/bazil.org/fuse/options_linux.go @@ -23,3 +23,7 @@ func noAppleDouble(conf *mountConfig) error { func exclCreate(conf *mountConfig) error { return nil } + +func noBrowse(conf *mountConfig) error { + return nil +} diff --git a/vendor/golang.org/x/net/AUTHORS b/vendor/golang.org/x/net/AUTHORS deleted file mode 100644 index 15167cd7..00000000 --- a/vendor/golang.org/x/net/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/net/CONTRIBUTORS b/vendor/golang.org/x/net/CONTRIBUTORS deleted file mode 100644 index 1c4577e9..00000000 --- a/vendor/golang.org/x/net/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/golang.org/x/net/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/net/PATENTS b/vendor/golang.org/x/net/PATENTS deleted file mode 100644 index 73309904..00000000 --- a/vendor/golang.org/x/net/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go deleted file mode 100644 index a3c021d3..00000000 --- a/vendor/golang.org/x/net/context/context.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package context defines the Context type, which carries deadlines, -// cancelation signals, and other request-scoped values across API boundaries -// and between processes. -// As of Go 1.7 this package is available in the standard library under the -// name context. https://golang.org/pkg/context. -// -// Incoming requests to a server should create a Context, and outgoing calls to -// servers should accept a Context. The chain of function calls between must -// propagate the Context, optionally replacing it with a modified copy created -// using WithDeadline, WithTimeout, WithCancel, or WithValue. -// -// Programs that use Contexts should follow these rules to keep interfaces -// consistent across packages and enable static analysis tools to check context -// propagation: -// -// Do not store Contexts inside a struct type; instead, pass a Context -// explicitly to each function that needs it. The Context should be the first -// parameter, typically named ctx: -// -// func DoSomething(ctx context.Context, arg Arg) error { -// // ... use ctx ... -// } -// -// Do not pass a nil Context, even if a function permits it. Pass context.TODO -// if you are unsure about which Context to use. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -// -// The same Context may be passed to functions running in different goroutines; -// Contexts are safe for simultaneous use by multiple goroutines. -// -// See http://blog.golang.org/context for example code for a server that uses -// Contexts. -package context // import "golang.org/x/net/context" - -// Background returns a non-nil, empty Context. It is never canceled, has no -// values, and has no deadline. It is typically used by the main function, -// initialization, and tests, and as the top-level Context for incoming -// requests. -func Background() Context { - return background -} - -// TODO returns a non-nil, empty Context. Code should use context.TODO when -// it's unclear which Context to use or it is not yet available (because the -// surrounding function has not yet been extended to accept a Context -// parameter). TODO is recognized by static analysis tools that determine -// whether Contexts are propagated correctly in a program. -func TODO() Context { - return todo -} diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go deleted file mode 100644 index d20f52b7..00000000 --- a/vendor/golang.org/x/net/context/go17.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -package context - -import ( - "context" // standard library's context, as of Go 1.7 - "time" -) - -var ( - todo = context.TODO() - background = context.Background() -) - -// Canceled is the error returned by Context.Err when the context is canceled. -var Canceled = context.Canceled - -// DeadlineExceeded is the error returned by Context.Err when the context's -// deadline passes. -var DeadlineExceeded = context.DeadlineExceeded - -// WithCancel returns a copy of parent with a new Done channel. The returned -// context's Done channel is closed when the returned cancel function is called -// or when the parent context's Done channel is closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { - ctx, f := context.WithCancel(parent) - return ctx, CancelFunc(f) -} - -// WithDeadline returns a copy of the parent context with the deadline adjusted -// to be no later than d. If the parent's deadline is already earlier than d, -// WithDeadline(parent, d) is semantically equivalent to parent. The returned -// context's Done channel is closed when the deadline expires, when the returned -// cancel function is called, or when the parent context's Done channel is -// closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { - ctx, f := context.WithDeadline(parent, deadline) - return ctx, CancelFunc(f) -} - -// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete: -// -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } -func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { - return WithDeadline(parent, time.Now().Add(timeout)) -} - -// WithValue returns a copy of parent in which the value associated with key is -// val. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -func WithValue(parent Context, key interface{}, val interface{}) Context { - return context.WithValue(parent, key, val) -} diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go deleted file mode 100644 index d88bd1db..00000000 --- a/vendor/golang.org/x/net/context/go19.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.9 - -package context - -import "context" // standard library's context, as of Go 1.7 - -// A Context carries a deadline, a cancelation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -type Context = context.Context - -// A CancelFunc tells an operation to abandon its work. -// A CancelFunc does not wait for the work to stop. -// After the first call, subsequent calls to a CancelFunc do nothing. -type CancelFunc = context.CancelFunc diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go deleted file mode 100644 index 0f35592d..00000000 --- a/vendor/golang.org/x/net/context/pre_go17.go +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.7 - -package context - -import ( - "errors" - "fmt" - "sync" - "time" -) - -// An emptyCtx is never canceled, has no values, and has no deadline. It is not -// struct{}, since vars of this type must have distinct addresses. -type emptyCtx int - -func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { - return -} - -func (*emptyCtx) Done() <-chan struct{} { - return nil -} - -func (*emptyCtx) Err() error { - return nil -} - -func (*emptyCtx) Value(key interface{}) interface{} { - return nil -} - -func (e *emptyCtx) String() string { - switch e { - case background: - return "context.Background" - case todo: - return "context.TODO" - } - return "unknown empty Context" -} - -var ( - background = new(emptyCtx) - todo = new(emptyCtx) -) - -// Canceled is the error returned by Context.Err when the context is canceled. -var Canceled = errors.New("context canceled") - -// DeadlineExceeded is the error returned by Context.Err when the context's -// deadline passes. -var DeadlineExceeded = errors.New("context deadline exceeded") - -// WithCancel returns a copy of parent with a new Done channel. The returned -// context's Done channel is closed when the returned cancel function is called -// or when the parent context's Done channel is closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { - c := newCancelCtx(parent) - propagateCancel(parent, c) - return c, func() { c.cancel(true, Canceled) } -} - -// newCancelCtx returns an initialized cancelCtx. -func newCancelCtx(parent Context) *cancelCtx { - return &cancelCtx{ - Context: parent, - done: make(chan struct{}), - } -} - -// propagateCancel arranges for child to be canceled when parent is. -func propagateCancel(parent Context, child canceler) { - if parent.Done() == nil { - return // parent is never canceled - } - if p, ok := parentCancelCtx(parent); ok { - p.mu.Lock() - if p.err != nil { - // parent has already been canceled - child.cancel(false, p.err) - } else { - if p.children == nil { - p.children = make(map[canceler]bool) - } - p.children[child] = true - } - p.mu.Unlock() - } else { - go func() { - select { - case <-parent.Done(): - child.cancel(false, parent.Err()) - case <-child.Done(): - } - }() - } -} - -// parentCancelCtx follows a chain of parent references until it finds a -// *cancelCtx. This function understands how each of the concrete types in this -// package represents its parent. -func parentCancelCtx(parent Context) (*cancelCtx, bool) { - for { - switch c := parent.(type) { - case *cancelCtx: - return c, true - case *timerCtx: - return c.cancelCtx, true - case *valueCtx: - parent = c.Context - default: - return nil, false - } - } -} - -// removeChild removes a context from its parent. -func removeChild(parent Context, child canceler) { - p, ok := parentCancelCtx(parent) - if !ok { - return - } - p.mu.Lock() - if p.children != nil { - delete(p.children, child) - } - p.mu.Unlock() -} - -// A canceler is a context type that can be canceled directly. The -// implementations are *cancelCtx and *timerCtx. -type canceler interface { - cancel(removeFromParent bool, err error) - Done() <-chan struct{} -} - -// A cancelCtx can be canceled. When canceled, it also cancels any children -// that implement canceler. -type cancelCtx struct { - Context - - done chan struct{} // closed by the first cancel call. - - mu sync.Mutex - children map[canceler]bool // set to nil by the first cancel call - err error // set to non-nil by the first cancel call -} - -func (c *cancelCtx) Done() <-chan struct{} { - return c.done -} - -func (c *cancelCtx) Err() error { - c.mu.Lock() - defer c.mu.Unlock() - return c.err -} - -func (c *cancelCtx) String() string { - return fmt.Sprintf("%v.WithCancel", c.Context) -} - -// cancel closes c.done, cancels each of c's children, and, if -// removeFromParent is true, removes c from its parent's children. -func (c *cancelCtx) cancel(removeFromParent bool, err error) { - if err == nil { - panic("context: internal error: missing cancel error") - } - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return // already canceled - } - c.err = err - close(c.done) - for child := range c.children { - // NOTE: acquiring the child's lock while holding parent's lock. - child.cancel(false, err) - } - c.children = nil - c.mu.Unlock() - - if removeFromParent { - removeChild(c.Context, c) - } -} - -// WithDeadline returns a copy of the parent context with the deadline adjusted -// to be no later than d. If the parent's deadline is already earlier than d, -// WithDeadline(parent, d) is semantically equivalent to parent. The returned -// context's Done channel is closed when the deadline expires, when the returned -// cancel function is called, or when the parent context's Done channel is -// closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { - if cur, ok := parent.Deadline(); ok && cur.Before(deadline) { - // The current deadline is already sooner than the new one. - return WithCancel(parent) - } - c := &timerCtx{ - cancelCtx: newCancelCtx(parent), - deadline: deadline, - } - propagateCancel(parent, c) - d := deadline.Sub(time.Now()) - if d <= 0 { - c.cancel(true, DeadlineExceeded) // deadline has already passed - return c, func() { c.cancel(true, Canceled) } - } - c.mu.Lock() - defer c.mu.Unlock() - if c.err == nil { - c.timer = time.AfterFunc(d, func() { - c.cancel(true, DeadlineExceeded) - }) - } - return c, func() { c.cancel(true, Canceled) } -} - -// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to -// implement Done and Err. It implements cancel by stopping its timer then -// delegating to cancelCtx.cancel. -type timerCtx struct { - *cancelCtx - timer *time.Timer // Under cancelCtx.mu. - - deadline time.Time -} - -func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { - return c.deadline, true -} - -func (c *timerCtx) String() string { - return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now())) -} - -func (c *timerCtx) cancel(removeFromParent bool, err error) { - c.cancelCtx.cancel(false, err) - if removeFromParent { - // Remove this timerCtx from its parent cancelCtx's children. - removeChild(c.cancelCtx.Context, c) - } - c.mu.Lock() - if c.timer != nil { - c.timer.Stop() - c.timer = nil - } - c.mu.Unlock() -} - -// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete: -// -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } -func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { - return WithDeadline(parent, time.Now().Add(timeout)) -} - -// WithValue returns a copy of parent in which the value associated with key is -// val. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -func WithValue(parent Context, key interface{}, val interface{}) Context { - return &valueCtx{parent, key, val} -} - -// A valueCtx carries a key-value pair. It implements Value for that key and -// delegates all other calls to the embedded Context. -type valueCtx struct { - Context - key, val interface{} -} - -func (c *valueCtx) String() string { - return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val) -} - -func (c *valueCtx) Value(key interface{}) interface{} { - if c.key == key { - return c.val - } - return c.Context.Value(key) -} diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go deleted file mode 100644 index b105f80b..00000000 --- a/vendor/golang.org/x/net/context/pre_go19.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.9 - -package context - -import "time" - -// A Context carries a deadline, a cancelation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -type Context interface { - // Deadline returns the time when work done on behalf of this context - // should be canceled. Deadline returns ok==false when no deadline is - // set. Successive calls to Deadline return the same results. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - // - // WithCancel arranges for Done to be closed when cancel is called; - // WithDeadline arranges for Done to be closed when the deadline - // expires; WithTimeout arranges for Done to be closed when the timeout - // elapses. - // - // Done is provided for use in select statements: - // - // // Stream generates values with DoSomething and sends them to out - // // until DoSomething returns an error or ctx.Done is closed. - // func Stream(ctx context.Context, out chan<- Value) error { - // for { - // v, err := DoSomething(ctx) - // if err != nil { - // return err - // } - // select { - // case <-ctx.Done(): - // return ctx.Err() - // case out <- v: - // } - // } - // } - // - // See http://blog.golang.org/pipelines for more examples of how to use - // a Done channel for cancelation. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - // - // A key identifies a specific value in a Context. Functions that wish - // to store values in Context typically allocate a key in a global - // variable then use that key as the argument to context.WithValue and - // Context.Value. A key can be any type that supports equality; - // packages should define keys as an unexported type to avoid - // collisions. - // - // Packages that define a Context key should provide type-safe accessors - // for the values stores using that key: - // - // // Package user defines a User type that's stored in Contexts. - // package user - // - // import "golang.org/x/net/context" - // - // // User is the type of value stored in the Contexts. - // type User struct {...} - // - // // key is an unexported type for keys defined in this package. - // // This prevents collisions with keys defined in other packages. - // type key int - // - // // userKey is the key for user.User values in Contexts. It is - // // unexported; clients use user.NewContext and user.FromContext - // // instead of using this key directly. - // var userKey key = 0 - // - // // NewContext returns a new Context that carries value u. - // func NewContext(ctx context.Context, u *User) context.Context { - // return context.WithValue(ctx, userKey, u) - // } - // - // // FromContext returns the User value stored in ctx, if any. - // func FromContext(ctx context.Context) (*User, bool) { - // u, ok := ctx.Value(userKey).(*User) - // return u, ok - // } - Value(key interface{}) interface{} -} - -// A CancelFunc tells an operation to abandon its work. -// A CancelFunc does not wait for the work to stop. -// After the first call, subsequent calls to a CancelFunc do nothing. -type CancelFunc func() diff --git a/vendor/modules.txt b/vendor/modules.txt index 3f05e696..5fb9c67a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 +# bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512 bazil.org/fuse bazil.org/fuse/fs bazil.org/fuse/fuseutil @@ -18,8 +18,6 @@ github.com/sirupsen/logrus github.com/spf13/cobra # github.com/spf13/pflag v1.0.3 github.com/spf13/pflag -# golang.org/x/net v0.0.0-20190522155817-f3200d17e092 -golang.org/x/net/context # golang.org/x/sync v0.0.0-20201207232520-09787c993a3a golang.org/x/sync/errgroup # golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c