[ovs-dev] [PATCH] dpdk: Redirect DPDK log to OVS logging subsystem.

Ilya Maximets i.maximets at samsung.com
Mon Mar 6 06:53:48 UTC 2017


On 02.03.2017 22:22, Aaron Conole wrote:
> Ilya Maximets <i.maximets at samsung.com> writes:
> 
>> This should be helpful for have all the logs in one place.
>> 'ovs-appctl vlog' commands for 'dpdk' module can be used
>> to configure the log level. Lower bound for DPDK logging
>> (--log-level) still can be passed through 'dpdk-extra' field.
>>
>> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
>> ---
> 
> +1 - good change!

Thanks.

> ...
>> diff --git a/lib/dpdk.c b/lib/dpdk.c
>> index c1626e2..eb03ec9 100644
>> --- a/lib/dpdk.c
>> +++ b/lib/dpdk.c
> ...
>> @@ -262,6 +266,45 @@ argv_release(char **dpdk_argv, char **dpdk_argv_release, size_t dpdk_argc)
>>      free(dpdk_argv);
>>  }
>>  
>> +static ssize_t
>> +dpdk_log_write(void *c OVS_UNUSED, const char *buf, size_t size)
>> +{
>> +    char *str = xmalloc(size + 1);
>> +
>> +    strncpy(str, buf, size);
>> +    str[size] = '\0';
> 
> Small nit - does it make more sense here to use xmemdup0(), instead?  If
> you're not worried about non-printable characters, what about xstrdup or
> even xasprintf("%s", buf)?

Good point. I've sent v2 with 'xmemdup0()'.

P.S. String functions can't be used here. Otherwise, where will be no
     need for copy at all.

Best regards, Ilya Maximets.


More information about the dev mailing list