Re: [PATCH v1 2/5] seqlock: Use unique prefix for seqcount_t property accessors

From: peterz
Date: Fri Aug 28 2020 - 04:28:33 EST


On Fri, Aug 28, 2020 at 03:07:07AM +0200, Ahmed S. Darwish wrote:
> Differentiate the first group by using "__seqcount_t_" as prefix. This
> also conforms with the rest of seqlock.h naming conventions.

> #define __seqprop_case(s, locktype, prop) \
> seqcount_##locktype##_t: __seqcount_##locktype##_##prop((void *)(s))
>
> #define __seqprop(s, prop) _Generic(*(s), \
> - seqcount_t: __seqcount_##prop((void *)(s)), \
> + seqcount_t: __seqcount_t_##prop((void *)(s)), \
> __seqprop_case((s), raw_spinlock, prop), \
> __seqprop_case((s), spinlock, prop), \
> __seqprop_case((s), rwlock, prop), \

If instead you do:

#define __seqprop_case(s, _lockname, prop) \
seqcount##_lockname##_t: __seqcount##_lockname##_##prop((void *)(s))

You can have:

__seqprop_case((s), , prop),
__seqprop_case((s), _raw_spinlock, prop),
__seqprop_case((s), _spinlock, prop),
__seqprop_case((s), _rwlock, prop),
__seqprop_case((s), _mutex, prop),
__seqprop_case((s), _ww_mutex, prop),

And it's all good again.

Although arguably we should do something like s/__seqcount/__seqprop/
over this lot.