VirtualBox

Changeset 66264 in vbox


Ignore:
Timestamp:
Mar 27, 2017 11:12:35 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114185
Message:

Storage/VD: Sketch out a new I/O queue based API for async I/O which will replace the old async API in the near future

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vd.h

    r66250 r66264  
    4646#endif
    4747
    48 /** @defgroup grp_vd            VBox HDD Container
     48/** @defgroup grp_vd            Virtual Disk Container
    4949 * @{
    5050 */
     
    13921392                                          PRTVFSFILE phVfsFile);
    13931393
     1394/** @defgroup grp_vd_ioqueue    I/O queues
     1395 * @{
     1396 */
     1397
     1398/** VD I/O queue handle. */
     1399typedef struct VDIOQUEUEINT *VDIOQUEUE;
     1400/** Pointer to an VD I/O queue handle. */
     1401typedef VDIOQUEUE *PVDIOQUEUE;
     1402
     1403/** VD I/O queue request handle. */
     1404typedef struct VDIOREQINT *VDIOREQ;
     1405/** Pointer to an VD I/O queue request handle. */
     1406typedef VDIOREQ *PVDIOREQ;
     1407
     1408/** A I/O request ID. */
     1409typedef uint64_t VDIOREQID;
     1410
     1411/**
     1412 * I/O queue request completion callback.
     1413 *
     1414 * @returns nothing.
     1415 * @param   hVdIoQueue      The VD I/O queue handle.
     1416 * @param   pDisk           The disk the queue is attached to.
     1417 * @param   hVdIoReq        The VD I/O request which completed.
     1418 * @param   pvVdIoReq       Pointer to the allocator specific memory for this request.
     1419 * @param   rcReq           The completion status code.
     1420 */
     1421typedef DECLCALLBACK(void) FNVDIOQUEUEREQCOMPLETE(VDIOQUEUE hVdIoQueue, PVDISK pDisk,
     1422                                                  VDIOREQ hVdIoReq, void *pvVdIoReq,
     1423                                                  int rcReq);
     1424/** Pointer to a VD I/O queue request completion callback. */
     1425typedef FNVDIOQUEUEREQCOMPLETE *PFNVDIOQUEUEREQCOMPLETE;
     1426
     1427
     1428/**
     1429 * Creates a new I/O queue.
     1430 *
     1431 * @returns VBox status code.
     1432 * @param   phVdIoQueue      Where to store the handle to the I/O queue on success.
     1433 * @param   pfnIoReqComplete The completion handle to call when a request on the specified queue completes.
     1434 * @param   cbIoReqAlloc     The extra amount of memory to allocate and associate with allocated requests
     1435 *                           for use by the caller.
     1436 * @param   iPriority        The priority of the queue from 0..UINT32_MAX. The lower the number the higher
     1437 *                           the priority of the queue.
     1438 */
     1439VBOXDDU_DECL(int) VDIoQueueCreate(PVDIOQUEUE phVdIoQueue, PFNVDIOQUEUEREQCOMPLETE pfnIoReqComplete,
     1440                                  size_t cbIoReqAlloc, uint32_t iPriority);
     1441
     1442/**
     1443 * Destroys the given I/O queue.
     1444 *
     1445 * @returns VBox status code.
     1446 * @param   hVdIoQueue       The I/O queue handle.
     1447 */
     1448VBOXDDU_DECL(int) VDIoQueueDestroy(VDIOQUEUE hVdIoQueue);
     1449
     1450/**
     1451 * Attaches the given I/O queue to the given virtual disk container.
     1452 *
     1453 * @returns VBox status code.
     1454 * @param   pDisk            The disk container handle.
     1455 * @param   hVdIoQueue       The I/O queue to attach.
     1456 */
     1457VBOXDDU_DECL(int) VDIoQueueAttach(PVDISK pDisk, VDIOQUEUE hVdIoQueue);
     1458
     1459/**
     1460 * Detaches the given I/O queue from the currently attached disk container.
     1461 *
     1462 * @returns VBox status code.
     1463 * @param   hVdIoQueue       The I/O queue.
     1464 * @param   fPurge           Flag whether to cancel all active requests on this queue
     1465 *                           before detaching.
     1466 */
     1467VBOXDDU_DECL(int) VDIoQueueDetach(VDIOQUEUE hVdIoQueue, bool fPurge);
     1468
     1469/**
     1470 * Purges all requests on the given queue.
     1471 *
     1472 * @returns VBox status code.
     1473 * @param   hVdIoQueue       The I/O queue.
     1474 */
     1475VBOXDDU_DECL(int) VDIoQueuePurge(VDIOQUEUE hVdIoQueue);
     1476
     1477/**
     1478 * Allocates a new request from the given queue.
     1479 *
     1480 * @returns VBox status code.
     1481 * @param   hVdIoQueue       The I/O queue.
     1482 * @param   phVdIoReq        Where to store the handle of the request on success.
     1483 * @param   ppvVdIoReq       Where to store the pointer to the allocator usable memory on success.
     1484 * @param   uIoReqId         The request ID to assign to the request for canceling.
     1485 */
     1486VBOXDDU_DECL(int) VDIoQueueReqAlloc(VDIOQUEUE hVdIoQueue, PVDIOREQ phVdIoReq,
     1487                                    void **ppvVdIoReq, VDIOREQID uIoReqId);
     1488
     1489/**
     1490 * Frees a given non active request.
     1491 *
     1492 * @returns VBox status code.
     1493 * @param   hVdIoReq         The I/O request to free.
     1494 */
     1495VBOXDDU_DECL(int) VDIoQueueReqFree(VDIOREQ hVdIoReq);
     1496
     1497/**
     1498 * Cancels an active request by the given request ID.
     1499 *
     1500 * @returns VBox status code.
     1501 * @param   hVdIoQueue       The I/O queue to cancel the request on.
     1502 * @param   uIoReqId         The request ID.
     1503 */
     1504VBOXDDU_DECL(int) VDIoQueueReqCancelById(VDIOQUEUE hVdIoQueue, VDIOREQID uIoReqId);
     1505
     1506/**
     1507 * Cancels an active request by the given handle.
     1508 *
     1509 * @returns VBox status code.
     1510 * @param   hVdIoReq         The I/O request handle to cancel.
     1511 */
     1512VBOXDDU_DECL(int) VDIoQueueReqCancelByHandle(VDIOREQ hVdIoReq);
     1513
     1514/**
     1515 * Initiates a read request using the given request handle.
     1516 *
     1517 * @returns VBox status code.
     1518 * @param   hVdIoReq         The I/O request handle.
     1519 * @param   off              Where to start reading from.
     1520 * @param   cbRead           Number of bytes to read.
     1521 * @param   pcSgBuf          The S/G buffer to use.
     1522 */
     1523VBOXDDU_DECL(int) VDIoQueueReqRead(VDIOREQ hVdIoReq, uint64_t off, size_t cbRead,
     1524                                   PCRTSGBUF pcSgBuf);
     1525
     1526/**
     1527 * Initiates a write request using the given request handle.
     1528 *
     1529 * @returns VBox status code.
     1530 * @param   hVdIoReq         The I/O request handle.
     1531 * @param   off              Where to start writing to.
     1532 * @param   cbWrite          Number of bytes to write.
     1533 * @param   pcSgBuf          The S/G buffer to use.
     1534 */
     1535VBOXDDU_DECL(int) VDIoQueueReqWrite(VDIOREQ hVdIoReq, uint64_t off, size_t cbWrite,
     1536                                    PCRTSGBUF pcSgBuf);
     1537
     1538/**
     1539 * Initiates a flush request using the given request handle.
     1540 *
     1541 * @returns VBox status code.
     1542 * @param   hVdIoReq         The I/O request handle.
     1543 */
     1544VBOXDDU_DECL(int) VDIoQueueReqFlush(VDIOREQ hVdIoReq);
     1545
     1546/**
     1547 * Initiates a discard request using the given request handle.
     1548 *
     1549 * @returns VBox status code.
     1550 * @param   hVdIoReq         The I/O request handle.
     1551 * @param   paRanges         Pointer to the array of ranges to discard.
     1552 * @param   cRanges          Number of entries in the array.
     1553 */
     1554VBOXDDU_DECL(int) VDIoQueueReqDiscard(VDIOREQ hVdIoReq, PCRTRANGE paRanges,
     1555                                      unsigned cRanges);
     1556
     1557/** @} */
     1558
     1559
    13941560RT_C_DECLS_END
    13951561
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette