group/pintos/src/filesys/directory.c
/* Opens and returns the directory for the given INODE, of which
   it takes ownership.  Returns a null pointer on failure. */
Opens and returns the directory for the given INODE, of which
it takes ownership.  Returns a null pointer on failure.
Opens and returns the directory for the given INODE of which it takes ownership . Returns a null pointer on failure .
struct dir *
dir_open (struct inode *inode)
{
  struct dir *dir = calloc (1, sizeof *dir);
  if (inode != NULL && dir != NULL)
    {
      dir->inode = inode;
      dir->pos = 0;
      return dir;
    }
  else
    {
      inode_close (inode);
      free (dir);
      return NULL;
    }
}
struct dir * dir_open ( struct inode * inode ) { struct dir * dir = calloc ( 1 , sizeof * dir ) ; if ( inode != NULL && dir != NULL ) { dir -> inode = inode ; dir -> pos = 0 ; return dir ; } else { inode_close ( inode ) ; free ( dir ) ; return NULL ; } }
Opens and returns the directory for the given INODE, of which
it takes ownership.
Opens and returns the directory for the given INODE of which it takes ownership .