From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by dpdk.org (Postfix) with ESMTP id 6F5631B2CB for ; Thu, 15 Feb 2018 23:25:55 +0100 (CET) Received: by mail-pg0-f66.google.com with SMTP id l24so914348pgc.5 for ; Thu, 15 Feb 2018 14:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i9T3BfChPIXQYfWDCqalE0tWHknnnQQDIk+D/47oCKs=; b=1z0t95TPwcePk1rRP2HKFCSJbTNdKLmBQJY2iHiZd3PjFrYVslWYaqoCf4L7LlRIKa 2X581kJfFZz2CBUqBLqogcfzdyC6eS47XuMr95L2evyH/NFN/N5VatSXNmG7mrSsikmN etvIJMxJhZs0y9aurI587Wsl4w6miOMx8zjdxqnRAF+JdLzfbmdo9N5Z9h8mEC/NdPQy f/qXzrXf8M9s9tAcCdD9XLC85KDBCOVtjbXlMkfN7GNX9XFMsSSqhVfeEuoprp3hFqd3 ExZG21lda6HHIaG8uRywvwKonnaG9C8Jwz8Yr93tjyFjV2ouphsEbupJjTFpnAkuElzY Qh0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i9T3BfChPIXQYfWDCqalE0tWHknnnQQDIk+D/47oCKs=; b=P3Dg2QYmoKTopkGM4nW5yCNEl743S9G2BvWPLGZ0Cma+ZWfMcsSnDQqhQFU+JRXPit TiU/0Uq5OCgvj9M2QNrXc9rQdKg/k1MYtOJt57plO4zRlkzD+AfZX6oSt65YsnilL1U/ t99CQu4L6vaPGHODxFUMpPBvMhDUmiT2Kz5bDcLs3/OSOEjlPPDxDwCbFpZCE1I3UEwh iW839z1zcqPpo0NRI5CdRsUidHejFHDq3nWLhfh4P+YnhGc781EPAaa3ak7WUbzG0ZG8 UD6rMrmd/m2m3ABJx0ecdXDqfpX7EeuEoDB30jmq/ODl6i0elCk7I3xFmZaNEslX4hRR mGjA== X-Gm-Message-State: APf1xPCCylCzMm21TFdODOfTPugUCywx/ZH/np2SXhtIPO3zDyYUroj7 QoeD6eQuRwpEsB1PECMcOJskoKuGzhY= X-Google-Smtp-Source: AH8x224E51ug3GuQGI/5V5e6V8K655pX+35pvFZpbum+73v3xYMYFVHC9IhFRLpypMJMuDBtvOOsUQ== X-Received: by 10.98.211.218 with SMTP id z87mr4068846pfk.54.1518733554152; Thu, 15 Feb 2018 14:25:54 -0800 (PST) Received: from xeon-e3.lan (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id y22sm45630426pfd.9.2018.02.15.14.25.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 14:25:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Thu, 15 Feb 2018 14:25:49 -0800 Message-Id: <20180215222550.31128-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180215222550.31128-1-stephen@networkplumber.org> References: <20180215222550.31128-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 1/2] pci: use %z to format size_t X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 22:25:55 -0000 This addresses potential issues where size_t and off_t can vary on some platforms. For size_t the best way to format the value is to use the z modifier to printf. For off_t need to cast to long long to handle 64 bit offset on 32 bit platforms. Signed-off-by: Stephen Hemminger --- lib/librte_pci/rte_pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index 1a6d748568ad..530738dbdf47 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -155,9 +155,10 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size, mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE, MAP_SHARED | additional_flags, fd, offset); if (mapaddr == MAP_FAILED) { - RTE_LOG(ERR, EAL, "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n", - __func__, fd, requested_addr, - (unsigned long)size, (unsigned long)offset, + RTE_LOG(ERR, EAL, + "%s(): cannot mmap(%d, %p, 0x%zx, 0x%llx): %s (%p)\n", + __func__, fd, requested_addr, size, + (unsigned long long)offset, strerror(errno), mapaddr); } else RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr); @@ -174,8 +175,8 @@ pci_unmap_resource(void *requested_addr, size_t size) /* Unmap the PCI memory resource of device */ if (munmap(requested_addr, size)) { - RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, 0x%lx): %s\n", - __func__, requested_addr, (unsigned long)size, + RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, %#zx): %s\n", + __func__, requested_addr, size, strerror(errno)); } else RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n", -- 2.15.1