Exemple #1
0
func (tag *Tag) Create(fid *Fid, name string, perm uint32, mode uint8, ext string) error {
	req := tag.reqAlloc()
	req.fid = fid
	err := ninep.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)
}
Exemple #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 := ninep.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-ninep.IOHDRSZ {
		fid.Iounit = clnt.Msize - ninep.IOHDRSZ
	}
	fid.Mode = mode
	return nil
}