From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0044.outbound.protection.outlook.com [104.47.37.44]) by dpdk.org (Postfix) with ESMTP id C249C5599 for ; Thu, 17 Nov 2016 06:28:09 +0100 (CET) Received: from BN6PR03CA0039.namprd03.prod.outlook.com (10.175.124.25) 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 05:28:08 +0000 Received: from BN1AFFO11FD007.protection.gbl (2a01:111:f400:7c10::116) by BN6PR03CA0039.outlook.office365.com (2603:10b6:404:10c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6 via Frontend Transport; Thu, 17 Nov 2016 05:28:07 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1AFFO11FD007.mail.protection.outlook.com (10.58.52.67) 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 05:28:06 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:698; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uAH5S1pq018741; Wed, 16 Nov 2016 22:28:04 -0700 From: Shreyansh Jain To: CC: , Jan Viktorin , Shreyansh Jain Date: Thu, 17 Nov 2016 11:00:00 +0530 Message-ID: <1479360605-20558-2-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> References: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131238340870674276; (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)(189002)(199003)(105606002)(106466001)(86362001)(97736004)(2351001)(5003940100001)(2906002)(92566002)(87936001)(48376002)(5660300001)(189998001)(50466002)(85426001)(76176999)(626004)(6916009)(2950100002)(110136003)(6666003)(8666005)(8676002)(356003)(36756003)(4326007)(47776003)(33646002)(50986999)(104016004)(7846002)(305945005)(81166006)(81156014)(8936002)(68736007)(50226002)(77096005)(7059030)(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; BN1AFFO11FD007; 1:nu7DytDySCqYtY04iuFvpUc6vkrTFwFrGZs1fPC5lHRobuO1SBhdytZnINTlQlM9DZm+mnYAewlB4bYRhF+sNprPTO3qqwQZIFJ2uOjPzKZI9rBNvqzN6Q1L/II/sccWk6S+/euw/S+02Lo40x8Sk/w+MhIU8YgIG3+9tYK1ywf5J28llAn/sNeb/ewTg3ia1Ip9bSBHpQVricffe8V7CjyEcP5/0MrI8E68LiGrMRctO9y+B3wcJP9KY4441e4SNhfgfmwlZwdVa4hWFK43+QlJYcKbXK6DoDKx4vIGepxTxWy4XIsD7TmUHRZPC7b5oTaXlU0aRLFKgCRBaeX3ZmYMdCG1DjhoSRlI++6Zx+JBtTZp/RuIIYo9o4W++M2fNs5sE7erew//4/kviIyuyQeiTwUMf2NkUI8I7x6O4z83IXYZIsqNF+ytCV1cXeUxeMCMHVUHsAbrWPazz1q5dEQttIkhrBEY8vwoAcEwrAZBNxZ9Upm1h+ac4/Ock5DAO6Q469k1EBXIEmSI1zEuwbEwT85yVrDytVlXDkzqdvGfCrN2/H8BucFWUE8rpjnGFcBITnIcnXdNYRu+HvEbrJxrI5WKhLfwAgoLw3f3OWZGHDHhPrK8y/eyQ8tvHRH9mq++cRIOMdCNdN2xFCZrdzu9d/77WsWD2kRgbUz1ILu5dy2ZQCIzTpD0Fg6O20XEaXHevcM+3AFWLmwIc29CVCkgOL6ljhZyJJAa9lnk4Tw= MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 2:pnxECx6YEcG8aXSGJVoeQPHVYH1xkQGZP8rgiWkAkGL5u5WDCC/IKGVNIM0iFDoZJiie9sDrLm8no2dvL/XqvkCOVBE1E8XPvWB0DytUZuVbBxs0iI8zYi6k1EwGWKcE+FBUXTNyHzVH44fZEAsHRDmEAGn36CEb0avk7KAY7Po=; 3:phTiKctldsoYa7+SPm1Lan+SQvtN1l28kftm8mv5HnHdtTkFhyJygO/jRXewhaaHNBKxXd6WR8YlUBgm6SJUmUK1/sgu/13AegatljATt6gtAYECaW76eaHqkKkRtQG8rzTQtDb7Gf9mK7O9MaFbCgLfmHYn3huddIQMZJIBrJDM2J8uzP/ZAjD6Ht9NezkT+vlfGSdqY0ym+aBe1XnhXKKDM8SzxygDJNMzruFQVKxQIZKg1kFzKelfGa9YMB6GXWNhMi9TJ/2k48pfjwFT1g== X-MS-Office365-Filtering-Correlation-Id: ca64e677-d8d6-4f44-b603-08d40eaa82f6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR0301MB0752; X-Microsoft-Exchange-Diagnostics: 1; DM2PR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H2knB+bL3O94bpfyk0bex82u7mFqA0/u0HtuBbpeClPBFQ==; 4:ja8FMil05ieh8r1fop/Wj/Gf0cAb8QFphJLWrkhf2EdZfUHCr5yWj+fXCcQ2YbbQJQUu1oaZTCQ4LsmBh1n1ivgrN68frsajlggupd35+4OWXODKwjNoeCDIHKGYAkIpTZ81eGj0ojp/1stkOXMUURe4P/7AU+vm1hoeU5RB56UDoj/WDApBx/t+rouh7OIPib77AmJHNI3QZUxoIfDD5xf94lS6uziRhm50/g3aBMLwArXkTYo4FHGKMzkI5ny+o2dl4lj5OLjlSvFWB7N035GdqlGK8n26uf9xRAxb5B6W3TplCDJ0a6NSMDuDE/qZNH0NXuT6K5uAy4aJ+6/s4mZ4VJlDJ8gfYbn+466wI08LpovohLiYaqceVBna42s46l60tuxXseKfyYzvpTgg5NmNzZZr7Ctla+C6qyEC/2KyHNvVPzECBde6gSa1CEroW58cOpdTDPItrH5Nj53GBQX7XErrZQAbC029p3qJ3QTYYIV0opwn15k7jA4o3HeWTN2IImrglftECLp5YNJfE9RHAbY1PwfbVoJX9uEXjxvz2gIt/yS31dYJPFNY541PnLY72O103JqvcPWCbPzuJg== 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: =?us-ascii?Q?1; DM2PR0301MB0752; 23:pCrXwe/BJ7Zv55xI9W4T3OLfn4t9rQ6x/3xqHRN?= =?us-ascii?Q?Z3j93se0P4SCMrPbKB87miYVrlsqrFdOpTlJqHWt9HvFrcsjUT08iXF9CpdB?= =?us-ascii?Q?p902l9fwfKJNJUGo4VKVI6NnzH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ii?Q?JY9pEumARMfYPRN7S3p/5YdCnHHqYhHYLp6m9YVBA6ITRBNCWj4FqDn9Ui2k?= =?us-ascii?Q?eqBPCv/AWE+J0HibQcSnbFKYGwYPTUFugERUSmx4qx/TSgkSj7oQtD//6S/1?= =?us-ascii?Q?doA/UqEfJNMtfiY/3soDXcMCwggfo/sxY?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 6:ObF1l1b24WRRICeuCdUqa6/pjqeTPFcVFqbDPSRQxqOt0r2AP1+tTkDH0j6Lvlz9z1voy8/sD7kc9mfPOfdH4/i51j6aprCeq3529xeeRjMFDBqdiLrKbD0KxPW5CQQhWKbJ7o5N/LcDFwvwkw4dnJlaH5hPajEsRAG+m4TWCqWOUgARFS0kW28Fle1Az56A58n/nbu/1IwBxStQdLPTg0H03CV7Z+ZpgmMVtWglvcrKFznSHOUPMffT12q0xit6NdwCOYv4J7qIke/Ic+4AUHNhKnF+XW3XS/+1hrro8YL+pjBHd+63DctbDTZn6FE59ymuuTx5VnueKh7zNHM8bg==; 5:eYvw4cjDyn+rUx/BQjpModkGPtKm1gXRHjmNjqiS7FhSlZvoVWymW5IyzXB7fgQLjrA7xuv9wNoLtchlLIeUygtWjoi0tBSP+z8h44SsuTD3riYAux6JxaBCGlQFI55+p3sPlTYxU/+PDc/mWr25QnuTinFB2co2lQog+QKFgGG9MTjblWbHy3JATGGO9JXV; 24:m0vcIPwSCn1ByyhFV92mQxfeUki3PA7HOwgdr9lWhqHuk5Y4nabo9f1pRYpB19BV3XqkD5vuaznLlffdE3wepPLR/eTKXtuG29Q8CC/+1Cs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0752; 7:j5sLLctrn1JXYe1DXBIa0K/9CSk5o3Jp1rJWd4IIlW2YZ3EOhDb9c+uL3+R5zr+ZTYdT9IRU2oxaZgz2m71v7lCW7rEdf0jKErspPNDy28FS0RafUPzMFl3EkuetrNzoE005TvH23dMIutflNsn5NKzw88jamqbuqkYCTYpQPLHW4JgQ6yfSoSqxrJ02CmDyggXXiyH4zEP2UtykvYpgRKuY/eMh6nmHyoooWTGwsKGMWLUoGPBoskYSoMDRIpLQqzKZnbVYepfeXJCbp04AoULZf46b1LZnAs74qhx3k1oqcj6yHr6s+aXJtLej8zpkvUE6mE4L9IxabfgwaP4FUDbq+5FcJ7q4F2+UOWZiXBY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 05:28:06.8802 (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: [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 05:28:10 -0000 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))) +#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