[dpdk-dev] [PATCH v3 01/20] kvargs: remove rte log dependency

Neil Horman nhorman at tuxdriver.com
Tue Mar 27 20:19:47 CEST 2018


On Tue, Mar 27, 2018 at 01:18:25AM +0200, Gaetan Rivet wrote:
> Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
> ---
>  lib/librte_kvargs/rte_kvargs.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
> index 9662375e8..d6b187aac 100644
> --- a/lib/librte_kvargs/rte_kvargs.c
> +++ b/lib/librte_kvargs/rte_kvargs.c
> @@ -3,10 +3,10 @@
>   * Copyright(c) 2014 6WIND S.A.
>   */
>  
> +#include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
>  
> -#include <rte_log.h>
>  #include <rte_string_fns.h>
>  
>  #include "rte_kvargs.h"
> @@ -29,7 +29,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)
>  	 */
>  	kvlist->str = strdup(params);
>  	if (kvlist->str == NULL) {
> -		RTE_LOG(ERR, PMD, "Cannot parse arguments: not enough memory\n");
> +		fprintf(stderr, "Cannot parse arguments: not enough memory\n");
>  		return -1;
>  	}
>  
I'm not entirely sure why any of this is needed.  RTE_LOG is basically a wrapper
around rte_vlog, which has this block of code:

if (f == NULL) {
                f = default_log_stream;
                if (f == NULL) {
                        /*
                         * Grab the current value of stderr here, rather than
                         * just initializing default_log_stream to stderr. This
                         * ensures that we will always use the current value
                         * of stderr, even if the application closes and
                         * reopens it.
                         */
                        f = stderr;
                }
        }
}

It seems to me that if rte_log_openstream hasn't been called yet, we should just
dump messages to stderr, just like Keith noted in his other email.  If thats not
working, thats definately a problem, but regardless, you should be able to use
RTE_LOG in your code without issue.

Neil



More information about the dev mailing list