Re: [PATCH 2/3] can: raw: use bitfields to store flags in struct raw_sock

From: Vincent Mailhol
Date: Wed Sep 17 2025 - 00:44:05 EST


On 17/09/2025 at 03:35, Christophe JAILLET wrote:
> Le 15/09/2025 à 11:23, Vincent Mailhol a écrit :

(...)

>> --- a/net/can/raw.c
>> +++ b/net/can/raw.c
>> @@ -87,10 +87,10 @@ struct raw_sock {
>>       struct net_device *dev;
>>       netdevice_tracker dev_tracker;
>>       struct list_head notifier;
>> -    int loopback;
>> -    int recv_own_msgs;
>> -    int fd_frames;
>> -    int xl_frames;
>> +    unsigned int loopback:1;
>> +    unsigned int recv_own_msgs:1;
>> +    unsigned int fd_frames:1;
>> +    unsigned int xl_frames:1;
>>       struct can_raw_vcid_options raw_vcid_opts;
>>       canid_t tx_vcid_shifted;
>>       canid_t rx_vcid_shifted;
>
> [...]
>
> Hi,
>
> just in case, it looks like bound and join_filters could also be defined in the
> bitfield.
>
> just my 2c.

You are absolutely right. I will add these two to the bitfield in v2.


Yours sincerely,
Vincent Mailhol