예제 #1
0
func (f *fs) handleGetattr(r *fuse.GetattrRequest) {
	log.Println("Inside handleGetattr")
	log.Println(r)
	resp := &fuse.GetattrResponse{}

	a, err := f.rpc.api.GetAttr(f.getContext(), &pb.GetAttrRequest{Inode: uint64(r.Node)})
	if err != nil {
		log.Fatalf("GetAttr fail: %v", err)
	}
	copyAttr(&resp.Attr, a.Attr)
	// TODO: should we make these configurable?
	resp.Attr.Valid = 5 * time.Second

	log.Println(resp)
	r.Respond(resp)
}
예제 #2
0
// gettattr returns fuse.Attr for the inode described by req.Header.Node
func (sc *serveConn) getattr(req *fuse.GetattrRequest) {
	inode := uint64(req.Header.Node)
	f, err := sc.db.FileByInode(inode)
	if err != nil {
		fuse.Debug(fmt.Sprintf("FileByInode(%v): %v", inode, err))
		req.RespondError(fuse.EIO)
		return
	}

	/* TODO: getattr during upload must return current file size
	sc.Lock()
	sc.Unlock()
	*/

	resp := &fuse.GetattrResponse{}
	resp.Attr = sc.attrFromFile(*f)
	fuse.Debug(resp)
	req.Respond(resp)
}