Skip to content

Commit 138c75e

Browse files
coolreader18tgross35
authored andcommitted
Add contents of linux/can/bcm.h
(backport <#4683>) (cherry picked from commit 62a1fad)
1 parent 16a6c79 commit 138c75e

File tree

4 files changed

+86
-2
lines changed

4 files changed

+86
-2
lines changed

libc-test/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,6 +3886,7 @@ fn test_linux(target: &str) {
38863886
headers! { cfg:
38873887
[gnu]: "linux/aio_abi.h",
38883888
"linux/can.h",
3889+
"linux/can/bcm.h",
38893890
"linux/can/raw.h",
38903891
"linux/can/j1939.h",
38913892
"linux/cn_proc.h",
@@ -4960,7 +4961,7 @@ fn test_linux(target: &str) {
49604961
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_fastopen_bitfields") ||
49614962
// either fsid_t or int[2] type
49624963
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
4963-
// `handle` is a VLA
4964+
// `handle` is a flexible array member
49644965
(struct_ == "fanotify_event_info_fid" && field == "handle") ||
49654966
// `anonymous_1` is an anonymous union
49664967
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
@@ -4978,7 +4979,9 @@ fn test_linux(target: &str) {
49784979
// the `xsk_tx_metadata_union` field is an anonymous union
49794980
(struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union") ||
49804981
// After musl 1.2.0, the type becomes `int` instead of `long`.
4981-
(old_musl && struct_ == "utmpx" && field == "ut_session")
4982+
(old_musl && struct_ == "utmpx" && field == "ut_session") ||
4983+
// `frames` is a flexible array member
4984+
(struct_ == "bcm_msg_head" && field == "frames")
49824985
});
49834986

49844987
cfg.skip_roundtrip(move |s| match s {
@@ -5017,6 +5020,7 @@ fn test_linux(target: &str) {
50175020
"inotify_event" => true,
50185021
"fanotify_event_info_fid" => true,
50195022
"cmsghdr" => true,
5023+
"bcm_msg_head" => true,
50205024

50215025
// FIXME(linux): the call ABI of max_align_t is incorrect on these platforms:
50225026
"max_align_t" if i686 || ppc64 => true,

libc-test/semver/linux.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ CAN_EFF_ID_BITS
234234
CAN_EFF_MASK
235235
CAN_ERR_FLAG
236236
CAN_ERR_MASK
237+
CAN_FD_FRAME
237238
CAN_INV_FILTER
238239
CAN_ISOTP
239240
CAN_J1939
@@ -2711,6 +2712,17 @@ RT_TOS
27112712
RUSAGE_CHILDREN
27122713
RUSAGE_SELF
27132714
RUSAGE_THREAD
2715+
RX_ANNOUNCE_RESUME
2716+
RX_CHANGED
2717+
RX_CHECK_DLC
2718+
RX_DELETE
2719+
RX_FILTER_ID
2720+
RX_NO_AUTOTIMER
2721+
RX_READ
2722+
RX_RTR_FRAME
2723+
RX_SETUP
2724+
RX_STATUS
2725+
RX_TIMEOUT
27142726
SCHED_BATCH
27152727
SCHED_FIFO
27162728
SCHED_IDLE
@@ -2844,6 +2856,7 @@ SEM_STAT
28442856
SEM_STAT_ANY
28452857
SEM_UNDO
28462858
SETALL
2859+
SETTIMER
28472860
SETVAL
28482861
SFD_CLOEXEC
28492862
SFD_NONBLOCK
@@ -3088,6 +3101,7 @@ SPLICE_F_MOVE
30883101
SPLICE_F_NONBLOCK
30893102
SS_DISABLE
30903103
SS_ONSTACK
3104+
STARTTIMER
30913105
STICKY_TIMEOUTS
30923106
ST_APPEND
30933107
ST_IMMUTABLE
@@ -3576,6 +3590,16 @@ TUN_TAP_DEV
35763590
TUN_TUN_DEV
35773591
TUN_TX_TIMESTAMP
35783592
TUN_TYPE_MASK
3593+
TX_ANNOUNCE
3594+
TX_COUNTEVT
3595+
TX_CP_CAN_ID
3596+
TX_DELETE
3597+
TX_EXPIRED
3598+
TX_READ
3599+
TX_RESET_MULTI_IDX
3600+
TX_SEND
3601+
TX_SETUP
3602+
TX_STATUS
35793603
T_FMT
35803604
T_FMT_AMPM
35813605
UDP_CORK
@@ -3859,6 +3883,8 @@ arpd_request
38593883
arphdr
38603884
arpreq
38613885
arpreq_old
3886+
bcm_msg_head
3887+
bcm_timeval
38623888
blkcnt64_t
38633889
brk
38643890
bsearch

src/new/linux_uapi/linux/can.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! Header: `uapi/linux/can.h`
22
3+
pub(crate) mod bcm;
34
pub(crate) mod j1939;
45
pub(crate) mod raw;
56

7+
pub use bcm::*;
68
pub use j1939::*;
79
pub use raw::*;
810

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//! `linux/can/bcm.h`
2+
3+
pub use crate::linux::can::*;
4+
5+
s! {
6+
pub struct bcm_timeval {
7+
pub tv_sec: c_long,
8+
pub tv_usec: c_long,
9+
}
10+
11+
pub struct bcm_msg_head {
12+
pub opcode: u32,
13+
pub flags: u32,
14+
pub count: u32,
15+
pub ival1: bcm_timeval,
16+
pub ival2: bcm_timeval,
17+
pub can_id: canid_t,
18+
pub nframes: u32,
19+
pub frames: [can_frame; 0],
20+
}
21+
}
22+
23+
c_enum! {
24+
#[repr(u32)]
25+
pub enum #anon {
26+
TX_SETUP = 1,
27+
TX_DELETE,
28+
TX_READ,
29+
TX_SEND,
30+
RX_SETUP,
31+
RX_DELETE,
32+
RX_READ,
33+
TX_STATUS,
34+
TX_EXPIRED,
35+
RX_STATUS,
36+
RX_TIMEOUT,
37+
RX_CHANGED,
38+
}
39+
}
40+
41+
pub const SETTIMER: u32 = 0x0001;
42+
pub const STARTTIMER: u32 = 0x0002;
43+
pub const TX_COUNTEVT: u32 = 0x0004;
44+
pub const TX_ANNOUNCE: u32 = 0x0008;
45+
pub const TX_CP_CAN_ID: u32 = 0x0010;
46+
pub const RX_FILTER_ID: u32 = 0x0020;
47+
pub const RX_CHECK_DLC: u32 = 0x0040;
48+
pub const RX_NO_AUTOTIMER: u32 = 0x0080;
49+
pub const RX_ANNOUNCE_RESUME: u32 = 0x0100;
50+
pub const TX_RESET_MULTI_IDX: u32 = 0x0200;
51+
pub const RX_RTR_FRAME: u32 = 0x0400;
52+
pub const CAN_FD_FRAME: u32 = 0x0800;

0 commit comments

Comments
 (0)