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

	fid.Mode = mode
	return tag.clnt.Rpcnb(req)
}
Exemplo n.º 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 := ninep.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-ninep.IOHDRSZ {
		fid.Iounit = clnt.Msize - ninep.IOHDRSZ
	}
	fid.Mode = mode
	return nil
}