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

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/r3/fileio.cpp

  • 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:
110
110
 *                      Updated on successful return.
111
111
 * @internal
112
112
 */
113
 
int rtFileRecalcAndValidateFlags(unsigned *pfOpen)
 
113
int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
114
114
{
115
115
    /*
116
116
     * Recalc.
117
117
     */
118
 
    unsigned fOpen = *pfOpen;
 
118
    uint32_t fOpen = *pfOpen;
119
119
    switch (fOpen & RTFILE_O_ACCESS_MASK)
120
120
    {
121
121
        case RTFILE_O_READ:
131
131
            fOpen &= ~g_fOpenReadWriteMask;
132
132
            break;
133
133
        default:
134
 
            AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#x\n", fOpen));
 
134
            AssertMsgFailed(("Invalid RW value, fOpen=%#x\n", fOpen));
135
135
            return VERR_INVALID_PARAMETER;
136
136
    }
137
137
 
138
138
    /*
139
139
     * Validate                                                                                                                                       .
140
140
     */
141
 
    if (    !(fOpen & RTFILE_O_ACCESS_MASK)
 
141
    AssertMsgReturn(fOpen & RTFILE_O_ACCESS_MASK, ("Missing RTFILE_O_READ/WRITE: fOpen=%#x\n", fOpen), VERR_INVALID_PARAMETER);
142
142
#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
143
 
        ||  (fOpen & (~RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK))
 
143
    AssertMsgReturn(!(fOpen & (~RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK)), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
144
144
#else
145
 
        ||  (fOpen & ~RTFILE_O_VALID_MASK)
 
145
    AssertMsgReturn(!(fOpen & ~RTFILE_O_VALID_MASK), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
146
146
#endif
147
 
        ||  (fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) == RTFILE_O_TRUNCATE
148
 
        ||  (   fOpen & RTFILE_O_NOT_CONTENT_INDEXED
149
 
             && !(   (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE
150
 
                  || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE
151
 
                  || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE))
152
 
       )
153
 
    {
154
 
        AssertMsgFailed(("Invalid parameters! fOpen=%#x\n", fOpen));
155
 
        return VERR_INVALID_PARAMETER;
 
147
    AssertMsgReturn((fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) != RTFILE_O_TRUNCATE, ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
 
148
 
 
149
    switch (fOpen & RTFILE_O_ACTION_MASK)
 
150
    {
 
151
        case 0: /* temporarily */
 
152
            AssertMsgFailed(("Missing RTFILE_O_OPEN/CREATE*! (continuable assertion)\n"));
 
153
            fOpen |= RTFILE_O_OPEN;
 
154
            break;
 
155
        case RTFILE_O_OPEN:
 
156
            AssertMsgReturn(!(RTFILE_O_NOT_CONTENT_INDEXED & fOpen), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
 
157
        case RTFILE_O_OPEN_CREATE:
 
158
        case RTFILE_O_CREATE:
 
159
        case RTFILE_O_CREATE_REPLACE:
 
160
            break;
 
161
        default:
 
162
            AssertMsgFailed(("Invalid action value: fOpen=%#x\n", fOpen));
 
163
            return VERR_INVALID_PARAMETER;
 
164
    }
 
165
 
 
166
    switch (fOpen & RTFILE_O_DENY_MASK)
 
167
    {
 
168
        case 0: /* temporarily */
 
169
            AssertMsgFailed(("Missing RTFILE_O_DENY_*! (continuable assertion)\n"));
 
170
            fOpen |= RTFILE_O_DENY_NONE;
 
171
            break;
 
172
        case RTFILE_O_DENY_NONE:
 
173
        case RTFILE_O_DENY_READ:
 
174
        case RTFILE_O_DENY_WRITE:
 
175
        case RTFILE_O_DENY_WRITE | RTFILE_O_DENY_READ:
 
176
        case RTFILE_O_DENY_NOT_DELETE:
 
177
        case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_READ:
 
178
        case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_WRITE:
 
179
        case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_WRITE | RTFILE_O_DENY_READ:
 
180
            break;
 
181
        default:
 
182
            AssertMsgFailed(("Invalid deny value: fOpen=%#x\n", fOpen));
 
183
            return VERR_INVALID_PARAMETER;
156
184
    }
157
185
 
158
186
    /* done */
287
315
     */
288
316
    RTFILE FileSrc;
289
317
    int rc = RTFileOpen(&FileSrc, pszSrc,
290
 
                        RTFILE_O_READ | (fFlags & RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE ? 0 : RTFILE_O_DENY_WRITE) | RTFILE_O_OPEN);
 
318
                        RTFILE_O_READ | RTFILE_O_OPEN
 
319
                        | (fFlags & RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE ? RTFILE_O_DENY_NONE : RTFILE_O_DENY_WRITE));
291
320
    if (RT_SUCCESS(rc))
292
321
    {
293
322
        RTFILE FileDst;
294
323
        rc = RTFileOpen(&FileDst, pszDst,
295
 
                        RTFILE_O_WRITE | (fFlags & RTFILECOPY_FLAGS_NO_DST_DENY_WRITE ? 0 : RTFILE_O_DENY_WRITE) | RTFILE_O_CREATE);
 
324
                        RTFILE_O_WRITE | RTFILE_O_CREATE
 
325
                        | (fFlags & RTFILECOPY_FLAGS_NO_DST_DENY_WRITE ? RTFILE_O_DENY_NONE : RTFILE_O_DENY_WRITE));
296
326
        if (RT_SUCCESS(rc))
297
327
        {
298
328
            /*