/* Called during initialisation to register each path with an optional repeat_count.  */
static int rr_add_path(struct path_selector *ps, struct dm_path *path, int argc, char **argv, char **error)
/* Called during initialisation to register each path with an optional repeat_count.  */
static int rr_add_path(struct path_selector *ps, struct dm_path *path, int argc, char **argv, char **error)
{
	struct selector *s = (struct selector *) ps->context;
	struct path_info *pi;
	unsigned repeat_count = RR_MIN_IO;
	if (argc > 1) {
		*error = "round-robin ps: incorrect number of arguments";
		return -EINVAL;
	}
	if ((argc == 1) && (sscanf(argv[0], "%u", &repeat_count) != 1)) {
		*error = "round-robin ps: invalid repeat count";
		return -EINVAL;
	}
	pi = kmalloc(sizeof(*pi), GFP_KERNEL);
	if (!pi) {
		*error = "round-robin ps: Error allocating path context";
		return -ENOMEM;
	}
	pi->path = path;
	pi->repeat_count = repeat_count;
	path->pscontext = pi;
	list_add_tail(&pi->list, &s->valid_paths);
	return 0;
}