fs/romfs/fs_romfsutil.c
static int romfs_followhardlinks(struct romfs_mountpt_s *rm, uint32_t offset,
                                 uint32_t *poffset)
{
  uint32_t next;
  uint32_t ndx;
  int      i;

  /* Loop while we are redirected by hardlinks */

  for (i = 0; i < ROMF_MAX_LINKS; i++)
    {
      /* Read the sector containing the offset into memory */

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

      /* Check if this is a hard link */

      next = romfs_devread32(rm, ndx + ROMFS_FHDR_NEXT);
      if (!IS_HARDLINK(next))
        {
          *poffset = offset;
          return OK;
        }

      /* Follow the hard-link */

      offset = romfs_devread32(rm, ndx + ROMFS_FHDR_INFO);
    }

  return -ELOOP;
}
/****************************************************************************
 * Name: romfs_followhardlinks
 *
 * Description:
 *   Given the offset to a file header, check if the file is a hardlink.
 *   If so, traverse the hard links until the terminal, non-linked header
 *   so found and return that offset.
 *
 ****************************************************************************/
romfs_followhardlinks
Description:
Given the offset to a file header, check if the file is a hardlink.
If so, traverse the hard links until the terminal, non-linked header
so found and return that offset.
romfs_followhardlinks Description : Given the offset to a file header check if the file is a hardlink . If so traverse the hard links until the terminal non - linked header so found and return that offset .
static int romfs_followhardlinks(struct romfs_mountpt_s *rm, uint32_t offset,
                                 uint32_t *poffset)
{
  uint32_t next;
  uint32_t ndx;
  int      i;
  for (i = 0; i < ROMF_MAX_LINKS; i++)
    {
      ndx = romfs_devcacheread(rm, offset);
      if (ndx < 0)
        {
          return ndx;
        }
      next = romfs_devread32(rm, ndx + ROMFS_FHDR_NEXT);
      if (!IS_HARDLINK(next))
        {
          *poffset = offset;
          return OK;
        }
      offset = romfs_devread32(rm, ndx + ROMFS_FHDR_INFO);
    }
  return -ELOOP;
}
static int romfs_followhardlinks ( struct romfs_mountpt_s * rm , uint32_t offset , uint32_t * poffset ) { uint32_t next ; uint32_t ndx ; int i ; for ( i = 0 ; i < ROMF_MAX_LINKS ; i ++ ) { ndx = romfs_devcacheread ( rm , offset ) ; if ( ndx < 0 ) { return ndx ; } next = romfs_devread32 ( rm , ndx + ROMFS_FHDR_NEXT ) ; if ( ! IS_HARDLINK ( next ) ) { * poffset = offset ; return OK ; } offset = romfs_devread32 ( rm , ndx + ROMFS_FHDR_INFO ) ; } return - ELOOP ; }
Name: romfs_followhardlinks
 Description:
   Given the offset to a file header, check if the file is a hardlink.
Name : romfs_followhardlinks Description : Given the offset to a file header check if the file is a hardlink .
/* Loop while we are redirected by hardlinks */ /* Read the sector containing the offset into memory */ /* Check if this is a hard link */ /* Follow the hard-link */