Skip to content

Commit 41eac99

Browse files
committed
Remove unneeded fuse.E*** dependencies (use syscall.E***)
1 parent 171fbc9 commit 41eac99

File tree

12 files changed

+118
-128
lines changed

12 files changed

+118
-128
lines changed

internal/backend.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
"io/ioutil"
2222
"strings"
2323
"sync"
24+
"syscall"
2425
"time"
25-
26-
"github.com/jacobsa/fuse"
2726
)
2827

2928
type Capabilities struct {
@@ -456,7 +455,7 @@ func (e StorageBackendInitError) HeadBlob(param *HeadBlobInput) (*HeadBlobOutput
456455
ContentType: PString("text/plain"),
457456
}, nil
458457
} else {
459-
return nil, fuse.ENOENT
458+
return nil, syscall.ENOENT
460459
}
461460
}
462461

@@ -508,7 +507,7 @@ func (e StorageBackendInitError) GetBlob(param *GetBlobInput) (*GetBlobOutput, e
508507
Body: ioutil.NopCloser(strings.NewReader(errStr)),
509508
}, nil
510509
} else {
511-
return nil, fuse.ENOENT
510+
return nil, syscall.ENOENT
512511
}
513512
}
514513

internal/backend_adlv1.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"syscall"
2929
"time"
3030

31-
"github.com/jacobsa/fuse"
3231
uuid "github.com/satori/go.uuid"
3332
"github.com/sirupsen/logrus"
3433

