group/pintos/src/filesys/directory.c
/* Reads the next directory entry in DIR and stores the name in
   NAME.  Returns true if successful, false if the directory
   contains no more entries. */
Reads the next directory entry in DIR and stores the name in
NAME.  Returns true if successful, false if the directory
contains no more entries.
Reads the next directory entry in DIR and stores the name in NAME . Returns true if successful false if the directory contains no more entries .
bool
dir_readdir (struct dir *dir, char name[NAME_MAX + 1])
{
  struct dir_entry e;
  while (inode_read_at (dir->inode, &e, sizeof e, dir->pos) == sizeof e)
    {
      dir->pos += sizeof e;
      if (e.in_use)
        {
          strlcpy (name, e.name, NAME_MAX + 1);
          return true;
        }
    }
  return false;
}
bool dir_readdir ( struct dir * dir , char name [ NAME_MAX + 1 ] ) { struct dir_entry e ; while ( inode_read_at ( dir -> inode , & e , sizeof e , dir -> pos ) == sizeof e ) { dir -> pos += sizeof e ; if ( e . in_use ) { strlcpy ( name , e . name , NAME_MAX + 1 ) ; return true ; } } return false ; }
Reads the next directory entry in DIR and stores the name in
NAME.
Reads the next directory entry in DIR and stores the name in NAME .