Changeset 18315 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Mar 26, 2009 2:24:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/module/vboxmod.c
r18124 r18315 130 130 }; 131 131 132 133 /** 134 * This function converts a VBox result code into a Linux error number. 135 * Note that we return 0 (success) for all informational values, as Linux 136 * has no such concept. 137 */ 138 static int vboxadd_convert_result(int vbox_err) 139 { 140 if ( vbox_err > -1000 141 && vbox_err < 1000) 142 return RTErrConvertToErrno(vbox_err); 143 switch (vbox_err) 144 { 145 case VERR_HGCM_SERVICE_NOT_FOUND: return ESRCH; 146 case VINF_HGCM_CLIENT_REJECTED: return 0; 147 case VERR_HGCM_INVALID_CMD_ADDRESS: return EFAULT; 148 case VINF_HGCM_ASYNC_EXECUTE: return 0; 149 case VERR_HGCM_INTERNAL: return EPROTO; 150 case VERR_HGCM_INVALID_CLIENT_ID: return EINVAL; 151 case VINF_HGCM_SAVE_STATE: return 0; 152 /* No reason to return this to a guest */ 153 // case VERR_HGCM_SERVICE_EXISTS: return EEXIST; 154 } 155 AssertMsgFailedReturn(("Unhandled error code %Rrc\n", vbox_err), EPROTO); 156 } 157 132 158 /** 133 159 * Register an HGCM connection as being connected with a given file descriptor, so that it … … 324 350 int vrc = vboxadd_cmc_call(vboxDev, VBOXGUEST_IOCTL_HGCM_CONNECT, 325 351 &info); 326 rc = RT_FAILURE(vrc) ? - RTErrConvertToErrno(vrc)327 : - RTErrConvertToErrno(info.result);352 rc = RT_FAILURE(vrc) ? -vboxadd_convert_result(vrc) 353 : -vboxadd_convert_result(info.result); 328 354 if (rc < 0) 329 355 LogFunc(("hgcm connection failed. internal ioctl result %Rrc, hgcm result %Rrc\n", … … 383 409 { 384 410 vrc = vboxadd_cmc_call(vboxDev, VBOXGUEST_IOCTL_HGCM_DISCONNECT, &info); 385 rc = -RTErrConvertToErrno(vrc); 411 rc = -vboxadd_convert_result(vrc); 412 if (rc < 0) 413 LogFunc(("HGCM disconnect failed, error %Rrc\n", vrc)); 386 414 } 387 415 if ( rc >= 0 … … 596 624 vrc = vboxadd_cmc_call(vboxDev, 597 625 VBOXGUEST_IOCTL_HGCM_CALL(u32Size), pInfo); 598 rc = -RTErrConvertToErrno(vrc); 626 rc = -vboxadd_convert_result(vrc); 627 if (rc < 0) 628 LogFunc(("HGCM call failed, error %Rrc\n", vrc)); 599 629 if ( rc >= 0 600 630 && copy_to_user ((void *)userspace_info, (void *)pInfo, … … 661 691 vrc = vboxadd_cmc_call(vboxDev, 662 692 VBOXGUEST_IOCTL_HGCM_CALL_TIMED(u32Size), pInfo); 663 rc = -RTErrConvertToErrno(vrc); 693 rc = -vboxadd_convert_result(vrc); 694 if (rc < 0) 695 LogFunc(("HGCM call failed, error %Rrc", vrc)); 664 696 if ( rc >= 0 665 697 && copy_to_user ((void *)userspace_info, (void *)pInfo, u32Size))
Note:
See TracChangeset
for help on using the changeset viewer.