Changeset 68633 in vbox for trunk/include/VBox/VBoxGuest.h
- Timestamp:
- Sep 5, 2017 11:56:00 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117863
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuest.h
r68630 r68633 170 170 171 171 /** 172 * Common In/Out header.173 *174 * This is a copy/mirror of VMMDevRequestHeader to prevent duplicating data and175 * needing to verify things multiple times. For that reason this differs a bit176 * from SUPREQHDR.177 *178 * @sa VMMDevRequestHeader179 */180 typedef struct VBGLREQHDR181 {182 /** IN: The request input size, and output size if cbOut is zero.183 * @sa VMMDevRequestHeader::size */184 uint32_t cbIn;185 /** IN: Structure version (VBGLREQHDR_VERSION)186 * @sa VMMDevRequestHeader::version */187 uint32_t uVersion;188 /** IN: The VMMDev request type, set to VBGLREQHDR_TYPE_DEFAULT unless this is a189 * kind of VMMDev request.190 * @sa VMMDevRequestType, VMMDevRequestHeader::requestType */191 uint32_t uType;192 /** OUT: The VBox status code of the operation, out direction only. */193 int32_t rc;194 /** IN: The output size. This is optional - set to zero to use cbIn as the195 * output size. */196 uint32_t cbOut;197 /** Reserved, MBZ. */198 uint32_t uReserved;199 } VBGLREQHDR;200 AssertCompileSize(VBGLREQHDR, 24);201 /** Pointer to a IOC header. */202 typedef VBGLREQHDR RT_FAR *PVBGLREQHDR;203 204 /** Version of VMMDevRequestHeader structure. */205 #define VBGLREQHDR_VERSION UINT32_C(0x10001)206 /** Default request type. Use this for non-VMMDev requests. */207 #define VBGLREQHDR_TYPE_DEFAULT UINT32_C(0)208 209 /** Initialize a VBGLREQHDR structure for a fixed size I/O control call.210 * @param a_pHdr Pointer to the header to initialize.211 * @param a_IOCtl The base I/O control name, no VBGL_IOCTL_ prefix. We212 * have to skip the prefix to avoid it getting expanded213 * before we append _SIZE_IN and _SIZE_OUT to it.214 */215 #define VBGLREQHDR_INIT(a_pHdr, a_IOCtl) \216 VBGLREQHDR_INIT_EX(a_pHdr, RT_CONCAT3(VBGL_IOCTL_,a_IOCtl,_SIZE_IN), RT_CONCAT3(VBGL_IOCTL_,a_IOCtl,_SIZE_OUT))217 /** Initialize a VBGLREQHDR structure, extended version. */218 #define VBGLREQHDR_INIT_EX(a_pHdr, a_cbIn, a_cbOut) \219 do { \220 (a_pHdr)->cbIn = (uint32_t)(a_cbIn); \221 (a_pHdr)->uVersion = VBGLREQHDR_VERSION; \222 (a_pHdr)->uType = VBGLREQHDR_TYPE_DEFAULT; \223 (a_pHdr)->rc = VERR_INTERNAL_ERROR; \224 (a_pHdr)->cbOut = (uint32_t)(a_cbOut); \225 (a_pHdr)->uReserved = 0; \226 } while (0)227 /** Initialize a VBGLREQHDR structure for a VMMDev request.228 * Same as VMMDEV_REQ_HDR_INIT(). */229 #define VBGLREQHDR_INIT_VMMDEV(a_pHdr, a_cb, a_enmType) \230 do { \231 (a_pHdr)->cbIn = (a_cb); \232 (a_pHdr)->uVersion = VBGLREQHDR_VERSION; \233 (a_pHdr)->uType = (a_enmType); \234 (a_pHdr)->rc = VERR_INTERNAL_ERROR; \235 (a_pHdr)->cbOut = 0; \236 (a_pHdr)->uReserved = 0; \237 } while (0)238 239 240 241 /**242 172 * The VBoxGuest I/O control version. 243 173 * … … 425 355 # endif 426 356 # define VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA(a_cb) VBGL_IOCTL_CODE_SIZE(8, (a_cb)) 427 /** @note This is used by alot of HGCM call structures. */428 typedef struct VBGLIOCHGCMCALL429 {430 /** Common header. */431 VBGLREQHDR Hdr;432 /** Input: The id of the caller. */433 uint32_t u32ClientID;434 /** Input: Function number. */435 uint32_t u32Function;436 /** Input: How long to wait (milliseconds) for completion before cancelling the437 * call. This is ignored if not a VBGL_IOCTL_HGCM_CALL_TIMED or438 * VBGL_IOCTL_HGCM_CALL_TIMED_32 request. */439 uint32_t cMsTimeout;440 /** Input: Whether a timed call is interruptible (ring-0 only). This is ignored441 * if not a VBGL_IOCTL_HGCM_CALL_TIMED or VBGL_IOCTL_HGCM_CALL_TIMED_32442 * request, or if made from user land. */443 bool fInterruptible;444 /** Explicit padding, MBZ. */445 uint8_t bReserved;446 /** Input: How many parameters following this structure.447 *448 * The parameters are either HGCMFunctionParameter64 or HGCMFunctionParameter32,449 * depending on whether we're receiving a 64-bit or 32-bit request.450 *451 * The current maximum is 61 parameters (given a 1KB max request size,452 * and a 64-bit parameter size of 16 bytes).453 *454 * @note This information is duplicated by Hdr.cbIn, but it's currently too much455 * work to eliminate this. */456 uint16_t cParms;457 /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */458 } VBGLIOCHGCMCALL, RT_FAR *PVBGLIOCHGCMCALL;459 AssertCompileSize(VBGLIOCHGCMCALL, 24 + 16);460 typedef VBGLIOCHGCMCALL const RT_FAR *PCVBGLIOCHGCMCALL;461 462 /**463 * Initialize a HGCM header (VBGLIOCHGCMCALL) for a non-timed call.464 *465 * @param a_pHdr The header to initalize.466 * @param a_idClient The client connection ID to call thru.467 * @param a_idFunction The function we're calling468 * @param a_cParameters Number of parameters.469 */470 # define VBGL_HGCM_HDR_INIT(a_pHdr, a_idClient, a_idFunction, a_cParameters) \471 do { \472 VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, \473 sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter), \474 sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter)); \475 (a_pHdr)->u32ClientID = (a_idClient); \476 (a_pHdr)->u32Function = (a_idFunction); \477 (a_pHdr)->cMsTimeout = RT_INDEFINITE_WAIT; \478 (a_pHdr)->fInterruptible = true; \479 (a_pHdr)->bReserved = 0; \480 (a_pHdr)->cParms = (a_cParameters); \481 } while (0)482 483 /**484 * Initialize a HGCM header (VBGLIOCHGCMCALL) for a non-timed call, custom size.485 *486 * This is usually only needed when appending page lists to the call.487 *488 * @param a_pHdr The header to initalize.489 * @param a_idClient The client connection ID to call thru.490 * @param a_idFunction The function we're calling491 * @param a_cParameters Number of parameters.492 * @param a_cbReq The request size.493 */494 # define VBGL_HGCM_HDR_INIT_EX(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cbReq) \495 do { \496 Assert((a_cbReq) >= sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter)); \497 VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, (a_cbReq), (a_cbReq)); \498 (a_pHdr)->u32ClientID = (a_idClient); \499 (a_pHdr)->u32Function = (a_idFunction); \500 (a_pHdr)->cMsTimeout = RT_INDEFINITE_WAIT; \501 (a_pHdr)->fInterruptible = true; \502 (a_pHdr)->bReserved = 0; \503 (a_pHdr)->cParms = (a_cParameters); \504 } while (0)505 506 /**507 * Initialize a HGCM header (VBGLIOCHGCMCALL), with timeout (interruptible).508 *509 * @param a_pHdr The header to initalize.510 * @param a_idClient The client connection ID to call thru.511 * @param a_idFunction The function we're calling512 * @param a_cParameters Number of parameters.513 * @param a_cMsTimeout The timeout in milliseconds.514 */515 # define VBGL_HGCM_HDR_INIT_TIMED(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cMsTimeout) \516 do { \517 (a_pHdr)->u32ClientID = (a_idClient); \518 (a_pHdr)->u32Function = (a_idFunction); \519 (a_pHdr)->cMsTimeout = (a_cMsTimeout); \520 (a_pHdr)->fInterruptible = true; \521 (a_pHdr)->bReserved = 0; \522 (a_pHdr)->cParms = (a_cParameters); \523 } while (0)524 525 /** Get the pointer to the first HGCM parameter. */526 # define VBGL_HGCM_GET_CALL_PARMS(a_pInfo) ( (HGCMFunctionParameter *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )527 /** Get the pointer to the first HGCM parameter in a 32-bit request. */528 # define VBGL_HGCM_GET_CALL_PARMS32(a_pInfo) ( (HGCMFunctionParameter32 *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )529 530 357 /** @} */ 531 358 #endif /* VBOX_WITH_HGCM */
Note:
See TracChangeset
for help on using the changeset viewer.