Example #1
0
func (sfs *NopSrv) Write(req *go9p.SrvReq) {
	fid := req.Fid.Aux.(Dispatcher)
	tc := req.Tc
	if sfs.Debuglevel > 0 {
		log.Printf("write: %f", fid)
	}

	e := fid.Write(req, tc.Data)
	if e != nil {
		req.RespondError(toError(e))
		return
	}

	req.RespondRwrite(uint32(len(tc.Data)))
}
Example #2
0
File: p9.go Project: flynn/bake
// Write writes data to a file.
func (fs *fileSystem) Write(req *go9p.SrvReq) {
	aux := req.Fid.Aux.(*Aux)
	if err := aux.stat(); err != nil {
		req.RespondError(err)
		return
	}

	// Add to writeset.
	fs.addToWriteset(aux.rootID, aux.path)

	n, err := aux.file.WriteAt(req.Tc.Data, int64(req.Tc.Offset))
	if err != nil {
		req.RespondError(toError(err))
		return
	}

	req.RespondRwrite(uint32(n))
}