Changeset 10715 in vbox for trunk/include/VBox
- Timestamp:
- Jul 16, 2008 10:38:23 PM (16 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxHDD-new.h
r10467 r10715 178 178 * used for querying information, and nothing else. */ 179 179 #define VD_OPEN_FLAGS_INFO RT_BIT(3) 180 /** Open image for asynchronous access. 181 * Only available if VD_CAP_ASYNC_IO is set 182 * Check with VDIsAsynchonousIoSupported wether 183 * asynchronous I/O is really supported for this file. 184 */ 185 #define VD_OPEN_FLAGS_ASYNC_IO RT_BIT(4) 180 186 /** Mask of valid flags. */ 181 #define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO )187 #define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO) 182 188 /** @}*/ 183 189 … … 196 202 /** Supports being used as differencing image format backend. */ 197 203 #define VD_CAP_DIFF RT_BIT(4) 204 /** Supports asynchronous I/O operations for at least some configurations. */ 205 #define VD_CAP_ASYNC RT_BIT(5) 198 206 /** The backend operates on files. The caller needs to know to handle the 199 207 * location appropriately. */ 200 208 #define VD_CAP_FILE RT_BIT(6) 201 209 /** @}*/ 202 203 210 204 211 /** … … 213 220 } VDBACKENDINFO, *PVDBACKENDINFO; 214 221 215 216 /** 217 * Error message callback. 218 * 219 * @param pvUser The opaque data passed on container creation. 220 * @param rc The VBox error code. 221 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 222 * @param pszFormat Error message format string. 223 * @param va Error message arguments. 224 */ 225 typedef DECLCALLBACK(void) FNVDERROR(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va); 226 /** Pointer to a FNVDERROR(). */ 227 typedef FNVDERROR *PFNVDERROR; 222 /** 223 * Supported interface types. 224 */ 225 typedef enum VDINTERFACETYPE 226 { 227 /** First valid interface. */ 228 VDINTERFACETYPE_FIRST = 0, 229 /** Interface to pass error message to upper layers. */ 230 VDINTERFACETYPE_ERROR = VDINTERFACETYPE_FIRST, 231 /** Interface for asynchronous I/O operations. */ 232 VDINTERFACETYPE_ASYNCIO, 233 /** Interface for progress notification. */ 234 VDINTERFACETYPE_PROGRESS, 235 /** invalid interface. */ 236 VDINTERFACETYPE_INVALID 237 } VDINTERFACETYPE; 238 239 /** 240 * Common structure for all interfaces. 241 */ 242 typedef struct VDINTERFACE 243 { 244 /** Human readable interface name. */ 245 const char *pszInterfaceName; 246 /** The size of the struct. */ 247 uint32_t cbSize; 248 /** Pointer to the next common interface structure. */ 249 struct VDINTERFACE *pNext; 250 /** Interface type. */ 251 VDINTERFACETYPE enmInterface; 252 /** Opaque user data which is passed on every call. */ 253 void *pvUser; 254 /** Pointer to the function call table of the interface. 255 * As this is opaque this must be casted to the right interface 256 * struct defined below based on the interface type in enmInterface. */ 257 void *pCallbacks; 258 } VDINTERFACE, *PVDINTERFACE; 259 /** Pointer to a const PVDINTERFACE. */ 260 typedef const PVDINTERFACE PCVDINTERFACE; 261 262 /** 263 * Helper functions to handle interface lists. 264 */ 265 266 /** 267 * Get a specific interface from a list of interfaces specified by the type. 268 * 269 * @returns Pointer to the matching interface or NULL if none was found. 270 * @param pInterfaces Pointer to the first interface in the list. 271 * @param enmInterface Interface to search for. 272 */ 273 DECLINLINE(PVDINTERFACE) VDGetInterfaceFromList(PVDINTERFACE pInterfaces, VDINTERFACETYPE enmInterface) 274 { 275 AssertMsgReturn( (enmInterface >= VDINTERFACETYPE_FIRST) 276 && (enmInterface < VDINTERFACETYPE_INVALID), 277 ("enmInterface=%u", enmInterface), NULL); 278 279 while (pInterfaces) 280 { 281 /* Sanity checks. */ 282 AssertMsgBreak(pInterfaces->cbSize == sizeof(VDINTERFACE), 283 ("cbSize=%u\n", pInterfaces->cbSize)); 284 285 if (pInterfaces->enmInterface == enmInterface) 286 return pInterfaces; 287 pInterfaces = pInterfaces->pNext; 288 } 289 290 /* No matching interface was found. */ 291 return NULL; 292 } 293 294 /** 295 * Initialize a common interface structure. 296 * 297 * @return VBox status code. 298 * @param pInterface Pointer to an unitialized common interface structure. 299 * @param pszName Name of the interface. 300 * @param enmInterface Type of the interface. 301 * @param pCallbacks The callback table of the interface. 302 * @param pvUser Opaque user data passed on every function call. 303 * @param pNext Pointer to the next supported interface if any. 304 */ 305 DECLINLINE(int) VDInterfaceCreate(PVDINTERFACE pInterface, const char *pszName, 306 VDINTERFACETYPE enmInterface, void *pCallbacks, 307 void *pvUser, PVDINTERFACE pNext) 308 { 309 310 /** Argument checks. */ 311 AssertMsgReturn( (enmInterface >= VDINTERFACETYPE_FIRST) 312 && (enmInterface < VDINTERFACETYPE_INVALID), 313 ("enmInterface=%u", enmInterface), VERR_INVALID_PARAMETER); 314 315 AssertMsgReturn(VALID_PTR(pCallbacks), 316 ("pCallbacks=%#p", pCallbacks), 317 VERR_INVALID_PARAMETER); 318 319 pInterface->cbSize = sizeof(VDINTERFACE); 320 pInterface->pszInterfaceName = pszName; 321 pInterface->enmInterface = enmInterface; 322 pInterface->pCallbacks = pCallbacks; 323 pInterface->pvUser = pvUser; 324 pInterface->pNext = pNext; 325 return VINF_SUCCESS; 326 } 327 328 /** 329 * Interface to deliver error messages to upper layers. 330 */ 331 typedef struct VDINTERFACEERROR 332 { 333 /** 334 * Size of the error interface. 335 */ 336 uint32_t cbSize; 337 338 /** 339 * Interface type. 340 */ 341 VDINTERFACETYPE enmInterface; 342 343 /** 344 * Error message callback. 345 * 346 * @param pvUser The opaque data passed on container creation. 347 * @param rc The VBox error code. 348 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 349 * @param pszFormat Error message format string. 350 * @param va Error message arguments. 351 */ 352 DECLR3CALLBACKMEMBER(void, pfnError, (void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)); 353 354 } VDINTERFACEERROR, *PVDINTERFACEERROR; 355 356 /** 357 * Get error interface from opaque callback table. 358 * 359 * @return Pointer to the callback table. 360 * @param pCallbacks Opaque interface pointer. 361 */ 362 DECLINLINE(PVDINTERFACEERROR) VDGetInterfaceError(void *pCallbacks) 363 { 364 PVDINTERFACEERROR pInterfaceError = (PVDINTERFACEERROR)pCallbacks; 365 366 /* Do basic checks. */ 367 AssertMsgReturn( (pInterfaceError->cbSize == sizeof(VDINTERFACEERROR)) 368 && (pInterfaceError->enmInterface == VDINTERFACETYPE_ERROR), 369 ("Not an error interface\n"), NULL); 370 371 return pInterfaceError; 372 } 373 374 /** 375 * Completion callback which is called by the interface owner 376 * to inform the backend that a task finished. 377 * 378 * @returns VBox status code. 379 * @param pvUser Opaque user data which is passed on request submission. 380 */ 381 typedef DECLCALLBACK(int) FNVDCOMPLETED(void *pvUser); 382 /** Pointer to FNVDCOMPLETED() */ 383 typedef FNVDCOMPLETED *PFNVDCOMPLETED; 384 385 386 /** 387 * Support interface for asynchronous I/O 388 */ 389 typedef struct VDINTERFACEASYNCIO 390 { 391 /** 392 * Size of the async interface. 393 */ 394 uint32_t cbSize; 395 396 /** 397 * Interface type. 398 */ 399 VDINTERFACETYPE enmInterface; 400 401 /** 402 * Open callback 403 * 404 * @returns VBox status code. 405 * @param pvUser The opaque data passed on container creation. 406 * @param pszLocation Name of the location to open. 407 * @param fReadonly Whether to open the storage medium read only. 408 * @param ppStorage Where to store the opaque storage handle. 409 */ 410 DECLR3CALLBACKMEMBER(int, pfnOpen, (void *pvUser, const char *pszLocation, bool fReadonly, void **ppStorage)); 411 412 /** 413 * Close callback. 414 * 415 * @returns VBox status code. 416 * @param pvUser The opaque data passed on container creation. 417 * @param pStorage The opaque storage handle to close. 418 */ 419 DECLR3CALLBACKMEMBER(int, pfnClose, (void *pvUser, void *pStorage)); 420 421 /** 422 * Synchronous write callback. 423 * 424 * @returns VBox status code. 425 * @param pvUser The opaque data passed on container creation. 426 * @param pStorage The storage handle to use. 427 * @param uOffset The offset to start from. 428 * @þaram cbWrite How many bytes to write. 429 * @param pvBuf Pointer to the bits need to be written. 430 * @param pcbWritten Where to store how many bytes where actually written. 431 */ 432 DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pvUser, void *pStorage, uint64_t uOffset, 433 size_t cbWrite, const void *pvBuf, size_t *pcbWritten)); 434 435 /** 436 * Synchronous read callback. 437 * 438 * @returns VBox status code. 439 * @param pvUser The opaque data passed on container creation. 440 * @param pStorage The storage handle to use. 441 * @param uOffset The offset to start from. 442 * @þaram cbRead How many bytes to read. 443 * @param pvBuf Where to store the read bits. 444 * @param pcbRead Where to store how many bytes where actually read. 445 */ 446 DECLR3CALLBACKMEMBER(int, pfnRead, (void *pvUser, void *pStorage, uint64_t uOffset, 447 size_t cbRead, void *pvBuf, size_t *pcbRead)); 448 449 /** 450 * Flush data to the storage backend. 451 * 452 * @returns VBox statis code. 453 * @param pvUser The opaque data passed on container creation. 454 * @param pStorage The storage handle to flush. 455 */ 456 DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pvUser, void *pStorage)); 457 458 /** 459 * Prepare an asynchronous read task. 460 * 461 * @returns VBox status code. 462 * @param pvUser The opqaue user data passed on container creation. 463 * @param pStorage The storage handle. 464 * @param uOffset The offset to start reading from. 465 * @param pvBuf Where to store read bits. 466 * @param cbRead How many bytes to read. 467 * @param ppTask Where to store the opaque task handle. 468 */ 469 DECLR3CALLBACKMEMBER(int, pfnPrepareRead, (void *pvUser, void *pStorage, uint64_t uOffset, 470 void *pvBuf, size_t cbRead, void **ppTask)); 471 472 /** 473 * Prepare an asynchronous write task. 474 * 475 * @returns VBox status code. 476 * @param pvUser The opaque user data passed on conatiner creation. 477 * @param pStorage The storage handle. 478 * @param uOffset The offset to start writing to. 479 * @param pvBuf Where to read the data from. 480 * @param cbWrite How many bytes to write. 481 * @param ppTask Where to store the opaque task handle. 482 */ 483 DECLR3CALLBACKMEMBER(int, pfnPrepareWrite, (void *pvUser, void *pStorage, uint64_t uOffset, 484 void *pvBuf, size_t cbWrite, void **ppTask)); 485 486 /** 487 * Submit an array of tasks for processing 488 * 489 * @returns VBox status code. 490 * @param pvUser The opaque user data passed on container creation. 491 * @param apTasks Array of task handles to submit. 492 * @param cTasks How many tasks to submit. 493 * @param pvUser2 User data which is passed on completion. 494 * @param pvUserCaller Opaque user data the caller of VDAsyncWrite/Read passed. 495 * @param pfnTasksCompleted Pointer to callback which is called on request completion. 496 */ 497 DECLR3CALLBACKMEMBER(int, pfnTasksSubmit, (void *pvUser, void *apTasks[], unsigned cTasks, void *pvUser2, 498 void *pvUserCaller, PFNVDCOMPLETED pfnTasksCompleted)); 499 500 } VDINTERFACEASYNCIO, *PVDINTERFACEASYNCIO; 501 502 /** 503 * Get async I/O interface from opaque callback table. 504 * 505 * @return Pointer to the callback table. 506 * @param pCallbacks Opaque interface pointer. 507 */ 508 DECLINLINE(PVDINTERFACEASYNCIO) VDGetInterfaceAsyncIO(void *pCallbacks) 509 { 510 PVDINTERFACEASYNCIO pInterfaceAsyncIO = (PVDINTERFACEASYNCIO)pCallbacks; 511 512 /* Do basic checks. */ 513 AssertMsgReturn( (pInterfaceAsyncIO->cbSize == sizeof(VDINTERFACEASYNCIO)) 514 && (pInterfaceAsyncIO->enmInterface == VDINTERFACETYPE_ASYNCIO), 515 ("Not an async I/O interface\n"), NULL); 516 517 return pInterfaceAsyncIO; 518 } 519 520 /** 521 * Progress notification interface 522 */ 523 typedef struct VDINTERFACEPROGRESS 524 { 525 /** 526 * Size of the progress interface. 527 */ 528 uint32_t cbSize; 529 530 /** 531 * Interface type. 532 */ 533 VDINTERFACETYPE enmInterface; 534 535 /** 536 * Progress notification callbacks. 537 */ 538 PFNVMPROGRESS pfnProgress; 539 } VDINTERFACEPROGRESS, *PVDINTERFACEPROGRESS; 540 541 /** 542 * Get progress interface from opaque callback table. 543 * 544 * @return Pointer to the callback table. 545 * @param pCallbacks Opaque interface pointer. 546 */ 547 DECLINLINE(PVDINTERFACEPROGRESS) VDGetInterfaceProgress(void *pCallbacks) 548 { 549 PVDINTERFACEPROGRESS pInterfaceProgress = (PVDINTERFACEPROGRESS)pCallbacks; 550 551 /* Do basic checks. */ 552 AssertMsgReturn( (pInterfaceProgress->cbSize == sizeof(VDINTERFACEPROGRESS)) 553 && (pInterfaceProgress->enmInterface == VDINTERFACETYPE_PROGRESS), 554 ("Not an progress notification interface\n"), NULL); 555 556 return pInterfaceProgress; 557 } 228 558 229 559 … … 250 580 unsigned *pcEntriesUsed); 251 581 582 /** 583 * Lists the capablities of a backend indentified by its name. 584 * Free all returned names with RTStrFree() when you no longer need them. 585 * 586 * @returns VBox status code. 587 * @param pszBackend The backend name. 588 * @param pEntries Pointer to an entry. 589 */ 590 VBOXDDU_DECL(int) VDBackendInfoOne(const char *pszBackend, PVDBACKENDINFO pEntry); 252 591 253 592 /** … … 256 595 * 257 596 * @returns VBox status code. 258 * @param pfnError Callback for setting extended error information. 259 * @param pvErrorUser Opaque parameter for pfnError. 597 * @param pInterfaces Pointer to the first supported interface. 260 598 * @param ppDisk Where to store the reference to HDD container. 261 599 */ 262 VBOXDDU_DECL(int) VDCreate(PFNVDERROR pfnError, void *pvErrorUser, 263 PVBOXHDD *ppDisk); 600 VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pInterfaces, PVBOXHDD *ppDisk); 264 601 265 602 /** … … 559 896 560 897 /** 898 * List the capabilities of image backend in HDD container. 899 * 900 * @returns VBox status code. 901 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened. 902 * @param pDisk Pointer to the HDD container. 903 * @param nImage Image number, counts from 0. 0 is always base image of container. 904 * @param pbackendInfo Where to store the backend information. 905 */ 906 VBOXDDU_DECL(int) VDBackendInfoSingle(PVBOXHDD pDisk, unsigned nImage, 907 PVDBACKENDINFO pBackendInfo); 908 909 /** 561 910 * Get flags of image in HDD container. 562 911 * … … 714 1063 VBOXDDU_DECL(void) VDDumpImages(PVBOXHDD pDisk); 715 1064 1065 1066 /** 1067 * Query if asynchronous operations are supported for this disk. 1068 * 1069 * @returns VBox status code. 1070 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened. 1071 * @param pDisk Pointer to the HDD container. 1072 * @param nImage Image number, counts from 0. 0 is always base image of container. 1073 * @param pfAIOSupported Where to store if async IO is supported. 1074 */ 1075 VBOXDDU_DECL(int) VDImageIsAsyncIOSupported(PVBOXHDD pDisk, unsigned nImage, bool *pfAIOSupported); 1076 1077 1078 /** 1079 * Start a asynchronous read request. 1080 * 1081 * @returns VBox status code. 1082 * @param pDisk Pointer to the HDD container. 1083 * @param uOffset The offset of the virtual disk to read from. 1084 * @param cbRead How many bytes to read. 1085 * @param paSeg Pointer to an array of segments. 1086 * @param cSeg Number of segments in the array. 1087 * @param pvUser User data which is passed on completion 1088 */ 1089 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 1090 PPDMDATASEG paSeg, unsigned cSeg, 1091 void *pvUser); 1092 1093 1094 /** 1095 * Start a asynchronous write request. 1096 * 1097 * @returns VBox status code. 1098 * @param pDisk Pointer to the HDD container. 1099 * @param uOffset The offset of the virtual disk to write to. 1100 * @param cbWrtie How many bytes to write. 1101 * @param paSeg Pointer to an array of segments. 1102 * @param cSeg Number of segments in the array. 1103 * @param pvUser User data which is passed on completion. 1104 */ 1105 VBOXDDU_DECL(int) VDAsyncWrite(PVBOXHDD pDisk, uint64_t uOffset, size_t cbWrite, 1106 PPDMDATASEG paSeg, unsigned cSeg, 1107 void *pvUser); 1108 1109 716 1110 __END_DECLS 717 1111 -
trunk/include/VBox/err.h
r10530 r10715 1049 1049 /** Configuration value not found. */ 1050 1050 #define VERR_VDI_VALUE_NOT_FOUND (-3216) 1051 /** Asynchronous I/O request finished. */ 1052 #define VINF_VDI_ASYNC_IO_FINISHED 3218 1053 /** Asynchronous I/O is not finished yet. */ 1054 #define VERR_VDI_ASYNC_IO_IN_PROGRESS (-3219) 1051 1055 /** @} */ 1052 1056 -
trunk/include/VBox/pdmifs.h
r9765 r10715 1115 1115 1116 1116 1117 /**1118 * Data transport buffer (scatter/gather)1119 */1120 typedef struct PDMIDATATRANSPORTSEG1121 {1122 /** Length of buffer in entry. */1123 size_t cbSeg;1124 /** Pointer to the start of the buffer. */1125 void *pvSeg;1126 } PDMIDATATRANSPORTSEG;1127 /** Pointer to a data transport segment. */1128 typedef PDMIDATATRANSPORTSEG *PPDMIDATATRANSPORTSEG;1129 /** Pointer to a const data transport segment. */1130 typedef PDMIDATATRANSPORTSEG const *PCPDMIDATATRANSPORTSEG;1131 1132 1133 1117 /** Pointer to an asynchronous iSCSI transport driver interface. */ 1134 1118 typedef struct PDMIISCSITRANSPORTASYNC *PPDMIISCSITRANSPORTASYNC; … … 1207 1191 { 1208 1192 /** 1209 * Notify completion of a read task. 1210 * 1211 * @returns VBox status code. 1212 * @param pInterface Pointer to the interface structure containing the called function pointer. 1213 * @param off Offset the task read from. 1214 * @param pSeg Pointer to the first element in the gather list. 1215 * @param cSeg Number of segments in the gather list. 1216 * @param cbRead Number of bytes read. 1217 * @param pvUser The user argument given in pfnStartRead. 1218 * @thread Any thread. 1219 */ 1220 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1221 1222 /** 1223 * Notify completion of a write task. 1224 * 1225 * @returns VBox status code. 1226 * @param pInterface Pointer to the interface structure containing the called function pointer. 1227 * @param off Offset the task has written to. 1228 * @param pSeg Pointer to the first element in the scatter list. 1229 * @param cSeg Number of segments in the scatter list. 1230 * @param cbWritten Number of bytes actually written. 1231 * @param pvUser The user argument given in pfnStartWrite. 1232 * @thread Any thread. 1233 */ 1234 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWritten, void *pvUser)); 1193 * Notify completion of a asynchronous transfer. 1194 * 1195 * @returns VBox status code. 1196 * @param pInterface Pointer to the interface structure containing the called function pointer. 1197 * @param pvUser The user argument given in pfnStartWrite/Read. 1198 * @thread Any thread. 1199 */ 1200 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, void *pvUser)); 1235 1201 } PDMIBLOCKASYNCPORT; 1236 1202 … … 1256 1222 * @thread Any thread. 1257 1223 */ 1258 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDM IDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));1224 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1259 1225 1260 1226 /** … … 1270 1236 * @thread Any thread. 1271 1237 */ 1272 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDM IDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));1238 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser)); 1273 1239 1274 1240 } PDMIBLOCKASYNC; … … 1284 1250 { 1285 1251 /** 1286 * Notify completion of a read task. 1287 * 1288 * @returns VBox status code. 1289 * @param pInterface Pointer to the interface structure containing the called function pointer. 1290 * @param off Offset the task read from. 1291 * @param pSeg Pointer to the first element in the scatter list. 1292 * @param cSeg Number of entries in the list. 1293 * @param cbRead Number of bytes read. 1294 * @param pvUser The user argument given in pfnStartRead. 1295 * @thread Any thread. 1296 */ 1297 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1298 1299 /** 1300 * Notify completion of a write task. 1301 * 1302 * @returns VBox status code. 1303 * @param pInterface Pointer to the interface structure containing the called function pointer. 1304 * @param off Offset the task has written to. 1305 * @param pSeg Pointer to the first element in the gather list. 1306 * @param cSeg Number of entries in the list. 1307 * @param cbWritten Number of bytes actually written. 1252 * Notify completion of a task. 1253 * 1254 * @returns VBox status code. 1255 * @param pInterface Pointer to the interface structure containing the called function pointer. 1308 1256 * @param pvUser The user argument given in pfnStartWrite. 1309 1257 * @thread Any thread. 1310 1258 */ 1311 DECLR3CALLBACKMEMBER(int, pfn WriteCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWritten, void *pvUser));1259 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, void *pvUser)); 1312 1260 } PDMIMEDIAASYNCPORT; 1313 1261 … … 1333 1281 * @thread Any thread. 1334 1282 */ 1335 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDM IDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));1283 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser)); 1336 1284 1337 1285 /** … … 1347 1295 * @thread Any thread. 1348 1296 */ 1349 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDM IDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));1297 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser)); 1350 1298 1351 1299 } PDMIMEDIAASYNC; … … 1361 1309 { 1362 1310 /** 1363 * Notify completion of a read task. 1364 * 1365 * @returns VBox status code. 1366 * @param pInterface Pointer to the interface structure containing the called function pointer. 1367 * @param off Offset the task read from. 1368 * @param pSeg Pointer to the first element in the scatter list. 1369 * @param cSeg Number of entries in the list. 1370 * @param cbRead Number of bytes read. 1371 * @param pvUser The user argument given in pfnStartRead. 1372 * @thread Any thread. 1373 */ 1374 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, 1375 size_t cbRead, void *pvUser)); 1376 1377 /** 1378 * Notify completion of a write task. 1379 * 1380 * @returns VBox status code. 1381 * @param pInterface Pointer to the interface structure containing the called function pointer. 1382 * @param off Offset the task has written to. 1383 * @param pSeg Pointer to the first element in the gather list. 1384 * @param cSeg Number of entries in the list. 1385 * @param cbWritten Number of bytes actually written. 1386 * @param pvUser The user argument given in pfnStartWrite. 1387 * @thread Any thread. 1388 */ 1389 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, 1390 size_t cbWritten, void *pvUser)); 1311 * Notify completion of tasks. 1312 * 1313 * @returns VBox status code. 1314 * @param pInterface Pointer to the interface structure containing the called function pointer. 1315 * @param pvUser The user argument given in pfnTasksSubmit. 1316 * @thread Any thread. 1317 */ 1318 DECLR3CALLBACKMEMBER(int, pfnTaskCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, void *pvUser)); 1319 1391 1320 } PDMITRANSPORTASYNCPORT; 1392 1321 … … 1406 1335 * @returns VBox status code. 1407 1336 * @param pInterface Pointer to the interface structure containint the called function pointer. 1337 * @param pStorage The storage handle to read from. 1408 1338 * @param off Offset to start reading from. 1409 * @param pvBuf here to store the read bits.1339 * @param pvBuf Where to store the read bits. 1410 1340 * @param cbRead Number of bytes to read. 1411 1341 * @param pcbRead Where to store the number of bytes actually read. 1412 1342 * @thread Any thread. 1413 1343 */ 1414 DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead)); 1344 DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMITRANSPORTASYNC pInterface, void *pStorage, 1345 uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead)); 1415 1346 1416 1347 /** … … 1420 1351 * @returns VBox status code. 1421 1352 * @param pInterface Pointer to the interface structure containint the called function pointer. 1353 * @param pStorage The storage handle to write to. 1422 1354 * @param off Offset to start reading from. 1423 * @param pvBuf here to store the read bits.1355 * @param pvBuf Pointer to the buffer which contains the data to write. 1424 1356 * @param cbWrite Number of bytes to read. 1425 1357 * @param pcbWritten Where to store the number of bytes actually read. 1426 1358 * @thread Any thread. 1427 1359 */ 1428 DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbWrite, size_t *pcbWritten)); 1429 1430 /** 1431 * Start asynchronous read. 1432 * 1433 * @returns VBox status code. 1434 * @param pInterface Pointer to the interface structure containing the called function pointer. 1435 * @param off Offset to start reading from. 1436 * @param pSeg Pointer to the first element in the scatter list. 1437 * @param cSeg Number of entries in the list. 1438 * @param cbRead Number of bytes to read. 1439 * @param pvUser User argument returned in completion callback. 1440 * @thread Any thread. 1441 */ 1442 DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, 1443 size_t cbRead, void *pvUser)); 1444 1445 /** 1446 * Start asynchronous write. 1447 * 1448 * @returns VBox status code. 1449 * @param pInterface Pointer to the interface structure containing the called function pointer. 1450 * @param off Offset to start writing at. 1451 * @param pSeg Pointer to the first element in the gather list. 1452 * @param cSeg Number of entries in the list. 1453 * @param cbWrite Number of bytes to write. 1454 * @param pvUser User argument returned in completion callback. 1455 * @thread Any thread. 1456 */ 1457 DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, 1458 size_t cbWrite, void *pvUser)); 1360 DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMITRANSPORTASYNC pInterface, void *pStorage, 1361 uint64_t off, const void *pvBuf, size_t cbWrite, size_t *pcbWritten)); 1459 1362 1460 1363 /** … … 1464 1367 * @returns VBox status code. 1465 1368 * @param pInterface Pointer to the interface structure containing the called function pointer. 1466 * @thread Any thread. 1467 */ 1468 DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMITRANSPORTASYNC pInterface)); 1369 * @param pStorage The storage handle to flush- 1370 * @thread Any thread. 1371 */ 1372 DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMITRANSPORTASYNC pInterface, void *pStorage)); 1469 1373 1470 1374 /** … … 1473 1377 * @returns Media size in bytes. 1474 1378 * @param pInterface Pointer to the interface structure containing the called function pointer. 1475 * @thread Any thread. 1476 */ 1477 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMITRANSPORTASYNC pInterface)); 1379 * @param pStorage The storage handle. 1380 * @thread Any thread. 1381 */ 1382 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMITRANSPORTASYNC pInterface, void *pStorage)); 1478 1383 1479 1384 /** … … 1483 1388 * @returns false if read/write. 1484 1389 * @param pInterface Pointer to the interface structure containing the called function pointer. 1485 * @thread Any thread. 1486 */ 1487 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMITRANSPORTASYNC pInterface)); 1390 * @param pStorage The storage handle. 1391 * @thread Any thread. 1392 */ 1393 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMITRANSPORTASYNC pInterface, void *pStorage)); 1488 1394 1489 1395 /** … … 1494 1400 * @param pszPath The path to open. 1495 1401 * @param fReadonly If the target shoudl opened readonly. 1496 * @thread Any thread. 1497 */ 1498 DECLR3CALLBACKMEMBER(int, pfnOpen, (PPDMITRANSPORTASYNC pInterface, const char *pszTargetPath, bool fReadonly)); 1402 * @param ppStorage Where to store the storage handle. 1403 * @thread Any thread. 1404 */ 1405 DECLR3CALLBACKMEMBER(int, pfnOpen, (PPDMITRANSPORTASYNC pInterface, const char *pszTargetPath, bool fReadonly, void **ppStorage)); 1499 1406 1500 1407 /** … … 1503 1410 * @returns VBox status code. 1504 1411 * @param pInterface Pointer to the interface structure containing the called function pointer. 1505 * @thread Any thread. 1506 */ 1507 DECLR3CALLBACKMEMBER(int, pfnClose, (PPDMITRANSPORTASYNC pInterface)); 1508 1412 * @param pStorage The storage handle to close. 1413 * @thread Any thread. 1414 */ 1415 DECLR3CALLBACKMEMBER(int, pfnClose, (PPDMITRANSPORTASYNC pInterface, void *pStorage)); 1416 1417 /** 1418 * Prepare an asynchronous read task. 1419 * 1420 * @returns VBox status code. 1421 * @param pInterface Pointer to the interface structure containing the called function pointer. 1422 * @param pStorage The storage handle. 1423 * @param uOffset The offset to start reading from. 1424 * @param pvBuf Where to store read bits. 1425 * @param cbRead How many bytes to read. 1426 * @param ppTask Where to store the opaque task handle. 1427 */ 1428 DECLR3CALLBACKMEMBER(int, pfnPrepareRead, (PPDMITRANSPORTASYNC pInterface, void *pStorage, uint64_t uOffset, 1429 void *pvBuf, size_t cbRead, void **ppTask)); 1430 1431 /** 1432 * Prepare an asynchronous write task. 1433 * 1434 * @returns VBox status code. 1435 * @param pInterface Pointer to the interface structure containing the called function pointer. 1436 * @param pStorage The storage handle. 1437 * @param uOffset The offset to start writing to. 1438 * @param pvBuf Where to read the data from. 1439 * @param cbWrite How many bytes to write. 1440 * @param ppTask Where to store the opaque task handle. 1441 */ 1442 DECLR3CALLBACKMEMBER(int, pfnPrepareWrite, (PPDMITRANSPORTASYNC pInterface, void *pStorage, uint64_t uOffset, 1443 void *pvBuf, size_t cbWrite, void **ppTask)); 1444 1445 /** 1446 * Submit an array of tasks for processing 1447 * 1448 * @returns VBox status code. 1449 * @param pInterface Pointer to the interface structure containing the called function pointer. 1450 * @param apTasks Array of task handles to submit. 1451 * @param cTasks How many tasks to submit. 1452 * @param pvUser User data which is passed on completion. 1453 */ 1454 DECLR3CALLBACKMEMBER(int, pfnTasksSubmit, (PPDMITRANSPORTASYNC pInterface, void *apTasks[], unsigned cTasks, void *pvUser)); 1509 1455 } PDMITRANSPORTASYNC; 1510 1456 -
trunk/include/VBox/types.h
r10087 r10715 508 508 typedef const PDMMAC *PCPDMMAC; 509 509 510 /** 511 * Data transport buffer (scatter/gather) 512 */ 513 typedef struct PDMDATASEG 514 { 515 /** Length of buffer in entry. */ 516 size_t cbSeg; 517 /** Pointer to the start of the buffer. */ 518 void *pvSeg; 519 } PDMDATASEG; 520 /** Pointer to a data transport segment. */ 521 typedef PDMDATASEG *PPDMDATASEG; 522 /** Pointer to a const data transport segment. */ 523 typedef PDMDATASEG const *PCPDMDATASEG; 510 524 511 525 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.