All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Jim Rees <rees@umich.edu>
Cc: linux-nfs@vger.kernel.org, Benny Halevy <bhalevy@panasas.com>
Subject: [PATCH] SQUASHME: blkmapd: fix pretty_sig short sig endianess agnosticity
Date: Thu,  2 Dec 2010 16:35:42 +0200	[thread overview]
Message-ID: <1291300542-14378-1-git-send-email-bhalevy@panasas.com> (raw)
In-Reply-To: <4CF7A64D.8040802@panasas.com>

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---

How about this?

Benny

 utils/blkmapd/device-process.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/utils/blkmapd/device-process.c b/utils/blkmapd/device-process.c
index 0c5060b..0584bf9 100644
--- a/utils/blkmapd/device-process.c
+++ b/utils/blkmapd/device-process.c
@@ -52,11 +52,17 @@
 static char *pretty_sig(char *sig, uint32_t siglen)
 {
 	static char rs[100];
-	unsigned long i = 0;
+	uint64_t sigval;
 
-	if (siglen <= sizeof i) {
-		memcpy(&i, sig, siglen);
-		sprintf(rs, "0x%0lx", i);
+	if (siglen <= sizeof(sigval)) {
+		int i;
+
+		sigval = 0;
+		for (i = 0; i < siglen; i++) {
+			sigval <<= 8;
+			sigval += ((unsigned char *)sig)[i];
+		}
+		sprintf(rs, "0x%0llx", sigval);
 	} else {
 		if (siglen > sizeof rs - 1)
 			siglen = sizeof rs - 1;
-- 
1.7.2.3


  parent reply	other threads:[~2010-12-02 14:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30 19:13 [PATCH 0/5] nfs-utils: various changes Jim Rees
2010-11-30 19:13 ` [PATCH 1/5] add blkmapd and spnfsd to list of build targets to ignore Jim Rees
2010-12-02 14:05   ` Benny Halevy
2010-11-30 19:13 ` [PATCH 2/5] Remove blkmapd config file, which is no longer used Jim Rees
2010-12-02 14:06   ` Benny Halevy
2010-11-30 19:14 ` [PATCH 3/5] disk signature fixes Jim Rees
2010-11-30 19:14 ` [PATCH 4/5] various minor cleanups Jim Rees
2010-12-02 13:59   ` Benny Halevy
2010-12-02 14:11     ` Benny Halevy
2010-12-02 14:40       ` [PATCH] SQUASHME: decorate truncated signatures with "..." Benny Halevy
2010-12-02 14:41       ` [PATCH 4/5] various minor cleanups Jim Rees
2010-12-02 14:43         ` Benny Halevy
2010-12-02 16:10           ` Jim Rees
2010-12-02 14:35     ` Benny Halevy [this message]
2010-12-02 16:24       ` [PATCH] SQUASHME: blkmapd: fix pretty_sig short sig endianess agnosticity Jim Rees
2010-12-02 16:30         ` Benny Halevy
2010-12-02 16:58           ` Jim Rees
2010-11-30 19:14 ` [PATCH 5/5] device mapping fixes Jim Rees

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=1291300542-14378-1-git-send-email-bhalevy@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rees@umich.edu \
    /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.