示例#1
0
文件: file.go 项目: rfjakob/cluefs
func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fusefs.Handle, error) {
	op := NewOpenOp(req, f.path)
	defer trace(op)
	newfile := NewFile(f.parent, f.name, f.fs)
	size, err := newfile.doOpen(f.path, req.Flags)
	if err != nil {
		return nil, err
	}
	resp.Handle = newfile.handleID
	op.FileSize = size
	op.BlockSize = newfile.blksize
	return newfile, nil
}
示例#2
0
文件: dir.go 项目: rfjakob/cluefs
func (d *Dir) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fusefs.Handle, error) {
	op := NewOpenOp(req, d.path)
	defer trace(op)
	newdir := NewDir(d.parent, d.name, d.fs)
	size, err := newdir.doOpen(d.path, req.Flags)
	if err != nil {
		return nil, err
	}
	newdir.SetProcessInfo(req.Header)
	resp.Handle = newdir.handleID
	op.FileSize = size
	op.BlockSize = newdir.blksize
	return newdir, nil
}