Commit 899ab445 authored by Mike Snitzer's avatar Mike Snitzer

dm table: rename dm_target variable in dm_table_add_target()

Rename from "tgt" to "ti" so that all of dm-table.c code uses the same
naming for dm_target variables.
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent 564b5c54
...@@ -635,7 +635,7 @@ int dm_table_add_target(struct dm_table *t, const char *type, ...@@ -635,7 +635,7 @@ int dm_table_add_target(struct dm_table *t, const char *type,
{ {
int r = -EINVAL, argc; int r = -EINVAL, argc;
char **argv; char **argv;
struct dm_target *tgt; struct dm_target *ti;
if (t->singleton) { if (t->singleton) {
DMERR("%s: target type %s must appear alone in table", DMERR("%s: target type %s must appear alone in table",
...@@ -645,87 +645,87 @@ int dm_table_add_target(struct dm_table *t, const char *type, ...@@ -645,87 +645,87 @@ int dm_table_add_target(struct dm_table *t, const char *type,
BUG_ON(t->num_targets >= t->num_allocated); BUG_ON(t->num_targets >= t->num_allocated);
tgt = t->targets + t->num_targets; ti = t->targets + t->num_targets;
memset(tgt, 0, sizeof(*tgt)); memset(ti, 0, sizeof(*ti));
if (!len) { if (!len) {
DMERR("%s: zero-length target", dm_device_name(t->md)); DMERR("%s: zero-length target", dm_device_name(t->md));
return -EINVAL; return -EINVAL;
} }
tgt->type = dm_get_target_type(type); ti->type = dm_get_target_type(type);
if (!tgt->type) { if (!ti->type) {
DMERR("%s: %s: unknown target type", dm_device_name(t->md), type); DMERR("%s: %s: unknown target type", dm_device_name(t->md), type);
return -EINVAL; return -EINVAL;
} }
if (dm_target_needs_singleton(tgt->type)) { if (dm_target_needs_singleton(ti->type)) {
if (t->num_targets) { if (t->num_targets) {
tgt->error = "singleton target type must appear alone in table"; ti->error = "singleton target type must appear alone in table";
goto bad; goto bad;
} }
t->singleton = true; t->singleton = true;
} }
if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) { if (dm_target_always_writeable(ti->type) && !(t->mode & FMODE_WRITE)) {
tgt->error = "target type may not be included in a read-only table"; ti->error = "target type may not be included in a read-only table";
goto bad; goto bad;
} }
if (t->immutable_target_type) { if (t->immutable_target_type) {
if (t->immutable_target_type != tgt->type) { if (t->immutable_target_type != ti->type) {
tgt->error = "immutable target type cannot be mixed with other target types"; ti->error = "immutable target type cannot be mixed with other target types";
goto bad; goto bad;
} }
} else if (dm_target_is_immutable(tgt->type)) { } else if (dm_target_is_immutable(ti->type)) {
if (t->num_targets) { if (t->num_targets) {
tgt->error = "immutable target type cannot be mixed with other target types"; ti->error = "immutable target type cannot be mixed with other target types";
goto bad; goto bad;
} }
t->immutable_target_type = tgt->type; t->immutable_target_type = ti->type;
} }
if (dm_target_has_integrity(tgt->type)) if (dm_target_has_integrity(ti->type))
t->integrity_added = 1; t->integrity_added = 1;
tgt->table = t; ti->table = t;
tgt->begin = start; ti->begin = start;
tgt->len = len; ti->len = len;
tgt->error = "Unknown error"; ti->error = "Unknown error";
/* /*
* Does this target adjoin the previous one ? * Does this target adjoin the previous one ?
*/ */
if (!adjoin(t, tgt)) { if (!adjoin(t, ti)) {
tgt->error = "Gap in table"; ti->error = "Gap in table";
goto bad; goto bad;
} }
r = dm_split_args(&argc, &argv, params); r = dm_split_args(&argc, &argv, params);
if (r) { if (r) {
tgt->error = "couldn't split parameters"; ti->error = "couldn't split parameters";
goto bad; goto bad;
} }
r = tgt->type->ctr(tgt, argc, argv); r = ti->type->ctr(ti, argc, argv);
kfree(argv); kfree(argv);
if (r) if (r)
goto bad; goto bad;
t->highs[t->num_targets++] = tgt->begin + tgt->len - 1; t->highs[t->num_targets++] = ti->begin + ti->len - 1;
if (!tgt->num_discard_bios && tgt->discards_supported) if (!ti->num_discard_bios && ti->discards_supported)
DMWARN("%s: %s: ignoring discards_supported because num_discard_bios is zero.", DMWARN("%s: %s: ignoring discards_supported because num_discard_bios is zero.",
dm_device_name(t->md), type); dm_device_name(t->md), type);
if (tgt->limit_swap_bios && !static_key_enabled(&swap_bios_enabled.key)) if (ti->limit_swap_bios && !static_key_enabled(&swap_bios_enabled.key))
static_branch_enable(&swap_bios_enabled); static_branch_enable(&swap_bios_enabled);
return 0; return 0;
bad: bad:
DMERR("%s: %s: %s (%pe)", dm_device_name(t->md), type, tgt->error, ERR_PTR(r)); DMERR("%s: %s: %s (%pe)", dm_device_name(t->md), type, ti->error, ERR_PTR(r));
dm_put_target_type(tgt->type); dm_put_target_type(ti->type);
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment