From b20ddc57a7d4c01fe1218fbd1bd74a500b9fab63 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 12 Mar 2022 22:38:14 -0800 Subject: [PATCH] mount: return open status --- weed/mount/weedfs_file_io.go | 7 ++++--- weed/mount/weedfs_filehandle.go | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/weed/mount/weedfs_file_io.go b/weed/mount/weedfs_file_io.go index 8ecf5039f..7039b14ec 100644 --- a/weed/mount/weedfs_file_io.go +++ b/weed/mount/weedfs_file_io.go @@ -61,12 +61,13 @@ import ( * @param fi file information */ func (wfs *WFS) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status) { - fileHandle, code := wfs.AcquireHandle(in.NodeId, in.Uid, in.Gid) - if code == fuse.OK { + var fileHandle *FileHandle + fileHandle, status = wfs.AcquireHandle(in.NodeId, in.Uid, in.Gid) + if status == fuse.OK { out.Fh = uint64(fileHandle.fh) // TODO https://github.com/libfuse/libfuse/blob/master/include/fuse_common.h#L64 } - return code + return status } /** diff --git a/weed/mount/weedfs_filehandle.go b/weed/mount/weedfs_filehandle.go index 3e085df37..18bfe07f2 100644 --- a/weed/mount/weedfs_filehandle.go +++ b/weed/mount/weedfs_filehandle.go @@ -1,9 +1,13 @@ package mount -import "github.com/hanwen/go-fuse/v2/fuse" +import ( + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/hanwen/go-fuse/v2/fuse" +) -func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, code fuse.Status) { - _, _, entry, status := wfs.maybeReadEntry(inode) +func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) { + var entry *filer_pb.Entry + _, _, entry, status = wfs.maybeReadEntry(inode) if status == fuse.OK { fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry) fileHandle.entry = entry