2022-02-14 03:14:34 +00:00
|
|
|
package mount
|
|
|
|
|
2022-03-13 06:38:14 +00:00
|
|
|
import (
|
|
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
2022-07-29 07:17:28 +00:00
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
2022-03-13 06:38:14 +00:00
|
|
|
)
|
2022-02-14 03:14:34 +00:00
|
|
|
|
2022-03-13 06:38:14 +00:00
|
|
|
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
|
|
|
var entry *filer_pb.Entry
|
2022-08-04 08:35:18 +00:00
|
|
|
_, _, entry, status = wfs.maybeReadEntry(inode)
|
2022-02-14 03:14:34 +00:00
|
|
|
if status == fuse.OK {
|
2022-06-05 23:44:07 +00:00
|
|
|
// need to AcquireFileHandle again to ensure correct handle counter
|
2022-02-14 06:50:44 +00:00
|
|
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
2022-02-14 03:14:34 +00:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (wfs *WFS) ReleaseHandle(handleId FileHandleId) {
|
|
|
|
wfs.fhmap.ReleaseByHandle(handleId)
|
|
|
|
}
|
2022-02-14 06:50:44 +00:00
|
|
|
|
|
|
|
func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle {
|
|
|
|
return wfs.fhmap.GetFileHandle(handleId)
|
|
|
|
}
|