Changes in / [9f945464:2c94501] in mainline


Ignore:
Location:
kernel
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/condvar.h

    r9f945464 r2c94501  
    4646} condvar_t;
    4747
    48 #define CONDVAR_INITIALIZER(name) (condvar_t) { \
    49         .wq = WAITQ_INITIALIZER((name).wq), \
    50 }
    51 
    52 #define CONDVAR_INITIALIZE(name) \
    53         condvar_t name = CONDVAR_INITIALIZER(name)
    54 
    5548#ifdef CONFIG_SMP
    5649#define _condvar_wait_timeout_spinlock(cv, lock, usec, flags) \
  • kernel/generic/include/synch/mutex.h

    r9f945464 r2c94501  
    5656} mutex_t;
    5757
    58 #define MUTEX_INITIALIZER(name, mtype) (mutex_t) { \
    59         .type = (mtype), \
    60         .sem = SEMAPHORE_INITIALIZER((name).sem, 1), \
    61         .owner = NULL, \
    62         .nesting = 0, \
    63 }
    64 
    65 #define MUTEX_INITIALIZE(name, mtype) \
    66         mutex_t name = MUTEX_INITIALIZER(name, mtype)
    67 
    6858extern void mutex_initialize(mutex_t *, mutex_type_t);
    6959extern bool mutex_locked(mutex_t *);
  • kernel/generic/include/synch/semaphore.h

    r9f945464 r2c94501  
    4545} semaphore_t;
    4646
    47 #define SEMAPHORE_INITIALIZER(name, count) (semaphore_t) { \
    48         .wq = WAITQ_INITIALIZER_WITH_COUNT((name).wq, count), \
    49 }
    50 
    51 #define SEMAPHORE_INITIALIZE(name, count) \
    52         semaphore_t name = SEMAPHORE_INITIALIZER(name, count)
    53 
    5447extern void semaphore_initialize(semaphore_t *, int);
    5548extern errno_t semaphore_down_timeout(semaphore_t *, uint32_t);
  • kernel/generic/include/synch/waitq.h

    r9f945464 r2c94501  
    4040#include <abi/synch.h>
    4141#include <adt/list.h>
    42 
    43 #define WAITQ_INITIALIZER_WITH_COUNT(name, count) (waitq_t) { \
    44         .lock = IRQ_SPINLOCK_INITIALIZER(#name ".lock"), \
    45         .sleepers = LIST_INITIALIZER((name).sleepers), \
    46         .wakeup_balance = (count), \
    47 }
    48 
    49 #define WAITQ_INITIALIZER(name) WAITQ_INITIALIZER_WITH_COUNT(name, 0)
    50 
    51 #define WAITQ_INITIALIZE_WITH_COUNT(name, count) \
    52         waitq_t name = WAITQ_INITIALIZER_WITH_COUNT(name, count)
    53 
    54 #define WAITQ_INITIALIZE(name) \
    55         waitq_t name = WAITQ_INITIALIZER(name)
    5642
    5743/** Wait queue structure.
  • kernel/generic/src/ddi/ddi.c

    r9f945464 r2c94501  
    6060
    6161/** This lock protects the @c pareas ordered dictionary. */
    62 static MUTEX_INITIALIZE(pareas_lock, MUTEX_PASSIVE);
     62static mutex_t pareas_lock;
    6363
    6464/** Ordered dictionary of enabled physical memory areas by base address. */
     
    7474{
    7575        odict_initialize(&pareas, pareas_getkey, pareas_cmp);
     76        mutex_initialize(&pareas_lock, MUTEX_PASSIVE);
    7677}
    7778
  • kernel/generic/src/main/main.c

    r9f945464 r2c94501  
    5353#include <stdio.h>
    5454#include <panic.h>
     55#include <assert.h>
    5556#include <config.h>
    5657#include <time/clock.h>
  • kernel/generic/src/mm/frame.c

    r9f945464 r2c94501  
    6363#include <proc/thread.h> /* THREAD */
    6464
    65 zones_t zones = {
    66         .count = 0,
    67         .lock = IRQ_SPINLOCK_INITIALIZER("frame.zones.lock"),
    68 };
     65zones_t zones;
    6966
    7067/*
     
    7269 * available.
    7370 */
    74 static MUTEX_INITIALIZE(mem_avail_mtx, MUTEX_ACTIVE);
    75 static CONDVAR_INITIALIZE(mem_avail_cv);
     71static mutex_t mem_avail_mtx;
     72static condvar_t mem_avail_cv;
    7673static size_t mem_avail_req = 0;  /**< Number of frames requested. */
    7774static size_t mem_avail_gen = 0;  /**< Generation counter. */
     
    11111108void frame_init(void)
    11121109{
     1110        if (config.cpu_active == 1) {
     1111                zones.count = 0;
     1112                irq_spinlock_initialize(&zones.lock, "frame.zones.lock");
     1113                mutex_initialize(&mem_avail_mtx, MUTEX_ACTIVE);
     1114                condvar_initialize(&mem_avail_cv);
     1115        }
     1116
    11131117        /* Tell the architecture to create some memory */
    11141118        frame_low_arch_init();
  • kernel/generic/src/proc/thread.c

    r9f945464 r2c94501  
    667667void thread_usleep(uint32_t usec)
    668668{
    669         WAITQ_INITIALIZE(wq);
     669        waitq_t wq;
     670
     671        waitq_initialize(&wq);
     672
    670673        (void) waitq_sleep_timeout(&wq, usec);
    671674}
  • kernel/generic/src/synch/condvar.c

    r9f945464 r2c94501  
    4848void condvar_initialize(condvar_t *cv)
    4949{
    50         *cv = CONDVAR_INITIALIZER(*cv);
     50        waitq_initialize(&cv->wq);
    5151}
    5252
  • kernel/generic/src/synch/mutex.c

    r9f945464 r2c94501  
    5353void mutex_initialize(mutex_t *mtx, mutex_type_t type)
    5454{
    55         *mtx = MUTEX_INITIALIZER(*mtx, type);
     55        mtx->type = type;
     56        mtx->owner = NULL;
     57        mtx->nesting = 0;
     58        semaphore_initialize(&mtx->sem, 1);
    5659}
    5760
  • kernel/generic/src/synch/semaphore.c

    r9f945464 r2c94501  
    5252void semaphore_initialize(semaphore_t *sem, int val)
    5353{
    54         *sem = SEMAPHORE_INITIALIZER(*sem, val);
     54        waitq_initialize_with_count(&sem->wq, val);
    5555}
    5656
  • kernel/generic/src/synch/waitq.c

    r9f945464 r2c94501  
    7070void waitq_initialize(waitq_t *wq)
    7171{
    72         *wq = WAITQ_INITIALIZER(*wq);
     72        memsetb(wq, sizeof(*wq), 0);
     73        irq_spinlock_initialize(&wq->lock, "wq.lock");
     74        list_initialize(&wq->sleepers);
    7375}
    7476
     
    7981void waitq_initialize_with_count(waitq_t *wq, int count)
    8082{
    81         *wq = WAITQ_INITIALIZER_WITH_COUNT(*wq, count);
     83        waitq_initialize(wq);
     84        wq->wakeup_balance = count;
    8285}
    8386
  • kernel/generic/src/sysinfo/stats.c

    r9f945464 r2c94501  
    9090
    9191/** Load calculation lock */
    92 static MUTEX_INITIALIZE(load_lock, MUTEX_PASSIVE);
     92static mutex_t load_lock;
    9393
    9494/** Get statistics of all CPUs
     
    846846void stats_init(void)
    847847{
     848        mutex_initialize(&load_lock, MUTEX_PASSIVE);
     849
    848850        sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL);
    849851        sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL);
  • kernel/generic/src/sysinfo/sysinfo.c

    r9f945464 r2c94501  
    5757
    5858/** Sysinfo lock */
    59 static MUTEX_INITIALIZE(sysinfo_lock, MUTEX_ACTIVE);
     59static mutex_t sysinfo_lock;
    6060
    6161/** Sysinfo item constructor
     
    102102            sizeof(sysinfo_item_t), 0, sysinfo_item_constructor,
    103103            sysinfo_item_destructor, SLAB_CACHE_MAGDEFERRED);
     104
     105        mutex_initialize(&sysinfo_lock, MUTEX_ACTIVE);
    104106}
    105107
  • kernel/test/mm/slab2.c

    r9f945464 r2c94501  
    127127
    128128static slab_cache_t *thr_cache;
    129 static CONDVAR_INITIALIZE(thread_starter);
    130 static MUTEX_INITIALIZE(starter_mutex, MUTEX_PASSIVE);
     129static condvar_t thread_starter;
     130static mutex_t starter_mutex;
    131131
    132132#define THREADS  8
     
    197197
    198198        TPRINTF("Running stress test with size %d\n", size);
     199
     200        condvar_initialize(&thread_starter);
     201        mutex_initialize(&starter_mutex, MUTEX_PASSIVE);
    199202
    200203        thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0);
Note: See TracChangeset for help on using the changeset viewer.