| 300 | } |
| 301 | |
| 302 | func (n *roFileVersionsDir) ReadDir(ctx context.Context) ([]fuse.Dirent, error) { |
| 303 | if err := n.populate(ctx); err != nil { |
| 304 | Logger.Println("populate:", err) |
| 305 | return nil, handleEIOorEINTR(err) |
| 306 | } |
| 307 | n.mu.Lock() |
| 308 | defer n.mu.Unlock() |
| 309 | var ents []fuse.Dirent |
| 310 | for name, childNode := range n.children { |
| 311 | var ino uint64 |
| 312 | switch v := childNode.(type) { |
| 313 | case *roDir: |
| 314 | ino = v.permanode.Sum64() |
| 315 | case *roFile: |
| 316 | ino = v.permanode.Sum64() |
| 317 | default: |
| 318 | Logger.Printf("roFileVersionsDir.ReadDir: unknown child type %T", childNode) |
| 319 | } |
| 320 | |
| 321 | // TODO: figure out what Dirent.Type means. |
| 322 | // fuse.go says "Type uint32 // ?" |
| 323 | dirent := fuse.Dirent{ |
| 324 | Name: name, |
| 325 | Inode: ino, |
| 326 | } |
| 327 | Logger.Printf("roFileVersionsDir(%q) appending inode %x, %+v", n.fullPath(), dirent.Inode, dirent) |
| 328 | ents = append(ents, dirent) |
| 329 | } |
| 330 | return ents, nil |
| 331 | } |
| 332 | |
| 333 | func (n *roFileVersionsDir) Lookup(ctx context.Context, name string) (ret fs.Node, err error) { |
| 334 | defer func() { |