fs/romfs/fs_romfsutil.c
int romfs_searchdir(struct romfs_mountpt_s *rm,
                                  const char *entryname, int entrylen, uint32_t firstoffset,
                                  struct romfs_dirinfo_s *dirinfo)
{
  uint32_t offset;
  uint32_t next;
  uint32_t ndx;
  int      ret;

  /* Then loop through the current directory until the directory
   * with the matching name is found.  Or until all of the entries
   * the directory have been examined.
   */

  offset = firstoffset;
  do
    {
      /* Read the sector into memory (do this before calling
       * romfs_checkentry() so we won't have to read the sector
       * twice in the event that the offset refers to a hardlink).
       */

      ndx = romfs_devcacheread(rm, offset);
      if (ndx < 0)
        {
          return ndx;
        }

      /* Because everything is chunked and aligned to 16-bit boundaries,
       * we know that most the basic node info fits into the sector.
       */

      next = romfs_devread32(rm, ndx + ROMFS_FHDR_NEXT) & RFNEXT_OFFSETMASK;

      /* Check if the name this entry is a directory with the matching
       * name
       */

      ret = romfs_checkentry(rm, offset, entryname, entrylen, dirinfo);
      if (ret == OK)
        {
          /* Its a match! Return success */

          return OK;
        }

      /* No match... select the offset to the next entry */

      offset = next;
    }
  while (next != 0);

  /* There is nothing in this directory with that name */

  return -ENOENT;
}
/****************************************************************************
 * Name: romfs_searchdir
 *
 * Description:
 *   This is part of the romfs_finddirentry log.  Search the directory
 *   beginning at dirinfo->fr_firstoffset for entryname.
 *
 ****************************************************************************/
romfs_searchdir
Description:
This is part of the romfs_finddirentry log.  Search the directory
beginning at dirinfo->fr_firstoffset for entryname.
romfs_searchdir Description : This is part of the romfs_finddirentry log . Search the directory beginning at dirinfo - > fr_firstoffset for entryname .
int romfs_searchdir(struct romfs_mountpt_s *rm,
                                  const char *entryname, int entrylen, uint32_t firstoffset,
                                  struct romfs_dirinfo_s *dirinfo)
{
  uint32_t offset;
  uint32_t next;
  uint32_t ndx;
  int      ret;
  offset = firstoffset;
  do
    {
      ndx = romfs_devcacheread(rm, offset);
      if (ndx < 0)
        {
          return ndx;
        }
      next = romfs_devread32(rm, ndx + ROMFS_FHDR_NEXT) & RFNEXT_OFFSETMASK;
      ret = romfs_checkentry(rm, offset, entryname, entrylen, dirinfo);
      if (ret == OK)
        {
          return OK;
        }
      offset = next;
    }
  while (next != 0);
  return -ENOENT;
}
int romfs_searchdir ( struct romfs_mountpt_s * rm , const char * entryname , int entrylen , uint32_t firstoffset , struct romfs_dirinfo_s * dirinfo ) { uint32_t offset ; uint32_t next ; uint32_t ndx ; int ret ; offset = firstoffset ; do { ndx = romfs_devcacheread ( rm , offset ) ; if ( ndx < 0 ) { return ndx ; } next = romfs_devread32 ( rm , ndx + ROMFS_FHDR_NEXT ) & RFNEXT_OFFSETMASK ; ret = romfs_checkentry ( rm , offset , entryname , entrylen , dirinfo ) ; if ( ret == OK ) { return OK ; } offset = next ; } while ( next != 0 ) ; return - ENOENT ; }
Name: romfs_searchdir
 Description:
   This is part of the romfs_finddirentry log.
Name : romfs_searchdir Description : This is part of the romfs_finddirentry log .
/* Then loop through the current directory until the directory
   * with the matching name is found.  Or until all of the entries
   * the directory have been examined.
   */ /* Read the sector into memory (do this before calling
       * romfs_checkentry() so we won't have to read the sector
       * twice in the event that the offset refers to a hardlink).
       */ /* Because everything is chunked and aligned to 16-bit boundaries,
       * we know that most the basic node info fits into the sector.
       */ /* Check if the name this entry is a directory with the matching
       * name
       */ /* Its a match! Return success */ /* No match... select the offset to the next entry */ /* There is nothing in this directory with that name */