mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-06-02 16:50:25 +02:00
mount: return open status
This commit is contained in:
parent
b40d252761
commit
b20ddc57a7
|
@ -61,12 +61,13 @@ import (
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
func (wfs *WFS) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status) {
|
func (wfs *WFS) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status) {
|
||||||
fileHandle, code := wfs.AcquireHandle(in.NodeId, in.Uid, in.Gid)
|
var fileHandle *FileHandle
|
||||||
if code == fuse.OK {
|
fileHandle, status = wfs.AcquireHandle(in.NodeId, in.Uid, in.Gid)
|
||||||
|
if status == fuse.OK {
|
||||||
out.Fh = uint64(fileHandle.fh)
|
out.Fh = uint64(fileHandle.fh)
|
||||||
// TODO https://github.com/libfuse/libfuse/blob/master/include/fuse_common.h#L64
|
// TODO https://github.com/libfuse/libfuse/blob/master/include/fuse_common.h#L64
|
||||||
}
|
}
|
||||||
return code
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package mount
|
package mount
|
||||||
|
|
||||||
import "github.com/hanwen/go-fuse/v2/fuse"
|
import (
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
|
"github.com/hanwen/go-fuse/v2/fuse"
|
||||||
|
)
|
||||||
|
|
||||||
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, code fuse.Status) {
|
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
||||||
_, _, entry, status := wfs.maybeReadEntry(inode)
|
var entry *filer_pb.Entry
|
||||||
|
_, _, entry, status = wfs.maybeReadEntry(inode)
|
||||||
if status == fuse.OK {
|
if status == fuse.OK {
|
||||||
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
||||||
fileHandle.entry = entry
|
fileHandle.entry = entry
|
||||||
|
|
Loading…
Reference in a new issue