fs/romfs/fs_romfsutil.c
int romfs_datastart(struct romfs_mountpt_s *rm, uint32_t offset,
                    uint32_t *start)
{
  uint32_t ndx;
  int      ret;

  /* Traverse hardlinks as necessary to get to the real file header */

  ret = romfs_followhardlinks(rm, offset, &offset);
  if (ret < 0)
    {
      return ret;
    }

  /* Loop until the header size is obtained. */

  offset += ROMFS_FHDR_NAME;
  for (; ; )
    {
      /* Read the sector into memory */

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

      /* Get the offset to the next chunk */

      offset += 16;
      if (offset >= rm->rm_volsize)
        {
          return -EIO;
        }

      /* Is the name terminated in this 16-byte block */

      if (rm->rm_buffer[ndx + 15] == '\0')
        {
          /* Yes.. then the data starts at the next chunk */

          *start = offset;
          return OK;
        }
    }

  return -EINVAL; /* Won't get here */
}
/****************************************************************************
 * Name: romfs_datastart
 *
 * Description:
 *   Given the offset to a file header, return the offset to the start of
 *   the file data
 *
 ****************************************************************************/
romfs_datastart
Description:
Given the offset to a file header, return the offset to the start of
the file data
romfs_datastart Description : Given the offset to a file header return the offset to the start of the file data
int romfs_datastart(struct romfs_mountpt_s *rm, uint32_t offset,
                    uint32_t *start)
{
  uint32_t ndx;
  int      ret;
  ret = romfs_followhardlinks(rm, offset, &offset);
  if (ret < 0)
    {
      return ret;
    }
  offset += ROMFS_FHDR_NAME;
  for (; ; )
    {
      ndx = romfs_devcacheread(rm, offset);
      if (ndx < 0)
        {
          return ndx;
        }
      offset += 16;
      if (offset >= rm->rm_volsize)
        {
          return -EIO;
        }
      if (rm->rm_buffer[ndx + 15] == '\0')
        {
          *start = offset;
          return OK;
        }
    }
  return -EINVAL; 
}
int romfs_datastart ( struct romfs_mountpt_s * rm , uint32_t offset , uint32_t * start ) { uint32_t ndx ; int ret ; ret = romfs_followhardlinks ( rm , offset , & offset ) ; if ( ret < 0 ) { return ret ; } offset += ROMFS_FHDR_NAME ; for ( ; ; ) { ndx = romfs_devcacheread ( rm , offset ) ; if ( ndx < 0 ) { return ndx ; } offset += 16 ; if ( offset >= rm -> rm_volsize ) { return - EIO ; } if ( rm -> rm_buffer [ ndx + 15 ] == ' \0 ' ) { * start = offset ; return OK ; } } return - EINVAL ; }
Name: romfs_datastart
 Description:
   Given the offset to a file header, return the offset to the start of
   the file data
Name : romfs_datastart Description : Given the offset to a file header return the offset to the start of the file data
/* Traverse hardlinks as necessary to get to the real file header */ /* Loop until the header size is obtained. */ /* Read the sector into memory */ /* Get the offset to the next chunk */ /* Is the name terminated in this 16-byte block */ /* Yes.. then the data starts at the next chunk */ /* Won't get here */