Exemple #1
0
// Always attach to the VuFs root.
func (u *VuFs) Attach(req *srv.Req) {

	if req.Tc.Aname != "/" && req.Tc.Aname != "" {
		req.RespondError(srv.Eperm)
		return
	}

	st, err := os.Stat(u.Root)
	if err != nil {
		req.RespondError(toError(err))
		return
	}

	fid := new(Fid)
	fid.path = u.Root
	req.Fid.Aux = fid

	qid := dir2Qid(st)
	req.RespondRattach(qid)
}
Exemple #2
0
func (u *Ufs) Attach(req *srv.Req) {
	if req.Afid != nil {
		req.RespondError(srv.Enoauth)
		return
	}

	tc := req.Tc
	fid := new(Fid)

	// You can think of the ufs.Root as a 'chroot' of a sort.
	// client attaches are not allowed to go outside the
	// directory represented by ufs.Root
	fid.path = path.Join(u.Root, tc.Aname)

	req.Fid.Aux = fid
	err := fid.stat()
	if err != nil {
		req.RespondError(err)
		return
	}

	qid := dir2Qid(fid.st)
	req.RespondRattach(qid)
}