Changeset a35b458 in mainline for kernel/generic/src/main


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

Location:
kernel/generic/src/main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    r3061bc1 ra35b458  
    102102{
    103103        thread_t *thread;
    104        
     104
    105105        /*
    106106         * Detach kinit as nobody will call thread_join_timeout() on it.
     
    109109
    110110        interrupts_disable();
    111        
     111
    112112        /* Start processing RCU callbacks. RCU is fully functional afterwards. */
    113113        rcu_kinit_init();
    114        
     114
    115115        /*
    116116         * Start processing work queue items. Some may have been queued during boot.
    117117         */
    118118        workq_global_worker_init();
    119        
     119
    120120#ifdef CONFIG_SMP
    121121        if (config.cpu_count > 1) {
    122122                waitq_initialize(&ap_completion_wq);
    123                
     123
    124124                /*
    125125                 * Create the kmp thread and wait for its completion.
     
    135135                } else
    136136                        panic("Unable to create kmp thread.");
    137                
     137
    138138                thread_join(thread);
    139139                thread_detach(thread);
    140                
     140
    141141                /*
    142142                 * For each CPU, create its load balancing thread.
    143143                 */
    144144                unsigned int i;
    145                
     145
    146146                for (i = 0; i < config.cpu_count; i++) {
    147147                        thread = thread_create(kcpulb, NULL, TASK,
     
    156156        }
    157157#endif /* CONFIG_SMP */
    158        
     158
    159159        /*
    160160         * At this point SMP, if present, is configured.
    161161         */
    162162        ARCH_OP(post_smp_init);
    163        
     163
    164164        /* Start thread computing system load */
    165165        thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
     
    169169        else
    170170                log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
    171        
     171
    172172#ifdef CONFIG_KCONSOLE
    173173        if (stdin) {
     
    184184        }
    185185#endif /* CONFIG_KCONSOLE */
    186        
     186
    187187        /*
    188188         * Store the default stack size in sysinfo so that uspace can create
     
    190190         */
    191191        sysinfo_set_item_val("default.stack_size", NULL, STACK_SIZE_USER);
    192        
     192
    193193        interrupts_enable();
    194        
     194
    195195        /*
    196196         * Create user tasks, load RAM disk images.
     
    198198        size_t i;
    199199        program_t programs[CONFIG_INIT_TASKS];
    200        
     200
    201201        // FIXME: do not propagate arguments through sysinfo
    202202        // but pass them directly to the tasks
     
    228228                        continue;
    229229                }
    230                
     230
    231231                /*
    232232                 * Construct task name from the 'init:' prefix and the
    233233                 * name stored in the init structure (if any).
    234234                 */
    235                
     235
    236236                char namebuf[TASK_NAME_BUFLEN];
    237                
     237
    238238                const char *name = init.tasks[i].name;
    239239                if (name[0] == 0)
    240240                        name = "<unknown>";
    241                
     241
    242242                static_assert(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN, "");
    243243                str_cpy(namebuf, TASK_NAME_BUFLEN, INIT_PREFIX);
    244244                str_cpy(namebuf + INIT_PREFIX_LEN,
    245245                    TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name);
    246                
     246
    247247                /*
    248248                 * Create virtual memory mappings for init task images.
     
    252252                    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
    253253                assert(page);
    254                
     254
    255255                errno_t rc = program_create_from_image((void *) page, namebuf,
    256256                    &programs[i]);
    257                
     257
    258258                if (rc == 0) {
    259259                        if (programs[i].task != NULL) {
     
    264264                                    PERM_PERM | PERM_MEM_MANAGER |
    265265                                    PERM_IO_MANAGER | PERM_IRQ_REG);
    266                                
     266
    267267                                if (!ipc_phone_0) {
    268268                                        ipc_phone_0 = &programs[i].task->answerbox;
     
    276276                                }
    277277                        }
    278                        
     278
    279279                        /*
    280280                         * If programs[i].task == NULL then it is
     
    293293                            str_error_name(rc), programs[i].loader_status);
    294294        }
    295        
     295
    296296        /*
    297297         * Run user tasks.
     
    301301                        program_ready(&programs[i]);
    302302        }
    303        
     303
    304304#ifdef CONFIG_KCONSOLE
    305305        if (!stdin) {
    306306                thread_sleep(10);
    307307                printf("kinit: No stdin\nKernel alive: .");
    308                
     308
    309309                unsigned int i = 0;
    310310                while (true) {
  • kernel/generic/src/main/main.c

    r3061bc1 ra35b458  
    166166        config.cpu_count = 1;
    167167        config.cpu_active = 1;
    168        
     168
    169169        config.base = hardcoded_load_address;
    170170        config.kernel_size = ALIGN_UP(hardcoded_ktext_size +
    171171            hardcoded_kdata_size, PAGE_SIZE);
    172172        config.stack_size = STACK_SIZE;
    173        
     173
    174174        /* Initialy the stack is placed just after the kernel */
    175175        config.stack_base = config.base + config.kernel_size;
    176        
     176
    177177        /* Avoid placing stack on top of init */
    178178        size_t i;
     
    190190                }
    191191        }
    192        
     192
    193193        /* Avoid placing stack on top of boot allocations. */
    194194        if (ballocs.size) {
     
    198198                            ballocs.size, PAGE_SIZE);
    199199        }
    200        
     200
    201201        if (config.stack_base < stack_safe)
    202202                config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE);
    203        
     203
    204204        context_save(&ctx);
    205205        context_set(&ctx, FADDR(main_bsp_separated_stack),
     
    218218        /* Keep this the first thing. */
    219219        the_initialize(THE);
    220        
     220
    221221        version_print();
    222        
     222
    223223        LOG("\nconfig.base=%p config.kernel_size=%zu"
    224224            "\nconfig.stack_base=%p config.stack_size=%zu",
    225225            (void *) config.base, config.kernel_size,
    226226            (void *) config.stack_base, config.stack_size);
    227        
     227
    228228#ifdef CONFIG_KCONSOLE
    229229        /*
     
    234234        kconsole_init();
    235235#endif
    236        
     236
    237237        /*
    238238         * Exception handler initialization, before architecture
     
    240240         */
    241241        exc_init();
    242        
     242
    243243        /*
    244244         * Memory management subsystems initialization.
     
    260260        ARCH_OP(pre_smp_init);
    261261        smp_init();
    262        
     262
    263263        /* Slab must be initialized after we know the number of processors. */
    264264        slab_enable_cpucache();
    265        
     265
    266266        uint64_t size;
    267267        const char *size_suffix;
     
    269269        printf("Detected %u CPU(s), %" PRIu64 " %s free memory\n",
    270270            config.cpu_count, size, size_suffix);
    271        
     271
    272272        cpu_init();
    273273        calibrate_delay_loop();
     
    293293        } else
    294294                printf("No init binaries found.\n");
    295        
     295
    296296        ipc_init();
    297297        event_init();
     
    299299        log_init();
    300300        stats_init();
    301        
     301
    302302        /*
    303303         * Create kernel task.
     
    306306        if (!kernel)
    307307                panic("Cannot create kernel task.");
    308        
     308
    309309        /*
    310310         * Create the first thread.
     
    315315                panic("Cannot create kinit thread.");
    316316        thread_ready(kinit_thread);
    317        
     317
    318318        /*
    319319         * This call to scheduler() will return to kinit,
     
    344344         */
    345345        config.cpu_active++;
    346        
     346
    347347        /*
    348348         * The THE structure is well defined because ctx.sp is used as stack.
    349349         */
    350350        the_initialize(THE);
    351        
     351
    352352        ARCH_OP(pre_mm_init);
    353353        frame_init();
     
    355355        tlb_init();
    356356        ARCH_OP(post_mm_init);
    357        
     357
    358358        cpu_init();
    359359        calibrate_delay_loop();
    360360        ARCH_OP(post_cpu_init);
    361        
     361
    362362        the_copy(THE, (the_t *) CPU->stack);
    363        
     363
    364364        /*
    365365         * If we woke kmp up before we left the kernel stack, we could
     
    382382{
    383383        smp_call_init();
    384        
     384
    385385        /*
    386386         * Configure timeouts for this cpu.
    387387         */
    388388        timeout_init();
    389        
     389
    390390        waitq_wakeup(&ap_completion_wq, WAKEUP_FIRST);
    391391        scheduler();
  • kernel/generic/src/main/shutdown.c

    r3061bc1 ra35b458  
    4545{
    4646        task_done();
    47        
     47
    4848#ifdef CONFIG_DEBUG
    4949        log(LF_OTHER, LVL_DEBUG, "Rebooting the system");
    5050#endif
    51        
     51
    5252        arch_reboot();
    5353        halt();
  • kernel/generic/src/main/uinit.c

    r3061bc1 ra35b458  
    6565         */
    6666        thread_detach(THREAD);
    67        
     67
    6868#ifdef CONFIG_UDEBUG
    6969        udebug_stoppable_end();
    7070#endif
    71        
     71
    7272        uspace_arg_t *uarg = (uspace_arg_t *) arg;
    7373        uspace_arg_t local_uarg;
    74        
     74
    7575        local_uarg.uspace_entry = uarg->uspace_entry;
    7676        local_uarg.uspace_stack = uarg->uspace_stack;
     
    7979        local_uarg.uspace_thread_function = NULL;
    8080        local_uarg.uspace_thread_arg = NULL;
    81        
     81
    8282        free(uarg);
    83        
     83
    8484        userspace(&local_uarg);
    8585}
Note: See TracChangeset for help on using the changeset viewer.