func (tag *Tag) Open(fid *Fid, mode uint8) error { req := tag.reqAlloc() req.fid = fid err := ixp.PackTopen(req.Tc, fid.Fid, mode) if err != nil { return err } fid.Mode = mode return tag.clnt.Rpcnb(req) }
// 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 := ixp.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-ixp.IOHDRSZ { fid.Iounit = clnt.Msize - ixp.IOHDRSZ } fid.Mode = mode return nil }