VirtualBox

Changeset 4996 in vbox


Ignore:
Timestamp:
Sep 24, 2007 9:31:35 AM (17 years ago)
Author:
vboxsync
Message:

Fix logging in src/VBox/Additions/linux/module/hgcmcall.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/module/hgcmcall.c

    r4071 r4996  
    4343    if (!hgcmR3)
    4444    {
    45         elog("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n");
    46         Log(("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n"));
     45        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n"));
    4746        return -ENOMEM;
    4847    }
     
    5049    if (copy_from_user(hgcmR3, pUser, sizeof(*hgcmR3) + cParms * sizeof(HGCMFunctionParameter)))
    5150    {
    52         elog("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n");
    53         Log(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
     51        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
    5452        kfree(hgcmR3);
    5553        return -EFAULT;
     
    8381    if (!hgcmR0)
    8482    {
    85         elog("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n");
    86         Log(("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n"));
     83        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: cannot allocate memory!\n"));
    8784        return -ENOMEM;
    8885    }
     
    105102            break;
    106103        default:
    107             elog("IOCTL_VBOXGUEST_HGCM_CALL: unsupported or unknown parameter type\n");
    108             Log(("IOCTL_VBOXGUEST_HGCM_CALL: unsupported or unknown parameter type\n"));
     104            LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: unsupported or unknown parameter type\n"));
    109105            kfree(hgcmR0);
    110106            return -EINVAL;
     
    115111    if (pu8PointerData == NULL)
    116112    {
    117         elog("IOCTL_VBOXGUEST_HGCM_CALL: out of memory allocating %d bytes for pointer data\n",
    118                 cbPointerData);
    119         Log(("IOCTL_VBOXGUEST_HGCM_CALL: out of memory allocating %d bytes for pointer data\n",
     113        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: out of memory allocating %d bytes for pointer data\n",
    120114                cbPointerData));
    121115        kfree(hgcmR0);
     
    140134                                VBOXGUEST_HGCM_CALL_PARMS(hgcmR3)[i].u.Pointer.size))
    141135            {
    142                 elog("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n");
    143                 Log(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
     136                LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
    144137                kfree(hgcmR0);
    145138                kfree(pu8PointerData);
     
    175168
    176169/**
    177  * Dump the contents of an hgcm call info structure to the system log and to the back door logger
    178  * if it is active.
     170 * Dump the contents of an hgcm call info structure to the back door logger
    179171 *
    180172 * @param hgcmR0 The structure to dump.
     
    190182        {
    191183        case VMMDevHGCMParmType_32bit:
    192             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type 32bit: %u\n",
    193                   i, VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.value32);
    194184            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type 32bit: %u\n",
    195185                  i, VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.value32));
    196186            break;
    197187        case VMMDevHGCMParmType_64bit:
    198             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type 64bit: %lu\n",
    199                   i, VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.value64);
    200188            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type 64bit: %lu\n",
    201189                  i, VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.value64));
    202190            break;
    203191        case VMMDevHGCMParmType_LinAddr:
    204             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr, size %u: %.*s...\n",
    205                   i,
    206                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size > 10 ?
    207                       VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size : 10,
    208                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.u.linearAddr,
    209                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size);
    210192            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr, size %u: %.*s...\n",
    211193                  i,
     
    216198            break;
    217199        case VMMDevHGCMParmType_LinAddr_In:
    218             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr_In, size %u: %.*s...\n",
    219                   i,
    220                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size > 10 ?
    221                       VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size : 10,
    222                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.u.linearAddr,
    223                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size);
    224200            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr_In, size %u: %.*s...\n",
    225201                  i,
     
    230206            break;
    231207        case VMMDevHGCMParmType_LinAddr_Out:
    232             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr_Out, size %u: %.*s...\n",
    233                   i,
    234                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size > 10 ?
    235                       VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size : 10,
    236                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.u.linearAddr,
    237                   VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size);
    238208            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of type LinAddr_Out, size %u: %.*s...\n",
    239209                  i,
     
    244214            break;
    245215        default:
    246             elog("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of unknown type!", i);
    247216            Log(("IOCTL_VBOXGUEST_HGCM_CALL: parameter %d is of unknown type!", i));
    248217        }
     
    279248                              VBOXGUEST_HGCM_CALL_PARMS(hgcmR0)[i].u.Pointer.size))
    280249            {
    281                 elog("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n");
    282                 Log(("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n"));
     250                LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n"));
    283251                return -EFAULT;
    284252            }
     
    298266                     sizeof(*hgcmR3) + hgcmR3->cParms * sizeof(HGCMFunctionParameter)))
    299267    {
    300         elog("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n");
    301         Log(("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n"));
     268        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: copy_to_user failed!\n"));
    302269        return -EFAULT;
    303270    }
     
    327294    if (copy_from_user(&callHeader, (void*)arg, sizeof(callHeader)))
    328295    {
    329         elog("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n");
    330         Log(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
     296        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: copy_from_user failed!\n"));
    331297        return -EFAULT;
    332298    }
     
    352318    if (VBOX_FAILURE(rc))
    353319    {
    354         elog("IOCTL_VBOXGUEST_HGCM_CALL: internal ioctl call failed, rc=%d\n", rc);
    355         Log(("IOCTL_VBOXGUEST_HGCM_CALL: internal ioctl call failed, rc=%d\n", rc));
    356         /** @todo We need a function to convert VBox error codes back to Linux. */
    357         rc = -EINVAL;
     320        LogRel(("IOCTL_VBOXGUEST_HGCM_CALL: internal ioctl call failed, rc=%Vrc\n", rc));
     321        rc = -RTErrConvertToErrno(rc);
    358322    }
    359323    else
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