~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Revision: 49961 $ */
1
2
/** @file
2
 
 *
3
 
 * VBoxGuestLib - A support library for VirtualBox guest additions:
4
 
 * Central calls
 
3
 * VBoxGuestLibR0 - Central calls.
5
4
 */
6
5
 
7
6
/*
30
29
# include "VBoxCalls.h"
31
30
#endif
32
31
#include <iprt/time.h>
 
32
#include <iprt/mem.h>
33
33
#include <iprt/path.h>
34
34
#include <iprt/string.h>
35
35
 
465
465
    return rc;
466
466
}
467
467
 
 
468
DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer)
 
469
{
 
470
    uint32_t            cbToWrite = *pcbBuffer;
 
471
    uint32_t            cPages    = RT_ALIGN_32((PhysBuffer & PAGE_OFFSET_MASK) + cbToWrite, PAGE_SIZE) >> PAGE_SHIFT;
 
472
    uint32_t            cbData    = sizeof(VBoxSFWrite) + RT_UOFFSETOF(HGCMPageListInfo, aPages[cPages]);
 
473
    VBoxSFWrite        *pData     = (VBoxSFWrite *)RTMemTmpAlloc(cbData);
 
474
    HGCMPageListInfo   *pPgLst    = (HGCMPageListInfo *)(pData + 1);
 
475
    uint32_t            iPage;
 
476
    int                 rc;
 
477
 
 
478
    if (RT_UNLIKELY(!pData))
 
479
        return VERR_NO_TMP_MEMORY;
 
480
 
 
481
    VBOX_INIT_CALL(&pData->callInfo, WRITE, pClient);
 
482
 
 
483
    pData->root.type                      = VMMDevHGCMParmType_32bit;
 
484
    pData->root.u.value32                 = pMap->root;
 
485
 
 
486
    pData->handle.type                    = VMMDevHGCMParmType_64bit;
 
487
    pData->handle.u.value64               = hFile;
 
488
    pData->offset.type                    = VMMDevHGCMParmType_64bit;
 
489
    pData->offset.u.value64               = offset;
 
490
    pData->cb.type                        = VMMDevHGCMParmType_32bit;
 
491
    pData->cb.u.value32                   = cbToWrite;
 
492
    pData->buffer.type                    = VMMDevHGCMParmType_PageList;
 
493
    pData->buffer.u.PageList.size         = cbToWrite;
 
494
    pData->buffer.u.PageList.offset       = sizeof(VBoxSFWrite);
 
495
 
 
496
    pPgLst->flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;
 
497
    pPgLst->offFirstPage = PhysBuffer & PAGE_OFFSET_MASK;
 
498
    pPgLst->cPages = cPages;
 
499
    PhysBuffer &= ~(RTCCPHYS)PAGE_OFFSET_MASK;
 
500
    for (iPage = 0; iPage < cPages; iPage++, PhysBuffer += PAGE_SIZE)
 
501
        pPgLst->aPages[iPage] = PhysBuffer;
 
502
 
 
503
    rc = VbglHGCMCall (pClient->handle, &pData->callInfo, cbData);
 
504
    if (RT_SUCCESS (rc))
 
505
    {
 
506
        rc = pData->callInfo.result;
 
507
        *pcbBuffer = pData->cb.u.value32;
 
508
    }
 
509
 
 
510
    RTMemTmpFree(pData);
 
511
    return rc;
 
512
 
 
513
}
 
514
 
468
515
DECLVBGL(int) vboxCallFlush(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile)
469
516
{
470
517
    int rc = VINF_SUCCESS;