VirtualBox

Changeset 6086 in vbox


Ignore:
Timestamp:
Dec 15, 2007 4:55:13 PM (17 years ago)
Author:
vboxsync
Message:

Add asynchronous versions of the media and block interface

File:
1 edited

Legend:

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

    r6066 r6086  
    8686     * used by the iSCSI media driver.  */
    8787    PDMINTERFACE_ISCSITRANSPORT,
     88    /** PDMIMEDIAASYNC          - Asynchronous version of the media interface (Down) Coupled with PDMINTERFACE_MEDIA_ASYNC_PORT. */
     89    PDMINTERFACE_MEDIA_ASYNC,
     90    /** PDMIMEDIAASYNCPORT      - Asynchronous version of the media interface (Up) Coupled with PDMINTERFACE_MEDIA_ASYNC. */
     91    PDMINTERFACE_MEDIA_ASYNC_PORT,
     92    /** PDMIBLOCKASYNC          - Asynchronous version of the block interface (Down) Coupled with PDMINTERFACE_BLOCK_ASYNC_PORT. */
     93    PDMINTERFACE_BLOCK_ASYNC,
     94    /** PDMIBLOCKASYNCPORT      - Asynchronous version of the block interface (Up) Coupled with PDMINTERFACE_BLOCK_ASYNC. */
     95    PDMINTERFACE_BLOCK_ASYNC_PORT,
    8896
    8997    /** PDMINETWORKPORT         - The network port interface.           (Down)  Coupled with PDMINTERFACE_NETWORK_CONNECTOR. */
     
    10901098} PDMIISCSITRANSPORT;
    10911099
     1100/**
     1101 * Block notify interface.
     1102 * Pair with PDMIBLOCKASYNC.
     1103 */
     1104
     1105/** Pointer to a asynchronous block notify interface. */
     1106typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
     1107
     1108/**
     1109 * Asynchronous block notify interface.
     1110 * Pair with PDMIBLOCKASYNC.
     1111 */
     1112typedef struct PDMIBLOCKASYNCPORT
     1113{
     1114    /**
     1115     * Notify completion of a read task.
     1116     *
     1117     * @returns VBox status code.
     1118     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1119     * @param   uOffset         Offset the task read from.
     1120     * @param   pvBuf           The buffer containig the read data.
     1121     * @param   cbRead          Number of bytes read.
     1122     * @param   pvUser          The user argument given in pfnStartRead.
     1123     * @thread  Any thread.
     1124     */
     1125    DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, void *pvUser));
     1126
     1127    /**
     1128     * Notify completion of a write task.
     1129     *
     1130     * @returns VBox status code.
     1131     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1132     * @param   uOffset         Offset the task has written to.
     1133     * @param   pvBuf           The buffer containig the written data.
     1134     * @param   cbWrite         Number of bytes actually written.
     1135     * @param   pvUser          The user argument given in pfnStartWrite.
     1136     * @thread  Any thread.
     1137     */
     1138    DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbWrite, void *pvUser));
     1139} PDMIBLOCKASYNCPORT;
     1140
     1141/** Pointer to a asynchronous block interface. */
     1142typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
     1143
     1144/**
     1145 * Asynchronous block interface.
     1146 * Pair with PDMIBLOCKASYNCPORT.
     1147 */
     1148typedef struct PDMIBLOCKASYNC
     1149{
     1150    /**
     1151     * Start reading task.
     1152     *
     1153     * @returns VBox status code.
     1154     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1155     * @param   off             Offset to start reading from.
     1156     * @param   pvBuf           Where to store the read bits.
     1157     * @param   cbRead          Number of bytes to read.
     1158     * @param   pvUser          User argument which is returned in completion callback.
     1159     * @thread  Any thread.
     1160     */
     1161    DECLR3CALLBACKMEMBER(int, pfnReadStart,(PPDMIBLOCKASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
     1162
     1163    /**
     1164     * Write bits.
     1165     *
     1166     * @returns VBox status code.
     1167     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1168     * @param   off             Offset to start writing at.
     1169     * @param   pvBuf           Where to store the write bits.
     1170     * @param   cbWrite         Number of bytes to write.
     1171     * @param   pvUser          User argument which is returned in completion callback.
     1172     * @thread  Any thread.
     1173     */
     1174    DECLR3CALLBACKMEMBER(int, pfnWriteStart,(PPDMIBLOCKASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
     1175
     1176    /**
     1177     * Make sure that the bits written are actually on the storage medium.
     1178     *
     1179     * @returns VBox status code.
     1180     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1181     * @thread  Any thread.
     1182     */
     1183    DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCKASYNC pInterface));
     1184
     1185    /**
     1186     * Check if the media is readonly or not.
     1187     *
     1188     * @returns true if readonly.
     1189     * @returns false if read/write.
     1190     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1191     * @thread  Any thread.
     1192     */
     1193    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCKASYNC pInterface));
     1194
     1195    /**
     1196     * Gets the media size in bytes.
     1197     *
     1198     * @returns Media size in bytes.
     1199     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1200     * @thread  Any thread.
     1201     */
     1202    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCKASYNC pInterface));
     1203
     1204    /**
     1205     * Gets the block drive type.
     1206     *
     1207     * @returns block drive type.
     1208     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1209     * @thread  Any thread.
     1210     */
     1211    DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKASYNC pInterface));
     1212
     1213    /**
     1214     * Gets the UUID of the block drive.
     1215     * Don't return the media UUID if it's removable.
     1216     *
     1217     * @returns VBox status code.
     1218     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1219     * @param   pUuid           Where to store the UUID on success.
     1220     * @thread  Any thread.
     1221     */
     1222    DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCKASYNC pInterface, PRTUUID pUuid));
     1223} PDMIBLOCKASYNC;
     1224
     1225
     1226
     1227/**
     1228 * Pointer to a async media notify interface.
     1229 * Pair with PDMIMEDIAASYNC.
     1230 */
     1231typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
     1232
     1233/**
     1234 * Notification interface for completed I/O tasks.
     1235 * Pair with PDMIMEDIAASYNC.
     1236 */
     1237typedef struct PDMIMEDIAASYNCPORT
     1238{
     1239    /**
     1240     * Notify completion of a read task.
     1241     *
     1242     * @returns VBox status code.
     1243     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1244     * @param   uOffset         Offset the task read from.
     1245     * @param   pvBuf           The buffer containig the read data.
     1246     * @param   cbRead          Number of bytes read.
     1247     * @param   pvUser          The user argument given in pfnStartRead.
     1248     * @thread  Any thread.
     1249     */
     1250    DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, void *pvUser));
     1251
     1252    /**
     1253     * Notify completion of a write task.
     1254     *
     1255     * @returns VBox status code.
     1256     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1257     * @param   uOffset         Offset the task has written to.
     1258     * @param   pvBuf           The buffer containig the written data.
     1259     * @param   cbWritten       Number of bytes actually written.
     1260     * @param   pvUser          The user argument given in pfnStartWrite.
     1261     * @thread  Any thread.
     1262     */
     1263    DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t uOffset, void *pvBuf, size_t cbWritten, void *pvUser));
     1264} PDMIMEDIAASYNCPORT;
     1265
     1266/** Pointer to a async media interface. */
     1267typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
     1268/**
     1269 * Asynchronous Media interface.
     1270 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
     1271 */
     1272typedef struct PDMIMEDIAASYNC
     1273{
     1274    /**
     1275     * Read bits synchronous.
     1276     * Blocks until finished.
     1277     *
     1278     * @returns VBox status code.
     1279     * @param   pInterface      Pointer to the interface structure containint the called function pointer.
     1280     * @param   uOffset         Offset to start reading from.
     1281     * @param   pvBuf           here to store the read bits.
     1282     * @param   cbRead          Number of bytes to read.
     1283     * @param   pcbRead         Where to store the number of bytes actually read.
     1284     * @thread  Any thread.
     1285     */
     1286    DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMIMEDIAASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbRead, size_t *pcbRead));
     1287
     1288    /**
     1289     * Write bits synchronous.
     1290     * Blocks until finished.
     1291     *
     1292     * @returns VBox status code.
     1293     * @param   pInterface      Pointer to the interface structure containint the called function pointer.
     1294     * @param   uOffset         Offset to start reading from.
     1295     * @param   pvBuf           here to store the read bits.
     1296     * @param   cbWrite         Number of bytes to read.
     1297     * @param   pcbWritten      Where to store the number of bytes actually read.
     1298     * @thread  Any thread.
     1299     */
     1300    DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMIMEDIAASYNC pInterface, uint64_t uOffset, void *pvBuf, size_t cbWrite, size_t *pcbWritten));
     1301
     1302    /**
     1303     * Start asynchronous read.
     1304     *
     1305     * @returns VBox status code.
     1306     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1307     * @param   off             Offset to start reading from.
     1308     * @param   pvBuf           Where to store the read bits.
     1309     * @param   cbRead          Number of bytes to read.
     1310     * @param   pvUser          User argument returned in completion callback.
     1311     * @thread  Any thread.
     1312     */
     1313    DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMIMEDIAASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
     1314
     1315    /**
     1316     * Start asynchronous write.
     1317     *
     1318     * @returns VBox status code.
     1319     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1320     * @param   off             Offset to start writing at.
     1321     * @param   pvBuf           Where to store the write bits.
     1322     * @param   cbWrite         Number of bytes to write.
     1323     * @param   pvUser          User argument returned in completion callback.
     1324     * @thread  Any thread.
     1325     */
     1326    DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMIMEDIAASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
     1327
     1328    /**
     1329     * Make sure that the bits written are actually on the storage medium.
     1330     * This is a synchronous task
     1331     *
     1332     * @returns VBox status code.
     1333     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1334     * @thread  Any thread.
     1335     */
     1336    DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMIMEDIAASYNC pInterface));
     1337
     1338    /**
     1339     * Get the media size in bytes.
     1340     *
     1341     * @returns Media size in bytes.
     1342     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1343     * @thread  Any thread.
     1344     */
     1345    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIAASYNC pInterface));
     1346
     1347    /**
     1348     * Check if the media is readonly or not.
     1349     *
     1350     * @returns true if readonly.
     1351     * @returns false if read/write.
     1352     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     1353     * @thread  Any thread.
     1354     */
     1355    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIAASYNC pInterface));
     1356
     1357} PDMIMEDIAASYNC;
     1358
    10921359/** Status line type.
    10931360 * @todo r=bird: These are just flags, so just use a uint8_t (or better an uint32_t / unsigned). no need for a type here. */
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