Example #1
0
	mu sync.Mutex

	name    string
	blob    *blobs.Blob
	dirty   dirtiness
	handles uint32

	// when was this entry last changed
	// TODO: written time.Time
}

var _ = node(&file{})
var _ = fs.Node(&file{})
var _ = fs.NodeForgetter(&file{})
var _ = fs.NodeOpener(&file{})
var _ = fs.NodeSetattrer(&file{})
var _ = fs.NodeFsyncer(&file{})
var _ = fs.HandleFlusher(&file{})
var _ = fs.HandleReader(&file{})
var _ = fs.HandleWriter(&file{})
var _ = fs.HandleReleaser(&file{})

func (f *file) setName(name string) {
	f.mu.Lock()
	defer f.mu.Unlock()
	f.name = name
}

func (f *file) marshalInternal() (*wire.Dirent, error) {
	de := &wire.Dirent{
		Inode: f.inode,
Example #2
0
		b, err := ctx.Dir(d.path)
		if err != nil {
			return err
		}
		meta, err := b.DirMeta()
		if err != nil {
			return err
		}
		a.Uid = meta.Uid
		a.Gid = meta.Gid
		a.Mode = os.ModeDir | meta.Perm
		return nil
	})
}

var _ = fs.NodeSetattrer(&Dir{})

func (d *Dir) Setattr(c context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error {
	log.Debugln("dir_setattr:", d.path, req)
	return nil
}

var _ = fs.HandleReadDirAller(&Dir{})

func (d *Dir) ReadDirAll(c context.Context) ([]fuse.Dirent, error) {
	var res []fuse.Dirent
	err := d.fs.backend.View(c, func(ctx Context) error {
		b, err := ctx.Dir(d.path)
		if err != nil {
			return err
		}
Example #3
0
}

func (r *RequestRecorder) Recorded() fuse.Request {
	val := r.rec.Recorded()
	if val == nil {
		return nil
	}
	return val.(fuse.Request)
}

// Setattrs records a Setattr request and its fields.
type Setattrs struct {
	rec RequestRecorder
}

var _ = fs.NodeSetattrer(&Setattrs{})

func (r *Setattrs) Setattr(req *fuse.SetattrRequest, resp *fuse.SetattrResponse, intr fs.Intr) fuse.Error {
	tmp := *req
	r.rec.RecordRequest(&tmp)
	return nil
}

func (r *Setattrs) RecordedSetattr() fuse.SetattrRequest {
	val := r.rec.Recorded()
	if val == nil {
		return fuse.SetattrRequest{}
	}
	return *(val.(*fuse.SetattrRequest))
}
Example #4
0
		log.Warningf("fuse: entry: mv: %v", err)
		return err
	}

	return nil
}

//
// Compile time checks to see which interfaces we implement:
// Please update this list when modifying code here.
var _ = fs.Node(&Entry{})
var _ = fs.NodeFsyncer(&Entry{})
var _ = fs.NodeGetxattrer(&Entry{})
var _ = fs.NodeListxattrer(&Entry{})
var _ = fs.NodeOpener(&Entry{})
var _ = fs.NodeSetattrer(&Entry{})

// var _ = fs.NodeRenamer(&Entry{})

//var _ = fs.NodeReadlinker(&Entry{})
//var _ = fs.NodeRemover(&Entry{})
//var _ = fs.NodeRemovexattrer(&Entry{})
// var _ = fs.NodeRequestLookuper(&Entry{})
// var _ = fs.NodeAccesser(&Entry{})
// var _ = fs.NodeForgetter(&Entry{})

//var _ = fs.NodeGetattrer(&Entry{})

//var _ = fs.NodeLinker(&Entry{})

//var _ = fs.NodeMkdirer(&Entry{})