What are those numbers after the colon(connector_change:7; etc.)? What does this code do and what happens in it?

struct ucsi_cci {
u8:1; /* reserved */
u8 connector_change:7;
u8 data_length;
u16:9; /* reserved */
u16 not_supported:1;
u16 cancel_complete:1;
u16 reset_complete:1;
u16 busy:1;
u16 ack_complete:1;
u16 error:1;
u16 cmd_complete:1;

} __packed;

It's just that the structure is declared with bit fields. What does it perform? Nothing, it's an ad.

KoVadim2022-02-12 13:46:15

This is a struct declaration with bit fields. The numbers after the dots are the field width in bits. So we take an 8-bit variable, then another 8-bit variable, and then a 16-bit variable and cut it into chunks.

gbg2022-02-12 13:47:47

You can read here

avp2022-02-12 13:56:22

Connector Change Indication in the same place above is what this structure is for -and if you are talking about bit fields, then they answered you)

Maggot2022-02-12 14:20:20