Changeset 5889 in vbox
- Timestamp:
- Nov 30, 2007 12:39:22 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r5824 r5889 35 35 /** The VBoxGuest device handle. */ 36 36 static RTFILE g_File = NIL_RTFILE; 37 37 38 38 39 VBGLR3DECL(int) VbglR3Init(void) … … 167 168 } 168 169 170 169 171 VBGLR3DECL(int) VbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cbSize, 170 VMMDevRequestType reqType)172 VMMDevRequestType enmReqType) 171 173 { 172 174 VMMDevRequestHeader *pReq; 173 int rc = VINF_SUCCESS; 174 175 if (!ppReq || cbSize < sizeof (VMMDevRequestHeader)) 176 { 177 AssertMsgFailed(("VbglR3GRAlloc: Invalid parameter: ppReq = %p, cbSize = %d\n", 178 ppReq, cbSize)); 179 return VERR_INVALID_PARAMETER; 180 } 181 pReq = (VMMDevRequestHeader *)RTMemTmpAlloc (cbSize); 182 if (!pReq) 183 { 184 AssertMsgFailed(("VbglR3GRAlloc: no memory\n")); 185 rc = VERR_NO_MEMORY; 186 } 187 else 188 { 189 pReq->size = cbSize; 190 pReq->version = VMMDEV_REQUEST_HEADER_VERSION; 191 pReq->requestType = reqType; 192 pReq->rc = VERR_GENERAL_FAILURE; 193 pReq->reserved1 = 0; 194 pReq->reserved2 = 0; 195 196 *ppReq = pReq; 197 } 198 199 return rc; 200 } 175 176 AssertPtrReturn(ppReq, VERR_INVALID_PARAMETER); 177 AssertMsgReturn(cb >= sizeof(VMMDevRequestHeader), ("%#x vs %#zx\n", cb, sizeof(VMMDevRequestHeader)), 178 VERR_INVALID_PARAMETER); 179 180 pReq = (VMMDevRequestHeader *)RTMemTmpAlloc(cb); 181 if (RT_UNLIKELY(!pReq)) 182 return VERR_NO_MEMORY; 183 184 pReq->size = cbSize; 185 pReq->version = VMMDEV_REQUEST_HEADER_VERSION; 186 pReq->requestType = enmReqType; 187 pReq->rc = VERR_GENERAL_FAILURE; 188 pReq->reserved1 = 0; 189 pReq->reserved2 = 0; 190 191 *ppReq = pReq; 192 193 return VINF_SUCCESS; 194 } 195 201 196 202 197 VBGLR3DECL(int) VbglR3GRPerform(VMMDevRequestHeader *pReq) … … 205 200 } 206 201 207 VBGLR3DECL(void) VbglR3GRFree (VMMDevRequestHeader *pReq) 208 { 209 RTMemTmpFree((void *)pReq); 210 } 202 203 VBGLR3DECL(void) VbglR3GRFree(VMMDevRequestHeader *pReq) 204 { 205 RTMemTmpFree(pReq); 206 } 207 211 208 212 209 VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime) … … 221 218 } 222 219 220 223 221 /** 224 * Cause any pending WaitEvent calls (VBOXGUEST_IOCTL_WAITEVENT) to return with a 225 * VERR_INTERRUPTED error. Can be used in combination with a termination flag variable for 226 * interrupting event loops. Avoiding race conditions is the responsibility of the caller. 222 * Cause any pending WaitEvent calls (VBOXGUEST_IOCTL_WAITEVENT) to return 223 * with a VERR_INTERRUPTED status. 224 * 225 * Can be used in combination with a termination flag variable for interrupting 226 * event loops. Avoiding race conditions is the responsibility of the caller. 227 227 * 228 228 * @returns IPRT status code
Note:
See TracChangeset
for help on using the changeset viewer.