From: David Marchand <david.marchand@6wind.com>
To: liljegren.mats2@gmail.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] mem: fix build on 32bits system
Date: Fri, 28 Feb 2014 09:21:36 +0100 [thread overview]
Message-ID: <1393575696-25289-2-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1393575696-25289-1-git-send-email-david.marchand@6wind.com>
Rebase commit 57c24af85d9eaa81549a212169605b4e2468a29f introduced a build
regression for 32bits system.
CC eal_memory.o
/home/marchand/dpdk.org/lib/librte_eal/linuxapp/eal/eal_memory.c: In function
‘rte_mem_virt2phy’:
/home/marchand/dpdk.org/lib/librte_eal/linuxapp/eal/eal_memory.c:140:12: error: cast
from pointer to integer of different size [-Werror=pointer-to-int-cast]
virtual = (uint64_t) virtaddr;
^
cc1: all warnings being treated as errors
Rework this patch so that it is equivalent to what we had in 1.5.2.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 296f172..242f1b3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -131,13 +131,14 @@ phys_addr_t
rte_mem_virt2phy(const void *virtaddr)
{
int fd;
- uint64_t page, physaddr, virtual;
- unsigned long virt_pfn;
int page_size;
+ unsigned long virtual;
+ uint64_t page;
+ off_t offset;
/* standard page size */
page_size = getpagesize();
- virtual = (uint64_t) virtaddr;
+ virtual = (unsigned long) virtaddr;
fd = open("/proc/self/pagemap", O_RDONLY);
if (fd < 0) {
@@ -146,9 +147,7 @@ rte_mem_virt2phy(const void *virtaddr)
return (uint64_t) -1;
}
- off_t offset;
- virt_pfn = (unsigned long)virtaddr / page_size;
- offset = sizeof(uint64_t) * virt_pfn;
+ offset = sizeof(uint64_t) * virtual / page_size;
if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
RTE_LOG(ERR, EAL, "%s(): seek error in /proc/self/pagemap: %s\n",
__func__, strerror(errno));
@@ -166,9 +165,8 @@ rte_mem_virt2phy(const void *virtaddr)
* the pfn (page frame number) are bits 0-54 (see
* pagemap.txt in linux Documentation)
*/
- physaddr = ((page & 0x7fffffffffffffULL) * page_size) + (virtual % page_size);
close(fd);
- return physaddr;
+ return ((page & 0x7fffffffffffffULL) * page_size) + (virtual % page_size);
}
/*
--
1.7.10.4
next prev parent reply other threads:[~2014-02-28 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 8:21 [dpdk-dev] [PATCH 1/2] eal: fix use of RTE_PTR_ALIGN_CEIL macro " David Marchand
2014-02-28 8:21 ` David Marchand [this message]
2014-03-20 14:43 ` [dpdk-dev] [PATCH 2/2] mem: fix build " Thomas Monjalon
2014-03-20 14:40 ` [dpdk-dev] [PATCH 1/2] eal: fix use of RTE_PTR_ALIGN_CEIL macro " Thomas Monjalon
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=1393575696-25289-2-git-send-email-david.marchand@6wind.com \
--to=david.marchand@6wind.com \
--cc=dev@dpdk.org \
--cc=liljegren.mats2@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).