Пример #1
0
func (*NullFS) Attach(req *srv.Req) {

	if req.Afid != nil {
		req.RespondError(srv.Enoauth)
		return
	}

	req.Fid.Aux = &Fid{NullFile: NullFile{Name: "."}}

	req.RespondRattach(dirQids["."])
}
Пример #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)
}