@@ -33,8 +33,8 @@ use bindgen_types::*;
33
33
use core:: cmp:: Ordering ;
34
34
use core:: ffi:: c_void;
35
35
use core:: hash:: { Hash , Hasher } ;
36
- use core:: mem:: { size_of, MaybeUninit } ;
37
- use core:: ptr:: { null_mut, write_bytes } ;
36
+ use core:: mem:: size_of;
37
+ use core:: ptr:: null_mut;
38
38
use linux_raw_sys:: net;
39
39
40
40
// Export types used in io_uring APIs.
@@ -1155,6 +1155,13 @@ pub union io_uring_user_data {
1155
1155
}
1156
1156
1157
1157
impl io_uring_user_data {
1158
+ /// Create a zero-initialized `Self`.
1159
+ pub const fn zeroed ( ) -> Self {
1160
+ // Initialize the `u64_` field, which is the size of the full union.
1161
+ // This can use `core::mem::zeroed` in Rust 1.75.
1162
+ Self { u64_ : 0 }
1163
+ }
1164
+
1158
1165
/// Return the `u64` value.
1159
1166
#[ inline]
1160
1167
pub const fn u64_ ( self ) -> u64 {
@@ -1236,12 +1243,7 @@ impl Hash for io_uring_user_data {
1236
1243
impl Default for io_uring_user_data {
1237
1244
#[ inline]
1238
1245
fn default ( ) -> Self {
1239
- let mut s = MaybeUninit :: < Self > :: uninit ( ) ;
1240
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
1241
- unsafe {
1242
- write_bytes ( s. as_mut_ptr ( ) , 0 , 1 ) ;
1243
- s. assume_init ( )
1244
- }
1246
+ Self :: zeroed ( )
1245
1247
}
1246
1248
}
1247
1249
@@ -1449,10 +1451,13 @@ pub struct io_uring_cqe {
1449
1451
#[ allow( missing_docs) ]
1450
1452
#[ repr( C ) ]
1451
1453
#[ derive( Copy , Clone , Default ) ]
1454
+ #[ non_exhaustive]
1452
1455
pub struct io_uring_restriction {
1453
1456
pub opcode : IoringRestrictionOp ,
1454
1457
pub register_or_sqe_op_or_sqe_flags : register_or_sqe_op_or_sqe_flags_union ,
1458
+ #[ doc( hidden) ]
1455
1459
pub resv : u8 ,
1460
+ #[ doc( hidden) ]
1456
1461
pub resv2 : [ u32 ; 3 ] ,
1457
1462
}
1458
1463
@@ -1468,6 +1473,7 @@ pub union register_or_sqe_op_or_sqe_flags_union {
1468
1473
#[ allow( missing_docs) ]
1469
1474
#[ repr( C ) ]
1470
1475
#[ derive( Debug , Copy , Clone , Default ) ]
1476
+ #[ non_exhaustive]
1471
1477
pub struct io_uring_params {
1472
1478
pub sq_entries : u32 ,
1473
1479
pub cq_entries : u32 ,
@@ -1476,6 +1482,7 @@ pub struct io_uring_params {
1476
1482
pub sq_thread_idle : u32 ,
1477
1483
pub features : IoringFeatureFlags ,
1478
1484
pub wq_fd : RawFd ,
1485
+ #[ doc( hidden) ]
1479
1486
pub resv : [ u32 ; 3 ] ,
1480
1487
pub sq_off : io_sqring_offsets ,
1481
1488
pub cq_off : io_cqring_offsets ,
@@ -1484,6 +1491,7 @@ pub struct io_uring_params {
1484
1491
#[ allow( missing_docs) ]
1485
1492
#[ repr( C ) ]
1486
1493
#[ derive( Debug , Copy , Clone , Default ) ]
1494
+ #[ non_exhaustive]
1487
1495
pub struct io_sqring_offsets {
1488
1496
pub head : u32 ,
1489
1497
pub tail : u32 ,
@@ -1492,13 +1500,15 @@ pub struct io_sqring_offsets {
1492
1500
pub flags : u32 ,
1493
1501
pub dropped : u32 ,
1494
1502
pub array : u32 ,
1503
+ #[ doc( hidden) ]
1495
1504
pub resv1 : u32 ,
1496
1505
pub user_addr : io_uring_ptr ,
1497
1506
}
1498
1507
1499
1508
#[ allow( missing_docs) ]
1500
1509
#[ repr( C ) ]
1501
1510
#[ derive( Debug , Copy , Clone , Default ) ]
1511
+ #[ non_exhaustive]
1502
1512
pub struct io_cqring_offsets {
1503
1513
pub head : u32 ,
1504
1514
pub tail : u32 ,
@@ -1507,46 +1517,57 @@ pub struct io_cqring_offsets {
1507
1517
pub overflow : u32 ,
1508
1518
pub cqes : u32 ,
1509
1519
pub flags : u32 ,
1520
+ #[ doc( hidden) ]
1510
1521
pub resv1 : u32 ,
1511
1522
pub user_addr : io_uring_ptr ,
1512
1523
}
1513
1524
1514
1525
#[ allow( missing_docs) ]
1515
1526
#[ repr( C ) ]
1516
1527
#[ derive( Debug , Default ) ]
1528
+ #[ non_exhaustive]
1517
1529
pub struct io_uring_probe {
1518
1530
pub last_op : IoringOp ,
1519
1531
pub ops_len : u8 ,
1532
+ #[ doc( hidden) ]
1520
1533
pub resv : u16 ,
1534
+ #[ doc( hidden) ]
1521
1535
pub resv2 : [ u32 ; 3 ] ,
1522
1536
pub ops : IncompleteArrayField < io_uring_probe_op > ,
1523
1537
}
1524
1538
1525
1539
#[ allow( missing_docs) ]
1526
1540
#[ repr( C ) ]
1527
1541
#[ derive( Debug , Copy , Clone , Default ) ]
1542
+ #[ non_exhaustive]
1528
1543
pub struct io_uring_probe_op {
1529
1544
pub op : IoringOp ,
1545
+ #[ doc( hidden) ]
1530
1546
pub resv : u8 ,
1531
1547
pub flags : IoringOpFlags ,
1548
+ #[ doc( hidden) ]
1532
1549
pub resv2 : u32 ,
1533
1550
}
1534
1551
1535
1552
#[ allow( missing_docs) ]
1536
1553
#[ repr( C , align( 8 ) ) ]
1537
1554
#[ derive( Debug , Copy , Clone , Default ) ]
1555
+ #[ non_exhaustive]
1538
1556
pub struct io_uring_files_update {
1539
1557
pub offset : u32 ,
1558
+ #[ doc( hidden) ]
1540
1559
pub resv : u32 ,
1541
1560
pub fds : io_uring_ptr ,
1542
1561
}
1543
1562
1544
1563
#[ allow( missing_docs) ]
1545
1564
#[ repr( C , align( 8 ) ) ]
1546
1565
#[ derive( Debug , Copy , Clone , Default ) ]
1566
+ #[ non_exhaustive]
1547
1567
pub struct io_uring_rsrc_register {
1548
1568
pub nr : u32 ,
1549
1569
pub flags : IoringRsrcFlags ,
1570
+ #[ doc( hidden) ]
1550
1571
pub resv2 : u64 ,
1551
1572
pub data : io_uring_ptr ,
1552
1573
pub tags : io_uring_ptr ,
@@ -1555,21 +1576,26 @@ pub struct io_uring_rsrc_register {
1555
1576
#[ allow( missing_docs) ]
1556
1577
#[ repr( C , align( 8 ) ) ]
1557
1578
#[ derive( Debug , Copy , Clone , Default ) ]
1579
+ #[ non_exhaustive]
1558
1580
pub struct io_uring_rsrc_update {
1559
1581
pub offset : u32 ,
1582
+ #[ doc( hidden) ]
1560
1583
pub resv : u32 ,
1561
1584
pub data : io_uring_ptr ,
1562
1585
}
1563
1586
1564
1587
#[ allow( missing_docs) ]
1565
1588
#[ repr( C , align( 8 ) ) ]
1566
1589
#[ derive( Debug , Copy , Clone , Default ) ]
1590
+ #[ non_exhaustive]
1567
1591
pub struct io_uring_rsrc_update2 {
1568
1592
pub offset : u32 ,
1593
+ #[ doc( hidden) ]
1569
1594
pub resv : u32 ,
1570
1595
pub data : io_uring_ptr ,
1571
1596
pub tags : io_uring_ptr ,
1572
1597
pub nr : u32 ,
1598
+ #[ doc( hidden) ]
1573
1599
pub resv2 : u32 ,
1574
1600
}
1575
1601
@@ -1617,30 +1643,38 @@ pub struct open_how {
1617
1643
#[ allow( missing_docs) ]
1618
1644
#[ repr( C ) ]
1619
1645
#[ derive( Debug , Copy , Clone , Default ) ]
1646
+ #[ non_exhaustive]
1620
1647
pub struct io_uring_buf_reg {
1621
1648
pub ring_addr : io_uring_ptr ,
1622
1649
pub ring_entries : u32 ,
1623
1650
pub bgid : u16 ,
1624
1651
pub flags : u16 ,
1652
+ #[ doc( hidden) ]
1625
1653
pub resv : [ u64 ; 3_usize ] ,
1626
1654
}
1627
1655
1628
1656
#[ allow( missing_docs) ]
1629
1657
#[ repr( C ) ]
1630
1658
#[ derive( Debug , Copy , Clone , Default ) ]
1659
+ #[ non_exhaustive]
1631
1660
pub struct io_uring_buf {
1632
1661
pub addr : io_uring_ptr ,
1633
1662
pub len : u32 ,
1634
1663
pub bid : u16 ,
1664
+ #[ doc( hidden) ]
1635
1665
pub resv : u16 ,
1636
1666
}
1637
1667
1638
1668
#[ allow( missing_docs) ]
1639
1669
#[ repr( C ) ]
1640
1670
#[ derive( Debug , Copy , Clone , Default ) ]
1671
+ #[ non_exhaustive]
1641
1672
pub struct buf_ring_tail_struct {
1673
+ #[ doc( hidden) ]
1642
1674
pub resv1 : u64 ,
1675
+ #[ doc( hidden) ]
1643
1676
pub resv2 : u32 ,
1677
+ #[ doc( hidden) ]
1644
1678
pub resv3 : u16 ,
1645
1679
pub tail : u16 ,
1646
1680
}
0 commit comments