From patchwork Thu Dec 2 14:35:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 374741 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB2EZmmb020633 for ; Thu, 2 Dec 2010 14:35:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932093Ab0LBOfq (ORCPT ); Thu, 2 Dec 2010 09:35:46 -0500 Received: from daytona.panasas.com ([67.152.220.89]:35580 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932080Ab0LBOfq (ORCPT ); Thu, 2 Dec 2010 09:35:46 -0500 Received: from fs1.bhalevy.com ([172.17.33.19]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 2 Dec 2010 09:35:45 -0500 From: Benny Halevy To: Jim Rees Cc: linux-nfs@vger.kernel.org, Benny Halevy Subject: [PATCH] SQUASHME: blkmapd: fix pretty_sig short sig endianess agnosticity Date: Thu, 2 Dec 2010 16:35:42 +0200 Message-Id: <1291300542-14378-1-git-send-email-bhalevy@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4CF7A64D.8040802@panasas.com> References: <4CF7A64D.8040802@panasas.com> X-OriginalArrivalTime: 02 Dec 2010 14:35:45.0230 (UTC) FILETIME=[34360EE0:01CB922E] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Dec 2010 14:35:49 +0000 (UTC) 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;