Beispiel #1
0
func (tag *Tag) Create(fid *Fid, name string, perm uint32, mode uint8, ext string) error {
	req := tag.reqAlloc()
	req.fid = fid
	err := p.PackTcreate(req.Tc, fid.Fid, name, perm, mode, ext, tag.clnt.Dotu)
	if err != nil {
		return err
	}

	fid.Mode = mode
	return tag.clnt.Rpcnb(req)
}
Beispiel #2
0
// Creates a file in the directory associated with the fid. Returns nil
// if the operation is successful.
func (clnt *Clnt) Create(fid *Fid, name string, perm uint32, mode uint8, ext string) error {
	tc := clnt.NewFcall()
	err := p.PackTcreate(tc, fid.Fid, name, perm, mode, ext, clnt.Dotu)
	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-p.IOHDRSZ {
		fid.Iounit = clnt.Msize - p.IOHDRSZ
	}
	fid.Mode = mode
	return nil
}