dm table: remove unused dm_get_device range parameters

Remove unused parameters(start and len) of dm_get_device()
and fix the callers.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
Nikanth Karthikesan 2010-03-06 02:32:27 +00:00 committed by Alasdair G Kergon
parent 0f3649a9e3
commit 8215d6ec5f
10 changed files with 21 additions and 32 deletions

View file

@ -1160,8 +1160,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
} }
cc->start = tmpll; cc->start = tmpll;
if (dm_get_device(ti, argv[3], cc->start, ti->len, if (dm_get_device(ti, argv[3], dm_table_get_mode(ti->table), &cc->dev)) {
dm_table_get_mode(ti->table), &cc->dev)) {
ti->error = "Device lookup failed"; ti->error = "Device lookup failed";
goto bad_device; goto bad_device;
} }

View file

@ -156,8 +156,8 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad; goto bad;
} }
if (dm_get_device(ti, argv[0], dc->start_read, ti->len, if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table),
dm_table_get_mode(ti->table), &dc->dev_read)) { &dc->dev_read)) {
ti->error = "Device lookup failed"; ti->error = "Device lookup failed";
goto bad; goto bad;
} }
@ -177,8 +177,8 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad_dev_read; goto bad_dev_read;
} }
if (dm_get_device(ti, argv[3], dc->start_write, ti->len, if (dm_get_device(ti, argv[3], dm_table_get_mode(ti->table),
dm_table_get_mode(ti->table), &dc->dev_write)) { &dc->dev_write)) {
ti->error = "Write device lookup failed"; ti->error = "Write device lookup failed";
goto bad_dev_read; goto bad_dev_read;
} }

View file

@ -47,8 +47,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
} }
lc->start = tmp; lc->start = tmp;
if (dm_get_device(ti, argv[0], lc->start, ti->len, if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &lc->dev)) {
dm_table_get_mode(ti->table), &lc->dev)) {
ti->error = "dm-linear: Device lookup failed"; ti->error = "dm-linear: Device lookup failed";
goto bad; goto bad;
} }

View file

@ -543,8 +543,7 @@ static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
return -EINVAL; return -EINVAL;
} }
r = dm_get_device(ti, argv[0], 0, 0 /* FIXME */, r = dm_get_device(ti, argv[0], FMODE_READ | FMODE_WRITE, &dev);
FMODE_READ | FMODE_WRITE, &dev);
if (r) if (r)
return r; return r;

View file

@ -607,8 +607,8 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps,
if (!p) if (!p)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
r = dm_get_device(ti, shift(as), ti->begin, ti->len, r = dm_get_device(ti, shift(as), dm_table_get_mode(ti->table),
dm_table_get_mode(ti->table), &p->path.dev); &p->path.dev);
if (r) { if (r) {
ti->error = "error getting device"; ti->error = "error getting device";
goto bad; goto bad;
@ -1505,8 +1505,7 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv)
goto out; goto out;
} }
r = dm_get_device(ti, argv[1], ti->begin, ti->len, r = dm_get_device(ti, argv[1], dm_table_get_mode(ti->table), &dev);
dm_table_get_mode(ti->table), &dev);
if (r) { if (r) {
DMWARN("message: error getting device %s", DMWARN("message: error getting device %s",
argv[1]); argv[1]);

View file

@ -920,8 +920,7 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti,
return -EINVAL; return -EINVAL;
} }
if (dm_get_device(ti, argv[0], offset, ti->len, if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table),
dm_table_get_mode(ti->table),
&ms->mirror[mirror].dev)) { &ms->mirror[mirror].dev)) {
ti->error = "Device lookup failure"; ti->error = "Device lookup failure";
return -ENXIO; return -ENXIO;

View file

@ -1081,8 +1081,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
argv++; argv++;
argc--; argc--;
r = dm_get_device(ti, cow_path, 0, 0, r = dm_get_device(ti, cow_path, FMODE_READ | FMODE_WRITE, &s->cow);
FMODE_READ | FMODE_WRITE, &s->cow);
if (r) { if (r) {
ti->error = "Cannot get COW device"; ti->error = "Cannot get COW device";
goto bad_cow; goto bad_cow;
@ -1098,7 +1097,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
argv += args_used; argv += args_used;
argc -= args_used; argc -= args_used;
r = dm_get_device(ti, origin_path, 0, ti->len, origin_mode, &s->origin); r = dm_get_device(ti, origin_path, origin_mode, &s->origin);
if (r) { if (r) {
ti->error = "Cannot get origin device"; ti->error = "Cannot get origin device";
goto bad_origin; goto bad_origin;
@ -2100,8 +2099,7 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return -EINVAL; return -EINVAL;
} }
r = dm_get_device(ti, argv[0], 0, ti->len, r = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &dev);
dm_table_get_mode(ti->table), &dev);
if (r) { if (r) {
ti->error = "Cannot get target device"; ti->error = "Cannot get target device";
return r; return r;

View file

@ -80,8 +80,7 @@ static int get_stripe(struct dm_target *ti, struct stripe_c *sc,
if (sscanf(argv[1], "%llu", &start) != 1) if (sscanf(argv[1], "%llu", &start) != 1)
return -EINVAL; return -EINVAL;
if (dm_get_device(ti, argv[0], start, sc->stripe_width, if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table),
dm_table_get_mode(ti->table),
&sc->stripe[stripe].dev)) &sc->stripe[stripe].dev))
return -ENXIO; return -ENXIO;

View file

@ -429,8 +429,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
* it's already present. * it's already present.
*/ */
static int __table_get_device(struct dm_table *t, struct dm_target *ti, static int __table_get_device(struct dm_table *t, struct dm_target *ti,
const char *path, sector_t start, sector_t len, const char *path, fmode_t mode, struct dm_dev **result)
fmode_t mode, struct dm_dev **result)
{ {
int r; int r;
dev_t uninitialized_var(dev); dev_t uninitialized_var(dev);
@ -527,11 +526,10 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
} }
EXPORT_SYMBOL_GPL(dm_set_device_limits); EXPORT_SYMBOL_GPL(dm_set_device_limits);
int dm_get_device(struct dm_target *ti, const char *path, sector_t start, int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
sector_t len, fmode_t mode, struct dm_dev **result) struct dm_dev **result)
{ {
return __table_get_device(ti->table, ti, path, return __table_get_device(ti->table, ti, path, mode, result);
start, len, mode, result);
} }

View file

@ -118,10 +118,9 @@ struct dm_dev {
/* /*
* Constructors should call these functions to ensure destination devices * Constructors should call these functions to ensure destination devices
* are opened/closed correctly. * are opened/closed correctly.
* FIXME: too many arguments.
*/ */
int dm_get_device(struct dm_target *ti, const char *path, sector_t start, int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
sector_t len, fmode_t mode, struct dm_dev **result); struct dm_dev **result);
void dm_put_device(struct dm_target *ti, struct dm_dev *d); void dm_put_device(struct dm_target *ti, struct dm_dev *d);
/* /*