Changeset e5f5ce0 in mainline for kernel/generic/src/ipc/ipc.c


Ignore:
Timestamp:
2017-09-04T20:25:18Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9e87562
Parents:
431c402
Message:

Create a slab cache for allocating phone_t structures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    r431c402 re5f5ce0  
    6666answerbox_t *ipc_phone_0 = NULL;
    6767
    68 static slab_cache_t *ipc_call_slab;
    69 static slab_cache_t *ipc_answerbox_slab;
     68static slab_cache_t *call_slab;
     69static slab_cache_t *answerbox_slab;
     70
     71slab_cache_t *phone_slab = NULL;
    7072
    7173/** Initialize a call structure.
     
    9597                if (call->buffer)
    9698                        free(call->buffer);
    97                 slab_free(ipc_call_slab, call);
     99                slab_free(call_slab, call);
    98100        }
    99101}
     
    112114call_t *ipc_call_alloc(unsigned int flags)
    113115{
    114         call_t *call = slab_alloc(ipc_call_slab, flags);
     116        call_t *call = slab_alloc(call_slab, flags);
    115117        if (call) {
    116118                _ipc_call_init(call);
     
    201203int ipc_call_sync(phone_t *phone, call_t *request)
    202204{
    203         answerbox_t *mybox = slab_alloc(ipc_answerbox_slab, 0);
     205        answerbox_t *mybox = slab_alloc(answerbox_slab, 0);
    204206        ipc_answerbox_init(mybox, TASK);
    205207       
     
    209211        int rc = ipc_call(phone, request);
    210212        if (rc != EOK) {
    211                 slab_free(ipc_answerbox_slab, mybox);
     213                slab_free(answerbox_slab, mybox);
    212214                return rc;
    213215        }
     
    256258        assert(!answer || request == answer);
    257259       
    258         slab_free(ipc_answerbox_slab, mybox);
     260        slab_free(answerbox_slab, mybox);
    259261        return rc;
    260262}
     
    854856void ipc_init(void)
    855857{
    856         ipc_call_slab = slab_cache_create("call_t", sizeof(call_t), 0, NULL,
     858        call_slab = slab_cache_create("call_t", sizeof(call_t), 0, NULL,
    857859            NULL, 0);
    858         ipc_answerbox_slab = slab_cache_create("answerbox_t",
    859             sizeof(answerbox_t), 0, NULL, NULL, 0);
     860        phone_slab = slab_cache_create("phone_t", sizeof(phone_t), 0, NULL,
     861            NULL, 0);
     862        answerbox_slab = slab_cache_create("answerbox_t", sizeof(answerbox_t),
     863            0, NULL, NULL, 0);
    860864}
    861865
Note: See TracChangeset for help on using the changeset viewer.