[v1,2/9] app/procinfo: add compare for new options
Checks
Commit Message
Add code for new debug options to compare usage strings and set
enable flag.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
app/proc-info/main.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
Comments
> -----Original Message-----
> From: Varghese, Vipin
> +/**< Enable port debug. */
In comment , Enable displaying port info?
> +static uint32_t enable_dbg_port;
Do you want to consider replacing "debug" to "show" in code here other places? As you have already changed the commands to "show."
ring_name = optarg;
How about doing memcpy instead of pointer assignment? Similarly below. Though I don't see issue here. But safe to use memcpy.
> + } else if (!strncmp(long_option[option_index].name,
> + "dbg-mempool",
> MAX_LONG_OPT_SZ)) {
> + enable_dbg_mempool = 1;
> + mempool_name = optarg;
> + }
Thanks,
Reshma
HI
<snipped>
>
> > +/**< Enable port debug. */
> In comment , Enable displaying port info?
ok
>
> > +static uint32_t enable_dbg_port;
> Do you want to consider replacing "debug" to "show" in code here other
> places? As you have already changed the commands to "show."
>
If the variable naming has to change, I can do
> ring_name = optarg;
> How about doing memcpy instead of pointer assignment? Similarly below.
> Though I don't see issue here. But safe to use memcpy.
>
I will check this internally, I also think this is safe as it is pointer argv elements. I have taken the same design from
/* Print xstat single value given by name*/
if (!strncmp(long_option[option_index].name,
"xstats-name", MAX_LONG_OPT_SZ)) {
enable_xstats_name = 1;
xstats_name = optarg;
<snipped>
@@ -63,6 +63,18 @@ static uint32_t mem_info;
/**< Enable displaying xstat name. */
static uint32_t enable_xstats_name;
static char *xstats_name;
+/**< Enable port debug. */
+static uint32_t enable_dbg_port;
+/**< Enable tm debug. */
+static uint32_t enable_dbg_tm;
+/**< Enable crypto debug. */
+static uint32_t enable_dbg_crypto;
+/**< Enable ring debug. */
+static uint32_t enable_dbg_ring;
+static char *ring_name;
+/**< Enable mempool debug. */
+static uint32_t enable_dbg_mempool;
+static char *mempool_name;
/**< Enable xstats by ids. */
#define MAX_NB_XSTATS_IDS 1024
@@ -247,6 +259,24 @@ proc_info_parse_args(int argc, char **argv)
else if (!strncmp(long_option[option_index].name, "xstats-reset",
MAX_LONG_OPT_SZ))
reset_xstats = 1;
+ else if (!strncmp(long_option[option_index].name,
+ "dbg-port", MAX_LONG_OPT_SZ))
+ enable_dbg_port = 1;
+ else if (!strncmp(long_option[option_index].name,
+ "dbg-tm", MAX_LONG_OPT_SZ))
+ enable_dbg_tm = 1;
+ else if (!strncmp(long_option[option_index].name,
+ "dbg-crypto", MAX_LONG_OPT_SZ))
+ enable_dbg_crypto = 1;
+ else if (!strncmp(long_option[option_index].name,
+ "dbg-ring", MAX_LONG_OPT_SZ)) {
+ enable_dbg_ring = 1;
+ ring_name = optarg;
+ } else if (!strncmp(long_option[option_index].name,
+ "dbg-mempool", MAX_LONG_OPT_SZ)) {
+ enable_dbg_mempool = 1;
+ mempool_name = optarg;
+ }
break;
case 1:
/* Print xstat single value given by name*/