From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 40EF95911 for ; Mon, 27 Feb 2017 15:28:15 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id v77so13710978wmv.0 for ; Mon, 27 Feb 2017 06:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=DA8W1x19CyWwdLL8ybdpGF68sO45RRoQlOV0KmmwKFk=; b=iLpXrbHO2qUZUGWNETTTzLslN7uNRZaIHjaDryxjDGd8mPdetJPJ06xYX76GFCWZ9u xiWOERFaiK+LQSNRzmX0Bed/Zmgzn+gDgwJQNEoWgz7Z6konBvgI3gug8usM8bd0aCRI DyV3RJxobruE5S5l8f9bCfN+WX0h/if+9gc7oPwNl858nySYDfjedzFX/YQewW746vZz Venmmi5QVkOlVNt3qb43LVwmz7vcubfCGCcQFzofBCJF8mfXmYLqZy5ZI9L+HtDqNxV+ eIV/gnbKkSbdYEPuCRBehZ7Kpqn+1oKBEIb7KvG+NaV28vwrNYfIwbmxVz3Iygbw/lHv 1JIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=DA8W1x19CyWwdLL8ybdpGF68sO45RRoQlOV0KmmwKFk=; b=ZDFFM7wJUtpj7H27s4pyhKVVqTU4GR8ogsxCG3YLZMnK/XwmS1jK3bbHP/osSKGpUK MKpBt6Xse5xLtuOMujHf5mMUA5TnSUXrkmVwWIJJhZtONPmbFnVXuLtR1Ru0uOsGsxw2 Tk2U/GzqcqjV+HRNn6nuGFJl6ZtAxQAmqIU2vnTczNbi0iMFt1gljvHxdbJDHZTmhLON Jwsz6Tbpmawb1mNaenA/0xA1LmdKWIH0fLjSrqnuU6E7kimD5y7VT0hZpAHMQRd6iwPG EgRcG9yGP4mWpGMsjfB70DhhvwcVgWXjb6CSoTfktP1leB38BatYq0mQ8emjG1zRZinH IlJw== X-Gm-Message-State: AMke39kYnDw/Bz1KSaRpEVoHdn4mOnMh7R4MhlJZi/+byu3agmZpzhEsGZWXXkIYEBv6Qaj6FWv/TXdmo5P6PQ== X-Received: by 10.28.191.194 with SMTP id o63mr3148788wmi.101.1488205694664; Mon, 27 Feb 2017 06:28:14 -0800 (PST) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.211.20 with HTTP; Mon, 27 Feb 2017 06:28:14 -0800 (PST) In-Reply-To: <1487082966-21074-1-git-send-email-jblunck@infradead.org> References: <1487082966-21074-1-git-send-email-jblunck@infradead.org> From: Jan Blunck Date: Mon, 27 Feb 2017 15:28:14 +0100 X-Google-Sender-Auth: zKK2-CUC1uYuyKUFb4VdpuX_Zdk Message-ID: To: dev Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH 1/2] Fix container_of() macro to work with const members 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: Mon, 27 Feb 2017 14:28:15 -0000 On Tue, Feb 14, 2017 at 3:36 PM, Jan Blunck wrote: > This fixes the usage of structure members that are declared const to get > a pointer to the embedding parent structure. Ping. Is anyone willing to review this? Thanks, Jan > > Signed-off-by: Jan Blunck > --- > lib/librte_eal/common/include/rte_common.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h > index 8dda3e2..c421708 100644 > --- a/lib/librte_eal/common/include/rte_common.h > +++ b/lib/librte_eal/common/include/rte_common.h > @@ -347,8 +347,9 @@ rte_bsf32(uint32_t v) > */ > #ifndef container_of > #define container_of(ptr, type, member) __extension__ ({ \ > - typeof(((type *)0)->member) *_ptr = (ptr); \ > - (type *)(((char *)_ptr) - offsetof(type, member)); }) > + const typeof(((type *)0)->member) *_ptr = (ptr); \ > + (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \ > + }) > #endif > > #define _RTE_STR(x) #x > -- > 2.7.4 >