Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
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
}