weedfs_filehandle.go 671 B

123456789101112131415161718192021222324
  1. package mount
  2. import (
  3. "github.com/hanwen/go-fuse/v2/fuse"
  4. "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
  5. )
  6. func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
  7. var entry *filer_pb.Entry
  8. _, _, entry, status = wfs.maybeReadEntry(inode)
  9. if status == fuse.OK {
  10. // need to AcquireFileHandle again to ensure correct handle counter
  11. fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
  12. }
  13. return
  14. }
  15. func (wfs *WFS) ReleaseHandle(handleId FileHandleId) {
  16. wfs.fhmap.ReleaseByHandle(handleId)
  17. }
  18. func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle {
  19. return wfs.fhmap.GetFileHandle(handleId)
  20. }