Exemple #1
0
}

func (benchDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
	l := []fuse.Dirent{
		{Inode: 2, Name: "bench", Type: fuse.DT_File},
	}
	return l, nil
}

type benchFile struct {
	conf *benchConfig
}

var _ = fs.Node(benchFile{})
var _ = fs.NodeOpener(benchFile{})
var _ = fs.NodeFsyncer(benchFile{})
var _ = fs.Handle(benchFile{})
var _ = fs.HandleReader(benchFile{})
var _ = fs.HandleWriter(benchFile{})

func (benchFile) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Inode = 2
	a.Mode = 0644
	a.Size = 9999999999999999
	return nil
}

func (f benchFile) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
	if f.conf.directIO {
		resp.Flags |= fuse.OpenDirectIO
	}
Exemple #2
0
}

func (r *Setattrs) RecordedSetattr() fuse.SetattrRequest {
	val := r.rec.Recorded()
	if val == nil {
		return fuse.SetattrRequest{}
	}
	return *(val.(*fuse.SetattrRequest))
}

// Fsyncs records an Fsync request and its fields.
type Fsyncs struct {
	rec RequestRecorder
}

var _ = fs.NodeFsyncer(&Fsyncs{})

func (r *Fsyncs) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
	tmp := *req
	r.rec.RecordRequest(&tmp)
	return nil
}

func (r *Fsyncs) RecordedFsync() fuse.FsyncRequest {
	val := r.rec.Recorded()
	if val == nil {
		return fuse.FsyncRequest{}
	}
	return *(val.(*fuse.FsyncRequest))
}