/* Returns: 1 if region filled, 0 if no work, <0 on error  */
static int userspace_get_resync_work(struct dm_dirty_log *log, region_t *region)
/* Returns: 1 if region filled, 0 if no work, <0 on error  */
static int userspace_get_resync_work(struct dm_dirty_log *log, region_t *region)
{
	int r;
	size_t rdata_size;
	struct log_c *lc = log->context;
	struct {
		int64_t i;
		region_t r;
	} pkg;
	if (lc->in_sync_hint >= lc->region_count)
		return 0;
	rdata_size = sizeof(pkg);
	r = userspace_do_request(lc, lc->uuid, DM_ULOG_GET_RESYNC_WORK,
				 NULL, 0,
				 (char *)&pkg, &rdata_size);
	*region = pkg.r;
	return (r) ? r : (int)pkg.i;
}