All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
To: Amr Mokhtar <amr.mokhtar@intel.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: [PATCH] eal: use eal abstraction for defining constructors
Date: Mon, 18 Mar 2019 04:15:56 +0000	[thread overview]
Message-ID: <20190318041512.19526-1-jerinj@marvell.com> (raw)

From: Jerin Jacob <jerinj@marvell.com>

Use eal's RTE_INIT abstraction for defining constructors.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 app/test-bbdev/main.h            | 3 +--
 app/test/resource.h              | 2 +-
 app/test/test.h                  | 3 +--
 lib/librte_mempool/rte_mempool.h | 7 +++----
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/app/test-bbdev/main.h b/app/test-bbdev/main.h
index 20a55efca..2bbe1b822 100644
--- a/app/test-bbdev/main.h
+++ b/app/test-bbdev/main.h
@@ -103,8 +103,7 @@ void add_test_command(struct test_command *t);
 		.command = RTE_STR(name), \
 		.callback = test_func_##name, \
 	}; \
-	static void __attribute__((constructor, used)) \
-	test_register_##name(void) \
+	RTE_INIT(test_register_##name) \
 	{ \
 		add_test_command(&test_struct_##name); \
 	}
diff --git a/app/test/resource.h b/app/test/resource.h
index 223fa22ae..c75ebd4b5 100644
--- a/app/test/resource.h
+++ b/app/test/resource.h
@@ -98,7 +98,7 @@ static struct resource linkres_ ##n = {       \
 	.begin = b,             \
 	.end = e,               \
 };                              \
-static void __attribute__((constructor, used)) resinitfn_ ##n(void) \
+RTE_INIT(resinitfn_ ##n)	\
 {                               \
 	resource_register(&linkres_ ##n);  \
 }
diff --git a/app/test/test.h b/app/test/test.h
index 7c2443230..9b3846b1e 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -177,8 +177,7 @@ void add_test_command(struct test_command *t);
 		.command = RTE_STR(cmd), \
 		.callback = func, \
 	}; \
-	static void __attribute__((constructor, used)) \
-	test_register_##cmd(void) \
+	RTE_INIT(test_register_##cmd) \
 	{ \
 		add_test_command(&test_struct_##cmd); \
 	}
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 7c9cd9a2f..fd19470d7 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -832,10 +832,9 @@ int rte_mempool_register_ops(const struct rte_mempool_ops *ops);
  * Note that the rte_mempool_register_ops fails silently here when
  * more than RTE_MEMPOOL_MAX_OPS_IDX is registered.
  */
-#define MEMPOOL_REGISTER_OPS(ops)					\
-	void mp_hdlr_init_##ops(void);					\
-	void __attribute__((constructor, used)) mp_hdlr_init_##ops(void)\
-	{								\
+#define MEMPOOL_REGISTER_OPS(ops)				\
+	RTE_INIT(mp_hdlr_init_##ops)				\
+	{							\
 		rte_mempool_register_ops(&ops);			\
 	}
 
-- 
2.21.0

             reply	other threads:[~2019-03-18  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18  4:15 Jerin Jacob Kollanukkaran [this message]
2019-03-18  7:54 ` [PATCH] eal: use eal abstraction for defining constructors David Marchand
2019-03-27 22:11   ` 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=20190318041512.19526-1-jerinj@marvell.com \
    --to=jerinj@marvell.com \
    --cc=amr.mokhtar@intel.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=thomas@monjalon.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.