From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0061.outbound.protection.outlook.com [104.47.40.61]) by dpdk.org (Postfix) with ESMTP id B41E05681 for ; Thu, 17 Nov 2016 13:59:04 +0100 (CET) Received: from BN3PR0301CA0067.namprd03.prod.outlook.com (10.160.152.163) by DM2PR0301MB0752.namprd03.prod.outlook.com (10.160.97.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Thu, 17 Nov 2016 12:59:03 +0000 Received: from BY2FFO11FD025.protection.gbl (2a01:111:f400:7c0c::147) by BN3PR0301CA0067.outlook.office365.com (2a01:111:e400:401e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8 via Frontend Transport; Thu, 17 Nov 2016 12:59:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD025.mail.protection.outlook.com (10.1.15.214) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.721.5 via Frontend Transport; Thu, 17 Nov 2016 12:59:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1001; Count:13 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uAHCwxX4021160; Thu, 17 Nov 2016 05:59:00 -0700 To: Jan Blunck References: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> <1479360605-20558-2-git-send-email-shreyansh.jain@nxp.com> CC: David Marchand , , Jan Viktorin From: Shreyansh Jain Message-ID: Date: Thu, 17 Nov 2016 18:31:16 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131238611424640747; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(336004)(339900001)(24454002)(377454003)(189002)(199003)(105606002)(31696002)(4001350100001)(97736004)(2906002)(2950100002)(86362001)(92566002)(31686004)(64126003)(189998001)(229853002)(50466002)(76176999)(106466001)(85426001)(626004)(6916009)(6666003)(110136003)(65826007)(5660300001)(87936001)(356003)(8676002)(83506001)(36756003)(65956001)(47776003)(4326007)(50986999)(33646002)(23676002)(54356999)(81156014)(104016004)(305945005)(81166006)(8936002)(65806001)(68736007)(7846002)(230700001)(77096005)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0752; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD025; 1:2/eA1W/6vnfo0vPhmhGpkY91xROz0J9YRbm2VyFpiiWw40Al2Sv5zLm1Z6f5aR7GqiuREwkElLlWnUINT4oDcd12I5CrSq9b6Gm0tb17rgI2zB/aOfBKddp6KmIG7vJnJbjLFFtbjC2sQ5ktV4qe+Uk5DUWbt4vClamXFZj+t5ld3VpwiLDs+kSjUgX0FiAwiPB1mnubnlb/PL9oLT9ZCApn6AzGQvXHmPllpp9hoZYXUklWC7bUMPdHH63m+Jru2lxReN4nsCnARYYJwbQGt5DV6onsQSjqSdj8Q9ZTQaXIjoMmRpcVgq5TQacws13yP6LxhcFgFUXWbmJytZo+FjVVY9Ke9YLvoRnBrMUU4wZYJxze5K/bD4vW25vOvNmWeC82dS9smwn7RRneE79O1js08jIksqNi4Ve74be+qkhYMwfg30DhYCX8isKQ4Ttxn84gSYTUz7DvT1rxrP8mm/oNuJ1xIt4K5rwWo3eN8DEKQOe8t+N/y2QOZH3k1z7Ncai3u+1FMjsKjBO1RQhmppXWnbYGYsAzgFg8DHwwduYi5QTGFPrDZOcdq0Ll4CiAsrNV4/x3KuTTLzmw1uEdDB2w076jcmc8ggFteS7w9rQ= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 2:eMdzdqd50dT5sjHIKygTXvrRzEkZssr6Rjw7E4MZqYiw3DV8Tkv17WGhSWWhTQQnWoJX+JfTH70Al6ROUDFLjArf0dWPV+kYSkqXC6bH86tUNfwVLsPTdxUiRbdDBoVVsLW1DbDDA+hMrh+rVwRB0kScjP3G4Hkqxyb0jrCmAMU=; 3:pYwhDErX9sPial/bRMOX7yif5HY9vNCefUKfw/cpGwpGUk/F6W5djQsFMmojz2itrwRJLIEcmvG3dVKAKCewOHz0VvJ95QzMkjwjNUHFPJ6ZewlS023TmTSjB3tBLoTcVpJhnat71xlHN5BIIfOeaQGfTAuloiqB4bNwAqYgOPKIKK+8uOh7fAdK4OV9NwnRqerpzXnDf1o0y2arqY8McJpCUFHS2DbxOmQgqDZs8cZkVE8Y3DyLBsMeWDV4tgDAwLzElgY1zPoCOWtQijR5QA== X-MS-Office365-Filtering-Correlation-Id: 1ee82f1f-42ca-4439-feeb-08d40ee9813e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR0301MB0752; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 25:z6RU9dFHYib2MQ8AURkNSXF/F0LLsnXy9eCgYsCORlvyWnfzunNlGmlkFnTRkn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2iNROoRcJ5PWV9zlHsVXvHtkE/6oOCars3ciWbIFatyzSePMUOVtNWTuH8RpRqQP5GBm6ptQwKDGATX3oeOd95eHoDl3tBsRYNt/qvKQXZOwBRIeJrSb+b4ok5EoLVs6CJQGwItUh7d0XgQ8qrwxPdFxSWemfQm9es0swK1WkOx/7GXG/2abQWSCDupB3xikCPgcw4rCHfSdL141fnUsd+WPGRBv6NWilIlJoZR67SkDvnmwCFeHePYMqxQZqQQNFW69/eKqRow5zn5aSIZTOMj55H2RznWPVoB4EaZB6b4PAMIACADMXfgHr/YAsA/9cW71U0istl1fuq19I22j1t7eLrCB0OzGdict9FOPO5WLAj5iscjR7p3jtda1PK2LpOLDl59ngzIQ0Xxvo+wfQSmjkpod1fJIE+hUL6Ld+TSk4kxkdOTt1oMJV/Fml0/gaoioOT5Wdmer/wiMLfrxNTPDMABoKPBmF8653yKqb/Xrn09npqDqSXbAQd1ybnHGyawnzs7W1TRqXIW4xga1itluQuaCIFkPcxSRO7cpDke+OXBztE2mlNyw6E54gCE2Nf7ArNdH8ISGToSQg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095035)(601004)(2401047)(5005006)(13017025)(13023025)(13018025)(13015025)(8121501046)(13024025)(3002001)(10201501046)(6055026)(6096035); SRVR:DM2PR0301MB0752; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR0301MB0752; X-Forefront-PRVS: 01294F875B X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjAzMDFNQjA3NTI7MjM6MlI5anJLaXhDS3NMTkhRMmdiemdIMlZ0?= =?utf-8?B?RFRaL0k2c1o5RmZNOVdoZEdXN2Z1R2ZpU3o2YTVYbVVWMUhKaUplbzM2b2pO?= =?utf-8?B?dkc5SlBIa1Rrd2pJMHcyMmk2MmpObTlPcDlCRkZKYldwd1p5a2g2V1lsSGNq?= =?utf-8?B?eU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g0/qvPi6F7hli/zCkW8dPJ3DSvKdP3wtLLRnTBaNYcyTIO7672ZBWUhux3ICz/SsLC5NpD8G27bLihaJ80+mM1HjkuyRuZ4y9Z69oX1XQ8gi9gTw+yqxkwQQh6GXOQixP/ukm81XoBTQ8EYy1tQeNHH2tbPK/FcKSM7Tcs3Wiw==; 5:VAXVLXYXeILoSd3jqrX/hKtbFS+EQ+36R7HRYvfD8GtOtOW5Gg0hPzHslQlOb+8LX2A7B0i/oknJGft8yrBmlWLqDBcPhPU97T6uVXkvZ97ac03IIVK7lriUKcksMHg3AFtBuTDkTafwGei2PaicXRAk+LvgSRgRmty6NQnmOtykN8z5Hc2/DznXR1kHmCD8; 24:V9X4y/yLWkaWkEJeLTt5PYxLtV7ywAsZe6FHorEH3tGm0ft2HxXRrAlC/0/2L108OKOZ09tLnCNnhhaAN5d0AwoOmJZOaS6Gszfuo9X/RBw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 7:O6MEsEbRWrYNmKHeXzjSFpsb4Z/nZ40qNsQNMME2dxg3368C7gUj8WoPudxYk5rs6eSvv0eD3OlEhwGnBA490WaBFpYlz+igd5GjdRggYo13UPWkLFU0bSluhojT1YW+DVsAFVILP/XfVLeQf1oavya1pzUw6dVbGouDx7LTHMIT0yntAIUy485oki8D6asUnNvYjan58saf10K1kBltRTTRJY0O+yGh1HuNeN5sfY/IokZkOgjTzhvhOCOjY7pBxGW8MA48feTd1HqGXZ2BfTauMMpXenAxCiRK/qqYhE5gBsAsiJYrwm39zI0S0ijNsmy43mGyNjPRRXfs3i+PieMPBfiXAgTf4eJfjTSp+zc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 12:59:02.2768 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0752 Subject: Re: [dpdk-dev] [RFC PATCH 1/6] eal: define container macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 12:59:05 -0000 On Thursday 17 November 2016 05:36 PM, Jan Blunck wrote: > On Thu, Nov 17, 2016 at 6:30 AM, Shreyansh Jain wrote: >> From: Jan Viktorin >> >> Signed-off-by: Jan Viktorin >> Signed-off-by: Shreyansh Jain >> --- >> lib/librte_eal/common/include/rte_common.h | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h >> index db5ac91..8152bd9 100644 >> --- a/lib/librte_eal/common/include/rte_common.h >> +++ b/lib/librte_eal/common/include/rte_common.h >> @@ -331,6 +331,24 @@ rte_bsf32(uint32_t v) >> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) >> #endif >> >> +/** >> + * Return pointer to the wrapping struct instance. >> + * Example: >> + * >> + * struct wrapper { >> + * ... >> + * struct child c; >> + * ... >> + * }; >> + * >> + * struct child *x = obtain(...); >> + * struct wrapper *w = container_of(x, struct wrapper, c); >> + */ >> +#ifndef container_of >> +#define container_of(p, type, member) \ >> + ((type *) (((char *) (p)) - offsetof(type, member))) > > Are there any reasons why you choose to implement this in a non-type > safe way? Catching obvious bugs at compile time is in the interest of > us and our users from my point of view. No specific reason. I just took an existing patchset floating in ML. If you can point me to some better implementation, I will use that. > > >> +#endif >> + >> #define _RTE_STR(x) #x >> /** Take a macro value and get a string version of it */ >> #define RTE_STR(x) _RTE_STR(x) >> -- >> 2.7.4 >> > -- - Shreyansh