Show a patch.

GET /api/patches/436/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 436,
    "url": "https://patches.dpdk.org/api/patches/436/?format=api",
    "web_url": "https://patches.dpdk.org/patch/436/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<1411375081-27986-6-git-send-email-david.marchand@6wind.com>",
    "date": "2014-09-22T08:37:59",
    "name": "[dpdk-dev,5/7] eal: merge bsd and linux common options parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "86a0ce6efe548e55109421126898e56ac783447a",
    "submitter": {
        "id": 3,
        "url": "https://patches.dpdk.org/api/people/3/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/436/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/436/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/436/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<1411375081-27986-1-git-send-email-david.marchand@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 1.7.10.4",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 18A51B3BB;\n\tMon, 22 Sep 2014 10:32:17 +0200 (CEST)",
            "from mail-wi0-f177.google.com (mail-wi0-f177.google.com\n\t[209.85.212.177]) by dpdk.org (Postfix) with ESMTP id E85E4B3B1\n\tfor <dev@dpdk.org>; Mon, 22 Sep 2014 10:32:11 +0200 (CEST)",
            "by mail-wi0-f177.google.com with SMTP id q5so2472156wiv.4\n\tfor <dev@dpdk.org>; Mon, 22 Sep 2014 01:38:15 -0700 (PDT)",
            "from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by mx.google.com with ESMTPSA id\n\tjs2sm11522334wjc.9.2014.09.22.01.38.13 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 22 Sep 2014 01:38:14 -0700 (PDT)"
        ],
        "References": "<1411375081-27986-1-git-send-email-david.marchand@6wind.com>",
        "X-BeenThere": "dev@dpdk.org",
        "X-Received": "by 10.194.58.244 with SMTP id u20mr19168558wjq.36.1411375094991; \n\tMon, 22 Sep 2014 01:38:14 -0700 (PDT)",
        "Message-Id": "<1411375081-27986-6-git-send-email-david.marchand@6wind.com>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ku5BMqk4JmOn7yLCT4n/p+9xuWAKMX6ReCn1rhuB/cY=;\n\tb=VpJLGBzUKG5gCPesNJbvb4+qnACicBDayMaDrnfGyRKDyiX4QvBh5QCwO1+l7x/S/m\n\tXSNbF+slJhWJXfGuXGe4uyf5e6KqIm2inKaLoo823v4p94NeDo4ClYrW3mpy6LPklh7G\n\tM1njctX631O9OHqLfgSgF36QnQ3juUWveK6/HnvpfYLKQBDrAz7igVACPoEL1NUhzRjt\n\ta/lY6gFiuJA85RQ/V9rAssbLilcpAx+8rSH4jN3WPJaX8KOnoYRdBpX4R2wKVchFczLY\n\tvtN5rPCC5KvFNmgi8iTd60xlIZgeenniL1WfZ91O2fLJ7q6P/QA/Px6moeTIciDxNSkf\n\tuxGg==",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Precedence": "list",
        "From": "David Marchand <david.marchand@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Mon, 22 Sep 2014 10:37:59 +0200",
        "X-Gm-Message-State": "ALoCoQmXk2P6IN6pLdtjmW7wcjeO315WN8Ts9wr1lqTsMQd07HraglWxGp6IvY/T4NWE/ts6iii5",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH 5/7] eal: merge bsd and linux common options\n\tparsing"
    },
    "content": "All common options are now in a single file.\nCommon usage() has been moved as well.\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/Makefile          |    1 +\n lib/librte_eal/bsdapp/eal/eal.c             |  340 +++---------------------\n lib/librte_eal/common/eal_common_options.c  |  379 +++++++++++++++++++++++++++\n lib/librte_eal/common/include/eal_options.h |   58 ++++\n lib/librte_eal/linuxapp/eal/Makefile        |    1 +\n lib/librte_eal/linuxapp/eal/eal.c           |  370 ++++----------------------\n 6 files changed, 519 insertions(+), 630 deletions(-)\n create mode 100644 lib/librte_eal/common/eal_common_options.c\n create mode 100644 lib/librte_eal/common/include/eal_options.h",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 8f44273..aaa174e 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -71,6 +71,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_string_fns.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c\n \n CFLAGS_eal.o := -D_GNU_SOURCE\n #CFLAGS_eal_thread.o := -D_GNU_SOURCE\ndiff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 81d1a65..58f00fd 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -79,26 +79,10 @@\n #include \"eal_internal_cfg.h\"\n #include \"eal_filesystem.h\"\n #include \"eal_hugepages.h\"\n-\n-#define OPT_HUGE_DIR    \"huge-dir\"\n-#define OPT_PROC_TYPE   \"proc-type\"\n-#define OPT_NO_SHCONF   \"no-shconf\"\n-#define OPT_NO_HPET     \"no-hpet\"\n-#define OPT_VMWARE_TSC_MAP   \"vmware-tsc-map\"\n-#define OPT_NO_PCI      \"no-pci\"\n-#define OPT_NO_HUGE     \"no-huge\"\n-#define OPT_FILE_PREFIX \"file-prefix\"\n-#define OPT_SOCKET_MEM  \"socket-mem\"\n-#define OPT_PCI_WHITELIST \"pci-whitelist\"\n-#define OPT_PCI_BLACKLIST \"pci-blacklist\"\n-#define OPT_VDEV        \"vdev\"\n-#define OPT_SYSLOG      \"syslog\"\n-#define OPT_LOG_LEVEL   \"log-level\"\n+#include \"eal_options.h\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n \n-#define BITS_PER_HEX 4\n-\n /* Allow the application to print its usage message too if set */\n static rte_usage_hook_t\trte_application_usage_hook = NULL;\n /* early configuration structure, when memory config is not mmapped */\n@@ -285,34 +269,8 @@ rte_config_init(void)\n static void\n eal_usage(const char *prgname)\n {\n-\tprintf(\"\\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n-\t       \"[--proc-type primary|secondary|auto] \\n\\n\"\n-\t       \"EAL options:\\n\"\n-\t       \"  -c COREMASK  : A hexadecimal bitmask of cores to run on\\n\"\n-\t       \"  -n NUM       : Number of memory channels\\n\"\n-\t       \"  -v           : Display version information on startup\\n\"\n-\t       \"  -m MB        : memory to allocate\\n\"\n-\t       \"  -r NUM       : force number of memory ranks (don't detect)\\n\"\n-\t       \"  --\"OPT_LOG_LEVEL\"  : set default log level\\n\"\n-\t       \"  --\"OPT_PROC_TYPE\"  : type of this process\\n\"\n-\t       \"  --\"OPT_PCI_BLACKLIST\", -b: add a PCI device in black list.\\n\"\n-\t       \"               Prevent EAL from using this PCI device. The argument\\n\"\n-\t       \"               format is <domain:bus:devid.func>.\\n\"\n-\t       \"  --\"OPT_PCI_WHITELIST\", -w: add a PCI device in white list.\\n\"\n-\t       \"               Only use the specified PCI devices. The argument format\\n\"\n-\t       \"               is <[domain:]bus:devid.func>. This option can be present\\n\"\n-\t       \"               several times (once per device).\\n\"\n-\t       \"               [NOTE: PCI whitelist cannot be used with -b option]\\n\"\n-\t       \"  --\"OPT_VDEV\": add a virtual device.\\n\"\n-\t       \"               The argument format is <driver><id>[,key=val,...]\\n\"\n-\t       \"               (ex: --vdev=eth_pcap0,iface=eth2).\\n\"\n-\t       \"  --\"OPT_VMWARE_TSC_MAP\": use VMware TSC map instead of native RDTSC\\n\"\n-\t       \"\\nEAL options for DEBUG use only:\\n\"\n-\t       \"  --\"OPT_NO_HUGE\"  : use malloc instead of hugetlbfs\\n\"\n-\t       \"  --\"OPT_NO_PCI\"   : disable pci\\n\"\n-\t       \"  --\"OPT_NO_SHCONF\": no shared config (mmap'd files)\\n\"\n-\t       \"\\n\",\n-\t       prgname);\n+\tprintf(\"\\nUsage: %s \", prgname);\n+\teal_common_usage();\n \t/* Allow the application to print its usage message too if hook is set */\n \tif ( rte_application_usage_hook ) {\n \t\tprintf(\"===== Application Usage =====\\n\\n\");\n@@ -333,136 +291,6 @@ rte_set_application_usage_hook( rte_usage_hook_t usage_func )\n \treturn old_func;\n }\n \n-/*\n- * Parse the coremask given as argument (hexadecimal string) and fill\n- * the global configuration (core role and core count) with the parsed\n- * value.\n- */\n-static int xdigit2val(unsigned char c)\n-{\n-\tint val;\n-\tif(isdigit(c))\n-\t\tval = c - '0';\n-\telse if(isupper(c))\n-\t\tval = c - 'A' + 10;\n-\telse\n-\t\tval = c - 'a' + 10;\n-\treturn val;\n-}\n-static int\n-eal_parse_coremask(const char *coremask)\n-{\n-\tstruct rte_config *cfg = rte_eal_get_configuration();\n-\tint i, j, idx = 0 ;\n-\tunsigned count = 0;\n-\tchar c;\n-\tint val;\n-\n-\tif (coremask == NULL)\n-\t\treturn -1;\n-\t/* Remove all blank characters ahead and after .\n-\t * Remove 0x/0X if exists.\n-\t */\n-\twhile (isblank(*coremask))\n-\t\tcoremask++;\n-\tif (coremask[0] == '0' && ((coremask[1] == 'x')\n-\t\t||  (coremask[1] == 'X')) )\n-\t\tcoremask += 2;\n-\ti = strnlen(coremask, sysconf(_SC_ARG_MAX));\n-\twhile ((i > 0) && isblank(coremask[i - 1]))\n-\t\ti--;\n-\tif (i == 0)\n-\t\treturn -1;\n-\n-\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\treturn (-1);\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n-\t\t\tif((1 << j) & val) {\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n-\t\t\t\tif(count == 0)\n-\t\t\t\t\tcfg->master_lcore = idx;\n-\t\t\t\tcount++;\n-\t\t\t} else  {\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n-\t\t\t}\n-\t\t}\n-\t}\n-\tfor(; i >= 0; i--)\n-\t\tif(coremask[i] != '0')\n-\t\t\treturn -1;\n-\tfor(; idx < RTE_MAX_LCORE; idx++)\n-\t\tcfg->lcore_role[idx] = ROLE_OFF;\n-\tif(count == 0)\n-\t\treturn -1;\n-\treturn 0;\n-}\n-\n-static int\n-eal_parse_syslog(const char *facility)\n-{\n-\tint i;\n-\tstatic struct {\n-\t\tconst char *name;\n-\t\tint value;\n-\t} map[] = {\n-\t\t{ \"auth\", LOG_AUTH },\n-\t\t{ \"cron\", LOG_CRON },\n-\t\t{ \"daemon\", LOG_DAEMON },\n-\t\t{ \"ftp\", LOG_FTP },\n-\t\t{ \"kern\", LOG_KERN },\n-\t\t{ \"lpr\", LOG_LPR },\n-\t\t{ \"mail\", LOG_MAIL },\n-\t\t{ \"news\", LOG_NEWS },\n-\t\t{ \"syslog\", LOG_SYSLOG },\n-\t\t{ \"user\", LOG_USER },\n-\t\t{ \"uucp\", LOG_UUCP },\n-\t\t{ \"local0\", LOG_LOCAL0 },\n-\t\t{ \"local1\", LOG_LOCAL1 },\n-\t\t{ \"local2\", LOG_LOCAL2 },\n-\t\t{ \"local3\", LOG_LOCAL3 },\n-\t\t{ \"local4\", LOG_LOCAL4 },\n-\t\t{ \"local5\", LOG_LOCAL5 },\n-\t\t{ \"local6\", LOG_LOCAL6 },\n-\t\t{ \"local7\", LOG_LOCAL7 },\n-\t\t{ NULL, 0 }\n-\t};\n-\n-\tfor (i = 0; map[i].name; i++) {\n-\t\tif (!strcmp(facility, map[i].name)) {\n-\t\t\tinternal_config.syslog_facility = map[i].value;\n-\t\t\treturn 0;\n-\t\t}\n-\t}\n-\treturn -1;\n-}\n-\n-static int\n-eal_parse_log_level(const char *level, uint32_t *log_level)\n-{\n-\tchar *end;\n-\tunsigned long tmp;\n-\n-\terrno = 0;\n-\ttmp = strtoul(level, &end, 0);\n-\n-\t/* check for errors */\n-\tif ((errno != 0) || (level[0] == '\\0') ||\n-\t    end == NULL || (*end != '\\0'))\n-\t\treturn -1;\n-\n-\t/* log_level is a uint32_t */\n-\tif (tmp >= UINT32_MAX)\n-\t\treturn -1;\n-\n-\t*log_level = tmp;\n-\treturn 0;\n-}\n-\n static inline size_t\n eal_get_hugepage_mem_size(void)\n {\n@@ -481,19 +309,6 @@ eal_get_hugepage_mem_size(void)\n \treturn (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;\n }\n \n-static enum rte_proc_type_t\n-eal_parse_proc_type(const char *arg)\n-{\n-\tif (strncasecmp(arg, \"primary\", sizeof(\"primary\")) == 0)\n-\t\treturn RTE_PROC_PRIMARY;\n-\tif (strncasecmp(arg, \"secondary\", sizeof(\"secondary\")) == 0)\n-\t\treturn RTE_PROC_SECONDARY;\n-\tif (strncasecmp(arg, \"auto\", sizeof(\"auto\")) == 0)\n-\t\treturn RTE_PROC_AUTO;\n-\n-\treturn RTE_PROC_INVALID;\n-}\n-\n /* Parse the argument given in the command line of the application */\n static int\n eal_parse_args(int argc, char **argv)\n@@ -503,23 +318,6 @@ eal_parse_args(int argc, char **argv)\n \tint option_index;\n \tint coremask_ok = 0;\n \tchar *prgname = argv[0];\n-\tstatic struct option lgopts[] = {\n-\t\t{OPT_NO_HUGE, 0, 0, 0},\n-\t\t{OPT_NO_PCI, 0, 0, 0},\n-\t\t{OPT_NO_HPET, 0, 0, 0},\n-\t\t{OPT_VMWARE_TSC_MAP, 0, 0, 0},\n-\t\t{OPT_HUGE_DIR, 1, 0, 0},\n-\t\t{OPT_NO_SHCONF, 0, 0, 0},\n-\t\t{OPT_PROC_TYPE, 1, 0, 0},\n-\t\t{OPT_FILE_PREFIX, 1, 0, 0},\n-\t\t{OPT_SOCKET_MEM, 1, 0, 0},\n-\t\t{OPT_PCI_WHITELIST, 1, 0, 'w'},\n-\t\t{OPT_PCI_BLACKLIST, 1, 0, 'b'},\n-\t\t{OPT_VDEV, 1, 0, 0},\n-\t\t{OPT_SYSLOG, 1, NULL, 0},\n-\t\t{OPT_LOG_LEVEL, 1, NULL, 0},\n-\t\t{0, 0, 0, 0}\n-\t};\n \n \targvopt = argv;\n \n@@ -547,117 +345,51 @@ eal_parse_args(int argc, char **argv)\n \n \tinternal_config.vmware_tsc_map = 0;\n \n-\twhile ((opt = getopt_long(argc, argvopt, \"b:w:c:m:n:r:v\",\n-\t\t\t\t  lgopts, &option_index)) != EOF) {\n+\twhile ((opt = getopt_long(argc, argvopt, eal_short_options,\n+\t\t\t\t  eal_long_options, &option_index)) != EOF) {\n \n-\t\tswitch (opt) {\n-\t\t/* blacklist */\n-\t\tcase 'b':\n-\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,\n-\t\t\t\t\toptarg) < 0) {\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn (-1);\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* whitelist */\n-\t\tcase 'w':\n-\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI,\n-\t\t\t\t\toptarg) < 0) {\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* coremask */\n-\t\tcase 'c':\n-\t\t\tif (eal_parse_coremask(optarg) < 0) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid coremask\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tcoremask_ok = 1;\n-\t\t\tbreak;\n-\t\t/* size of memory */\n-\t\tcase 'm':\n-\t\t\tinternal_config.memory = atoi(optarg);\n-\t\t\tinternal_config.memory *= 1024ULL;\n-\t\t\tinternal_config.memory *= 1024ULL;\n-\t\t\tbreak;\n-\t\t/* force number of channels */\n-\t\tcase 'n':\n-\t\t\tinternal_config.force_nchannel = atoi(optarg);\n-\t\t\tif (internal_config.force_nchannel == 0 ||\n-\t\t\t    internal_config.force_nchannel > 4) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid channel number\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* force number of ranks */\n-\t\tcase 'r':\n-\t\t\tinternal_config.force_nrank = atoi(optarg);\n-\t\t\tif (internal_config.force_nrank == 0 ||\n-\t\t\t    internal_config.force_nrank > 16) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid rank number\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\tcase 'v':\n-\t\t\t/* since message is explicitly requested by user, we\n-\t\t\t * write message at highest log level so it can always be seen\n-\t\t\t * even if info or warning messages are disabled */\n-\t\t\tRTE_LOG(CRIT, EAL, \"RTE Version: '%s'\\n\", rte_version());\n-\t\t\tbreak;\n+\t\tint ret;\n+\n+\t\t/* getopt is not happy, stop right now */\n+\t\tif (opt == '?')\n+\t\t\treturn -1;\n \n+\t\tret = eal_parse_common_option(opt, optarg, option_index,\n+\t\t\t\t\t      &internal_config);\n+\t\t/* common parser is not happy */\n+\t\tif (ret < 0) {\n+\t\t\teal_usage(prgname);\n+\t\t\treturn -1;\n+\t\t}\n+\t\t/* common parser handled this option */\n+\t\tif (ret == 0) {\n+\t\t\t/* special case, note that the common parser accepted\n+\t\t\t * the coremask option */\n+\t\t\tif (opt == 'c')\n+\t\t\t\tcoremask_ok = 1;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tswitch (opt) {\n \t\t/* long options */\n \t\tcase 0:\n-\t\t\tif (!strcmp(lgopts[option_index].name, OPT_NO_HUGE)) {\n-\t\t\t\tinternal_config.no_hugetlbfs = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_PCI)) {\n-\t\t\t\tinternal_config.no_pci = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_HPET)) {\n-\t\t\t\tinternal_config.no_hpet = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_VMWARE_TSC_MAP)) {\n-\t\t\t\tinternal_config.vmware_tsc_map = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_SHCONF)) {\n-\t\t\t\tinternal_config.no_shconf = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_PROC_TYPE)) {\n-\t\t\t\tinternal_config.process_type = eal_parse_proc_type(optarg);\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_VDEV)) {\n-\t\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL,\n-\t\t\t\t\t\toptarg) < 0) {\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_SYSLOG)) {\n-\t\t\t\tif (eal_parse_syslog(optarg) < 0) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n-\t\t\t\t\t\t\tOPT_SYSLOG \"\\n\");\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name,\n-\t\t\t\t\t OPT_LOG_LEVEL)) {\n-\t\t\t\tuint32_t log;\n-\n-\t\t\t\tif (eal_parse_log_level(optarg, &log) < 0) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\t\t\t\"invalid parameters for --\"\n-\t\t\t\t\t\tOPT_LOG_LEVEL \"\\n\");\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t\tinternal_config.log_level = log;\n-\t\t\t} else {\n+\t\t\t{\n \t\t\t\tRTE_LOG(ERR, EAL, \"Option %s is not supported \"\n \t\t\t\t\t\"on FreeBSD\\n\",\n-\t\t\t\t\tlgopts[option_index].name);\n+\t\t\t\t\teal_long_options[option_index].name);\n \t\t\t\teal_usage(prgname);\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t\tbreak;\n \n \t\tdefault:\n+\t\t\tif (isprint(opt)) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Option %c is not supported \"\n+\t\t\t\t\t\"on FreeBSD\\n\", opt);\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Option %d is not supported \"\n+\t\t\t\t\t\"on FreeBSD\\n\", opt);\n+\t\t\t}\n \t\t\teal_usage(prgname);\n \t\t\treturn -1;\n \t\t}\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nnew file mode 100644\nindex 0000000..ead4300\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -0,0 +1,379 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2014 6WIND S.A.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdlib.h>\n+#include <string.h>\n+#include <syslog.h>\n+#include <ctype.h>\n+#include <limits.h>\n+#include <errno.h>\n+#include <getopt.h>\n+\n+#include <rte_eal.h>\n+#include <rte_log.h>\n+#include <rte_lcore.h>\n+#include <rte_version.h>\n+#include <rte_devargs.h>\n+\n+#include \"eal_internal_cfg.h\"\n+#include \"eal_options.h\"\n+\n+#define BITS_PER_HEX 4\n+\n+const char\n+eal_short_options[] =\n+\t\"b:\" /* pci-blacklist */\n+\t\"w:\" /* pci-whitelist */\n+\t\"c:\"\n+\t\"d:\"\n+\t\"m:\"\n+\t\"n:\"\n+\t\"r:\"\n+\t\"v\";\n+\n+const struct option\n+eal_long_options[] = {\n+\t{OPT_HUGE_DIR, 1, 0, 0},\n+\t{OPT_PROC_TYPE, 1, 0, 0},\n+\t{OPT_NO_SHCONF, 0, 0, 0},\n+\t{OPT_NO_HPET, 0, 0, 0},\n+\t{OPT_VMWARE_TSC_MAP, 0, 0, 0},\n+\t{OPT_NO_PCI, 0, 0, 0},\n+\t{OPT_NO_HUGE, 0, 0, 0},\n+\t{OPT_FILE_PREFIX, 1, 0, 0},\n+\t{OPT_SOCKET_MEM, 1, 0, 0},\n+\t{OPT_PCI_WHITELIST, 1, 0, 'w'},\n+\t{OPT_PCI_BLACKLIST, 1, 0, 'b'},\n+\t{OPT_VDEV, 1, 0, 0},\n+\t{OPT_SYSLOG, 1, NULL, 0},\n+\t{OPT_LOG_LEVEL, 1, NULL, 0},\n+\t{OPT_BASE_VIRTADDR, 1, 0, 0},\n+\t{OPT_XEN_DOM0, 0, 0, 0},\n+\t{OPT_CREATE_UIO_DEV, 1, NULL, 0},\n+\t{OPT_VFIO_INTR, 1, NULL, 0},\n+\t{0, 0, 0, 0}\n+};\n+\n+/*\n+ * Parse the coremask given as argument (hexadecimal string) and fill\n+ * the global configuration (core role and core count) with the parsed\n+ * value.\n+ */\n+static int xdigit2val(unsigned char c)\n+{\n+\tint val;\n+\n+\tif (isdigit(c))\n+\t\tval = c - '0';\n+\telse if (isupper(c))\n+\t\tval = c - 'A' + 10;\n+\telse\n+\t\tval = c - 'a' + 10;\n+\treturn val;\n+}\n+\n+static int\n+eal_parse_coremask(const char *coremask)\n+{\n+\tstruct rte_config *cfg = rte_eal_get_configuration();\n+\tint i, j, idx = 0;\n+\tunsigned count = 0;\n+\tchar c;\n+\tint val;\n+\n+\tif (coremask == NULL)\n+\t\treturn -1;\n+\t/* Remove all blank characters ahead and after .\n+\t * Remove 0x/0X if exists.\n+\t */\n+\twhile (isblank(*coremask))\n+\t\tcoremask++;\n+\tif (coremask[0] == '0' && ((coremask[1] == 'x')\n+\t\t|| (coremask[1] == 'X')))\n+\t\tcoremask += 2;\n+\ti = strnlen(coremask, PATH_MAX);\n+\twhile ((i > 0) && isblank(coremask[i - 1]))\n+\t\ti--;\n+\tif (i == 0)\n+\t\treturn -1;\n+\n+\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n+\t\tc = coremask[i];\n+\t\tif (isxdigit(c) == 0) {\n+\t\t\t/* invalid characters */\n+\t\t\treturn -1;\n+\t\t}\n+\t\tval = xdigit2val(c);\n+\t\tfor (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++)\n+\t\t{\n+\t\t\tif ((1 << j) & val) {\n+\t\t\t\tif (!lcore_config[idx].detected) {\n+\t\t\t\t\tRTE_LOG(ERR, EAL, \"lcore %u \"\n+\t\t\t\t\t        \"unavailable\\n\", idx);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n+\t\t\t\tif (count == 0)\n+\t\t\t\t\tcfg->master_lcore = idx;\n+\t\t\t\tcount++;\n+\t\t\t} else {\n+\t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t\t\t}\n+\t\t}\n+\t}\n+\tfor (; i >= 0; i--)\n+\t\tif (coremask[i] != '0')\n+\t\t\treturn -1;\n+\tfor (; idx < RTE_MAX_LCORE; idx++)\n+\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\tif (count == 0)\n+\t\treturn -1;\n+\t/* Update the count of enabled logical cores of the EAL configuration */\n+\tcfg->lcore_count = count;\n+\treturn 0;\n+}\n+\n+static int\n+eal_parse_syslog(const char *facility, struct internal_config *conf)\n+{\n+\tint i;\n+\tstatic struct {\n+\t\tconst char *name;\n+\t\tint value;\n+\t} map[] = {\n+\t\t{ \"auth\", LOG_AUTH },\n+\t\t{ \"cron\", LOG_CRON },\n+\t\t{ \"daemon\", LOG_DAEMON },\n+\t\t{ \"ftp\", LOG_FTP },\n+\t\t{ \"kern\", LOG_KERN },\n+\t\t{ \"lpr\", LOG_LPR },\n+\t\t{ \"mail\", LOG_MAIL },\n+\t\t{ \"news\", LOG_NEWS },\n+\t\t{ \"syslog\", LOG_SYSLOG },\n+\t\t{ \"user\", LOG_USER },\n+\t\t{ \"uucp\", LOG_UUCP },\n+\t\t{ \"local0\", LOG_LOCAL0 },\n+\t\t{ \"local1\", LOG_LOCAL1 },\n+\t\t{ \"local2\", LOG_LOCAL2 },\n+\t\t{ \"local3\", LOG_LOCAL3 },\n+\t\t{ \"local4\", LOG_LOCAL4 },\n+\t\t{ \"local5\", LOG_LOCAL5 },\n+\t\t{ \"local6\", LOG_LOCAL6 },\n+\t\t{ \"local7\", LOG_LOCAL7 },\n+\t\t{ NULL, 0 }\n+\t};\n+\n+\tfor (i = 0; map[i].name; i++) {\n+\t\tif (!strcmp(facility, map[i].name)) {\n+\t\t\tconf->syslog_facility = map[i].value;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\treturn -1;\n+}\n+\n+static int\n+eal_parse_log_level(const char *level, uint32_t *log_level)\n+{\n+\tchar *end;\n+\tunsigned long tmp;\n+\n+\terrno = 0;\n+\ttmp = strtoul(level, &end, 0);\n+\n+\t/* check for errors */\n+\tif ((errno != 0) || (level[0] == '\\0') ||\n+\t    end == NULL || (*end != '\\0'))\n+\t\treturn -1;\n+\n+\t/* log_level is a uint32_t */\n+\tif (tmp >= UINT32_MAX)\n+\t\treturn -1;\n+\n+\t*log_level = tmp;\n+\treturn 0;\n+}\n+\n+static enum rte_proc_type_t\n+eal_parse_proc_type(const char *arg)\n+{\n+\tif (strncasecmp(arg, \"primary\", sizeof(\"primary\")) == 0)\n+\t\treturn RTE_PROC_PRIMARY;\n+\tif (strncasecmp(arg, \"secondary\", sizeof(\"secondary\")) == 0)\n+\t\treturn RTE_PROC_SECONDARY;\n+\tif (strncasecmp(arg, \"auto\", sizeof(\"auto\")) == 0)\n+\t\treturn RTE_PROC_AUTO;\n+\n+\treturn RTE_PROC_INVALID;\n+}\n+\n+int\n+eal_parse_common_option(int opt, const char *optarg, int longindex,\n+\t\t\tstruct internal_config *conf)\n+{\n+\tswitch (opt) {\n+\t/* blacklist */\n+\tcase 'b':\n+\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,\n+\t\t\t\toptarg) < 0) {\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\t/* whitelist */\n+\tcase 'w':\n+\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI,\n+\t\t\t\toptarg) < 0) {\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\t/* coremask */\n+\tcase 'c':\n+\t\tif (eal_parse_coremask(optarg) < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"invalid coremask\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\t/* size of memory */\n+\tcase 'm':\n+\t\tconf->memory = atoi(optarg);\n+\t\tconf->memory *= 1024ULL;\n+\t\tconf->memory *= 1024ULL;\n+\t\tbreak;\n+\t/* force number of channels */\n+\tcase 'n':\n+\t\tconf->force_nchannel = atoi(optarg);\n+\t\tif (conf->force_nchannel == 0 ||\n+\t\t    conf->force_nchannel > 4) {\n+\t\t\tRTE_LOG(ERR, EAL, \"invalid channel number\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\t/* force number of ranks */\n+\tcase 'r':\n+\t\tconf->force_nrank = atoi(optarg);\n+\t\tif (conf->force_nrank == 0 ||\n+\t\t    conf->force_nrank > 16) {\n+\t\t\tRTE_LOG(ERR, EAL, \"invalid rank number\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\tcase 'v':\n+\t\t/* since message is explicitly requested by user, we\n+\t\t * write message at highest log level so it can always\n+\t\t * be seen\n+\t\t * even if info or warning messages are disabled */\n+\t\tRTE_LOG(CRIT, EAL, \"RTE Version: '%s'\\n\", rte_version());\n+\t\tbreak;\n+\n+\t/* long options */\n+\tcase 0:\n+\t\tif (!strcmp(eal_long_options[longindex].name, OPT_NO_HUGE)) {\n+\t\t\tconf->no_hugetlbfs = 1;\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_NO_PCI)) {\n+\t\t\tconf->no_pci = 1;\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_NO_HPET)) {\n+\t\t\tconf->no_hpet = 1;\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_VMWARE_TSC_MAP)) {\n+\t\t\tconf->vmware_tsc_map = 1;\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_NO_SHCONF)) {\n+\t\t\tconf->no_shconf = 1;\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_PROC_TYPE)) {\n+\t\t\tconf->process_type = eal_parse_proc_type(optarg);\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_VDEV)) {\n+\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL,\n+\t\t\t\t\toptarg) < 0) {\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else if (!strcmp(eal_long_options[longindex].name, OPT_SYSLOG)) {\n+\t\t\tif (eal_parse_syslog(optarg, conf) < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n+\t\t\t\t\t\tOPT_SYSLOG \"\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else if (!strcmp(eal_long_options[longindex].name,\n+\t\t\t\t OPT_LOG_LEVEL)) {\n+\t\t\tuint32_t log;\n+\n+\t\t\tif (eal_parse_log_level(optarg, &log) < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\t\"invalid parameters for --\"\n+\t\t\t\t\tOPT_LOG_LEVEL \"\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tconf->log_level = log;\n+\t\t}\n+\n+\t\tbreak;\n+\n+\t/* don't know what to do, leave this to caller */\n+\tdefault:\n+\t\treturn 1;\n+\n+\t}\n+\n+\treturn 0;\n+}\n+\n+void\n+eal_common_usage(void)\n+{\n+\tprintf(\"-c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n+\t       \"[--proc-type primary|secondary|auto]\\n\\n\"\n+\t       \"EAL common options:\\n\"\n+\t       \"  -c COREMASK  : A hexadecimal bitmask of cores to run on\\n\"\n+\t       \"  -n NUM       : Number of memory channels\\n\"\n+\t       \"  -v           : Display version information on startup\\n\"\n+\t       \"  -m MB        : memory to allocate (see also --\"OPT_SOCKET_MEM\")\\n\"\n+\t       \"  -r NUM       : force number of memory ranks (don't detect)\\n\"\n+\t       \"  --\"OPT_SYSLOG\"     : set syslog facility\\n\"\n+\t       \"  --\"OPT_LOG_LEVEL\"  : set default log level\\n\"\n+\t       \"  --\"OPT_PROC_TYPE\"  : type of this process\\n\"\n+\t       \"  --\"OPT_PCI_BLACKLIST\", -b: add a PCI device in black list.\\n\"\n+\t       \"               Prevent EAL from using this PCI device. The argument\\n\"\n+\t       \"               format is <domain:bus:devid.func>.\\n\"\n+\t       \"  --\"OPT_PCI_WHITELIST\", -w: add a PCI device in white list.\\n\"\n+\t       \"               Only use the specified PCI devices. The argument format\\n\"\n+\t       \"               is <[domain:]bus:devid.func>. This option can be present\\n\"\n+\t       \"               several times (once per device).\\n\"\n+\t       \"               [NOTE: PCI whitelist cannot be used with -b option]\\n\"\n+\t       \"  --\"OPT_VDEV\": add a virtual device.\\n\"\n+\t       \"               The argument format is <driver><id>[,key=val,...]\\n\"\n+\t       \"               (ex: --vdev=eth_pcap0,iface=eth2).\\n\"\n+\t       \"  --\"OPT_VMWARE_TSC_MAP\": use VMware TSC map instead of native RDTSC\\n\"\n+\t       \"\\nEAL options for DEBUG use only:\\n\"\n+\t       \"  --\"OPT_NO_HUGE\"  : use malloc instead of hugetlbfs\\n\"\n+\t       \"  --\"OPT_NO_PCI\"   : disable pci\\n\"\n+\t       \"  --\"OPT_NO_HPET\"  : disable hpet\\n\"\n+\t       \"  --\"OPT_NO_SHCONF\": no shared config (mmap'd files)\\n\"\n+\t       \"\\n\");\n+}\ndiff --git a/lib/librte_eal/common/include/eal_options.h b/lib/librte_eal/common/include/eal_options.h\nnew file mode 100644\nindex 0000000..4e6b90d\n--- /dev/null\n+++ b/lib/librte_eal/common/include/eal_options.h\n@@ -0,0 +1,58 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2014 6WIND S.A.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#define OPT_PCI_WHITELIST \"pci-whitelist\"\n+#define OPT_PCI_BLACKLIST \"pci-blacklist\"\n+\n+#define OPT_HUGE_DIR    \"huge-dir\"\n+#define OPT_PROC_TYPE   \"proc-type\"\n+#define OPT_NO_SHCONF   \"no-shconf\"\n+#define OPT_NO_HPET     \"no-hpet\"\n+#define OPT_VMWARE_TSC_MAP   \"vmware-tsc-map\"\n+#define OPT_NO_PCI      \"no-pci\"\n+#define OPT_NO_HUGE     \"no-huge\"\n+#define OPT_FILE_PREFIX \"file-prefix\"\n+#define OPT_SOCKET_MEM  \"socket-mem\"\n+#define OPT_VDEV        \"vdev\"\n+#define OPT_SYSLOG      \"syslog\"\n+#define OPT_LOG_LEVEL   \"log-level\"\n+#define OPT_BASE_VIRTADDR   \"base-virtaddr\"\n+#define OPT_XEN_DOM0    \"xen-dom0\"\n+#define OPT_CREATE_UIO_DEV \"create-uio-dev\"\n+#define OPT_VFIO_INTR    \"vfio-intr\"\n+\n+extern const char eal_short_options[];\n+extern const struct option eal_long_options[];\n+\n+int eal_parse_common_option(int opt, const char *argv, int longindex,\n+\t\t\t    struct internal_config *conf);\n+void eal_common_usage(void);\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 756d6b0..c99433e 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -82,6 +82,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_string_fns.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c\n \n CFLAGS_eal.o := -D_GNU_SOURCE\n CFLAGS_eal_thread.o := -D_GNU_SOURCE\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 3393550..d82debf 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -82,25 +82,7 @@\n #include \"eal_internal_cfg.h\"\n #include \"eal_filesystem.h\"\n #include \"eal_hugepages.h\"\n-\n-#define OPT_HUGE_DIR    \"huge-dir\"\n-#define OPT_PROC_TYPE   \"proc-type\"\n-#define OPT_NO_SHCONF   \"no-shconf\"\n-#define OPT_NO_HPET     \"no-hpet\"\n-#define OPT_VMWARE_TSC_MAP   \"vmware-tsc-map\"\n-#define OPT_NO_PCI      \"no-pci\"\n-#define OPT_NO_HUGE     \"no-huge\"\n-#define OPT_FILE_PREFIX \"file-prefix\"\n-#define OPT_SOCKET_MEM  \"socket-mem\"\n-#define OPT_PCI_WHITELIST \"pci-whitelist\"\n-#define OPT_PCI_BLACKLIST \"pci-blacklist\"\n-#define OPT_VDEV        \"vdev\"\n-#define OPT_SYSLOG      \"syslog\"\n-#define OPT_LOG_LEVEL   \"log-level\"\n-#define OPT_BASE_VIRTADDR   \"base-virtaddr\"\n-#define OPT_XEN_DOM0    \"xen-dom0\"\n-#define OPT_CREATE_UIO_DEV \"create-uio-dev\"\n-#define OPT_VFIO_INTR    \"vfio-intr\"\n+#include \"eal_options.h\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n \n@@ -108,8 +90,6 @@\n \n #define HIGHEST_RPL 3\n \n-#define BITS_PER_HEX 4\n-\n /* Allow the application to print its usage message too if set */\n static rte_usage_hook_t\trte_application_usage_hook = NULL;\n \n@@ -372,47 +352,21 @@ eal_hugedirs_unlock(void)\n static void\n eal_usage(const char *prgname)\n {\n-\tprintf(\"\\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n-\t       \"[--proc-type primary|secondary|auto] \\n\\n\"\n-\t       \"EAL options:\\n\"\n-\t       \"  -c COREMASK  : A hexadecimal bitmask of cores to run on\\n\"\n-\t       \"  -n NUM       : Number of memory channels\\n\"\n-\t\t   \"  -v           : Display version information on startup\\n\"\n+\tprintf(\"\\nUsage: %s \", prgname);\n+\teal_common_usage();\n+\tprintf(\"EAL Linux options:\\n\"\n \t       \"  -d LIB.so    : add driver (can be used multiple times)\\n\"\n-\t       \"  -m MB        : memory to allocate (see also --\"OPT_SOCKET_MEM\")\\n\"\n-\t       \"  -r NUM       : force number of memory ranks (don't detect)\\n\"\n \t       \"  --\"OPT_XEN_DOM0\" : support application running on Xen Domain0 \"\n \t\t\t   \"without hugetlbfs\\n\"\n-\t       \"  --\"OPT_SYSLOG\"     : set syslog facility\\n\"\n-\t       \"  --\"OPT_LOG_LEVEL\"  : set default log level\\n\"\n \t       \"  --\"OPT_SOCKET_MEM\" : memory to allocate on specific\\n\"\n \t\t   \"                 sockets (use comma separated values)\\n\"\n \t       \"  --\"OPT_HUGE_DIR\"   : directory where hugetlbfs is mounted\\n\"\n-\t       \"  --\"OPT_PROC_TYPE\"  : type of this process\\n\"\n \t       \"  --\"OPT_FILE_PREFIX\": prefix for hugepage filenames\\n\"\n-\t       \"  --\"OPT_PCI_BLACKLIST\", -b: add a PCI device in black list.\\n\"\n-\t       \"               Prevent EAL from using this PCI device. The argument\\n\"\n-\t       \"               format is <domain:bus:devid.func>.\\n\"\n-\t       \"  --\"OPT_PCI_WHITELIST\", -w: add a PCI device in white list.\\n\"\n-\t       \"               Only use the specified PCI devices. The argument format\\n\"\n-\t       \"               is <[domain:]bus:devid.func>. This option can be present\\n\"\n-\t       \"               several times (once per device).\\n\"\n-\t       \"               [NOTE: PCI whitelist cannot be used with -b option]\\n\"\n-\t       \"  --\"OPT_VDEV\": add a virtual device.\\n\"\n-\t       \"               The argument format is <driver><id>[,key=val,...]\\n\"\n-\t       \"               (ex: --vdev=eth_pcap0,iface=eth2).\\n\"\n-\t       \"  --\"OPT_VMWARE_TSC_MAP\": use VMware TSC map instead of native RDTSC\\n\"\n \t       \"  --\"OPT_BASE_VIRTADDR\": specify base virtual address\\n\"\n \t       \"  --\"OPT_VFIO_INTR\": specify desired interrupt mode for VFIO \"\n \t\t\t   \"(legacy|msi|msix)\\n\"\n \t       \"  --\"OPT_CREATE_UIO_DEV\": create /dev/uioX (usually done by hotplug)\\n\"\n-\t       \"\\nEAL options for DEBUG use only:\\n\"\n-\t       \"  --\"OPT_NO_HUGE\"  : use malloc instead of hugetlbfs\\n\"\n-\t       \"  --\"OPT_NO_PCI\"   : disable pci\\n\"\n-\t       \"  --\"OPT_NO_HPET\"  : disable hpet\\n\"\n-\t       \"  --\"OPT_NO_SHCONF\": no shared config (mmap'd files)\\n\"\n-\t       \"\\n\",\n-\t       prgname);\n+\t       \"\\n\");\n \t/* Allow the application to print its usage message too if hook is set */\n \tif ( rte_application_usage_hook ) {\n \t\tprintf(\"===== Application Usage =====\\n\\n\");\n@@ -433,143 +387,6 @@ rte_set_application_usage_hook( rte_usage_hook_t usage_func )\n \treturn old_func;\n }\n \n-/*\n- * Parse the coremask given as argument (hexadecimal string) and fill\n- * the global configuration (core role and core count) with the parsed\n- * value.\n- */\n-static int xdigit2val(unsigned char c)\n-{\n-\tint val;\n-\tif(isdigit(c))\n-\t\tval = c - '0';\n-\telse if(isupper(c))\n-\t\tval = c - 'A' + 10;\n-\telse\n-\t\tval = c - 'a' + 10;\n-\treturn val;\n-}\n-static int\n-eal_parse_coremask(const char *coremask)\n-{\n-\tstruct rte_config *cfg = rte_eal_get_configuration();\n-\tint i, j, idx = 0 ;\n-\tunsigned count = 0;\n-\tchar c;\n-\tint val;\n-\n-\tif (coremask == NULL)\n-\t\treturn -1;\n-\t/* Remove all blank characters ahead and after .\n-\t * Remove 0x/0X if exists.\n-\t */\n-\twhile (isblank(*coremask))\n-\t\tcoremask++;\n-\tif (coremask[0] == '0' && ((coremask[1] == 'x')\n-\t\t||  (coremask[1] == 'X')) )\n-\t\tcoremask += 2;\n-\ti = strnlen(coremask, PATH_MAX);\n-\twhile ((i > 0) && isblank(coremask[i - 1]))\n-\t\ti--;\n-\tif (i == 0)\n-\t\treturn -1;\n-\n-\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\treturn (-1);\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n-\t\t\tif((1 << j) & val) {\n-\t\t\t\tif (!lcore_config[idx].detected) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"lcore %u \"\n-\t\t\t\t\t        \"unavailable\\n\", idx);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n-\t\t\t\tif(count == 0)\n-\t\t\t\t\tcfg->master_lcore = idx;\n-\t\t\t\tcount++;\n-\t\t\t} else  {\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n-\t\t\t}\n-\t\t}\n-\t}\n-\tfor(; i >= 0; i--)\n-\t\tif(coremask[i] != '0')\n-\t\t\treturn -1;\n-\tfor(; idx < RTE_MAX_LCORE; idx++)\n-\t\tcfg->lcore_role[idx] = ROLE_OFF;\n-\tif(count == 0)\n-\t\treturn -1;\n-\t/* Update the count of enabled logical cores of the EAL configuration */\n-\tcfg->lcore_count = count;\n-\treturn 0;\n-}\n-\n-static int\n-eal_parse_syslog(const char *facility)\n-{\n-\tint i;\n-\tstatic struct {\n-\t\tconst char *name;\n-\t\tint value;\n-\t} map[] = {\n-\t\t{ \"auth\", LOG_AUTH },\n-\t\t{ \"cron\", LOG_CRON },\n-\t\t{ \"daemon\", LOG_DAEMON },\n-\t\t{ \"ftp\", LOG_FTP },\n-\t\t{ \"kern\", LOG_KERN },\n-\t\t{ \"lpr\", LOG_LPR },\n-\t\t{ \"mail\", LOG_MAIL },\n-\t\t{ \"news\", LOG_NEWS },\n-\t\t{ \"syslog\", LOG_SYSLOG },\n-\t\t{ \"user\", LOG_USER },\n-\t\t{ \"uucp\", LOG_UUCP },\n-\t\t{ \"local0\", LOG_LOCAL0 },\n-\t\t{ \"local1\", LOG_LOCAL1 },\n-\t\t{ \"local2\", LOG_LOCAL2 },\n-\t\t{ \"local3\", LOG_LOCAL3 },\n-\t\t{ \"local4\", LOG_LOCAL4 },\n-\t\t{ \"local5\", LOG_LOCAL5 },\n-\t\t{ \"local6\", LOG_LOCAL6 },\n-\t\t{ \"local7\", LOG_LOCAL7 },\n-\t\t{ NULL, 0 }\n-\t};\n-\n-\tfor (i = 0; map[i].name; i++) {\n-\t\tif (!strcmp(facility, map[i].name)) {\n-\t\t\tinternal_config.syslog_facility = map[i].value;\n-\t\t\treturn 0;\n-\t\t}\n-\t}\n-\treturn -1;\n-}\n-\n-static int\n-eal_parse_log_level(const char *level, uint32_t *log_level)\n-{\n-\tchar *end;\n-\tunsigned long tmp;\n-\n-\terrno = 0;\n-\ttmp = strtoul(level, &end, 0);\n-\n-\t/* check for errors */\n-\tif ((errno != 0) || (level[0] == '\\0') ||\n-\t    end == NULL || (*end != '\\0'))\n-\t\treturn -1;\n-\n-\t/* log_level is a uint32_t */\n-\tif (tmp >= UINT32_MAX)\n-\t\treturn -1;\n-\n-\t*log_level = tmp;\n-\treturn 0;\n-}\n-\n static int\n eal_parse_socket_mem(char *socket_mem)\n {\n@@ -686,19 +503,6 @@ eal_get_hugepage_mem_size(void)\n \treturn (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;\n }\n \n-static enum rte_proc_type_t\n-eal_parse_proc_type(const char *arg)\n-{\n-\tif (strncasecmp(arg, \"primary\", sizeof(\"primary\")) == 0)\n-\t\treturn RTE_PROC_PRIMARY;\n-\tif (strncasecmp(arg, \"secondary\", sizeof(\"secondary\")) == 0)\n-\t\treturn RTE_PROC_SECONDARY;\n-\tif (strncasecmp(arg, \"auto\", sizeof(\"auto\")) == 0)\n-\t\treturn RTE_PROC_AUTO;\n-\n-\treturn RTE_PROC_INVALID;\n-}\n-\n /* Parse the argument given in the command line of the application */\n static int\n eal_parse_args(int argc, char **argv)\n@@ -708,27 +512,6 @@ eal_parse_args(int argc, char **argv)\n \tint option_index;\n \tint coremask_ok = 0;\n \tchar *prgname = argv[0];\n-\tstatic struct option lgopts[] = {\n-\t\t{OPT_NO_HUGE, 0, 0, 0},\n-\t\t{OPT_NO_PCI, 0, 0, 0},\n-\t\t{OPT_NO_HPET, 0, 0, 0},\n-\t\t{OPT_VMWARE_TSC_MAP, 0, 0, 0},\n-\t\t{OPT_HUGE_DIR, 1, 0, 0},\n-\t\t{OPT_NO_SHCONF, 0, 0, 0},\n-\t\t{OPT_PROC_TYPE, 1, 0, 0},\n-\t\t{OPT_FILE_PREFIX, 1, 0, 0},\n-\t\t{OPT_SOCKET_MEM, 1, 0, 0},\n-\t\t{OPT_PCI_WHITELIST, 1, 0, 'w'},\n-\t\t{OPT_PCI_BLACKLIST, 1, 0, 'b'},\n-\t\t{OPT_VDEV, 1, 0, 0},\n-\t\t{OPT_SYSLOG, 1, NULL, 0},\n-\t\t{OPT_LOG_LEVEL, 1, NULL, 0},\n-\t\t{OPT_VFIO_INTR, 1, NULL, 0},\n-\t\t{OPT_BASE_VIRTADDR, 1, 0, 0},\n-\t\t{OPT_XEN_DOM0, 0, 0, 0},\n-\t\t{OPT_CREATE_UIO_DEV, 1, NULL, 0},\n-\t\t{0, 0, 0, 0}\n-\t};\n \tstruct shared_driver *solib;\n \n \targvopt = argv;\n@@ -761,35 +544,32 @@ eal_parse_args(int argc, char **argv)\n \tinternal_config.vmware_tsc_map = 0;\n \tinternal_config.base_virtaddr = 0;\n \n-\twhile ((opt = getopt_long(argc, argvopt, \"b:w:c:d:m:n:r:v\",\n-\t\t\t\t  lgopts, &option_index)) != EOF) {\n+\twhile ((opt = getopt_long(argc, argvopt, eal_short_options,\n+\t\t\t\t  eal_long_options, &option_index)) != EOF) {\n+\n+\t\tint ret;\n+\n+\t\t/* getopt is not happy, stop right now */\n+\t\tif (opt == '?')\n+\t\t\treturn -1;\n+\n+\t\tret = eal_parse_common_option(opt, optarg, option_index,\n+\t\t\t\t\t      &internal_config);\n+\t\t/* common parser is not happy */\n+\t\tif (ret < 0) {\n+\t\t\teal_usage(prgname);\n+\t\t\treturn -1;\n+\t\t}\n+\t\t/* common parser handled this option */\n+\t\tif (ret == 0) {\n+\t\t\t/* special case, note that the common parser accepted\n+\t\t\t * the coremask option */\n+\t\t\tif (opt == 'c')\n+\t\t\t\tcoremask_ok = 1;\n+\t\t\tcontinue;\n+\t\t}\n \n \t\tswitch (opt) {\n-\t\t/* blacklist */\n-\t\tcase 'b':\n-\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,\n-\t\t\t\t\toptarg) < 0) {\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn (-1);\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* whitelist */\n-\t\tcase 'w':\n-\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI,\n-\t\t\t\t\toptarg) < 0) {\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* coremask */\n-\t\tcase 'c':\n-\t\t\tif (eal_parse_coremask(optarg) < 0) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid coremask\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tcoremask_ok = 1;\n-\t\t\tbreak;\n \t\t/* force loading of external driver */\n \t\tcase 'd':\n \t\t\tsolib = malloc(sizeof(*solib));\n@@ -802,44 +582,10 @@ eal_parse_args(int argc, char **argv)\n \t\t\tsolib->name[PATH_MAX-1] = 0;\n \t\t\tTAILQ_INSERT_TAIL(&solib_list, solib, next);\n \t\t\tbreak;\n-\t\t/* size of memory */\n-\t\tcase 'm':\n-\t\t\tinternal_config.memory = atoi(optarg);\n-\t\t\tinternal_config.memory *= 1024ULL;\n-\t\t\tinternal_config.memory *= 1024ULL;\n-\t\t\tbreak;\n-\t\t/* force number of channels */\n-\t\tcase 'n':\n-\t\t\tinternal_config.force_nchannel = atoi(optarg);\n-\t\t\tif (internal_config.force_nchannel == 0 ||\n-\t\t\t    internal_config.force_nchannel > 4) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid channel number\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t/* force number of ranks */\n-\t\tcase 'r':\n-\t\t\tinternal_config.force_nrank = atoi(optarg);\n-\t\t\tif (internal_config.force_nrank == 0 ||\n-\t\t\t    internal_config.force_nrank > 16) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid rank number\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\tcase 'v':\n-\t\t\t/* since message is explicitly requested by user, we\n-\t\t\t * write message at highest log level so it can always be seen\n-\t\t\t * even if info or warning messages are disabled */\n-\t\t\tRTE_LOG(CRIT, EAL, \"RTE Version: '%s'\\n\", rte_version());\n-\t\t\tbreak;\n \n \t\t/* long options */\n \t\tcase 0:\n-\t\t\tif (!strcmp(lgopts[option_index].name, OPT_NO_HUGE)) {\n-\t\t\t\tinternal_config.no_hugetlbfs = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_XEN_DOM0)) {\n+\t\t\tif (!strcmp(eal_long_options[option_index].name, OPT_XEN_DOM0)) {\n \t\t#ifdef RTE_LIBRTE_XEN_DOM0\n \t\t\t\tinternal_config.xen_dom0_support = 1;\n \t\t#else\n@@ -848,78 +594,50 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\t\t\" RTE_LIBRTE_XEN_DOM0=y\\n\");\n \t\t\t\treturn -1;\n \t\t#endif\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_PCI)) {\n-\t\t\t\tinternal_config.no_pci = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_HPET)) {\n-\t\t\t\tinternal_config.no_hpet = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_VMWARE_TSC_MAP)) {\n-\t\t\t\tinternal_config.vmware_tsc_map = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_NO_SHCONF)) {\n-\t\t\t\tinternal_config.no_shconf = 1;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_HUGE_DIR)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_HUGE_DIR)) {\n \t\t\t\tinternal_config.hugepage_dir = optarg;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_PROC_TYPE)) {\n-\t\t\t\tinternal_config.process_type = eal_parse_proc_type(optarg);\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_FILE_PREFIX)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_FILE_PREFIX)) {\n \t\t\t\tinternal_config.hugefile_prefix = optarg;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_SOCKET_MEM)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_SOCKET_MEM)) {\n \t\t\t\tif (eal_parse_socket_mem(optarg) < 0) {\n \t\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n \t\t\t\t\t\t\tOPT_SOCKET_MEM \"\\n\");\n \t\t\t\t\teal_usage(prgname);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_VDEV)) {\n-\t\t\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL,\n-\t\t\t\t\t\toptarg) < 0) {\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_SYSLOG)) {\n-\t\t\t\tif (eal_parse_syslog(optarg) < 0) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n-\t\t\t\t\t\t\tOPT_SYSLOG \"\\n\");\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name,\n-\t\t\t\t\t OPT_LOG_LEVEL)) {\n-\t\t\t\tuint32_t log;\n-\n-\t\t\t\tif (eal_parse_log_level(optarg, &log) < 0) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\t\t\t\"invalid parameters for --\"\n-\t\t\t\t\t\tOPT_LOG_LEVEL \"\\n\");\n-\t\t\t\t\teal_usage(prgname);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t\tinternal_config.log_level = log;\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_BASE_VIRTADDR)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_BASE_VIRTADDR)) {\n \t\t\t\tif (eal_parse_base_virtaddr(optarg) < 0) {\n \t\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameter for --\"\n \t\t\t\t\t\t\tOPT_BASE_VIRTADDR \"\\n\");\n \t\t\t\t\teal_usage(prgname);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_VFIO_INTR)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_VFIO_INTR)) {\n \t\t\t\tif (eal_parse_vfio_intr(optarg) < 0) {\n \t\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n \t\t\t\t\t\t\tOPT_VFIO_INTR \"\\n\");\n \t\t\t\t\teal_usage(prgname);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n-\t\t\t} else if (!strcmp(lgopts[option_index].name, OPT_CREATE_UIO_DEV)) {\n+\t\t\t} else if (!strcmp(eal_long_options[option_index].name, OPT_CREATE_UIO_DEV)) {\n \t\t\t\tinternal_config.create_uio_dev = 1;\n \t\t\t} else {\n \t\t\t\tRTE_LOG(ERR, EAL, \"Option %s is not supported \"\n \t\t\t\t\t\"on Linux\\n\",\n-\t\t\t\t\tlgopts[option_index].name);\n+\t\t\t\t\teal_long_options[option_index].name);\n \t\t\t\teal_usage(prgname);\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t\tbreak;\n \n \t\tdefault:\n+\t\t\tif (isprint(opt)) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Option %c is not supported \"\n+\t\t\t\t\t\"on Linux\\n\", opt);\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Option %d is not supported \"\n+\t\t\t\t\t\"on Linux\\n\", opt);\n+\t\t\t}\n \t\t\teal_usage(prgname);\n \t\t\treturn -1;\n \t\t}\n",
    "prefixes": [
        "dpdk-dev",
        "5/7"
    ]
}