lkml.org 
[lkml]   [2020]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v9 02/15] tools/libperf: add properties to struct pollfd *entries objects
From
Date

On 06.07.2020 15:24, Jiri Olsa wrote:
> On Fri, Jul 03, 2020 at 10:41:45AM +0300, Alexey Budankov wrote:
>>
>> Store boolean properties per struct pollfd *entries object in a
>> bitmap of int size. Implement fdarray_prop__nonfilterable property
>> to skip object from counting by fdarray_filter().
>
> ok, I think can do it like this, few comments below
>
> thanks,
> jirka
>
>>
>> Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
>> ---
>> tools/lib/api/fd/array.c | 17 +++++++++--------
>> tools/lib/api/fd/array.h | 18 +++++++++++++-----
>> tools/lib/perf/evlist.c | 10 +++++-----
>> tools/lib/perf/include/internal/evlist.h | 2 +-
>> tools/perf/tests/fdarray.c | 2 +-
>> tools/perf/util/evlist.c | 2 +-
>> 6 files changed, 30 insertions(+), 21 deletions(-)

<SNIP>

>>
>> diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h
>> index b39557d1a88f..19b6a34aeea5 100644
>> --- a/tools/lib/api/fd/array.h
>> +++ b/tools/lib/api/fd/array.h
>> @@ -21,10 +21,18 @@ struct fdarray {
>> int nr_alloc;
>> int nr_autogrow;
>> struct pollfd *entries;
>> - union {
>> - int idx;
>> - void *ptr;
>> - } *priv;
>> + struct {
>> + union {
>> + int idx;
>> + void *ptr;
>> + } priv;
>> + int bits;
>> + } *prop;
>> +};
>
> why not keeping the 'priv' as a struct, like:
>
> struct {
> union {
> int idx;
> void *ptr;
> };
> unsigned int flags;
> } *priv;
>
> I think we would have much less changes, also please rename bits
> to flags and use some unsigned type for that

Well, I supposed that priv is short for private what means the layout
of struct priv object is opaque to fdarray implementation and it just
passes the object as a void pointer to external callbacks (e.g in __filter()).
So I preserved this semantics and wrapped and extended priv object
with with flags field. It can be implemented with struct priv if you like.

>
>> +
>> +enum fdarray_props {
>> + fdarray_prop__default = 0x00000000,
>> + fdarray_prop__nonfilterable = 0x00000001
>> };
>
> s/fdarray_props/fdarray_flag/

Accepted.

Alexey

\
 
 \ /
  Last update: 2020-07-06 15:08    [W:0.048 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site