~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Storage/DrvHostFloppy.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-10-17 23:23:09 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20111017232309-kzm6841lzk61ranj
Tags: 4.1.4-dfsg-1
* New upstream release.
  - Fixes missing icons when using pt_BR locale. (Closes: #507188)
  - Fixes guest additions download url. (Closes: #637349; LP: #840668)
* Refresh patches.
* Drop the vboxmouse x11 driver. The mouse integration is now completely
  handled by the kernel module.
* Restrict dh_pycentral to the virtualbox binary package.
* Merge changes from the Ubuntu package but use them only when built
  on Ubuntu:
  - Add an Apport hook.
  - Add vboxguest modalias to the package control field.
* Pass KBUILD_VERBOSE=2 to kmk.
* Add 36-fix-text-mode.patch to fix text mode when using the vboxvideo driver.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
 
66
66
 
 
67
#ifdef RT_OS_WINDOWS
 
68
/**
 
69
 * Get media size - needs a special IOCTL.
 
70
 *
 
71
 * @param   pThis   The instance data.
 
72
 */
 
73
static DECLCALLBACK(int) drvHostFloppyGetMediaSize(PDRVHOSTBASE pThis, uint64_t *pcb)
 
74
{
 
75
    DISK_GEOMETRY   geom;
 
76
    DWORD           cbBytesReturned;
 
77
    int             rc;
 
78
    int             cbSectors;
 
79
 
 
80
    memset(&geom, 0, sizeof(geom));
 
81
    rc = DeviceIoControl((HANDLE)RTFileToNative(pThis->hFileDevice), IOCTL_DISK_GET_DRIVE_GEOMETRY,
 
82
                         NULL, 0, &geom, sizeof(geom), &cbBytesReturned,  NULL);
 
83
    if (rc) {
 
84
        cbSectors = geom.Cylinders.QuadPart * geom.TracksPerCylinder * geom.SectorsPerTrack;
 
85
        *pcb = cbSectors * geom.BytesPerSector;
 
86
        rc = VINF_SUCCESS;
 
87
    }
 
88
    else
 
89
    {
 
90
        DWORD   dwLastError;
 
91
 
 
92
        dwLastError = GetLastError();
 
93
        rc = RTErrConvertFromWin32(dwLastError);
 
94
        Log(("DrvHostFloppy: IOCTL_DISK_GET_DRIVE_GEOMETRY(%s) failed, LastError=%d rc=%Rrc\n", 
 
95
             pThis->pszDevice, dwLastError, rc));
 
96
        return rc;
 
97
    }
 
98
 
 
99
    return rc;
 
100
}
 
101
#endif /* RT_OS_WINDOWS */
 
102
 
67
103
#ifdef RT_OS_LINUX
68
104
/**
69
105
 * Get media size and do change processing.
162
198
        /*
163
199
         * Override stuff.
164
200
         */
 
201
#ifdef RT_OS_WINDOWS
 
202
        pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize;
 
203
#endif
165
204
#ifdef RT_OS_LINUX
166
205
        pThis->Base.pfnPoll         = drvHostFloppyPoll;
167
206
        pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize;