Пример #1
0
func (sfs *NopSrv) Open(req *go9p.SrvReq) {
	fid := req.Fid.Aux.(Dispatcher)
	if sfs.Debuglevel > 0 {
		log.Printf("open %s", fid)
	}
	req.RespondRopen(Qid(fid), 0)
}
Пример #2
0
Файл: p9.go Проект: flynn/bake
// Open opens a local file.
func (fs *fileSystem) Open(req *go9p.SrvReq) {
	// Stat file handle.
	aux := req.Fid.Aux.(*Aux)
	if err := aux.stat(); err != nil {
		req.RespondError(err)
		return
	}

	// Open local file handle.
	file, err := os.OpenFile(aux.path, omode2uflags(req.Tc.Mode), 0)
	if err != nil {
		req.RespondError(toError(err))
		return
	}
	aux.file = file

	// Add to appropriate set.
	if req.Tc.Mode&go9p.OREAD != 0 {
		fs.addToReadset(aux.rootID, aux.path)
	} else if req.Tc.Mode&go9p.OWRITE != 0 {
		fs.addToWriteset(aux.rootID, aux.path)
	} else if req.Tc.Mode&go9p.ORDWR != 0 {
		fs.addToReadset(aux.rootID, aux.path)
		fs.addToWriteset(aux.rootID, aux.path)
	}

	req.RespondRopen(aux.qid(), 0)
}