2022-02-14 11:14:34 +08:00
|
|
|
package mount
|
|
|
|
|
2022-03-13 14:38:14 +08:00
|
|
|
import (
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
|
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
|
|
|
)
|
2022-02-14 11:14:34 +08:00
|
|
|
|
2022-03-13 14:38:14 +08:00
|
|
|
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
|
|
|
var entry *filer_pb.Entry
|
|
|
|
_, _, entry, status = wfs.maybeReadEntry(inode)
|
2022-02-14 11:14:34 +08:00
|
|
|
if status == fuse.OK {
|
2022-02-14 14:50:44 +08:00
|
|
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
2022-02-14 11:14:34 +08:00
|
|
|
fileHandle.entry = entry
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (wfs *WFS) ReleaseHandle(handleId FileHandleId) {
|
|
|
|
wfs.fhmap.ReleaseByHandle(handleId)
|
|
|
|
}
|
2022-02-14 14:50:44 +08:00
|
|
|
|
|
|
|
func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle {
|
|
|
|
return wfs.fhmap.GetFileHandle(handleId)
|
|
|
|
}
|