Example #1
0
/*
 * This function will convert a string to a block number.  It returns
 * 0 on success, 1 on failure.  On failure, it outputs either an optionally
 * specified error message or a default.
 */
int strtoblk(const char *cmd, const char *str, const char *errmsg,
	     blk64_t *ret)
{
	blk64_t	blk;
	int	err;

	if (errmsg == NULL)
		blk = parse_ulonglong(str, cmd, "block number", &err);
	else
		blk = parse_ulonglong(str, cmd, errmsg, &err);
	*ret = blk;
	return err;
}
Example #2
0
/*
 * This function will convert a string to a block number.  It returns
 * 0 on success, 1 on failure.
 */
int strtoblk(const char *cmd, const char *str, blk64_t *ret)
{
	blk64_t	blk;
	int	err;

	blk = parse_ulonglong(str, cmd, "block number", &err);
	*ret = blk;
	if (err)
		com_err(cmd, 0, "Invalid block number: %s", str);
	return err;
}