Esempio n. 1
0
File: blk.c Progetto: mdalecki/nvml
/*
 * pmemblk_check -- block memory pool consistency check
 */
int
pmemblk_check(const char *path)
{
	LOG(3, "path \"%s\"", path);

	int fd = open(path, O_RDWR);

	if (fd < 0) {
		LOG(1, "!open");
		return -1;
	}

	/* open the pool read-only */
	PMEMblk *pbp = pmemblk_map_common(fd, 0, 1);
	close(fd);

	if (pbp == NULL)
		return -1;	/* errno set by pmemblk_map_common() */

	int retval = btt_check(pbp->bttp);
	int oerrno = errno;
	pmemblk_unmap(pbp);
	errno = oerrno;

	return retval;
}
Esempio n. 2
0
File: blk.c Progetto: xguo/nvml
/*
 * pmemblk_check -- block memory pool consistency check
 */
int
pmemblk_check(const char *path, size_t bsize)
{
	LOG(3, "path \"%s\" bsize %zu", path, bsize);

	/* map the pool read-only */
	PMEMblkpool *pbp = pmemblk_open_common(path, bsize, 1);
	if (pbp == NULL)
		return -1;	/* errno set by pmemblk_open_common() */

	int retval = btt_check(pbp->bttp);
	int oerrno = errno;
	pmemblk_close(pbp);
	errno = oerrno;

	return retval;
}