-int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
- unsigned *args_used,
+int dm_exception_store_create(const char *type_name, struct dm_target *ti,
+ int argc, char **argv,
struct dm_exception_store **store)
{
int r = 0;
struct dm_exception_store_type *type;
struct dm_exception_store *tmp_store;
- char persistent;
- if (argc < 3) {
+ if (argc < 2) {
ti->error = "Insufficient exception store arguments";
return -EINVAL;
}
@@ -210,13 +209,7 @@ int dm_exception_store_create(struct dm_
return -ENOMEM;
}
- persistent = toupper(*argv[1]);
- if (persistent != 'P' && persistent != 'N') {
- ti->error = "Persistent flag is not P or N";
- return -EINVAL;
- }
-
- type = get_type(argv[1]);
+ type = get_type(type_name);
if (!type) {
ti->error = "Exception store type not recognised";
r = -EINVAL;
@@ -226,6 +219,12 @@ int dm_exception_store_create(struct dm_
tmp_store->type = type;
tmp_store->ti = ti;
+ /*
+ * COW-dev and chunk_size are common to all types of
+ * exception stores and are stored directly in the
+ * dm_exception_store and not passed on to the
+ * constructor for the dm_exception_store_type
+ */
r = dm_get_device(ti, argv[0], 0, 0,
FMODE_READ | FMODE_WRITE, &tmp_store->cow);
if (r) {
@@ -233,17 +232,21 @@ int dm_exception_store_create(struct dm_
goto bad_cow;
}
- r = set_chunk_size(tmp_store, argv[2], &ti->error);
- if (r)
+ r = set_chunk_size(tmp_store, argv[1], &ti->error);
+ if (r) {
+ ti->error = "Unable to set chunk size";
goto bad_cow;
+ }
+
+ argc -= 2;
+ argv += 2;
- r = type->ctr(tmp_store, 0, NULL);
+ r = type->ctr(tmp_store, argc, argv);
if (r) {
ti->error = "Exception store type constructor failed";
goto bad_ctr;
}