VirtualBox

Ignore:
Timestamp:
Jan 10, 2012 6:15:04 PM (13 years ago)
Author:
vboxsync
Message:

rtr0memobj: Status code adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

    r39705 r39744  
    180180 * @param   fFlagsLnx   The page allocation flags (GPFs).
    181181 * @param   fContiguous Whether the allocation must be contiguous.
     182 * @param   rcNoMem     What to return when we're out of pages.
    182183 */
    183184static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb,
    184                                      size_t uAlignment, unsigned fFlagsLnx, bool fContiguous)
     185                                     size_t uAlignment, unsigned fFlagsLnx, bool fContiguous, int rcNoMem)
    185186{
    186187    size_t          iPage;
     
    231232        {
    232233            rtR0MemObjDelete(&pMemLnx->Core);
    233             return VERR_NO_MEMORY;
     234            return rcNoMem;
    234235        }
    235236    }
     
    245246                    __free_page(pMemLnx->apPages[iPage]);
    246247                rtR0MemObjDelete(&pMemLnx->Core);
    247                 return VERR_NO_MEMORY;
     248                return rcNoMem;
    248249            }
    249250        }
     
    256257    {
    257258        rtR0MemObjDelete(&pMemLnx->Core);
    258         return VERR_NO_MEMORY;
     259        return rcNoMem;
    259260    }
    260261    for (iPage = 0; iPage < cPages; iPage++)
     
    295296                    (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
    296297            rtR0MemObjLinuxFreePages(pMemLnx);
    297             return VERR_NO_MEMORY;
     298            return rcNoMem;
    298299        }
    299300    }
     
    541542
    542543#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
    543     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER, false /* non-contiguous */);
     544    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER,
     545                                   false /* non-contiguous */, VERR_NO_MEMORY);
    544546#else
    545     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */);
     547    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER,
     548                                   false /* non-contiguous */, VERR_NO_MEMORY);
    546549#endif
    547550    if (RT_SUCCESS(rc))
     
    570573#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
    571574    /* ZONE_DMA32: 0-4GB */
    572     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32, false /* non-contiguous */);
     575    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32,
     576                                   false /* non-contiguous */, VERR_NO_LOW_MEMORY);
    573577    if (RT_FAILURE(rc))
    574578#endif
    575579#ifdef RT_ARCH_AMD64
    576580        /* ZONE_DMA: 0-16MB */
    577         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA, false /* non-contiguous */);
     581        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA,
     582                                       false /* non-contiguous */, VERR_NO_LOW_MEMORY);
    578583#else
    579584# ifdef CONFIG_X86_PAE
    580585# endif
    581586        /* ZONE_NORMAL: 0-896MB */
    582         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */);
     587        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER,
     588                                       false /* non-contiguous */, VERR_NO_LOW_MEMORY);
    583589#endif
    584590    if (RT_SUCCESS(rc))
     
    606612#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
    607613    /* ZONE_DMA32: 0-4GB */
    608     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32, true /* contiguous */);
     614    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
     615                                   true /* contiguous */, VERR_NO_CONT_MEMORY);
    609616    if (RT_FAILURE(rc))
    610617#endif
    611618#ifdef RT_ARCH_AMD64
    612619        /* ZONE_DMA: 0-16MB */
    613         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA, true /* contiguous */);
     620        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
     621                                       true /* contiguous */, VERR_NO_CONT_MEMORY);
    614622#else
    615623        /* ZONE_NORMAL (32-bit hosts): 0-896MB */
    616         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER, true /* contiguous */);
     624        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
     625                                       true /* contiguous */, VERR_NO_CONT_MEMORY);
    617626#endif
    618627    if (RT_SUCCESS(rc))
     
    658667
    659668    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp,
    660                                    enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */);
     669                                   enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */,
     670                                   VERR_NO_PHYS_MEMORY);
    661671    if (RT_FAILURE(rc))
    662672        return rc;
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