Esempio n. 1
0
static unsigned char erase_block(unsigned long block)
{
	unsigned char status;
	int ret;

	status = (do_oobcheck) ? check_block_1(block) : ZONE_GOOD;
	erase.start = block * meminfo.erasesize;

	if (status != ZONE_GOOD) {
		printf("\rSkipping bad zone (factory marked) #%ld @ 0x%x\n", block, erase.start);
		fflush(stdout);
		return status;
	}

	printf("\r\t Erasing Zone #%ld @ 0x%x", block, erase.start);
	fflush(stdout);

	if ((ret=ioctl(fd, MEMERASE, &erase)) != 0) {
		printf(": Erase failed (%s)\n", strerror(errno));
		return ZONE_BAD_ORIGINAL;
	}

	if (do_rwecheck) {
		printf("\r\tChecking Zone #%ld @ 0x%x", block, erase.start);
		fflush(stdout);
		status = check_block_2(block);
		if (status != ZONE_GOOD) {
			printf("\rSkipping bad zone (RWE test failed) #%ld @ 0x%x\n", block, erase.start);
			fflush(stdout);
		}
	}
	return status;
}
Esempio n. 2
0
int	check_block(t_sol *test, t_check_block *check)
{
  check->k = 0;
  check->l = 0;
  while (check->k != 3)
    {
      while (check->l != 3)
	{
	  if (check_block_2(test, check) == -1)
	    return (-1);
	  check->l += 1;
	}
      check->l = 0;
      check->k += 1;
    }
  return (0);
}