| ... | @@ -1284,6 +1284,9 @@ pub const IORING_SETUP_CLAMP = 1 << 4; | ... | @@ -1284,6 +1284,9 @@ pub const IORING_SETUP_CLAMP = 1 << 4; |
| 1284 | /// attach to existing wq | 1284 | /// attach to existing wq |
| 1285 | pub const IORING_SETUP_ATTACH_WQ = 1 << 5; | 1285 | pub const IORING_SETUP_ATTACH_WQ = 1 << 5; |
| 1286 | | 1286 | |
| | 1287 | /// start with ring disabled |
| | 1288 | pub const IORING_SETUP_R_DISABLED = 1 << 6; |
| | 1289 | |
| 1287 | pub const io_sqring_offsets = extern struct { | 1290 | pub const io_sqring_offsets = extern struct { |
| 1288 | /// offset of ring head | 1291 | /// offset of ring head |
| 1289 | head: u32, | 1292 | head: u32, |
| ... | @@ -1430,6 +1433,11 @@ pub const io_uring_cqe = extern struct { | ... | @@ -1430,6 +1433,11 @@ pub const io_uring_cqe = extern struct { |
| 1430 | flags: u32, | 1433 | flags: u32, |
| 1431 | }; | 1434 | }; |
| 1432 | | 1435 | |
| | 1436 | // io_uring_cqe.flags |
| | 1437 | |
| | 1438 | /// If set, the upper 16 bits are the buffer ID |
| | 1439 | pub const IORING_CQE_F_BUFFER = 1 << 0; |
| | 1440 | |
| 1433 | pub const IORING_OFF_SQ_RING = 0; | 1441 | pub const IORING_OFF_SQ_RING = 0; |
| 1434 | pub const IORING_OFF_CQ_RING = 0x8000000; | 1442 | pub const IORING_OFF_CQ_RING = 0x8000000; |
| 1435 | pub const IORING_OFF_SQES = 0x10000000; | 1443 | pub const IORING_OFF_SQES = 0x10000000; |
| ... | @@ -1439,7 +1447,7 @@ pub const IORING_ENTER_GETEVENTS = 1 << 0; | ... | @@ -1439,7 +1447,7 @@ pub const IORING_ENTER_GETEVENTS = 1 << 0; |
| 1439 | pub const IORING_ENTER_SQ_WAKEUP = 1 << 1; | 1447 | pub const IORING_ENTER_SQ_WAKEUP = 1 << 1; |
| 1440 | | 1448 | |
| 1441 | // io_uring_register opcodes and arguments | 1449 | // io_uring_register opcodes and arguments |
| 1442 | pub const IORING_REGISTER = extern enum(u32) { | 1450 | pub const IORING_REGISTER = extern enum(u8) { |
| 1443 | REGISTER_BUFFERS, | 1451 | REGISTER_BUFFERS, |
| 1444 | UNREGISTER_BUFFERS, | 1452 | UNREGISTER_BUFFERS, |
| 1445 | REGISTER_FILES, | 1453 | REGISTER_FILES, |
| ... | @@ -1451,11 +1459,13 @@ pub const IORING_REGISTER = extern enum(u32) { | ... | @@ -1451,11 +1459,13 @@ pub const IORING_REGISTER = extern enum(u32) { |
| 1451 | REGISTER_PROBE, | 1459 | REGISTER_PROBE, |
| 1452 | REGISTER_PERSONALITY, | 1460 | REGISTER_PERSONALITY, |
| 1453 | UNREGISTER_PERSONALITY, | 1461 | UNREGISTER_PERSONALITY, |
| | 1462 | REGISTER_RESTRICTIONS, |
| | 1463 | REGISTER_ENABLE_RINGS, |
| 1454 | | 1464 | |
| 1455 | _, | 1465 | _, |
| 1456 | }; | 1466 | }; |
| 1457 | | 1467 | |
| 1458 | pub const io_uring_files_update = struct { | 1468 | pub const io_uring_files_update = extern struct { |
| 1459 | offset: u32, | 1469 | offset: u32, |
| 1460 | resv: u32, | 1470 | resv: u32, |
| 1461 | fds: u64, | 1471 | fds: u64, |
| ... | @@ -1463,7 +1473,7 @@ pub const io_uring_files_update = struct { | ... | @@ -1463,7 +1473,7 @@ pub const io_uring_files_update = struct { |
| 1463 | | 1473 | |
| 1464 | pub const IO_URING_OP_SUPPORTED = 1 << 0; | 1474 | pub const IO_URING_OP_SUPPORTED = 1 << 0; |
| 1465 | | 1475 | |
| 1466 | pub const io_uring_probe_op = struct { | 1476 | pub const io_uring_probe_op = extern struct { |
| 1467 | op: IORING_OP, | 1477 | op: IORING_OP, |
| 1468 | | 1478 | |
| 1469 | resv: u8, | 1479 | resv: u8, |
| ... | @@ -1474,7 +1484,7 @@ pub const io_uring_probe_op = struct { | ... | @@ -1474,7 +1484,7 @@ pub const io_uring_probe_op = struct { |
| 1474 | resv2: u32, | 1484 | resv2: u32, |
| 1475 | }; | 1485 | }; |
| 1476 | | 1486 | |
| 1477 | pub const io_uring_probe = struct { | 1487 | pub const io_uring_probe = extern struct { |
| 1478 | /// last opcode supported | 1488 | /// last opcode supported |
| 1479 | last_op: IORING_OP, | 1489 | last_op: IORING_OP, |
| 1480 | | 1490 | |
| ... | @@ -1487,6 +1497,39 @@ pub const io_uring_probe = struct { | ... | @@ -1487,6 +1497,39 @@ pub const io_uring_probe = struct { |
| 1487 | // Followed by up to `ops_len` io_uring_probe_op structures | 1497 | // Followed by up to `ops_len` io_uring_probe_op structures |
| 1488 | }; | 1498 | }; |
| 1489 | | 1499 | |
| | 1500 | pub const io_uring_restriction = extern struct { |
| | 1501 | opcode: u16, |
| | 1502 | arg: extern union { |
| | 1503 | /// IORING_RESTRICTION_REGISTER_OP |
| | 1504 | register_op: IORING_REGISTER, |
| | 1505 | |
| | 1506 | /// IORING_RESTRICTION_SQE_OP |
| | 1507 | sqe_op: IORING_OP, |
| | 1508 | |
| | 1509 | /// IORING_RESTRICTION_SQE_FLAGS_* |
| | 1510 | sqe_flags: u8, |
| | 1511 | }, |
| | 1512 | resv: u8, |
| | 1513 | resv2: u32[3], |
| | 1514 | }; |
| | 1515 | |
| | 1516 | /// io_uring_restriction->opcode values |
| | 1517 | pub const IORING_RESTRICTION = extern enum(u8) { |
| | 1518 | /// Allow an io_uring_register(2) opcode |
| | 1519 | REGISTER_OP = 0, |
| | 1520 | |
| | 1521 | /// Allow an sqe opcode |
| | 1522 | SQE_OP = 1, |
| | 1523 | |
| | 1524 | /// Allow sqe flags |
| | 1525 | SQE_FLAGS_ALLOWED = 2, |
| | 1526 | |
| | 1527 | /// Require sqe flags (these flags must be set on each submission) |
| | 1528 | SQE_FLAGS_REQUIRED = 3, |
| | 1529 | |
| | 1530 | _, |
| | 1531 | }; |
| | 1532 | |
| 1490 | pub const utsname = extern struct { | 1533 | pub const utsname = extern struct { |
| 1491 | sysname: [64:0]u8, | 1534 | sysname: [64:0]u8, |
| 1492 | nodename: [64:0]u8, | 1535 | nodename: [64:0]u8, |