Пример #1
0
static void open_pseudodir(FAR struct inode *inode, FAR struct fs_dirent_s *dir)
{
  /* We have a valid pseudo-filesystem node.  Take two references on the
   * inode -- one for the parent (fd_root) and one for the child (fd_next).
   * Note that we do not call inode_addref because we are holding the tree
   * semaphore and that would result in deadlock.
   */

  inode->i_crefs += 2;
  dir->u.pseudo.fd_next = inode; /* This is the next node to use for readdir() */

  /* Flag the inode as belonging to the pseudo-filesystem */

#ifndef CONFIG_DISABLE_MOUNTPOINT
  DIRENT_SETPSEUDONODE(dir->fd_flags);
#endif
}
Пример #2
0
static inline void open_emptydir(FAR struct fs_dirent_s *dir)
{
  /* We have a valid, but empty pseudo-filesystem node.  fd_next is NULL
   * meaning that we are already at the end of the list of its children.
   * fd_root is NULL so that if the directory is rewound, it will still be
   * at the end of the list.
   */

#if 0 /* Already nullified by kuzalloc */
  dir->fd_root          = NULL; /* Save the inode where we start */
  dir->u.pseudo.fd_next = NULL; /* We are at the end of the list */
#endif

  /* Flag the inode as belonging to the pseudo-filesystem */

#ifndef CONFIG_DISABLE_MOUNTPOINT
  DIRENT_SETPSEUDONODE(dir->fd_flags);
#endif
}