"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
vfs: add flags parameter to Dir.Create
Nick Craig-Wooda80d8a21dc1b
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.goindex 8b159713d..c9242e0cb 100644--- a/cmd/cmount/fs.go+++ b/cmd/cmount/fs.go@@ -299,7 +299,7 @@ func (fsys *FS) Create(filePath string, flags int, mode uint32) (errc int, fh uiif errc != 0 {return errc, fhUnset}- file, err := parentDir.Create(leaf)+ file, err := parentDir.Create(leaf, flags)if err != nil {return translateError(err), fhUnset}diff --git a/cmd/mount/dir.go b/cmd/mount/dir.goindex 77086cba0..5f3600717 100644--- a/cmd/mount/dir.go+++ b/cmd/mount/dir.go@@ -112,7 +112,7 @@ var _ fusefs.NodeCreater = (*Dir)(nil)// Create makes a new filefunc (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (node fusefs.Node, handle fusefs.Handle, err error) {defer log.Trace(d, "name=%q", req.Name)("node=%v, handle=%v, err=%v", &node, &handle, &err)- file, err := d.Dir.Create(req.Name)+ file, err := d.Dir.Create(req.Name, int(req.Flags))if err != nil {return nil, nil, translateError(err)}diff --git a/vfs/dir.go b/vfs/dir.goindex 017828e99..bd19ee057 100644--- a/vfs/dir.go+++ b/vfs/dir.go@@ -326,7 +326,7 @@ func (d *Dir) Open(flags int) (fd Handle, err error) {}// Create makes a new file node-func (d *Dir) Create(name string) (*File, error) {+func (d *Dir) Create(name string, flags int) (*File, error) {// fs.Debugf(path, "Dir.Create")if d.vfs.Opt.ReadOnly {return nil, EROFSdiff --git a/vfs/dir_test.go b/vfs/dir_test.goindex c8f20614a..c71c981e7 100644--- a/vfs/dir_test.go+++ b/vfs/dir_test.go@@ -281,7 +281,7 @@ func TestDirCreate(t *testing.T) {defer r.Finalise()vfs, dir, _ := dirCreate(t, r)- file, err := dir.Create("potato")+ file, err := dir.Create("potato", os.O_WRONLY|os.O_CREATE)require.NoError(t, err)assert.Equal(t, int64(0), file.Size())@@ -306,7 +306,7 @@ func TestDirCreate(t *testing.T) {assert.Equal(t, int64(5), file2.Size())vfs.Opt.ReadOnly = true- _, err = dir.Create("sausage")+ _, err = dir.Create("sausage", os.O_WRONLY|os.O_CREATE)assert.Equal(t, EROFS, err)}diff --git a/vfs/vfs.go b/vfs/vfs.goindex 5a491b273..7b4023463 100644--- a/vfs/vfs.go+++ b/vfs/vfs.go@@ -403,7 +403,7 @@ func (vfs *VFS) OpenFile(name string, flags int, perm os.FileMode) (fd Handle, eif err != nil {return nil, err}- node, err = dir.Create(leaf)+ node, err = dir.Create(leaf, flags)if err != nil {return nil, err}