Changeset faba839 in mainline


Ignore:
Timestamp:
2012-06-13T13:16:19Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2902e1bb
Parents:
32d19f7
Message:

use symbolic values for address space constants

Location:
uspace
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/mm/common.c

    r32d19f7 rfaba839  
    342342        link_initialize(&area->link);
    343343       
    344         area->addr = as_area_create((void *) -1, size,
     344        area->addr = as_area_create(AS_AREA_ANY, size,
    345345            AS_AREA_WRITE | AS_AREA_READ);
    346         if (area->addr == (void *) -1) {
     346        if (area->addr == AS_MAP_FAILED) {
    347347                free(area);
    348348                check_consistency("map_area (a)");
  • uspace/app/tester/mm/mapping1.c

    r32d19f7 rfaba839  
    4242        TPRINTF("Creating AS area...\n");
    4343       
    44         void *result = as_area_create((void *) -1, size,
     44        void *result = as_area_create(AS_AREA_ANY, size,
    4545            AS_AREA_READ | AS_AREA_WRITE);
    46         if (result == (void *) -1)
     46        if (result == AS_MAP_FAILED)
    4747                return NULL;
    4848       
  • uspace/drv/bus/usb/uhci/utils/malloc32.h

    r32d19f7 rfaba839  
    9999static inline void * get_page(void)
    100100{
    101         void *address = as_area_create((void *) -1, UHCI_REQUIRED_PAGE_SIZE,
     101        void *address = as_area_create(AS_AREA_ANY, UHCI_REQUIRED_PAGE_SIZE,
    102102            AS_AREA_READ | AS_AREA_WRITE);
    103         if (address == (void *) -1)
     103        if (address == AS_MAP_FAILED)
    104104                return NULL;
    105105       
  • uspace/drv/bus/usb/usbmast/main.c

    r32d19f7 rfaba839  
    302302       
    303303        (void) async_share_out_finalize(callid, &comm_buf);
    304         if (comm_buf == (void *) -1) {
     304        if (comm_buf == AS_MAP_FAILED) {
    305305                async_answer_0(callid, EHANGUP);
    306306                return;
  • uspace/lib/c/generic/as.c

    r32d19f7 rfaba839  
    4646 *
    4747 * @param base  Starting virtual address of the area.
    48  *              If set to (void *) -1, the kernel finds
    49  *              a mappable area.
     48 *              If set to AS_AREA_ANY ((void *) -1),
     49 *              the kernel finds a mappable area.
    5050 * @param size  Size of the area.
    5151 * @param flags Flags describing type of the area.
    5252 *
    5353 * @return Starting virtual address of the created area on success.
    54  * @return (void *) -1 otherwise.
     54 * @return AS_MAP_FAILED ((void *) -1) otherwise.
    5555 *
    5656 */
  • uspace/lib/c/generic/elf/elf_load.c

    r32d19f7 rfaba839  
    366366        a = as_area_create((uint8_t *) base + bias, mem_sz,
    367367            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    368         if (a == (void *) -1) {
     368        if (a == AS_MAP_FAILED) {
    369369                DPRINTF("memory mapping failed (0x%x, %d)\n",
    370370                    base + bias, mem_sz);
  • uspace/lib/c/generic/malloc.c

    r32d19f7 rfaba839  
    285285        /* Align the heap area size on page boundary */
    286286        size_t asize = ALIGN_UP(size, PAGE_SIZE);
    287         void *astart = as_area_create((void *) -1, asize,
     287        void *astart = as_area_create(AS_AREA_ANY, asize,
    288288            AS_AREA_WRITE | AS_AREA_READ);
    289         if (astart == (void *) -1)
     289        if (astart == AS_MAP_FAILED)
    290290                return false;
    291291       
  • uspace/lib/c/generic/mman.c

    r32d19f7 rfaba839  
    4242{
    4343        if (!start)
    44                 start = (void *) -1;
     44                start = AS_AREA_ANY;
    4545       
    4646//      if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
  • uspace/lib/c/include/as.h

    r32d19f7 rfaba839  
    4141#include <libarch/config.h>
    4242
     43#define AS_AREA_ANY    ((void *) -1)
     44#define AS_MAP_FAILED  ((void *) -1)
     45
    4346static inline size_t SIZE2PAGES(size_t size)
    4447{
  • uspace/lib/c/include/sys/mman.h

    r32d19f7 rfaba839  
    3939#include <sys/types.h>
    4040
    41 #define MAP_FAILED  ((void *) -1)
     41#define MAP_FAILED  AS_MAP_FAILED
    4242
    4343#define MAP_SHARED     (1 << 0)
  • uspace/lib/fb/imgmap.c

    r32d19f7 rfaba839  
    420420       
    421421        if ((flags & IMGMAP_FLAG_SHARED) == IMGMAP_FLAG_SHARED) {
    422                 imgmap = (imgmap_t *) as_area_create((void *) -1, size,
     422                imgmap = (imgmap_t *) as_area_create(AS_AREA_ANY, size,
    423423                    AS_AREA_READ | AS_AREA_WRITE);
    424                 if (imgmap == (void *) -1)
     424                if (imgmap == AS_MAP_FAILED)
    425425                        return NULL;
    426426        } else {
  • uspace/lib/fb/screenbuffer.c

    r32d19f7 rfaba839  
    7979       
    8080        if ((flags & SCREENBUFFER_FLAG_SHARED) == SCREENBUFFER_FLAG_SHARED) {
    81                 scrbuf = (screenbuffer_t *) as_area_create((void *) -1, size,
     81                scrbuf = (screenbuffer_t *) as_area_create(AS_AREA_ANY, size,
    8282                    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    83                 if (scrbuf == (void *) -1)
     83                if (scrbuf == AS_MAP_FAILED)
    8484                        return NULL;
    8585        } else {
  • uspace/lib/fs/libfs.c

    r32d19f7 rfaba839  
    339339         */
    340340        rc = async_share_in_start_0_0(exch, PLB_SIZE, (void *) &reg.plb_ro);
    341         if (reg.plb_ro == (void *) -1) {
     341        if (reg.plb_ro == AS_MAP_FAILED) {
    342342                async_exchange_end(exch);
    343343                async_forget(req);
  • uspace/srv/bd/ata_bd/ata_bd.c

    r32d19f7 rfaba839  
    308308
    309309        (void) async_share_out_finalize(callid, &fs_va);
    310         if (fs_va == (void *) -1) {
     310        if (fs_va == AS_MAP_FAILED) {
    311311                async_answer_0(callid, EHANGUP);
    312312                return;
  • uspace/srv/bd/file_bd/file_bd.c

    r32d19f7 rfaba839  
    189189
    190190        (void) async_share_out_finalize(callid, &fs_va);
    191         if (fs_va == (void *) -1) {
     191        if (fs_va == AS_MAP_FAILED) {
    192192                async_answer_0(callid, EHANGUP);
    193193                return;
  • uspace/srv/bd/gxe_bd/gxe_bd.c

    r32d19f7 rfaba839  
    196196
    197197        (void) async_share_out_finalize(callid, &fs_va);
    198         if (fs_va == (void *) -1) {
     198        if (fs_va == AS_MAP_FAILED) {
    199199                async_answer_0(callid, EHANGUP);
    200200                return;
  • uspace/srv/bd/part/guid_part/guid_part.c

    r32d19f7 rfaba839  
    350350
    351351        (void) async_share_out_finalize(callid, &fs_va);
    352         if (fs_va == (void *) -1) {
     352        if (fs_va == AS_MAP_FAILED) {
    353353                async_answer_0(callid, EHANGUP);
    354354                return;
  • uspace/srv/bd/part/mbr_part/mbr_part.c

    r32d19f7 rfaba839  
    427427
    428428        (void) async_share_out_finalize(callid, &fs_va);
    429         if (fs_va == (void *) -1) {
     429        if (fs_va == AS_MAP_FAILED) {
    430430                async_answer_0(callid, EHANGUP);
    431431                return;
  • uspace/srv/bd/rd/rd.c

    r32d19f7 rfaba839  
    106106        if (async_share_out_receive(&callid, &comm_size, &flags)) {
    107107                (void) async_share_out_finalize(callid, &fs_va);
    108                 if (fs_va == (void *) -1) {
     108                if (fs_va == AS_MAP_FAILED) {
    109109                        async_answer_0(callid, EHANGUP);
    110110                        return;
  • uspace/srv/hid/fb/fb.c

    r32d19f7 rfaba839  
    305305       
    306306        int rc = async_share_out_finalize(callid, &frontbuf->data);
    307         if ((rc != EOK) || (frontbuf->data == (void *) -1)) {
     307        if ((rc != EOK) || (frontbuf->data == AS_MAP_FAILED)) {
    308308                free(frontbuf);
    309309                async_answer_0(iid, ENOMEM);
     
    348348       
    349349        int rc = async_share_out_finalize(callid, &imagemap->data);
    350         if ((rc != EOK) || (imagemap->data == (void *) -1)) {
     350        if ((rc != EOK) || (imagemap->data == AS_MAP_FAILED)) {
    351351                free(imagemap);
    352352                async_answer_0(iid, ENOMEM);
  • uspace/srv/vfs/vfs.c

    r32d19f7 rfaba839  
    173173         * Allocate and initialize the Path Lookup Buffer.
    174174         */
    175         plb = as_area_create((void *) -1, PLB_SIZE,
     175        plb = as_area_create(AS_AREA_ANY, PLB_SIZE,
    176176            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    177         if (plb == (void *) -1) {
     177        if (plb == AS_MAP_FAILED) {
    178178                printf("%s: Cannot create address space area\n", NAME);
    179179                return ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.