VirtualBox

Changeset 68633 in vbox for trunk/include


Ignore:
Timestamp:
Sep 5, 2017 11:56:00 AM (7 years ago)
Author:
vboxsync
Message:

Reduce number of VBoxGuest.h includes.

Location:
trunk/include/VBox
Files:
2 edited

Legend:

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

    r68630 r68633  
    170170
    171171/**
    172  * Common In/Out header.
    173  *
    174  * This is a copy/mirror of VMMDevRequestHeader to prevent duplicating data and
    175  * needing to verify things multiple times.  For that reason this differs a bit
    176  * from SUPREQHDR.
    177  *
    178  * @sa VMMDevRequestHeader
    179  */
    180 typedef struct VBGLREQHDR
    181 {
    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 a
    189      * 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 the
    195      * 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.  We
    212  *                      have to skip the prefix to avoid it getting expanded
    213  *                      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 /**
    242172 * The VBoxGuest I/O control version.
    243173 *
     
    425355# endif
    426356# 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 VBGLIOCHGCMCALL
    429 {
    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 the
    437      * call.  This is ignored if not a VBGL_IOCTL_HGCM_CALL_TIMED or
    438      * VBGL_IOCTL_HGCM_CALL_TIMED_32 request. */
    439     uint32_t    cMsTimeout;
    440     /** Input: Whether a timed call is interruptible (ring-0 only).  This is ignored
    441      * if not a VBGL_IOCTL_HGCM_CALL_TIMED or VBGL_IOCTL_HGCM_CALL_TIMED_32
    442      * 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 much
    455      *       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 calling
    468  * @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 calling
    491  * @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 calling
    512  * @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 
    530357/** @} */
    531358#endif /* VBOX_WITH_HGCM */
  • trunk/include/VBox/VBoxGuestCoreTypes.h

    r68630 r68633  
    3838
    3939/**
     40 * Common in/out header.
     41 *
     42 * This is a copy/mirror of VMMDevRequestHeader to prevent duplicating data and
     43 * needing to verify things multiple times.  For that reason this differs a bit
     44 * from SUPREQHDR.
     45 *
     46 * @sa VMMDevRequestHeader
     47 */
     48typedef struct VBGLREQHDR
     49{
     50    /** IN: The request input size, and output size if cbOut is zero.
     51     * @sa VMMDevRequestHeader::size  */
     52    uint32_t        cbIn;
     53    /** IN: Structure version (VBGLREQHDR_VERSION)
     54     * @sa VMMDevRequestHeader::version */
     55    uint32_t        uVersion;
     56    /** IN: The VMMDev request type, set to VBGLREQHDR_TYPE_DEFAULT unless this is a
     57     * kind of VMMDev request.
     58     * @sa VMMDevRequestType, VMMDevRequestHeader::requestType */
     59    uint32_t        uType;
     60    /** OUT: The VBox status code of the operation, out direction only. */
     61    int32_t         rc;
     62    /** IN: The output size.  This is optional - set to zero to use cbIn as the
     63     * output size. */
     64    uint32_t        cbOut;
     65    /** Reserved, MBZ. */
     66    uint32_t        uReserved;
     67} VBGLREQHDR;
     68AssertCompileSize(VBGLREQHDR, 24);
     69/** Pointer to a IOC header. */
     70typedef VBGLREQHDR RT_FAR *PVBGLREQHDR;
     71
     72/** Version of VMMDevRequestHeader structure. */
     73#define VBGLREQHDR_VERSION          UINT32_C(0x10001)
     74/** Default request type.  Use this for non-VMMDev requests. */
     75#define VBGLREQHDR_TYPE_DEFAULT     UINT32_C(0)
     76
     77/** Initialize a VBGLREQHDR structure for a fixed size I/O control call.
     78 * @param   a_pHdr      Pointer to the header to initialize.
     79 * @param   a_IOCtl     The base I/O control name, no VBGL_IOCTL_ prefix.  We
     80 *                      have to skip the prefix to avoid it getting expanded
     81 *                      before we append _SIZE_IN and _SIZE_OUT to it.
     82 */
     83#define VBGLREQHDR_INIT(a_pHdr, a_IOCtl) \
     84    VBGLREQHDR_INIT_EX(a_pHdr, RT_CONCAT3(VBGL_IOCTL_,a_IOCtl,_SIZE_IN), RT_CONCAT3(VBGL_IOCTL_,a_IOCtl,_SIZE_OUT))
     85/** Initialize a VBGLREQHDR structure, extended version. */
     86#define VBGLREQHDR_INIT_EX(a_pHdr, a_cbIn, a_cbOut) \
     87    do { \
     88        (a_pHdr)->cbIn      = (uint32_t)(a_cbIn); \
     89        (a_pHdr)->uVersion  = VBGLREQHDR_VERSION; \
     90        (a_pHdr)->uType     = VBGLREQHDR_TYPE_DEFAULT; \
     91        (a_pHdr)->rc        = VERR_INTERNAL_ERROR; \
     92        (a_pHdr)->cbOut     = (uint32_t)(a_cbOut); \
     93        (a_pHdr)->uReserved = 0; \
     94    } while (0)
     95/** Initialize a VBGLREQHDR structure for a VMMDev request.
     96 * Same as VMMDEV_REQ_HDR_INIT().  */
     97#define VBGLREQHDR_INIT_VMMDEV(a_pHdr, a_cb, a_enmType) \
     98    do { \
     99        (a_pHdr)->cbIn      = (a_cb); \
     100        (a_pHdr)->uVersion  = VBGLREQHDR_VERSION; \
     101        (a_pHdr)->uType     = (a_enmType); \
     102        (a_pHdr)->rc        = VERR_INTERNAL_ERROR; \
     103        (a_pHdr)->cbOut     = 0; \
     104        (a_pHdr)->uReserved = 0; \
     105    } while (0)
     106
     107
     108/**
     109 * For VBGL_IOCTL_HGCM_CALL and VBGL_IOCTL_HGCM_CALL_WITH_USER_DATA.
     110 *
     111 * @note This is used by alot of HGCM call structures.
     112 */
     113typedef struct VBGLIOCHGCMCALL
     114{
     115    /** Common header. */
     116    VBGLREQHDR  Hdr;
     117    /** Input: The id of the caller. */
     118    uint32_t    u32ClientID;
     119    /** Input: Function number. */
     120    uint32_t    u32Function;
     121    /** Input: How long to wait (milliseconds) for completion before cancelling the
     122     * call.  This is ignored if not a VBGL_IOCTL_HGCM_CALL_TIMED or
     123     * VBGL_IOCTL_HGCM_CALL_TIMED_32 request. */
     124    uint32_t    cMsTimeout;
     125    /** Input: Whether a timed call is interruptible (ring-0 only).  This is ignored
     126     * if not a VBGL_IOCTL_HGCM_CALL_TIMED or VBGL_IOCTL_HGCM_CALL_TIMED_32
     127     * request, or if made from user land. */
     128    bool        fInterruptible;
     129    /** Explicit padding, MBZ. */
     130    uint8_t     bReserved;
     131    /** Input: How many parameters following this structure.
     132     *
     133     * The parameters are either HGCMFunctionParameter64 or HGCMFunctionParameter32,
     134     * depending on whether we're receiving a 64-bit or 32-bit request.
     135     *
     136     * The current maximum is 61 parameters (given a 1KB max request size,
     137     * and a 64-bit parameter size of 16 bytes).
     138     *
     139     * @note This information is duplicated by Hdr.cbIn, but it's currently too much
     140     *       work to eliminate this. */
     141    uint16_t    cParms;
     142    /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
     143} VBGLIOCHGCMCALL, RT_FAR *PVBGLIOCHGCMCALL;
     144AssertCompileSize(VBGLIOCHGCMCALL, 24 + 16);
     145typedef VBGLIOCHGCMCALL const RT_FAR *PCVBGLIOCHGCMCALL;
     146
     147/**
     148 * Initialize a HGCM header (VBGLIOCHGCMCALL) for a non-timed call.
     149 *
     150 * @param   a_pHdr          The header to initalize.
     151 * @param   a_idClient      The client connection ID to call thru.
     152 * @param   a_idFunction    The function we're calling
     153 * @param   a_cParameters   Number of parameters.
     154 */
     155# define VBGL_HGCM_HDR_INIT(a_pHdr, a_idClient, a_idFunction, a_cParameters) \
     156    do { \
     157        VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, \
     158                           sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter), \
     159                           sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter)); \
     160        (a_pHdr)->u32ClientID    = (a_idClient); \
     161        (a_pHdr)->u32Function    = (a_idFunction); \
     162        (a_pHdr)->cMsTimeout     = RT_INDEFINITE_WAIT; \
     163        (a_pHdr)->fInterruptible = true; \
     164        (a_pHdr)->bReserved      = 0; \
     165        (a_pHdr)->cParms         = (a_cParameters); \
     166    } while (0)
     167
     168/**
     169 * Initialize a HGCM header (VBGLIOCHGCMCALL) for a non-timed call, custom size.
     170 *
     171 * This is usually only needed when appending page lists to the call.
     172 *
     173 * @param   a_pHdr          The header to initalize.
     174 * @param   a_idClient      The client connection ID to call thru.
     175 * @param   a_idFunction    The function we're calling
     176 * @param   a_cParameters   Number of parameters.
     177 * @param   a_cbReq         The request size.
     178 */
     179# define VBGL_HGCM_HDR_INIT_EX(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cbReq) \
     180    do { \
     181        Assert((a_cbReq) >= sizeof(VBGLIOCHGCMCALL) + (a_cParameters) * sizeof(HGCMFunctionParameter)); \
     182        VBGLREQHDR_INIT_EX(&(a_pHdr)->Hdr, (a_cbReq), (a_cbReq)); \
     183        (a_pHdr)->u32ClientID    = (a_idClient); \
     184        (a_pHdr)->u32Function    = (a_idFunction); \
     185        (a_pHdr)->cMsTimeout     = RT_INDEFINITE_WAIT; \
     186        (a_pHdr)->fInterruptible = true; \
     187        (a_pHdr)->bReserved      = 0; \
     188        (a_pHdr)->cParms         = (a_cParameters); \
     189    } while (0)
     190
     191/**
     192 * Initialize a HGCM header (VBGLIOCHGCMCALL), with timeout (interruptible).
     193 *
     194 * @param   a_pHdr          The header to initalize.
     195 * @param   a_idClient      The client connection ID to call thru.
     196 * @param   a_idFunction    The function we're calling
     197 * @param   a_cParameters   Number of parameters.
     198 * @param   a_cMsTimeout    The timeout in milliseconds.
     199 */
     200# define VBGL_HGCM_HDR_INIT_TIMED(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cMsTimeout) \
     201    do { \
     202        (a_pHdr)->u32ClientID    = (a_idClient); \
     203        (a_pHdr)->u32Function    = (a_idFunction); \
     204        (a_pHdr)->cMsTimeout     = (a_cMsTimeout); \
     205        (a_pHdr)->fInterruptible = true; \
     206        (a_pHdr)->bReserved      = 0; \
     207        (a_pHdr)->cParms         = (a_cParameters); \
     208    } while (0)
     209
     210/** Get the pointer to the first HGCM parameter.  */
     211# define VBGL_HGCM_GET_CALL_PARMS(a_pInfo)   ( (HGCMFunctionParameter   *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )
     212/** Get the pointer to the first HGCM parameter in a 32-bit request.  */
     213# define VBGL_HGCM_GET_CALL_PARMS32(a_pInfo) ( (HGCMFunctionParameter32 *)((uint8_t *)(a_pInfo) + sizeof(VBGLIOCHGCMCALL)) )
     214
     215
     216/**
    40217 * Mouse event noticification callback function.
    41218 * @param   pvUser      Argument given when setting the callback.
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