Commit 44e2317e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dm: Use an EMIT macro in the status function.

From: Kevin Corry <kevcorry@us.ibm.com>

Striped: Use an EMIT macro in the status function.
parent 702a8edf
...@@ -187,24 +187,24 @@ static int stripe_status(struct dm_target *ti, ...@@ -187,24 +187,24 @@ static int stripe_status(struct dm_target *ti,
status_type_t type, char *result, unsigned int maxlen) status_type_t type, char *result, unsigned int maxlen)
{ {
struct stripe_c *sc = (struct stripe_c *) ti->private; struct stripe_c *sc = (struct stripe_c *) ti->private;
int offset; unsigned int sz = 0;
unsigned int i; unsigned int i;
char buffer[32]; char buffer[32];
#define EMIT(x...) sz += ((sz >= maxlen) ? \
0 : scnprintf(result + sz, maxlen - sz, x))
switch (type) { switch (type) {
case STATUSTYPE_INFO: case STATUSTYPE_INFO:
result[0] = '\0'; result[0] = '\0';
break; break;
case STATUSTYPE_TABLE: case STATUSTYPE_TABLE:
offset = scnprintf(result, maxlen, "%d " SECTOR_FORMAT, EMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1);
sc->stripes, sc->chunk_mask + 1);
for (i = 0; i < sc->stripes; i++) { for (i = 0; i < sc->stripes; i++) {
format_dev_t(buffer, sc->stripe[i].dev->bdev->bd_dev); format_dev_t(buffer, sc->stripe[i].dev->bdev->bd_dev);
offset += EMIT(" %s " SECTOR_FORMAT, buffer,
scnprintf(result + offset, maxlen - offset, sc->stripe[i].physical_start);
" %s " SECTOR_FORMAT, buffer,
sc->stripe[i].physical_start);
} }
break; break;
} }
......
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