本文整理匯總了Golang中github.com/lionkov/ninep/srv.Req.RespondRwalk方法的典型用法代碼示例。如果您正苦於以下問題:Golang Req.RespondRwalk方法的具體用法?Golang Req.RespondRwalk怎麽用?Golang Req.RespondRwalk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lionkov/ninep/srv.Req
的用法示例。
在下文中一共展示了Req.RespondRwalk方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Walk
func (f *NullFS) Walk(req *srv.Req) {
tc := req.Tc
if len(tc.Wname) > 1 && tc.Qid.Type != ninep.QTDIR {
req.RespondError(ninep.ENOENT)
return
}
// The most common case is walking from '.', so we initialize to '.' and fix it up
// later if needed.
if req.Newfid.Aux == nil {
req.Newfid.Aux = &Fid{NullFile: NullFile{Name: ".", Qid: dirQids["."]}}
}
if len(tc.Wname) == 0 {
req.RespondRwalk([]ninep.Qid{})
return
}
if q, ok := dirQids[tc.Wname[0]]; !ok {
req.RespondError(ninep.ENOENT)
} else {
req.Newfid.Aux.(*Fid).Name = tc.Wname[0]
req.Newfid.Aux.(*Fid).Qid = q
req.RespondRwalk([]ninep.Qid{*q})
}
}
示例2: Walk
func (*Ufs) Walk(req *srv.Req) {
fid := req.Fid.Aux.(*Fid)
tc := req.Tc
err := fid.stat()
if err != nil {
req.RespondError(err)
return
}
if req.Newfid.Aux == nil {
req.Newfid.Aux = new(Fid)
}
nfid := req.Newfid.Aux.(*Fid)
wqids := make([]ninep.Qid, len(tc.Wname))
path := fid.path
i := 0
for ; i < len(tc.Wname); i++ {
p := path + "/" + tc.Wname[i]
st, err := os.Lstat(p)
if err != nil {
if i == 0 {
req.RespondError(Enoent)
return
}
break
}
wqids[i] = *dir2Qid(st)
path = p
}
nfid.path = path
req.RespondRwalk(wqids[0:i])
}