2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

fuse: use syscall errnos directly to fix deprecations

This commit is contained in:
Michael Eischer 2023-05-18 17:47:42 +02:00
parent e01baeabba
commit c832a492ac
2 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"sync" "sync"
"syscall"
"github.com/anacrolix/fuse" "github.com/anacrolix/fuse"
"github.com/anacrolix/fuse/fs" "github.com/anacrolix/fuse/fs"
@ -202,7 +203,7 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
node, ok := d.items[name] node, ok := d.items[name]
if !ok { if !ok {
debug.Log(" Lookup(%v) -> not found", name) debug.Log(" Lookup(%v) -> not found", name)
return nil, fuse.ENOENT return nil, syscall.ENOENT
} }
inode := inodeFromNode(d.inode, node) inode := inodeFromNode(d.inode, node)
switch node.Type { switch node.Type {
@ -216,7 +217,7 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
return newOther(d.root, inode, node) return newOther(d.root, inode, node)
default: default:
debug.Log(" node %v has unknown type %v", name, node.Type) debug.Log(" node %v has unknown type %v", name, node.Type)
return nil, fuse.ENOENT return nil, syscall.ENOENT
} }
} }

View File

@ -6,6 +6,7 @@ package fuse
import ( import (
"context" "context"
"os" "os"
"syscall"
"github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/restic"
@ -60,7 +61,7 @@ func (d *SnapshotsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
if err != nil { if err != nil {
return nil, unwrapCtxCanceled(err) return nil, unwrapCtxCanceled(err)
} else if meta == nil { } else if meta == nil {
return nil, fuse.ENOENT return nil, syscall.ENOENT
} }
items := []fuse.Dirent{ items := []fuse.Dirent{
@ -99,7 +100,7 @@ func (d *SnapshotsDir) Lookup(ctx context.Context, name string) (fs.Node, error)
if err != nil { if err != nil {
return nil, unwrapCtxCanceled(err) return nil, unwrapCtxCanceled(err)
} else if meta == nil { } else if meta == nil {
return nil, fuse.ENOENT return nil, syscall.ENOENT
} }
entry := meta.names[name] entry := meta.names[name]
@ -114,7 +115,7 @@ func (d *SnapshotsDir) Lookup(ctx context.Context, name string) (fs.Node, error)
} }
} }
return nil, fuse.ENOENT return nil, syscall.ENOENT
} }
// SnapshotLink // SnapshotLink