本文整理匯總了Golang中github.com/lionkov/go9p/p/srv.Req.RespondRattach方法的典型用法代碼示例。如果您正苦於以下問題:Golang Req.RespondRattach方法的具體用法?Golang Req.RespondRattach怎麽用?Golang Req.RespondRattach使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lionkov/go9p/p/srv.Req
的用法示例。
在下文中一共展示了Req.RespondRattach方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Attach
// 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)
}
示例2: Attach
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)
}