func (n *Server) Walk(req *go9ps.Req) { fmt.Printf("Walk fid=%d wname=%v newfid=%d\n", req.Tc.Fid, req.Tc.Wname, req.Tc.Newfid) e, ok := req.Fid.Aux.(*FileEntry) if !ok { req.RespondError(go9ps.Enoent) return } if e.h == nil { req.RespondError(go9ps.Enoent) return } newH, err := e.h.WalkDir(req.Tc.Wname...) if err != nil { req.RespondError(err) return } req.Newfid.Aux = &FileEntry{ h: newH, } req.RespondRwalk(newQids(req.Tc.Mode)) }
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([]go9p.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]) }