From patchwork Tue Jan 20 20:05:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 3330 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0KK11bm017752 for ; Tue, 20 Jan 2009 12:01:02 -0800 Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id D0DFF6196CD; Tue, 20 Jan 2009 15:05:33 -0500 (EST) Received: from int-mx2.corp.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n0KK5WFm029630 for ; Tue, 20 Jan 2009 15:05:32 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0KK5WQ7028551 for ; Tue, 20 Jan 2009 15:05:32 -0500 Received: from [10.15.80.1] (hydrogen.msp.redhat.com [10.15.80.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0KK5W9m004361 for ; Tue, 20 Jan 2009 15:05:32 -0500 From: Jonathan Brassow To: dm-devel@redhat.com Date: Tue, 20 Jan 2009 14:05:30 -0600 Message-Id: <1232481930.19993.37.camel@hydrogen.msp.redhat.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 8 of 12]: dm-snapshot-use-DMEMIT-macro-for-status.patch X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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; }