From: Jonathan Brassow <jbrassow@redhat.com>
To: dm-devel@redhat.com
Subject: [PATCH 8 of 12]: dm-snapshot-use-DMEMIT-macro-for-status.patch
Date: Tue, 20 Jan 2009 14:05:30 -0600 [thread overview]
Message-ID: <1232481930.19993.37.camel@hydrogen.msp.redhat.com> (raw)
brassow
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>
Index: linux-2.6.28/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.28.orig/drivers/md/dm-snap.c 2009-01-08 20:00:37.000000000 +0000
+++ linux-2.6.28/drivers/md/dm-snap.c 2009-01-08 20:32:18.000000000 +0000
@@ -1205,24 +1205,25 @@ static void snapshot_resume(struct dm_ta
static int snapshot_status(struct dm_target *ti, status_type_t type,
char *result, unsigned int maxlen)
{
+ int sz = 0;
struct dm_snapshot *snap = ti->private;
switch (type) {
case STATUSTYPE_INFO:
if (!snap->valid)
- snprintf(result, maxlen, "Invalid");
+ DMEMIT("Invalid");
else {
if (snap->store->type->fraction_full) {
sector_t numerator, denominator;
snap->store->type->fraction_full(snap->store,
&numerator,
&denominator);
- snprintf(result, maxlen, "%llu/%llu",
- (unsigned long long)numerator,
- (unsigned long long)denominator);
+ DMEMIT("%llu/%llu",
+ (unsigned long long)numerator,
+ (unsigned long long)denominator);
}
else
- snprintf(result, maxlen, "Unknown");
+ DMEMIT("Unknown");
}
break;
@@ -1232,10 +1233,10 @@ static int snapshot_status(struct dm_tar
* to make private copies if the output is to
* make sense.
*/
- snprintf(result, maxlen, "%s %s %s %llu",
- snap->origin->name, snap->store->cow->name,
- snap->store->type->name,
- (unsigned long long)snap->store->chunk_size);
+ DMEMIT("%s", snap->origin->name);
+ DMEMIT(" %s %s %llu", snap->store->cow->name,
+ snap->store->type->name,
+ (unsigned long long)snap->store->chunk_size);
break;
}
reply other threads:[~2009-01-20 20:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232481930.19993.37.camel@hydrogen.msp.redhat.com \
--to=jbrassow@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.