You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
853 B

3 years ago
3 months ago
3 months ago
3 years ago
3 months ago
3 years ago
  1. package mount
  2. import (
  3. "github.com/hanwen/go-fuse/v2/fuse"
  4. "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
  5. "github.com/seaweedfs/seaweedfs/weed/util"
  6. )
  7. func (wfs *WFS) AcquireHandle(inode uint64, flags, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
  8. var entry *filer_pb.Entry
  9. var path util.FullPath
  10. path, _, entry, status = wfs.maybeReadEntry(inode)
  11. if status == fuse.OK {
  12. if wfs.wormEnabledForEntry(path, entry) && flags&fuse.O_ANYWRITE != 0 {
  13. return nil, fuse.EPERM
  14. }
  15. // need to AcquireFileHandle again to ensure correct handle counter
  16. fileHandle = wfs.fhMap.AcquireFileHandle(wfs, inode, entry)
  17. }
  18. return
  19. }
  20. func (wfs *WFS) ReleaseHandle(handleId FileHandleId) {
  21. wfs.fhMap.ReleaseByHandle(handleId)
  22. }
  23. func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle {
  24. return wfs.fhMap.GetFileHandle(handleId)
  25. }