mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-27 12:49:41 +08:00
6c986e9d70
* improve worm support Signed-off-by: lou <alex1988@outlook.com> * worm mode in filer Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * move to fs configure Signed-off-by: lou <alex1988@outlook.com> * remove flag Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * support worm hardlink Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * typo Signed-off-by: lou <alex1988@outlook.com> * sync filer conf Signed-off-by: lou <alex1988@outlook.com> --------- Signed-off-by: lou <alex1988@outlook.com>
30 lines
853 B
Go
30 lines
853 B
Go
package mount
|
|
|
|
import (
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
|
)
|
|
|
|
func (wfs *WFS) AcquireHandle(inode uint64, flags, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
|
var entry *filer_pb.Entry
|
|
var path util.FullPath
|
|
path, _, entry, status = wfs.maybeReadEntry(inode)
|
|
if status == fuse.OK {
|
|
if wfs.wormEnabledForEntry(path, entry) && flags&fuse.O_ANYWRITE != 0 {
|
|
return nil, fuse.EPERM
|
|
}
|
|
// need to AcquireFileHandle again to ensure correct handle counter
|
|
fileHandle = wfs.fhMap.AcquireFileHandle(wfs, inode, entry)
|
|
}
|
|
return
|
|
}
|
|
|
|
func (wfs *WFS) ReleaseHandle(handleId FileHandleId) {
|
|
wfs.fhMap.ReleaseByHandle(handleId)
|
|
}
|
|
|
|
func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle {
|
|
return wfs.fhMap.GetFileHandle(handleId)
|
|
}
|