Re: [PATCH 08/17] tracing/probes: Split [ku]probes_fetch_type_table

From: Namhyung Kim
Date: Mon Dec 09 2013 - 23:41:42 EST


On Tue, 10 Dec 2013 10:05:40 +0900, Namhyung Kim wrote:
> On Tue, 10 Dec 2013 00:09:36 +0900, Masami Hiramatsu wrote:
>> (2013/12/09 15:19), Namhyung Kim wrote:
>>> @@ -398,21 +376,21 @@ static const struct fetch_type *find_fetch_type(const char *type)
>>> - for (i = 0; i < ARRAY_SIZE(fetch_type_table); i++)
>>> - if (strcmp(type, fetch_type_table[i].name) == 0)
>>> - return &fetch_type_table[i];
>>> + for (i = 0; i < NR_FETCH_TYPES; i++)
>>
>> Hmm, I consider this should use correct length of given array. Thus,
>> I'd like recommend you to do;
>> giving the size of fetch_type_table, or define *probe_fetch_type_table with
>> NR_FETCH_TYPES size, or introduce a gatekeeper, e.g. special terminator entry
>> for initializing.
>
> Ah, okay. So I'd like to go with the gatekeeper approach since I added
> the NR_FETCH_TYPES only for iterating the table so no need to keep the
> size itself. And it might be better for additional change in the
> future.

So here is the new patch: