[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3036b8e-3e89-2fde-b484-6e326b113adb@gmail.com>
Date: Mon, 9 Jul 2018 11:32:35 -0600
From: David Ahern <dsahern@...il.com>
To: Jesus Sanchez-Palencia <jesus.sanchez-palencia@...el.com>,
netdev@...r.kernel.org
Cc: jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
Vinicius Costa Gomes <vinicius.gomes@...el.com>
Subject: Re: [PATCH v3 iproute2 2/3] tc: Add support for the ETF Qdisc
On 7/9/18 9:48 AM, Jesus Sanchez-Palencia wrote:
> Hi David,
>
>
> On 07/06/2018 08:58 AM, David Ahern wrote:
>> On 7/5/18 4:42 PM, Jesus Sanchez-Palencia wrote:
>>
>>> +static int get_clockid(__s32 *val, const char *arg)
>>> +{
>>> + const struct static_clockid {
>>> + const char *name;
>>> + clockid_t clockid;
>>> + } clockids_sysv[] = {
>>> + { "CLOCK_REALTIME", CLOCK_REALTIME },
>>> + { "CLOCK_TAI", CLOCK_TAI },
>>> + { "CLOCK_BOOTTIME", CLOCK_BOOTTIME },
>>> + { "CLOCK_MONOTONIC", CLOCK_MONOTONIC },
>>> + { NULL }
>>> + };
>>> +
>>> + const struct static_clockid *c;
>>> +
>>> + for (c = clockids_sysv; c->name; c++) {
>>> + if (strncasecmp(c->name, arg, 25) == 0) {
>>
>> Why 25?
>
>
> That was just an upper bound giving some room beyond the longest
> clockid name we have today. Should I add a define MAX_CLOCK_NAME ?
why not just strcasecmp? using the 'n' variant with n > strlen of either
argument seems pointless.
>
>
>>
>> be nice to allow shortcuts -- e.g., just REALTIME or realtime.
>
>
> I'd rather just keep it as is and use the names as they are defined for
> everything else (i.e. CLOCK_REALTIME), unless there are some strong objections.
An all caps argument is unnecessary work on the pinky finger and the
CLOCK_ prefix is redundant to the keyword. Really, just a thought on
making it easier for users. A CLI argument does not need to maintain a
1:1 with code names.
Powered by blists - more mailing lists