From: Panu Matilainen <pmatilai@redhat.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] eal: refactor plugin list append from eal_parse_args() to a helper function
Date: Fri, 16 Oct 2015 14:58:13 +0300 [thread overview]
Message-ID: <e18b068e2e25a82fb1d321a4bd4f32d41c6d83e6.1444996480.git.pmatilai@redhat.com> (raw)
In-Reply-To: <cover.1444996152.git.pmatilai@redhat.com>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 33e1067..cc66d9f 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -530,6 +530,24 @@ eal_log_level_parse(int argc, char **argv)
optind = 0; /* reset getopt lib */
}
+static int
+eal_plugin_add(const char *path)
+{
+ struct shared_driver *solib;
+
+ solib = malloc(sizeof(*solib));
+ if (solib == NULL) {
+ RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
+ return -1;
+ }
+ memset(solib, 0, sizeof(*solib));
+ strncpy(solib->name, path, PATH_MAX-1);
+ solib->name[PATH_MAX-1] = 0;
+ TAILQ_INSERT_TAIL(&solib_list, solib, next);
+
+ return 0;
+}
+
/* Parse the argument given in the command line of the application */
static int
eal_parse_args(int argc, char **argv)
@@ -538,7 +556,6 @@ eal_parse_args(int argc, char **argv)
char **argvopt;
int option_index;
char *prgname = argv[0];
- struct shared_driver *solib;
argvopt = argv;
@@ -570,15 +587,8 @@ eal_parse_args(int argc, char **argv)
/* force loading of external driver */
case 'd':
- solib = malloc(sizeof(*solib));
- if (solib == NULL) {
- RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
+ if (eal_plugin_add(optarg) == -1)
return -1;
- }
- memset(solib, 0, sizeof(*solib));
- strncpy(solib->name, optarg, PATH_MAX-1);
- solib->name[PATH_MAX-1] = 0;
- TAILQ_INSERT_TAIL(&solib_list, solib, next);
break;
/* long options */
--
2.4.3
next prev parent reply other threads:[~2015-10-16 11:58 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 11:58 [dpdk-dev] [PATCH 0/2] Add support for driver directories Panu Matilainen
2015-09-25 11:58 ` [dpdk-dev] [PATCH 1/2] eal: refactor plugin list append from eal_parse_args() to a helper function Panu Matilainen
2015-09-25 11:58 ` [dpdk-dev] [PATCH 2/2] eal: add support for driver directory concept Panu Matilainen
2015-09-25 12:35 ` [dpdk-dev] [PATCH 0/2] Add support for driver directories David Marchand
2015-09-25 13:00 ` Panu Matilainen
2015-10-14 10:41 ` Panu Matilainen
2015-10-14 11:55 ` David Marchand
2015-10-16 11:58 ` [dpdk-dev] [PATCH 0/5 v2] " Panu Matilainen
2015-10-16 11:58 ` Panu Matilainen [this message]
2015-10-16 11:58 ` [dpdk-dev] [PATCH 2/5] eal: refactor plugin init from eal_parse_args() to a helper function Panu Matilainen
2015-10-16 11:58 ` [dpdk-dev] [PATCH 3/5] eal: move plugin loading to eal/common Panu Matilainen
2015-10-16 11:58 ` [dpdk-dev] [PATCH 4/5] eal: add an error code to plugin init for the next step Panu Matilainen
2015-10-16 12:59 ` Bruce Richardson
2015-10-16 13:14 ` Panu Matilainen
2015-10-16 13:38 ` Panu Matilainen
2015-10-21 8:14 ` Thomas Monjalon
2015-10-16 11:58 ` [dpdk-dev] [PATCH 5/5] eal: add support for driver directory concept Panu Matilainen
2015-10-16 12:57 ` [dpdk-dev] [PATCH 1/5] eal: refactor plugin list append from eal_parse_args() to a helper function Bruce Richardson
2015-10-16 13:07 ` Panu Matilainen
2015-10-21 8:29 ` [dpdk-dev] [PATCH 0/2 v3] Add support for driver directories Panu Matilainen
2015-10-21 8:29 ` [dpdk-dev] [PATCH 1/2] eal: move plugin loading to eal/common Panu Matilainen
2015-10-21 10:15 ` David Marchand
2015-10-21 10:54 ` Panu Matilainen
2015-10-21 11:09 ` David Marchand
2015-10-21 11:15 ` Bruce Richardson
2015-10-21 11:53 ` Thomas Monjalon
2015-10-21 12:07 ` Panu Matilainen
2015-10-21 8:29 ` [dpdk-dev] [PATCH 2/2] eal: add support for driver directory concept Panu Matilainen
2015-10-21 8:44 ` Thomas Monjalon
2015-10-21 9:43 ` Panu Matilainen
2015-11-10 14:28 ` [dpdk-dev] [PATCH v4 0/2] Add support for driver directories Panu Matilainen
2015-11-10 15:04 ` David Marchand
2015-11-12 15:52 ` Thomas Monjalon
2015-12-03 2:07 ` Stephen Hemminger
2015-12-03 2:26 ` Thomas Monjalon
2015-12-03 7:59 ` Panu Matilainen
2015-11-10 14:28 ` [dpdk-dev] [PATCH v4 1/2] eal: move plugin loading to eal/common Panu Matilainen
2015-11-10 14:28 ` [dpdk-dev] [PATCH v4 2/2] eal: add support for driver directory concept Panu Matilainen
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=e18b068e2e25a82fb1d321a4bd4f32d41c6d83e6.1444996480.git.pmatilai@redhat.com \
--to=pmatilai@redhat.com \
--cc=dev@dpdk.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).