aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2009-04-02 14:55:34 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 14:55:34 -0400
commit2e4a31df2b10cbcaf43c333112f6f7440a035c69 (patch)
treefbfcde3d358e615b500c22219190654825e48a26 /drivers/md/dm-snap.c
parentccc45ea8aeffec49fa5985efc3649aa67bb4fcb7 (diff)
dm snapshot: use DMEMIT macro for status
Use DMEMIT in place of snprintf. This makes it easier later when other modules are helping to populate our status output. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r--drivers/md/dm-snap.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index bb28f9782bdd..fcb1ac12119f 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1214,24 +1214,25 @@ static void snapshot_resume(struct dm_target *ti)
1214static int snapshot_status(struct dm_target *ti, status_type_t type, 1214static int snapshot_status(struct dm_target *ti, status_type_t type,
1215 char *result, unsigned int maxlen) 1215 char *result, unsigned int maxlen)
1216{ 1216{
1217 unsigned sz = 0;
1217 struct dm_snapshot *snap = ti->private; 1218 struct dm_snapshot *snap = ti->private;
1218 1219
1219 switch (type) { 1220 switch (type) {
1220 case STATUSTYPE_INFO: 1221 case STATUSTYPE_INFO:
1221 if (!snap->valid) 1222 if (!snap->valid)
1222 snprintf(result, maxlen, "Invalid"); 1223 DMEMIT("Invalid");
1223 else { 1224 else {
1224 if (snap->store->type->fraction_full) { 1225 if (snap->store->type->fraction_full) {
1225 sector_t numerator, denominator; 1226 sector_t numerator, denominator;
1226 snap->store->type->fraction_full(snap->store, 1227 snap->store->type->fraction_full(snap->store,
1227 &numerator, 1228 &numerator,
1228 &denominator); 1229 &denominator);
1229 snprintf(result, maxlen, "%llu/%llu", 1230 DMEMIT("%llu/%llu",
1230 (unsigned long long)numerator, 1231 (unsigned long long)numerator,
1231 (unsigned long long)denominator); 1232 (unsigned long long)denominator);
1232 } 1233 }
1233 else 1234 else
1234 snprintf(result, maxlen, "Unknown"); 1235 DMEMIT("Unknown");
1235 } 1236 }
1236 break; 1237 break;
1237 1238
@@ -1241,10 +1242,10 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
1241 * to make private copies if the output is to 1242 * to make private copies if the output is to
1242 * make sense. 1243 * make sense.
1243 */ 1244 */
1244 snprintf(result, maxlen, "%s %s %s %llu", 1245 DMEMIT("%s", snap->origin->name);
1245 snap->origin->name, snap->store->cow->name, 1246 DMEMIT(" %s %s %llu", snap->store->cow->name,
1246 snap->store->type->name, 1247 snap->store->type->name,
1247 (unsigned long long)snap->store->chunk_size); 1248 (unsigned long long)snap->store->chunk_size);
1248 break; 1249 break;
1249 } 1250 }
1250 1251