Example #1
0
void seekdir(FAR DIR *dirp, off_t offset)
{
  struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;

  /* Sanity checks */

  if (!idir || !idir->fd_root)
    {
      return;
    }

  /* The way we handle the readdir depends on the type of inode
   * that we are dealing with.
   */

#ifndef CONFIG_DISABLE_MOUNTPOINT
  if (INODE_IS_MOUNTPT(idir->fd_root))
    {
      /* The node is a file system mointpoint */

      seekmountptdir(idir, offset);
    }
  else
#endif
    {
      /* The node is part of the root pseudo file system */

      seekpseudodir(idir, offset);
    }
}
Example #2
0
void seekdir(FAR DIR *dirp, off_t offset)
{
  struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;

  /* Verify that we were provided with a valid directory structure,
   * A special case is when we enumerate an "empty", unused inode (fd_root
   * == 0).  That is an inode in the pseudo-filesystem that has no
   * operations and no children.  This is a "dangling" directory entry that
   * has lost its children.
   */

  if (!idir || !idir->fd_root)
    {
      return;
    }

  /* The way we handle the readdir depends on the type of inode
   * that we are dealing with.
   */

#ifndef CONFIG_DISABLE_MOUNTPOINT
  if (INODE_IS_MOUNTPT(idir->fd_root))
    {
      /* The node is a file system mointpoint */

      seekmountptdir(idir, offset);
    }
  else
#endif
    {
      /* The node is part of the root pseudo file system */

      seekpseudodir(idir, offset);
    }
}