VirtualBox

Changeset 6112 in vbox for trunk/include


Ignore:
Timestamp:
Dec 17, 2007 11:30:50 PM (17 years ago)
Author:
vboxsync
Message:

Rework asynchronous versions of the media interface and add a async transport interface

File:
1 edited

Legend:

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

    r6087 r6112  
    9494    /** PDMIBLOCKASYNCPORT      - Asynchronous version of the block interface (Up) Coupled with PDMINTERFACE_BLOCK_ASYNC. */
    9595    PDMINTERFACE_BLOCK_ASYNC_PORT,
     96    /** PDMITRANSPORTASYNC      - Transport data asynchronous to their target (Down) Coupled with PDMINTERFACE_TRANSPORT_ASYNC_PORT. */
     97    PDMINTERFACE_TRANSPORT_ASYNC,
     98    /** PDMITRANSPORTASYNCPORT  - Transport data asynchronous to their target (Up) Coupled with PDMINTERFACE_TRANSPORT_ASYNC. */
     99    PDMINTERFACE_TRANSPORT_ASYNC_PORT,
     100
    96101
    97102    /** PDMINETWORKPORT         - The network port interface.           (Down)  Coupled with PDMINTERFACE_NETWORK_CONNECTOR. */
     
    11591164     * @thread  Any thread.
    11601165     */
    1161     DECLR3CALLBACKMEMBER(int, pfnReadStart,(PPDMIBLOCKASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
     1166    DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
    11621167
    11631168    /**
     
    11721177     * @thread  Any thread.
    11731178     */
    1174     DECLR3CALLBACKMEMBER(int, pfnWriteStart,(PPDMIBLOCKASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
     1179    DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
    11751180
    11761181    /**
     
    12231228} PDMIBLOCKASYNC;
    12241229
    1225 
    1226 
    1227 /**
    1228  * Pointer to a async media notify interface.
     1230/** Notification interface for completed I/O tasks.
    12291231 * Pair with PDMIMEDIAASYNC.
    12301232 */
     1233
     1234/** Pointer to a asynchronous notification interface. */
    12311235typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
    12321236
    12331237/**
    1234  * Notification interface for completed I/O tasks.
    1235  * Pair with PDMIMEDIAASYNC.
     1238 * Asynchronous media interface.
     1239 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
    12361240 */
    12371241typedef struct PDMIMEDIAASYNCPORT
     
    12641268} PDMIMEDIAASYNCPORT;
    12651269
     1270/** Pointer to a asynchronous media interface. */
     1271typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
     1272
     1273/**
     1274 * Asynchronous media interface.
     1275 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
     1276 */
     1277typedef struct PDMIMEDIAASYNC
     1278{
     1279    /**
     1280     * Start reading task.
     1281     *
     1282     * @returns VBox status code.
     1283     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1284     * @param   off             Offset to start reading from.
     1285     * @param   pvBuf           Where to store the read bits.
     1286     * @param   cbRead          Number of bytes to read.
     1287     * @param   pvUser          User data.
     1288     * @thread  Any thread.
     1289     */
     1290    DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
     1291
     1292    /**
     1293     * Start writing task.
     1294     *
     1295     * @returns VBox status code.
     1296     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1297     * @param   off             Offset to start writing at.
     1298     * @param   pvBuf           Where to store the write bits.
     1299     * @param   cbWrite         Number of bytes to write.
     1300     * @param   pvUser          User data.
     1301     * @thread  Any thread.
     1302     */
     1303    DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
     1304
     1305    /**
     1306     * Make sure that the bits written are actually on the storage medium.
     1307     *
     1308     * @returns VBox status code.
     1309     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1310     * @thread  Any thread.
     1311     */
     1312    DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIAASYNC pInterface));
     1313
     1314    /**
     1315     * Get the media size in bytes.
     1316     *
     1317     * @returns Media size in bytes.
     1318     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1319     * @thread  Any thread.
     1320     */
     1321    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIAASYNC pInterface));
     1322
     1323    /**
     1324     * Check if the media is readonly or not.
     1325     *
     1326     * @returns true if readonly.
     1327     * @returns false if read/write.
     1328     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1329     * @thread  Any thread.
     1330     */
     1331    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIAASYNC pInterface));
     1332
     1333    /**
     1334     * Get stored media geometry - BIOS property.
     1335     * This is an optional feature of a media.
     1336     *
     1337     * @returns VBox status code.
     1338     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
     1339     * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetGeometry() yet.
     1340     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1341     * @param   pcCylinders     Number of cylinders.
     1342     * @param   pcHeads         Number of heads.
     1343     * @param   pcSectors       Number of sectors. This number is 1-based.
     1344     * @remark  This have no influence on the read/write operations.
     1345     * @thread  Any thread.
     1346     */
     1347    DECLR3CALLBACKMEMBER(int, pfnBiosGetGeometry,(PPDMIMEDIAASYNC pInterface, uint32_t *pcCylinders, uint32_t *pcHeads, uint32_t *pcSectors));
     1348
     1349    /**
     1350     * Store the media geometry - BIOS property.
     1351     * This is an optional feature of a media.
     1352     *
     1353     * @returns VBox status code.
     1354     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
     1355     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1356     * @param   cCylinders      Number of cylinders.
     1357     * @param   cHeads          Number of heads.
     1358     * @param   cSectors        Number of sectors. This number is 1-based.
     1359     * @remark  This have no influence on the read/write operations.
     1360     * @thread  The emulation thread.
     1361     */
     1362    DECLR3CALLBACKMEMBER(int, pfnBiosSetGeometry,(PPDMIMEDIAASYNC pInterface, uint32_t cCylinders, uint32_t cHeads, uint32_t cSectors));
     1363
     1364    /**
     1365     * Get stored geometry translation mode - BIOS property.
     1366     * This is an optional feature of a media.
     1367     *
     1368     * @returns VBox status code.
     1369     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry translation mode.
     1370     * @returns VERR_PDM_TRANSLATION_NOT_SET if the translation hasn't been set using pfnBiosSetTranslation() yet.
     1371     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1372     * @param   penmTranslation Where to store the translation type.
     1373     * @remark  This have no influence on the read/write operations.
     1374     * @thread  Any thread.
     1375     */
     1376    DECLR3CALLBACKMEMBER(int, pfnBiosGetTranslation,(PPDMIMEDIAASYNC pInterface, PPDMBIOSTRANSLATION penmTranslation));
     1377
     1378    /**
     1379     * Store media geometry - BIOS property.
     1380     * This is an optional feature of a media.
     1381     *
     1382     * @returns VBox status code.
     1383     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
     1384     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1385     * @param   enmTranslation  The translation type.
     1386     * @remark  This have no influence on the read/write operations.
     1387     * @thread  The emulation thread.
     1388     */
     1389    DECLR3CALLBACKMEMBER(int, pfnBiosSetTranslation,(PPDMIMEDIAASYNC pInterface, PDMBIOSTRANSLATION enmTranslation));
     1390
     1391    /**
     1392     * Gets the UUID of the media drive.
     1393     *
     1394     * @returns VBox status code.
     1395     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1396     * @param   pUuid           Where to store the UUID on success.
     1397     * @thread  Any thread.
     1398     */
     1399    DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIAASYNC pInterface, PRTUUID pUuid));
     1400
     1401} PDMIMEDIAASYNC;
     1402
     1403/**
     1404 * Pointer to a async media notify interface.
     1405 * Pair with PDMITRANSPORTASYNC.
     1406 */
     1407typedef struct PDMITRANSPORTASYNCPORT *PPDMITRANSPORTASYNCPORT;
     1408
     1409/**
     1410 * Notification interface for completed I/O tasks.
     1411 * Pair with PDMITRANSPORTASYNC.
     1412 */
     1413typedef struct PDMITRANSPORTASYNCPORT
     1414{
     1415    /**
     1416     * Notify completion of a read task.
     1417     *
     1418     * @returns VBox status code.
     1419     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1420     * @param   uOffset         Offset the task read from.
     1421     * @param   pvBuf           The buffer containig the read data.
     1422     * @param   cbRead          Number of bytes read.
     1423     * @param   pvUser          The user argument given in pfnStartRead.
     1424     * @thread  Any thread.
     1425     */
     1426    DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, void *pvUser));
     1427
     1428    /**
     1429     * Notify completion of a write task.
     1430     *
     1431     * @returns VBox status code.
     1432     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1433     * @param   uOffset         Offset the task has written to.
     1434     * @param   pvBuf           The buffer containig the written data.
     1435     * @param   cbWritten       Number of bytes actually written.
     1436     * @param   pvUser          The user argument given in pfnStartWrite.
     1437     * @thread  Any thread.
     1438     */
     1439    DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbWritten, void *pvUser));
     1440} PDMITRANSPORTASYNCPORT;
     1441
    12661442/** Pointer to a async media interface. */
    1267 typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
    1268 /**
    1269  * Asynchronous Media interface.
    1270  * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
    1271  */
    1272 typedef struct PDMIMEDIAASYNC
     1443typedef struct PDMITRANSPORTASYNC *PPDMITRANSPORTASYNC;
     1444/**
     1445 * Asynchronous transport interface.
     1446 * Makes up the fundation for PDMIMEDIAASYNC.
     1447 */
     1448typedef struct PDMITRANSPORTASYNC
    12731449{
    12741450    /**
     
    12841460     * @thread  Any thread.
    12851461     */
    1286     DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMIMEDIAASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, size_t *pcbRead));
     1462    DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, size_t *pcbRead));
    12871463
    12881464    /**
     
    12981474     * @thread  Any thread.
    12991475     */
    1300     DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMIMEDIAASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbWrite, size_t *pcbWritten));
     1476    DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbWrite, size_t *pcbWritten));
    13011477
    13021478    /**
     
    13111487     * @thread  Any thread.
    13121488     */
    1313     DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMIMEDIAASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
     1489    DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
    13141490
    13151491    /**
     
    13241500     * @thread  Any thread.
    13251501     */
    1326     DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMIMEDIAASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
     1502    DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
    13271503
    13281504    /**
     
    13341510     * @thread  Any thread.
    13351511     */
    1336     DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMIMEDIAASYNC pInterface));
     1512    DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMITRANSPORTASYNC pInterface));
    13371513
    13381514    /**
     
    13431519     * @thread  Any thread.
    13441520     */
    1345     DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIAASYNC pInterface));
     1521    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMITRANSPORTASYNC pInterface));
    13461522
    13471523    /**
     
    13531529     * @thread  Any thread.
    13541530     */
    1355     DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIAASYNC pInterface));
    1356 
    1357 } PDMIMEDIAASYNC;
     1531    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMITRANSPORTASYNC pInterface));
     1532
     1533    /**
     1534     * Opens the data source.
     1535     *
     1536     * @returns VBox status code.
     1537     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1538     * @param   pszPath         The path to open.
     1539     * @param   fReadonly       If the target shoudl opened readonly.
     1540     * @thread  Any thread.
     1541     */
     1542    DECLR3CALLBACKMEMBER(int, pfnOpen, (PPDMITRANSPORTASYNC pInterface, const char *pszTargetPath, bool fReadonly));
     1543
     1544    /**
     1545     * Close the data source.
     1546     *
     1547     * @returns VBox status code.
     1548     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1549     * @thread  Any thread.
     1550     */
     1551    DECLR3CALLBACKMEMBER(int, pfnClose, (PPDMITRANSPORTASYNC pInterface));
     1552
     1553} PDMITRANSPORTASYNC;
    13581554
    13591555/** @name Bit mask definitions for status line type
Note: See TracChangeset for help on using the changeset viewer.

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