"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: rename Lookup to Stat to be more in keeping with os
Nick Craig-Wood7e065440fb62
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.goindex 642d4613d..feff7d5cc 100644--- a/cmd/cmount/fs.go+++ b/cmd/cmount/fs.go@@ -120,7 +120,7 @@ func (of *openFiles) Close(fh uint64) (errc int) {// lookup a Node given a pathfunc (fsys *FS) lookupNode(path string) (node vfs.Node, errc int) {- node, err := fsys.VFS.Lookup(path)+ node, err := fsys.VFS.Stat(path)return node, translateError(err)}diff --git a/cmd/mount/dir.go b/cmd/mount/dir.goindex 16738c6d5..3c89b39df 100644--- a/cmd/mount/dir.go+++ b/cmd/mount/dir.go@@ -79,7 +79,7 @@ var _ fusefs.NodeRequestLookuper = (*Dir)(nil)// Lookup need not to handle the names "." and "..".func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fusefs.Node, err error) {defer fs.Trace(d, "name=%q", req.Name)("node=%+v, err=%v", &node, &err)- mnode, err := d.Dir.Lookup(req.Name)+ mnode, err := d.Dir.Stat(req.Name)if err != nil {return nil, translateError(err)}diff --git a/vfs/dir.go b/vfs/dir.goindex a21ea6dfc..950180650 100644--- a/vfs/dir.go+++ b/vfs/dir.go@@ -219,10 +219,10 @@ func (d *Dir) _readDir() error {return nil}-// lookup a single item in the directory+// stat a single item in the directory//// returns ENOENT if not found.-func (d *Dir) lookup(leaf string) (Node, error) {+func (d *Dir) stat(leaf string) (Node, error) {d.mu.Lock()defer d.mu.Unlock()err := d._readDir()@@ -269,23 +269,23 @@ func (d *Dir) SetModTime(modTime time.Time) error {return nil}-// Lookup looks up a specific entry in the receiver.+// Stat looks up a specific entry in the receiver.//-// Lookup should return a Node corresponding to the entry. If the-// name does not exist in the directory, Lookup should return ENOENT.+// Stat should return a Node corresponding to the entry. If the+// name does not exist in the directory, Stat should return ENOENT.//-// Lookup need not to handle the names "." and "..".-func (d *Dir) Lookup(name string) (node Node, err error) {+// Stat need not to handle the names "." and "..".+func (d *Dir) Stat(name string) (node Node, err error) {path := path.Join(d.path, name)- // fs.Debugf(path, "Dir.Lookup")- node, err = d.lookup(name)+ // fs.Debugf(path, "Dir.Stat")+ node, err = d.stat(name)if err != nil {if err != ENOENT {- fs.Errorf(path, "Dir.Lookup error: %v", err)+ fs.Errorf(path, "Dir.Stat error: %v", err)}return nil, err}- // fs.Debugf(path, "Dir.Lookup OK")+ // fs.Debugf(path, "Dir.Stat OK")return node, nil}@@ -408,7 +408,7 @@ func (d *Dir) RemoveName(name string) error {}path := path.Join(d.path, name)// fs.Debugf(path, "Dir.Remove")- node, err := d.lookup(name)+ node, err := d.stat(name)if err != nil {fs.Errorf(path, "Dir.Remove error: %v", err)return err@@ -424,7 +424,7 @@ func (d *Dir) Rename(oldName, newName string, destDir *Dir) error {oldPath := path.Join(d.path, oldName)newPath := path.Join(destDir.path, newName)// fs.Debugf(oldPath, "Dir.Rename to %q", newPath)- oldNode, err := d.lookup(oldName)+ oldNode, err := d.stat(oldName)if err != nil {fs.Errorf(oldPath, "Dir.Rename error: %v", err)return errdiff --git a/vfs/vfs.go b/vfs/vfs.goindex 0669d9d97..7818761aa 100644--- a/vfs/vfs.go+++ b/vfs/vfs.go@@ -129,8 +129,11 @@ func NewInode() (inode uint64) {return atomic.AddUint64(&inodeCount, 1)}-// Lookup finds the Node by path starting from the root-func (vfs *VFS) Lookup(path string) (node Node, err error) {+// Stat finds the Node by path starting from the root+//+// It is the equivalent of os.Stat - Node contains the os.FileInfo+// interface.+func (vfs *VFS) Stat(path string) (node Node, err error) {node = vfs.rootfor path != "" {i := strings.IndexRune(path, '/')@@ -148,28 +151,10 @@ func (vfs *VFS) Lookup(path string) (node Node, err error) {// We need to look in a directory, but found a filereturn nil, ENOENT}- node, err = dir.Lookup(name)+ node, err = dir.Stat(name)if err != nil {return nil, err}}return}--// Statfs is called to obtain file system metadata.-// It should write that data to resp.-func (vfs *VFS) Statfs() error {- /* FIXME- const blockSize = 4096- const fsBlocks = (1 << 50) / blockSize- resp.Blocks = fsBlocks // Total data blocks in file system.- resp.Bfree = fsBlocks // Free blocks in file system.- resp.Bavail = fsBlocks // Free blocks in file system if you're not root.- resp.Files = 1E9 // Total files in file system.- resp.Ffree = 1E9 // Free files in file system.- resp.Bsize = blockSize // Block size- resp.Namelen = 255 // Maximum file name length?- resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.- */- return nil-}