From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0073.outbound.protection.outlook.com [104.47.41.73]) by dpdk.org (Postfix) with ESMTP id AD83B8DAD for ; Wed, 7 Sep 2016 16:09:12 +0200 (CEST) Received: from BY2PR03CA069.namprd03.prod.outlook.com (10.141.249.42) by BY2PR0301MB2006.namprd03.prod.outlook.com (10.163.196.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Wed, 7 Sep 2016 14:09:11 +0000 Received: from BY2FFO11FD043.protection.gbl (2a01:111:f400:7c0c::117) by BY2PR03CA069.outlook.office365.com (2a01:111:e400:2c5d::42) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Wed, 7 Sep 2016 14:09:11 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; rehivetech.com; dkim=none (message not signed) header.d=none;rehivetech.com; 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 BY2FFO11FD043.mail.protection.outlook.com (10.1.14.228) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 7 Sep 2016 14:09:10 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u87E8BCk013556; Wed, 7 Sep 2016 07:09:07 -0700 From: Shreyansh Jain To: CC: , Shreyansh Jain , "Jan Viktorin" Date: Wed, 7 Sep 2016 19:37:53 +0530 Message-ID: <1473257297-7221-2-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131177309505192393; (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)(339900001)(189002)(199003)(356003)(77096005)(86362001)(2351001)(19580405001)(50466002)(92566002)(7846002)(2950100001)(47776003)(106466001)(229853001)(33646002)(19580395003)(48376002)(50986999)(76176999)(11100500001)(36756003)(105606002)(85426001)(68736007)(8936002)(50226002)(586003)(2906002)(4326007)(305945005)(5003940100001)(8666005)(104016004)(189998001)(8676002)(110136002)(5660300001)(626004)(81156014)(97736004)(81166006)(87936001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB2006; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD043; 1:r1biKoiP+IVoQZXc2tJIlQ8nr/mb4aQAegKBBK7XZEjBAF6sUHMrLNkwcsv9AxkqRAW0xM5J3bt4ql7QddEuZ5xM91zEFEkzdke/SVIqFvZxRjdQgSoPlApt20UXLOf/Jc5RCaVE3N+lvsiMR3td5/scM8yp6mIyro81JyVKE71CjBSKGNs0V4OgVuoD7Snqd1RIJpRFRucTOezzWxhsnQjeyV/zTQT85N9pcrHhQvsjVPk0FcA2MJtJlUhcppd+rd548Hs3U2UOxf0A2xSMVQHFEXCQwpcHH4ZU33ubPMU0zV+zm6d/hIhNXUPfZBrOqnvfu/F4aTg/Xz89gEKagKI7dnvobV5FgpuUWQIWNP1/0NbfCYZC2W8toheog5+aQTdFI8/wFJ/FvK7FGOiQiZSgGaHUmeY6pZ2qjpvZKEIttf+jNY2aPmM3W+JxwaRSAtl+LC70cxEeZjyza3t799vN5is7jUSHgkl1AfEsgYQqd30gnQV+hfm2PWJlw+XQgxM48EwZa/7qaNFszaOfuAsUtFhMwfuY6mrsJbFQLBmzxAnQtuyzuDWsHXg0Bn+pPtxhlj3OG45XlWvd3Xs+wbexWR3PUNNrSlU2O0uHun05YMSAv48EDTURUTCnc/QI MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f56692be-d564-4769-d29e-08d3d7288a02 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2006; 2:807UeT4WKDxysV4uNE5f+jDZ9Mgbq0zYYWfUs8AAQIhX0I5bMxDZ17l90iLyVj6hHgSPLYfQD2zPp4uyfkhKnZp8vOwp/RvfbHk6McURYRv81SFj8L3KqNTok2x3qRD08LRj9EgU9yXB4xGZU7PY/ig09tUkD+4/g0+1z8eEiFuMOyq8QjaKP8tQMsNyjUOZ; 3:2uHU46OxNV95mkj5zEsHKiBqP1FhGoK8M99jszFdlucsoZIyCeuNyitPlojei7ppwymBOZGnNegV3eEpvI5F2WPZyWOdRdWotX/LcxHRdXA+EiA+2twhvDWeYZ3BqFXLvj07/rna8QD2sJCmG/BvBEHDU7Wy4+BPkOZ4gtCT4R1fXYNdwwFFhi87iQwt8uUkQ7I7AOSKBYwvXcmo4tANiteqDIGRQtQukJOGJdlGU0Y= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB2006; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2006; 25:M3Lsn6CMi2P2fc/wRwABhNQxKu+QncoeY6VJm55o2NW4x7zmrwBd1J0CKHawr7F4hOPFoTZbYeyp5HyX1vsAid8FX2H9MAetpil0PU9fhg9CWQpEOjVUcYI1o7wsolBUj/LCdkVLhJmWA7ybWYN/pb/c3yPK4SAX2WpIiPGIIaPL3CI36tKRTnMOYhMVD3RODR9L6A4lSwWWrDQthk1j0FEzuX0Bdj0jIMnFQBJEJ07akedwmNScMNujX7gv3BFJT6nDMie0HErmnqVbNY/GaqZlXPvsStLLZgCulJ3Tdu4HD2vc5Js3la133DGz1y+pivfDKpO9oQTULYazUUrY8Jw3MP2vxPrnEcZXOENAU0ffKa1wLBS0fsMiISRpqvtYdAr6U9WZVsksnGKuWDdUp+310MuLuzw8vigla+/kiOe5SWMSdrsDU1EnaFVNA269S8BFm/ff/rO51wWaQGNDc7lfRqfi3UZgcQ2rX6k0DBjvAxE2kMIL6T4PNxu9+gPV72WWAtVfeyfDNgxsqmAVQ+fJ+j7cRZdR9PoC5IzhzxL2xJsXFm9HB358cRmLWCY7elBCGk3ckR5Hj1J2GRs7XPkrBgtGWSF9hpt0mkSulIp/tOAChLNpk4WxP3adGRgIL4VBhWIqlJS5uUWRp9ZpT/wwlUxDE++ysI7Iq5pXl7P8ycApxPx+wOy4zlfHGb4ZIAgbPb5wJX2/GsRTvqz8uw==; 31:mGmnZwCczkwXPa6seSp5wJYuM12hPZKirgHkx87SVnjT+dj0WEQ+hhRwNkec8gqYUjuHKc86BlkXOPcRhqn4rcEndoxj7bPN2uv+G8e91DsrSOp9n/uMjBAu9zBehFBgEbA1tafFcB61pxt6rMyFTa1yeo7XpsNa7lIATTuG1OgtsArxBV06+Gwv0bPvqlgTElDufHcu15W3A1C6Ejdz3PqOkDyc1tPbfq341FBgfVc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BY2PR0301MB2006; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB2006; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2006; 4:BZU3B5A4exdDI9SFAzvNpSNTF6izBkW/yY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5nwe3?= =?us-ascii?Q?mXFCOOtDYGTeD2DPTdkqnC4atSLI6uza5O55f/JWwEYitycVZeDAXZGjJGc7?= =?us-ascii?Q?2Tr9cuRIihgygDZlQJgrGdw42lB+teRnn0uVNbTHJFlAuoSTa/utGk5zQk1U?= =?us-ascii?Q?TsCXW3cM+tQMRqpPc86y7aTrI4fKTGsGblSGBlyLc1PGTMAWqWH9T9p073g6?= =?us-ascii?Q?r4OKt3WsrymmNik/IgDzbIMh6bmAknjwns6OjBSB/0+psET1cJLMXfLxcSdS?= =?us-ascii?Q?NL7c2/hvBzT7OOojkY8wcjlVLCPzZeLpdIsR2Wzvs/sP3VYW4N0pj7gDbOMN?= =?us-ascii?Q?m74MtJPfz1bJkZd7dCOaIFEe4qlcUi910yWiiw3SD/nKTBgINFcKUcsbkZso?= =?us-ascii?Q?958ARg6yB+wIyWGdeEM5Xmrms1vSJ1RoB5WbKB0kmZbkkXVMYPaCNXSqX/I2?= =?us-ascii?Q?FIiFDEV61k0bDiGTgJb+1n9WvxkxHZNVSN9IbhyCSFBnU4t0IVFwKBmKfu+J?= =?us-ascii?Q?Z/yFVB7UVXmM7ZoNLCQWc9IvoFPTk1LHjTrQ8tczginZxOFKlfF0e67tYNAH?= =?us-ascii?Q?a3b5iV65QOVwQOMAU5Yd9DjrZs0gr4kO0HDh5bzO1OntQDSRmmPJbSowM85r?= =?us-ascii?Q?uNTtOowZQJqHC2u7KcTbACNqcXS3G2ZTbX2+72/eG4CORAMVuOAzK67XWAOd?= =?us-ascii?Q?0Z8qKKoBJxYA8Da7tmxbWWbsjibj9Mai/XS+/yvj4WSronHwBGY2l32Xj9/S?= =?us-ascii?Q?cfTckOK42XEBy/8lznHHb9qIXpR2ZptWocG10cJVu+LWSI61l8vdkykHE066?= =?us-ascii?Q?p747dejouEIgTjIw=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2006; 6:383EWEaS46xx+qD5PzF5kHBbuu87LUaoXQhtHJohrHD7Tx6tKJjDqzwXXK5Di7AafSEpcvjbRnAb3+Kd0dcnvAp/QZe1yKr6O15vy1+4P4YyMTZ9gOedYZ+/TuKi55nAhdqN/4n8U9a8I5YG7hJLG1slZ4MJ32qD5Pxs+2SneZ48KOufht84d/XeoERGUM4lctKibWhpaKU3rE+gmvmWz0qaXyex4/Y8Yz9rybxAn/m7mJMY/X9dqRgiS6vh19sRQtUfCQ3ATKjjf/RdyAfpIqEtzHUIBWSFdaITU7chFcQ=; 5:lGcH4T+NNMNM/+jLZWZ/cwt3MgWdrgEeQi7lr9txGjvSZnzoEU3n+pYnNlPNSaihG37pSQ9aR/OHsklqY7ik2/p9iMqTY0ZbI/Z2gPJnux1DhGGyIiMTAg6o6XXAfH5D+35TO4o9z2AadApKJpsU4zOaCGnfV1v5dcwCK3S4eVs=; 24:VZ3APOv4v8k25iS7C9tNcfXT1kcebb4K4PX7+B5ifPB+HbRr9NXkCpNEmxFjOs1Z/zbT5eOseyyI/qufXbodWIGGgzm3sdxFYO+XHIlJWLk=; 7:O2045ueg+qOiaPuvqqzOVNGj3AJPQj5SL7uIADaLci+22qv5NxNvn8IFnh9K8zFJhU3/e3jQ+Uk5GgFXjY02QLl9Rqi5vjxlQm5lsuhd7cahbHbawoWmRn90AXUC6/+ILs3xeT0KJNnQhYPw/TAml19cssFjMugN7cdQxhj/e5q/u2y5FhLdIlEJk75wug6eyrtrFpUbjJFeZom3NQaeYNsM0jKIbRGhx6/7MX0xjoZjUopUfZWHI2JufG6i3IxA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2016 14:09:10.1604 (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: BY2PR0301MB2006 Subject: [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of 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: Wed, 07 Sep 2016 14:09:13 -0000 Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 332f2a4..c5d94f3 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -322,6 +322,27 @@ 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); + * + * Some implementation already have this defined, thus, conditional + * declaration. + */ +#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