Changeset b3f8fb7 in mainline for kernel/generic/src


Ignore:
Timestamp:
2007-01-28T13:25:49Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e8c1a5
Parents:
1ba41c5
Message:

huge type system cleanup
remove cyclical type dependencies across multiple header files
many minor coding style fixes

Location:
kernel/generic/src
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/bitmap.c

    r1ba41c5 rb3f8fb7  
    3939
    4040#include <adt/bitmap.h>
    41 #include <typedefs.h>
    4241#include <arch/types.h>
    4342#include <align.h>
  • kernel/generic/src/adt/btree.c

    r1ba41c5 rb3f8fb7  
    5252#include <debug.h>
    5353#include <panic.h>
    54 #include <typedefs.h>
    5554#include <print.h>
    5655
  • kernel/generic/src/adt/hash_table.c

    r1ba41c5 rb3f8fb7  
    4040#include <adt/hash_table.h>
    4141#include <adt/list.h>
    42 #include <typedefs.h>
    4342#include <arch/types.h>
    4443#include <debug.h>
  • kernel/generic/src/console/cmd.c

    r1ba41c5 rb3f8fb7  
    4646#include <print.h>
    4747#include <panic.h>
    48 #include <typedefs.h>
    4948#include <arch/types.h>
    5049#include <adt/list.h>
  • kernel/generic/src/console/console.c

    r1ba41c5 rb3f8fb7  
    3939#include <synch/spinlock.h>
    4040#include <arch/types.h>
    41 #include <typedefs.h>
    4241#include <arch.h>
    4342#include <func.h>
  • kernel/generic/src/console/kconsole.c

    r1ba41c5 rb3f8fb7  
    4444#include <print.h>
    4545#include <panic.h>
    46 #include <typedefs.h>
    4746#include <arch/types.h>
    4847#include <adt/list.h>
  • kernel/generic/src/cpu/cpu.c

    r1ba41c5 rb3f8fb7  
    4545#include <config.h>
    4646#include <panic.h>
    47 #include <typedefs.h>
    4847#include <memstr.h>
    4948#include <adt/list.h>
  • kernel/generic/src/ddi/device.c

    r1ba41c5 rb3f8fb7  
    3939#include <atomic.h>
    4040#include <debug.h>
    41 #include <typedefs.h>
    4241
    4342static atomic_t last;
  • kernel/generic/src/ddi/irq.c

    r1ba41c5 rb3f8fb7  
    7070#include <adt/hash_table.h>
    7171#include <arch/types.h>
    72 #include <typedefs.h>
    7372#include <synch/spinlock.h>
    7473#include <arch.h>
  • kernel/generic/src/debug/symtab.c

    r1ba41c5 rb3f8fb7  
    3737
    3838#include <symtab.h>
    39 #include <typedefs.h>
    4039#include <arch/byteorder.h>
    4140#include <func.h>
  • kernel/generic/src/lib/elf.c

    r1ba41c5 rb3f8fb7  
    4040#include <debug.h>
    4141#include <arch/types.h>
    42 #include <typedefs.h>
    4342#include <mm/as.h>
    4443#include <mm/frame.h>
  • kernel/generic/src/lib/func.c

    r1ba41c5 rb3f8fb7  
    4141#include <arch/asm.h>
    4242#include <arch.h>
    43 #include <typedefs.h>
    4443#include <console/kconsole.h>
    4544
  • kernel/generic/src/main/kinit.c

    r1ba41c5 rb3f8fb7  
    6363#include <security/cap.h>
    6464#include <lib/rd.h>
     65#include <ipc/ipc.h>
    6566
    6667#ifdef CONFIG_SMP
  • kernel/generic/src/main/main.c

    r1ba41c5 rb3f8fb7  
    5454#include <config.h>
    5555#include <time/clock.h>
     56#include <time/timeout.h>
    5657#include <proc/scheduler.h>
    5758#include <proc/thread.h>
     
    7576#include <arch.h>
    7677#include <arch/faddr.h>
    77 #include <typedefs.h>
    7878#include <ipc/ipc.h>
    7979#include <macros.h>
  • kernel/generic/src/mm/as.c

    r1ba41c5 rb3f8fb7  
    7575#include <align.h>
    7676#include <arch/types.h>
    77 #include <typedefs.h>
    7877#include <syscall/copy.h>
    7978#include <arch/interrupt.h>
     
    169168        as->refcount = 0;
    170169        as->cpu_refcount = 0;
     170#ifdef AS_PAGE_TABLE
    171171        as->page_table = page_table_create(flags);
     172#else
     173        page_table_create(flags);
     174#endif
    172175
    173176        return as;
     
    217220
    218221        btree_destroy(&as->as_area_btree);
     222#ifdef AS_PAGE_TABLE
    219223        page_table_destroy(as->page_table);
     224#else
     225        page_table_destroy(NULL);
     226#endif
    220227
    221228        interrupts_restore(ipl);
  • kernel/generic/src/mm/backend_anon.c

    r1ba41c5 rb3f8fb7  
    4848#include <errno.h>
    4949#include <arch/types.h>
    50 #include <typedefs.h>
    5150#include <align.h>
    5251#include <arch.h>
  • kernel/generic/src/mm/backend_elf.c

    r1ba41c5 rb3f8fb7  
    3939#include <debug.h>
    4040#include <arch/types.h>
    41 #include <typedefs.h>
    4241#include <mm/as.h>
    4342#include <mm/frame.h>
  • kernel/generic/src/mm/backend_phys.c

    r1ba41c5 rb3f8fb7  
    3838#include <debug.h>
    3939#include <arch/types.h>
    40 #include <typedefs.h>
    4140#include <mm/as.h>
    4241#include <mm/frame.h>
  • kernel/generic/src/mm/buddy.c

    r1ba41c5 rb3f8fb7  
    4343#include <mm/frame.h>
    4444#include <arch/types.h>
    45 #include <typedefs.h>
    46 #include <adt/list.h>
    4745#include <debug.h>
    4846#include <print.h>
  • kernel/generic/src/mm/frame.c

    r1ba41c5 rb3f8fb7  
    5252 */
    5353
    54 #include <typedefs.h>
    5554#include <arch/types.h>
    5655#include <mm/frame.h>
  • kernel/generic/src/mm/page.c

    r1ba41c5 rb3f8fb7  
    4747#include <mm/frame.h>
    4848#include <arch/types.h>
    49 #include <typedefs.h>
    5049#include <arch/asm.h>
    5150#include <memstr.h>
  • kernel/generic/src/mm/tlb.c

    r1ba41c5 rb3f8fb7  
    4545#include <smp/ipi.h>
    4646#include <synch/spinlock.h>
    47 #include <typedefs.h>
    4847#include <atomic.h>
    4948#include <arch/interrupt.h>
     
    5251#include <panic.h>
    5352#include <debug.h>
     53#include <cpu.h>
    5454
    5555/**
  • kernel/generic/src/proc/scheduler.c

    r1ba41c5 rb3f8fb7  
    4545#include <mm/page.h>
    4646#include <mm/as.h>
     47#include <time/timeout.h>
    4748#include <time/delay.h>
    4849#include <arch/asm.h>
     
    5354#include <config.h>
    5455#include <context.h>
     56#include <fpu_context.h>
    5557#include <func.h>
    5658#include <arch.h>
    5759#include <adt/list.h>
    5860#include <panic.h>
    59 #include <typedefs.h>
    6061#include <cpu.h>
    6162#include <print.h>
  • kernel/generic/src/proc/task.c

    r1ba41c5 rb3f8fb7  
    364364               
    365365                if (sleeping)
    366                         waitq_interrupt_sleep(thr);
     366                        thread_interrupt_sleep(thr);
    367367        }
    368368       
  • kernel/generic/src/proc/the.c

    r1ba41c5 rb3f8fb7  
    4343
    4444#include <arch.h>
    45 #include <typedefs.h>
    4645
    4746
  • kernel/generic/src/proc/thread.c

    r1ba41c5 rb3f8fb7  
    5454#include <adt/btree.h>
    5555#include <adt/list.h>
    56 #include <typedefs.h>
    5756#include <time/clock.h>
     57#include <time/timeout.h>
    5858#include <config.h>
    5959#include <arch/interrupt.h>
     
    679679}
    680680
     681/** Interrupt sleeping thread.
     682 *
     683 * This routine attempts to interrupt a thread from its sleep in a waitqueue.
     684 * If the thread is not found sleeping, no action is taken.
     685 *
     686 * @param t Thread to be interrupted.
     687 */
     688void thread_interrupt_sleep(thread_t *t)
     689{
     690        waitq_t *wq;
     691        bool do_wakeup = false;
     692        ipl_t ipl;
     693
     694        ipl = interrupts_disable();
     695        spinlock_lock(&threads_lock);
     696        if (!thread_exists(t))
     697                goto out;
     698
     699grab_locks:
     700        spinlock_lock(&t->lock);
     701        if ((wq = t->sleep_queue)) {            /* assignment */
     702                if (!(t->sleep_interruptible)) {
     703                        /*
     704                         * The sleep cannot be interrupted.
     705                         */
     706                        spinlock_unlock(&t->lock);
     707                        goto out;
     708                }
     709                       
     710                if (!spinlock_trylock(&wq->lock)) {
     711                        spinlock_unlock(&t->lock);
     712                        goto grab_locks;        /* avoid deadlock */
     713                }
     714
     715                if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))
     716                        t->timeout_pending = false;
     717
     718                list_remove(&t->wq_link);
     719                t->saved_context = t->sleep_interruption_context;
     720                do_wakeup = true;
     721                t->sleep_queue = NULL;
     722                spinlock_unlock(&wq->lock);
     723        }
     724        spinlock_unlock(&t->lock);
     725
     726        if (do_wakeup)
     727                thread_ready(t);
     728
     729out:
     730        spinlock_unlock(&threads_lock);
     731        interrupts_restore(ipl);
     732}
     733
    681734/** @}
    682735 */
  • kernel/generic/src/security/cap.c

    r1ba41c5 rb3f8fb7  
    4444#include <syscall/copy.h>
    4545#include <arch.h>
    46 #include <typedefs.h>
    4746#include <errno.h>
    4847
  • kernel/generic/src/synch/condvar.c

    r1ba41c5 rb3f8fb7  
    4141#include <synch/synch.h>
    4242#include <arch.h>
    43 #include <typedefs.h>
    4443
    4544/** Initialize condition variable.
  • kernel/generic/src/synch/rwlock.c

    r1ba41c5 rb3f8fb7  
    6464#include <synch/synch.h>
    6565#include <adt/list.h>
    66 #include <typedefs.h>
    6766#include <arch/asm.h>
    6867#include <arch.h>
  • kernel/generic/src/synch/waitq.c

    r1ba41c5 rb3f8fb7  
    5050#include <arch/asm.h>
    5151#include <arch/types.h>
    52 #include <typedefs.h>
    5352#include <time/timeout.h>
    5453#include <arch.h>
     
    118117}
    119118
    120 /** Interrupt sleeping thread.
    121  *
    122  * This routine attempts to interrupt a thread from its sleep in a waitqueue.
    123  * If the thread is not found sleeping, no action is taken.
    124  *
    125  * @param t Thread to be interrupted.
    126  */
    127 void waitq_interrupt_sleep(thread_t *t)
    128 {
    129         waitq_t *wq;
    130         bool do_wakeup = false;
    131         ipl_t ipl;
    132 
    133         ipl = interrupts_disable();
    134         spinlock_lock(&threads_lock);
    135         if (!thread_exists(t))
    136                 goto out;
    137 
    138 grab_locks:
    139         spinlock_lock(&t->lock);
    140         if ((wq = t->sleep_queue)) {            /* assignment */
    141                 if (!(t->sleep_interruptible)) {
    142                         /*
    143                          * The sleep cannot be interrupted.
    144                          */
    145                         spinlock_unlock(&t->lock);
    146                         goto out;
    147                 }
    148                        
    149                 if (!spinlock_trylock(&wq->lock)) {
    150                         spinlock_unlock(&t->lock);
    151                         goto grab_locks;        /* avoid deadlock */
    152                 }
    153 
    154                 if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))
    155                         t->timeout_pending = false;
    156 
    157                 list_remove(&t->wq_link);
    158                 t->saved_context = t->sleep_interruption_context;
    159                 do_wakeup = true;
    160                 t->sleep_queue = NULL;
    161                 spinlock_unlock(&wq->lock);
    162         }
    163         spinlock_unlock(&t->lock);
    164 
    165         if (do_wakeup)
    166                 thread_ready(t);
    167 
    168 out:
    169         spinlock_unlock(&threads_lock);
    170         interrupts_restore(ipl);
    171 }
    172119
    173120/** Sleep until either wakeup, timeout or interruption occurs
     
    426373         * (the link belongs to the wait queue), but because
    427374         * of synchronization with waitq_timeouted_sleep()
    428          * and waitq_interrupt_sleep().
     375         * and thread_interrupt_sleep().
    429376         *
    430377         * In order for these two functions to work, the following
  • kernel/generic/src/syscall/copy.c

    r1ba41c5 rb3f8fb7  
    4545#include <arch.h>
    4646#include <errno.h>
    47 #include <typedefs.h>
    4847
    4948/** Copy data from userspace to kernel.
  • kernel/generic/src/time/timeout.c

    r1ba41c5 rb3f8fb7  
    3737
    3838#include <time/timeout.h>
    39 #include <typedefs.h>
    4039#include <arch/types.h>
    4140#include <config.h>
Note: See TracChangeset for help on using the changeset viewer.