@@ -355,7 +354,7 @@ func (b *ADLv1) ListBlobs(param *ListBlobsInput) (*ListBlobsOutput, error) {
355354

356355
_, prefixes, items, err := b.appendToListResults(NilStr(param.Prefix),
357356
recursive, NilStr(continuationToken), param.MaxKeys, nil, nil)
358-
if err == fuse.ENOENT {
357+
if err == syscall.ENOENT {
359358
err = nil
360359
} else if err != nil {
361360
return nil, err
@@ -375,7 +374,7 @@ func (b *ADLv1) DeleteBlob(param *DeleteBlobInput) (*DeleteBlobOutput, error) {
375374
return nil, err
376375
}
377376
if !*res.OperationResult {
378-
return nil, fuse.ENOENT
377+
return nil, syscall.ENOENT
379378
}
380379
return &DeleteBlobOutput{}, nil
381380
}
@@ -417,7 +416,7 @@ func (b *ADLv1) RenameBlob(param *RenameBlobInput) (*RenameBlobOutput, error) {
417416
// (the reverse, renaming a file to a directory works
418417
// in ADLv1 and is the same as moving the file into
419418
// the directory)
420-
return nil, fuse.ENOENT
419+
return nil, syscall.ENOENT
421420
}
422421

423422
return &RenameBlobOutput{}, nil
@@ -556,7 +555,7 @@ func (b *ADLv1) uploadPart(param *MultipartBlobAddInput, offset uint64) error {
556555
// created. The behavior is odd: seems
557556
// like the first stream will error
558557
// but the latter stream works fine
559-
err = fuse.EINVAL
558+
err = syscall.EINVAL
560559
return err
561560
} else if adlErr.resp.StatusCode == 400 &&
562561
adlErr.RemoteException.Exception == "BadOffsetException" {
@@ -641,7 +640,7 @@ func (b *ADLv1) MultipartBlobCommit(param *MultipartBlobCommitInput) (*Multipart
641640
&ReadSeekerCloser{bytes.NewReader([]byte(""))}, PInt64(int64(commitData.Size)),
642641
adl.CLOSE, &leaseId, &leaseId)
643642
err = mapADLv1Error(res.Response, err, false)
644-
if err == fuse.ENOENT {
643+
if err == syscall.ENOENT {
645644
// either the blob was concurrently deleted or we got
646645
// another CREATE which broke our lease. Either way
647646
// technically we did finish uploading data so swallow
@@ -661,7 +660,7 @@ func (b *ADLv1) MultipartExpire(param *MultipartExpireInput) (*MultipartExpireOu
661660

662661
func (b *ADLv1) RemoveBucket(param *RemoveBucketInput) (*RemoveBucketOutput, error) {
663662
if b.bucket == "" {
664-
return nil, fuse.EINVAL
663+
return nil, syscall.EINVAL
665664
}
666665

667666
res, err := b.client.Delete(context.TODO(), b.account, b.path(""), PBool(false))
@@ -670,15 +669,15 @@ func (b *ADLv1) RemoveBucket(param *RemoveBucketInput) (*RemoveBucketOutput, err
670669
return nil, err
671670
}
672671
if !*res.OperationResult {
673-
return nil, fuse.ENOENT
672+
return nil, syscall.ENOENT
674673
}
675674

676675
return &RemoveBucketOutput{}, nil
677676
}
678677

679678
func (b *ADLv1) MakeBucket(param *MakeBucketInput) (*MakeBucketOutput, error) {
680679
if b.bucket == "" {
681-
return nil, fuse.EINVAL
680+
return nil, syscall.EINVAL
682681
}
683682

684683
err := b.mkdir("")
@@ -697,7 +696,7 @@ func (b *ADLv1) mkdir(dir string) error {
697696
return err
698697
}
699698
if !*res.OperationResult {
700-
return fuse.EEXIST
699+
return syscall.EEXIST
701700
}
702701
return nil
703702
}

internal/backend_adlv2.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"time"
3434

3535
"github.com/google/uuid"
36-
"github.com/jacobsa/fuse"
3736
"github.com/sirupsen/logrus"
3837

3938
adl2 "github.com/Azure/azure-sdk-for-go/services/storage/datalake/2018-11-09/storagedatalake"
@@ -197,7 +196,7 @@ func (b *ADLv2) Delegate() interface{} {
197196

198197
func (b *ADLv2) Init(key string) (err error) {
199198
_, err = b.HeadBlob(&HeadBlobInput{Key: key})
200-
if err == fuse.ENOENT {
199+
if err == syscall.ENOENT {
201200
err = nil
202201
}
203202
return
@@ -439,7 +438,7 @@ func (b *ADLv2) listBlobs(param *ListBlobsInput, maxResults *int32) (adl2PathLis
439438

440439
func (b *ADLv2) ListBlobs(param *ListBlobsInput) (*ListBlobsOutput, error) {
441440
if param.Delimiter != nil && *param.Delimiter != "/" {
442-
return nil, fuse.EINVAL
441+
return nil, syscall.EINVAL
443442
}
444443

445444
var maxResults *int32
@@ -449,7 +448,7 @@ func (b *ADLv2) ListBlobs(param *ListBlobsInput) (*ListBlobsOutput, error) {
449448

450449
res, err := b.listBlobs(param, maxResults)
451450
if err != nil {
452-
if err == fuse.ENOENT {
451+
if err == syscall.ENOENT {
453452
return &ListBlobsOutput{
454453
RequestId: res.Response.Response.Header.Get(ADL2_REQUEST_ID),
455454
}, nil
@@ -724,7 +723,7 @@ func (b *ADLv2) PutBlob(param *PutBlobInput) (*PutBlobOutput, error) {
724723
func (b *ADLv2) MultipartBlobBegin(param *MultipartBlobBeginInput) (*MultipartBlobCommitInput, error) {
725724
leaseId := uuid.New().String()
726725
err := b.lease(adl2.Acquire, param.Key, leaseId, 60, "")
727-
if err == fuse.ENOENT {
726+
if err == syscall.ENOENT {
728727
// the file didn't exist, we will create the file
729728
// first and then acquire the lease
730729
create, err := b.create(param.Key, adl2.File, param.ContentType, param.Metadata, "")

internal/backend_azblob.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/Azure/azure-storage-blob-go/azblob"
3535

3636
"github.com/google/uuid"
37-
"github.com/jacobsa/fuse"
3837
"github.com/sirupsen/logrus"
3938
)
4039

@@ -305,7 +304,7 @@ func (b *AZBlob) updateToken() (*azblob.ContainerURL, error) {
305304
u, err := url.Parse(sUrl)
306305
if err != nil {
307306
azbLog.Errorf("Unable to construct service URL: %v", sUrl)
308-
return nil, fuse.EINVAL
307+
return nil, syscall.EINVAL
309308
}
310309

311310
serviceURL := azblob.NewServiceURL(*u, b.pipeline)
@@ -325,7 +324,7 @@ func (b *AZBlob) testBucket(key string) (err error) {
325324
_, err = b.HeadBlob(&HeadBlobInput{Key: key})
326325
if err != nil {
327326
err = mapAZBError(err)
328-
if err == fuse.ENOENT {
327+
if err == syscall.ENOENT {
329328
err = nil
330329
}
331330
}
@@ -353,7 +352,7 @@ func mapAZBError(err error) error {
353352
case azblob.ServiceCodeBlobAlreadyExists:
354353
return syscall.EACCES
355354
case azblob.ServiceCodeBlobNotFound:
356-
return fuse.ENOENT
355+
return syscall.ENOENT
357356
case azblob.ServiceCodeContainerAlreadyExists:
358357
return syscall.EEXIST
359358
case azblob.ServiceCodeContainerBeingDeleted:
@@ -363,17 +362,17 @@ func mapAZBError(err error) error {
363362
case azblob.ServiceCodeContainerNotFound:
364363
return syscall.ENODEV
365364
case azblob.ServiceCodeCopyAcrossAccountsNotSupported:
366-
return fuse.EINVAL
365+
return syscall.EINVAL
367366
case azblob.ServiceCodeSourceConditionNotMet:
368-
return fuse.EINVAL
367+
return syscall.EINVAL
369368
case azblob.ServiceCodeSystemInUse:
370369
return syscall.EAGAIN
371370
case azblob.ServiceCodeTargetConditionNotMet:
372-
return fuse.EINVAL
371+
return syscall.EINVAL
373372
case azblob.ServiceCodeBlobBeingRehydrated:
374373
return syscall.EAGAIN
375374
case azblob.ServiceCodeBlobArchived:
376-
return fuse.EINVAL
375+
return syscall.EINVAL
377376
case azblob.ServiceCodeAccountBeingCreated:
378377
return syscall.EAGAIN
379378
case azblob.ServiceCodeAuthenticationFailed:
@@ -387,7 +386,7 @@ func mapAZBError(err error) error {
387386
case azblob.ServiceCodeOperationTimedOut:
388387
return syscall.EAGAIN
389388
case azblob.ServiceCodeResourceNotFound:
390-
return fuse.ENOENT
389+
return syscall.ENOENT
391390
case azblob.ServiceCodeServerBusy:
392391
return syscall.EAGAIN
393392
case "AuthorizationFailure": // from Azurite emulator
@@ -426,7 +425,7 @@ func (b *AZBlob) HeadBlob(param *HeadBlobInput) (*HeadBlobOutput, error) {
426425
if err == nil {
427426
if !dirBlob.IsDirBlob {
428427
// we requested for a dir suffix, but this isn't one
429-
err = fuse.ENOENT
428+
err = syscall.ENOENT
430429
}
431430
}
432431
return dirBlob, err
@@ -604,7 +603,7 @@ func (b *AZBlob) ListBlobs(param *ListBlobsInput) (*ListBlobsOutput, error) {
604603
*dirBlob.Key += "/"
605604
items = append(items, dirBlob.BlobItemOutput)
606605
sortItems = true
607-
} else if err == fuse.ENOENT {
606+
} else if err == syscall.ENOENT {
608607
err = nil
609608
} else {
610609
return nil, err
@@ -672,7 +671,7 @@ func (b *AZBlob) DeleteBlobs(param *DeleteBlobsInput) (ret *DeleteBlobsOutput, d
672671
_, err := b.DeleteBlob(&DeleteBlobInput{key})
673672
if err != nil {
674673
err = mapAZBError(err)
675-
if err != fuse.ENOENT {
674+
if err != syscall.ENOENT {
676675
deleteError = err
677676
}
678677
}

internal/backend_gcs3.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"sync"
2424
"syscall"
2525

26-
"github.com/jacobsa/fuse"
2726
"cloud.google.com/go/storage"
2827
"google.golang.org/api/iterator"
2928
)
@@ -135,7 +134,7 @@ func (s *GCS3) DeleteBlobs(param *DeleteBlobsInput) (*DeleteBlobsOutput, error)
135134
_, err := s.DeleteBlob(&DeleteBlobInput{
136135
Key: key,
137136
})
138-
if err != nil && err != fuse.ENOENT {
137+
if err != nil && err != syscall.ENOENT {
139138
overallErr = err
140139
}
141140
wg.Done()

internal/backend_s3.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import (
3838
"github.com/aws/aws-sdk-go/aws/credentials"
3939
"github.com/aws/aws-sdk-go/aws/request"
4040
"github.com/aws/aws-sdk-go/service/s3"
41-
42-
"github.com/jacobsa/fuse"
4341
)
4442

4543
type S3Backend struct {
@@ -323,7 +321,7 @@ func (s *S3Backend) detectBucketLocationByHEAD() (err error, isAws bool) {
323321
s.awsConfig.Endpoint = aws.String("")
324322
}
325323
case 400:
326-
err = fuse.EINVAL
324+
err = syscall.EINVAL
327325
case 403:
328326
err = syscall.EACCES
329327
case 404:
@@ -351,7 +349,7 @@ func (s *S3Backend) detectBucketLocationByHEAD() (err error, isAws bool) {
351349
func (s *S3Backend) testBucket(key string) (err error) {
352350
_, err = s.HeadBlob(&HeadBlobInput{Key: key})
353351
if err != nil {
354-
if mapAwsError(err) == fuse.ENOENT {
352+
if mapAwsError(err) == syscall.ENOENT {
355353
err = nil
356354
}
357355
}
@@ -361,7 +359,7 @@ func (s *S3Backend) testBucket(key string) (err error) {
361359

362360
func (s *S3Backend) fallbackV2Signer() (err error) {
363361
if s.v2Signer {
364-
return fuse.EINVAL
362+
return syscall.EINVAL
365363
}
366364

367365
s3Log.Infoln("Falling back to v2 signer")
@@ -399,7 +397,7 @@ func (s *S3Backend) Init(key string) error {
399397
// swift3, ceph-s3 returns 400
400398
// Amplidata just gives up and return 500
401399
code := mapAwsError(err)
402-
if code == syscall.EACCES || code == fuse.EINVAL || code == syscall.EAGAIN {
400+
if code == syscall.EACCES || code == syscall.EINVAL || code == syscall.EAGAIN {
403401
err = s.fallbackV2Signer()
404402
if err != nil {
405403
return err

0 commit comments

Comments
 (0)