本文整理汇总了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])
}