Changeset 91a8f83 in mainline


Ignore:
Timestamp:
2018-10-31T18:15:56Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
071cb36
Parents:
482f968
Message:

Rename THE/the_t to CURRENT/current_t

Because the word "THE" occurs several times in every licence
header, searching for occurences of "THE" macro is more difficult
than necessary.

While I appreciate the wit of it, using a nonconflicting word
for it is more practical.

Location:
kernel
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/arch/asm.h

    r482f968 r91a8f83  
    192192        /*
    193193         * On real hardware this returns the address of the bottom
    194          * of the current CPU stack. The the_t structure is stored
     194         * of the current CPU stack. The current_t structure is stored
    195195         * on the bottom of stack and this is used to identify the
    196196         * current CPU, current task, current thread and current
  • kernel/generic/include/arch.h

    r482f968 r91a8f83  
    4040
    4141/*
    42  * THE is not an abbreviation, but the English definite article written in
    43  * capital letters. It means the current pointer to something, e.g. thread,
    44  * processor or address space. Kind reader of this comment shall appreciate
    45  * the wit of constructs like THE->thread and similar.
     42 * The context pointer. The current_t structure holds pointers to various parts
     43 * of the current execution context, like running task, thread, address space,
     44 * etc.
    4645 */
    47 #define THE  ((the_t * )(get_stack_base()))
     46#define CURRENT  ((current_t * )(get_stack_base()))
    4847
    4948#define MAGIC                UINT32_C(0xfacefeed)
     
    5352#define DEFAULT_CONTAINER  0
    5453#define CONTAINER \
    55         ((THE->task) ? (THE->task->container) : (DEFAULT_CONTAINER))
     54        ((CURRENT->task) ? (CURRENT->task->container) : (DEFAULT_CONTAINER))
    5655
    5756/* Fwd decl. to avoid include hell. */
     
    7675        struct as *as;         /**< Current address space. */
    7776        uint32_t magic;        /**< Magic value */
    78 } the_t;
     77} current_t;
    7978
    8079typedef struct {
     
    9695#define ARCH_OP(op)     ARCH_STRUCT_OP(arch_ops, op)
    9796
    98 extern void the_initialize(the_t *);
    99 extern void the_copy(the_t *, the_t *);
     97extern void current_initialize(current_t *);
     98extern void current_copy(current_t *, current_t *);
    10099
    101100extern void calibrate_delay_loop(void);
  • kernel/generic/include/cpu.h

    r482f968 r91a8f83  
    4545#include <arch.h>
    4646
    47 #define CPU                  THE->cpu
     47#define CPU                  CURRENT->cpu
    4848
    4949/** CPU structure.
  • kernel/generic/include/mm/as.h

    r482f968 r91a8f83  
    5050#include <lib/refcount.h>
    5151
    52 #define AS                   THE->as
     52#define AS                   CURRENT->as
    5353
    5454/**
  • kernel/generic/include/preemption.h

    r482f968 r91a8f83  
    4141
    4242#define PREEMPTION_INC         (1 << 0)
    43 #define PREEMPTION_DISABLED    (PREEMPTION_INC <= THE->preemption)
     43#define PREEMPTION_DISABLED    (PREEMPTION_INC <= CURRENT->preemption)
    4444#define PREEMPTION_ENABLED     (!PREEMPTION_DISABLED)
    4545
     
    4747#define preemption_disable() \
    4848        do { \
    49                 THE->preemption += PREEMPTION_INC; \
     49                CURRENT->preemption += PREEMPTION_INC; \
    5050                compiler_barrier(); \
    5151        } while (0)
     
    5656                assert(PREEMPTION_DISABLED); \
    5757                compiler_barrier(); \
    58                 THE->preemption -= PREEMPTION_INC; \
     58                CURRENT->preemption -= PREEMPTION_INC; \
    5959        } while (0)
    6060
  • kernel/generic/include/proc/task.h

    r482f968 r91a8f83  
    6363#include <cap/cap.h>
    6464
    65 #define TASK                 THE->task
     65#define TASK                 CURRENT->task
    6666
    6767struct thread;
  • kernel/generic/include/proc/thread.h

    r482f968 r91a8f83  
    5252#include <arch.h>
    5353
    54 #define THREAD              THE->thread
     54#define THREAD              CURRENT->thread
    5555
    5656#define THREAD_NAME_BUFLEN  20
  • kernel/generic/include/synch/rcu.h

    r482f968 r91a8f83  
    132132static inline void rcu_read_lock(void)
    133133{
    134         THE->rcu_nesting += RCU_CNT_INC;
     134        CURRENT->rcu_nesting += RCU_CNT_INC;
    135135        compiler_barrier();
    136136}
     
    140140{
    141141        compiler_barrier();
    142         THE->rcu_nesting -= RCU_CNT_INC;
    143 
    144         if (RCU_WAS_PREEMPTED == THE->rcu_nesting) {
     142        CURRENT->rcu_nesting -= RCU_CNT_INC;
     143
     144        if (RCU_WAS_PREEMPTED == CURRENT->rcu_nesting) {
    145145                _rcu_preempted_unlock();
    146146        }
  • kernel/generic/include/time/timeout.h

    r482f968 r91a8f83  
    4545        IRQ_SPINLOCK_DECLARE(lock);
    4646
    47         /** Link to the list of active timeouts on THE->cpu */
     47        /** Link to the list of active timeouts on CURRENT->cpu */
    4848        link_t link;
    4949        /** Timeout will be activated in this amount of clock() ticks. */
  • kernel/generic/src/debug/panic.c

    r482f968 r91a8f83  
    9494        printf("\n");
    9595
    96         printf("THE=%p: ", THE);
    97         if (THE != NULL) {
     96        printf("CURRENT=%p: ", CURRENT);
     97        if (CURRENT != NULL) {
    9898                printf("pe=%" PRIuPTR " thread=%p task=%p cpu=%p as=%p"
    99                     " magic=%#" PRIx32 "\n", THE->preemption,
    100                     THE->thread, THE->task, THE->cpu, THE->as, THE->magic);
     99                    " magic=%#" PRIx32 "\n", CURRENT->preemption,
     100                    CURRENT->thread, CURRENT->task, CURRENT->cpu, CURRENT->as, CURRENT->magic);
    101101
    102                 if (THE->thread != NULL)
    103                         printf("thread=\"%s\"\n", THE->thread->name);
     102                if (CURRENT->thread != NULL)
     103                        printf("thread=\"%s\"\n", CURRENT->thread->name);
    104104
    105                 if (THE->task != NULL)
    106                         printf("task=\"%s\"\n", THE->task->name);
     105                if (CURRENT->task != NULL)
     106                        printf("task=\"%s\"\n", CURRENT->task->name);
    107107        } else
    108108                printf("invalid\n");
  • kernel/generic/src/main/main.c

    r482f968 r91a8f83  
    213213{
    214214        /* Keep this the first thing. */
    215         the_initialize(THE);
     215        current_initialize(CURRENT);
    216216
    217217        version_print();
     
    342342
    343343        /*
    344          * The THE structure is well defined because ctx.sp is used as stack.
    345          */
    346         the_initialize(THE);
     344         * The CURRENT structure is well defined because ctx.sp is used as stack.
     345         */
     346        current_initialize(CURRENT);
    347347
    348348        ARCH_OP(pre_mm_init);
     
    356356        ARCH_OP(post_cpu_init);
    357357
    358         the_copy(THE, (the_t *) CPU->stack);
     358        current_copy(CURRENT, (current_t *) CPU->stack);
    359359
    360360        /*
  • kernel/generic/src/proc/scheduler.c

    r482f968 r91a8f83  
    363363
    364364        /*
    365          * Through the 'THE' structure, we keep track of THREAD, TASK, CPU, AS
    366          * and preemption counter. At this point THE could be coming either
     365         * Through the 'CURRENT' structure, we keep track of THREAD, TASK, CPU, AS
     366         * and preemption counter. At this point CURRENT could be coming either
    367367         * from THREAD's or CPU's stack.
    368368         *
    369369         */
    370         the_copy(THE, (the_t *) CPU->stack);
     370        current_copy(CURRENT, (current_t *) CPU->stack);
    371371
    372372        /*
     
    548548         * thread's stack.
    549549         */
    550         the_copy(THE, (the_t *) THREAD->kstack);
     550        current_copy(CURRENT, (current_t *) THREAD->kstack);
    551551
    552552        context_restore(&THREAD->saved_context);
  • kernel/generic/src/proc/the.c

    r482f968 r91a8f83  
    3333/**
    3434 * @file
    35  * @brief THE structure functions.
     35 * @brief CURRENT structure functions.
    3636 *
    37  * This file contains functions to manage the THE structure.
    38  * The THE structure exists at the base address of every kernel
     37 * This file contains functions to manage the CURRENT structure.
     38 * The CURRENT structure exists at the base address of every kernel
    3939 * stack and carries information about current settings
    4040 * (e.g. current CPU, current thread, task and address space
     
    4545#include <assert.h>
    4646
    47 /** Initialize THE structure
     47/** Initialize CURRENT structure
    4848 *
    49  * Initialize THE structure passed as argument.
     49 * Initialize CURRENT structure passed as argument.
    5050 *
    51  * @param the THE structure to be initialized.
     51 * @param the CURRENT structure to be initialized.
    5252 *
    5353 */
    54 void the_initialize(the_t *the)
     54void current_initialize(current_t *the)
    5555{
    5656        the->preemption = 0;
     
    6565}
    6666
    67 /** Copy THE structure
     67/** Copy CURRENT structure
    6868 *
    69  * Copy the source THE structure to the destination THE structure.
     69 * Copy the source CURRENT structure to the destination CURRENT structure.
    7070 *
    71  * @param src The source THE structure.
    72  * @param dst The destination THE structure.
     71 * @param src The source CURRENT structure.
     72 * @param dst The destination CURRENT structure.
    7373 *
    7474 */
    75 NO_TRACE void the_copy(the_t *src, the_t *dst)
     75NO_TRACE void current_copy(current_t *src, current_t *dst)
    7676{
    7777        assert(src->magic == MAGIC);
  • kernel/generic/src/proc/thread.c

    r482f968 r91a8f83  
    356356            (uintptr_t) thread->kstack, STACK_SIZE);
    357357
    358         the_initialize((the_t *) thread->kstack);
     358        current_initialize((current_t *) thread->kstack);
    359359
    360360        ipl_t ipl = interrupts_disable();
  • kernel/generic/src/synch/rcu.c

    r482f968 r91a8f83  
    10261026        cpu_mask_t *reader_cpus = (cpu_mask_t *)arg;
    10271027
    1028         bool locked = RCU_CNT_INC <= THE->rcu_nesting;
     1028        bool locked = RCU_CNT_INC <= CURRENT->rcu_nesting;
    10291029        /* smp_call machinery makes the most current _rcu_cur_gp visible. */
    10301030        bool passed_qs = (CPU->rcu.last_seen_gp == _rcu_cur_gp);
     
    10541054         * with a local copy.
    10551055         */
    1056         size_t nesting_cnt = local_atomic_exchange(&THE->rcu_nesting, 0);
     1056        size_t nesting_cnt = local_atomic_exchange(&CURRENT->rcu_nesting, 0);
    10571057
    10581058        /*
     
    11131113
    11141114        /* Load the thread's saved nesting count from before it was preempted. */
    1115         THE->rcu_nesting = THREAD->rcu.nesting_cnt;
     1115        CURRENT->rcu_nesting = THREAD->rcu.nesting_cnt;
    11161116}
    11171117
     
    11231123void rcu_thread_exiting(void)
    11241124{
    1125         assert(THE->rcu_nesting == 0);
     1125        assert(CURRENT->rcu_nesting == 0);
    11261126
    11271127        /*
     
    11451145bool rcu_read_locked(void)
    11461146{
    1147         return RCU_CNT_INC <= THE->rcu_nesting;
     1147        return RCU_CNT_INC <= CURRENT->rcu_nesting;
    11481148}
    11491149
     
    11511151void _rcu_preempted_unlock(void)
    11521152{
    1153         assert(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);
    1154 
    1155         size_t prev = local_atomic_exchange(&THE->rcu_nesting, 0);
     1153        assert(0 == CURRENT->rcu_nesting || RCU_WAS_PREEMPTED == CURRENT->rcu_nesting);
     1154
     1155        size_t prev = local_atomic_exchange(&CURRENT->rcu_nesting, 0);
    11561156        if (prev == RCU_WAS_PREEMPTED) {
    11571157                /*
Note: See TracChangeset for help on using the changeset viewer.