+ io = dirp->io;
+ for(;;) {
+ if (dirp->loc >= io->i_ino.i_size)
+ return (NULL);
+ off = blkoff(&io->i_fs, dirp->loc);
+ if (off == 0) {
+ lbn = lblkno(&io->i_fs, dirp->loc);
+ d = sbmap(io, lbn);
+ if(d == 0)
+ return NULL;
+ io->i_bn = fsbtodb(&io->i_fs, d) + io->i_boff;
+ io->i_ma = io->i_buf;
+ io->i_cc = blksize(&io->i_fs, &io->i_ino, lbn);
+ if (devread(io) < 0) {
+ errno = io->i_error;
+ printf("bn %D: read error\n", io->i_bn);
+ return (NULL);
+ }
+ }
+ dp = (struct direct *)(io->i_buf + off);
+ dirp->loc += dp->d_reclen;
+ if (dp->d_ino == 0)
+ continue;
+ return (dp);