DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: parse args before any kinds of init
@ 2014-04-15  3:03 Wang Sheng-Hui
  2014-04-17 21:58 ` Thomas Monjalon
  2014-05-05 15:50 ` Thomas Monjalon
  0 siblings, 2 replies; 6+ messages in thread
From: Wang Sheng-Hui @ 2014-04-15  3:03 UTC (permalink / raw)
  To: dev


Parse args first, to resolve any invalid args and give out the usage string.
E.g './helloworld --invalid', the '--invalid' will be checked before any init.
After the options are checked, take any init actions.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 3ded563..9d20718 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -637,6 +637,11 @@ eal_parse_args(int argc, char **argv)
        };
        struct shared_driver *solib;

+       /* check the no args case */
+       if (argc == 1) {
+               eal_usage(prgname);
+               return (-1);
+       }
        argvopt = argv;

        internal_config.memory = 0;
@@ -964,16 +969,16 @@ rte_eal_init(int argc, char **argv)

        thread_id = pthread_self();

+       fctret = eal_parse_args(argc, argv);
+       if (fctret < 0)
+               exit(1);
+
        if (rte_eal_log_early_init() < 0)
                rte_panic("Cannot init early logs\n");

        if (rte_eal_cpu_init() < 0)
                rte_panic("Cannot detect lcores\n");

-       fctret = eal_parse_args(argc, argv);
-       if (fctret < 0)
-               exit(1);
-
        if (internal_config.no_hugetlbfs == 0 &&
                        internal_config.process_type != RTE_PROC_SECONDARY &&
                        internal_config.xen_dom0_support == 0 &&
-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH] eal: parse args before any kinds of init
@ 2014-04-15  3:00 Wang Sheng-Hui
  0 siblings, 0 replies; 6+ messages in thread
From: Wang Sheng-Hui @ 2014-04-15  3:00 UTC (permalink / raw)
  To: dev


Parse args first, to resolve any invalid args and give out the usage string.
E.g './helloworld --invalid', the '--invalid' will be checked before any init.
After the options are checked, take any init actions.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 3ded563..9d20718 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -637,6 +637,11 @@ eal_parse_args(int argc, char **argv)
        };
        struct shared_driver *solib;

+       /* check the no args case */
+       if (argc == 1) {
+               eal_usage(prgname);
+               return (-1);
+       }
        argvopt = argv;

        internal_config.memory = 0;
@@ -964,16 +969,16 @@ rte_eal_init(int argc, char **argv)

        thread_id = pthread_self();

+       fctret = eal_parse_args(argc, argv);
+       if (fctret < 0)
+               exit(1);
+
        if (rte_eal_log_early_init() < 0)
                rte_panic("Cannot init early logs\n");

        if (rte_eal_cpu_init() < 0)
                rte_panic("Cannot detect lcores\n");

-       fctret = eal_parse_args(argc, argv);
-       if (fctret < 0)
-               exit(1);
-
        if (internal_config.no_hugetlbfs == 0 &&
                        internal_config.process_type != RTE_PROC_SECONDARY &&
                        internal_config.xen_dom0_support == 0 &&
-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-07 13:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15  3:03 [dpdk-dev] [PATCH] eal: parse args before any kinds of init Wang Sheng-Hui
2014-04-17 21:58 ` Thomas Monjalon
2014-04-18  0:30   ` Wang Sheng-Hui
2014-05-05 15:50 ` Thomas Monjalon
2014-05-07 13:06   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2014-04-15  3:00 Wang Sheng-Hui

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).