Beispiel #1
0
func (tag *Tag) Open(fid *Fid, mode uint8) error {
	req := tag.reqAlloc()
	req.fid = fid
	err := go9p.PackTopen(req.Tc, fid.Fid, mode)
	if err != nil {
		return err
	}

	fid.Mode = mode
	return tag.clnt.Rpcnb(req)
}
Beispiel #2
0
// Opens the file associated with the fid. Returns nil if
// the operation is successful.
func (clnt *Clnt) Open(fid *Fid, mode uint8) error {
	tc := clnt.NewFcall()
	err := go9p.PackTopen(tc, fid.Fid, mode)
	if err != nil {
		return err
	}

	rc, err := clnt.Rpc(tc)
	if err != nil {
		return err
	}

	fid.Qid = rc.Qid
	fid.Iounit = rc.Iounit
	if fid.Iounit == 0 || fid.Iounit > clnt.Msize-go9p.IOHDRSZ {
		fid.Iounit = clnt.Msize - go9p.IOHDRSZ
	}
	fid.Mode = mode
	return nil
}