From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0AhE-0006bm-5J for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:30:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0Ah1-0001ll-PL for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:30:40 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:46065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0Ah1-0001lX-Fv for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:30:27 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Jun 2014 15:30:26 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 765BC1B08051 for ; Thu, 26 Jun 2014 15:30:55 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5QEUMgx34209944 for ; Thu, 26 Jun 2014 14:30:22 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5QEULcT022255 for ; Thu, 26 Jun 2014 08:30:22 -0600 From: Jens Freimann Date: Thu, 26 Jun 2014 16:30:05 +0200 Message-Id: <1403793009-54176-7-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1403793009-54176-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1403793009-54176-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 06/10] pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: "Eugene (jno) Dvurechenski" , qemu-devel@nongnu.org From: "Eugene (jno) Dvurechenski" Factor out helper function for dumping a hex value into a buffer. Signed-off-by: Eugene (jno) Dvurechenski --- pc-bios/s390-ccw/s390-ccw.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index d1c3c42..1d650d8 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -86,15 +86,21 @@ static inline void fill_hex(char *out, unsigned char val) out[1] = hex[val & 0xf]; } -static inline void print_int(const char *desc, u64 addr) +static inline void fill_hex_val(char *out, void *ptr, unsigned size) { - unsigned char *addr_c = (unsigned char *)&addr; - char out[] = ": 0xffffffffffffffff\n"; + unsigned char *value = ptr; unsigned int i; - for (i = 0; i < sizeof(addr); i++) { - fill_hex(&out[4 + (i*2)], addr_c[i]); + for (i = 0; i < size; i++) { + fill_hex(&out[i*2], value[i]); } +} + +static inline void print_int(const char *desc, u64 addr) +{ + char out[] = ": 0xffffffffffffffff\n"; + + fill_hex_val(&out[4], &addr, sizeof(addr)); sclp_print(desc); sclp_print(out); -- 1.8.5.5