Changeset 6c441cf8 in mainline for kernel/generic/src


Ignore:
Timestamp:
2008-02-27T11:49:17Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
56976a17
Parents:
fdb7795
Message:

code cleanup (mostly signed/unsigned)
allow extra compiler warnings

Location:
kernel/generic/src
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/symtab.c

    rfdb7795 r6c441cf8  
    7171static char * symtab_search_one(const char *name, int *startpos)
    7272{
    73         int namelen = strlen(name);
     73        unsigned int namelen = strlen(name);
    7474        char *curname;
    7575        int i,j;
  • kernel/generic/src/interrupt/interrupt.c

    rfdb7795 r6c441cf8  
    104104static int exc_print_cmd(cmd_arg_t *argv)
    105105{
     106#if (IVT_ITEMS > 0)
    106107        unsigned int i;
    107108        char *symbol;
     
    139140       
    140141        spinlock_unlock(&exctbl_lock);
     142#endif
    141143       
    142144        return 1;
  • kernel/generic/src/ipc/irq.c

    rfdb7795 r6c441cf8  
    6666static void code_execute(call_t *call, irq_code_t *code)
    6767{
    68         int i;
     68        unsigned int i;
    6969        unative_t dstval = 0;
    7070       
  • kernel/generic/src/ipc/sysipc.c

    rfdb7795 r6c441cf8  
    165165        int phoneid;
    166166
    167         if (IPC_GET_RETVAL(answer->data) == EHANGUP) {
     167        if ((native_t) IPC_GET_RETVAL(answer->data) == EHANGUP) {
    168168                /* In case of forward, hangup the forwared phone,
    169169                 * not the originator
     
    355355static void process_answer(call_t *call)
    356356{
    357         if (IPC_GET_RETVAL(call->data) == EHANGUP &&
     357        if (((native_t) IPC_GET_RETVAL(call->data) == EHANGUP) &&
    358358            (call->flags & IPC_CALL_FORWARDED))
    359359                IPC_SET_RETVAL(call->data, EFORWARD);
  • kernel/generic/src/lib/elf.c

    rfdb7795 r6c441cf8  
    7070 * @return EE_OK on success
    7171 */
    72 int elf_load(elf_header_t *header, as_t * as)
     72unsigned int elf_load(elf_header_t *header, as_t * as)
    7373{
    7474        int i, rc;
     
    132132 * @return NULL terminated description of error.
    133133 */
    134 char *elf_error(int rc)
     134char *elf_error(unsigned int rc)
    135135{
    136136        ASSERT(rc < sizeof(error_codes) / sizeof(char *));
  • kernel/generic/src/lib/func.c

    rfdb7795 r6c441cf8  
    140140int strncmp(const char *src, const char *dst, size_t len)
    141141{
    142         int i;
     142        unsigned int i;
    143143       
    144         for (i = 0; *src && *dst && i < len; src++, dst++, i++) {
     144        for (i = 0; (*src) && (*dst) && (i < len); src++, dst++, i++) {
    145145                if (*src < *dst)
    146146                        return -1;
     
    169169void strncpy(char *dest, const char *src, size_t len)
    170170{
    171         int i;
     171        unsigned int i;
    172172        for (i = 0; i < len; i++) {
    173173                if (!(dest[i] = src[i]))
  • kernel/generic/src/lib/memstr.c

    rfdb7795 r6c441cf8  
    6060void *_memcpy(void * dst, const void *src, size_t cnt)
    6161{
    62         int i, j;
     62        unsigned int i, j;
    6363       
    6464        if (ALIGN_UP((uintptr_t) src, sizeof(unative_t)) != (uintptr_t) src ||
     
    9090void _memsetb(uintptr_t dst, size_t cnt, uint8_t x)
    9191{
    92         int i;
     92        unsigned int i;
    9393        uint8_t *p = (uint8_t *) dst;
    9494       
     
    109109void _memsetw(uintptr_t dst, size_t cnt, uint16_t x)
    110110{
    111         int i;
     111        unsigned int i;
    112112        uint16_t *p = (uint16_t *) dst;
    113113       
  • kernel/generic/src/lib/sort.c

    rfdb7795 r6c441cf8  
    9797{
    9898        if (n > 4) {
    99                 int i = 0, j = n - 1;
     99                unsigned int i = 0, j = n - 1;
    100100
    101101                memcpy(pivot, data, e_size);
    102102
    103103                while (1) {
    104                         while ((cmp(data + i * e_size, pivot) < 0) && i < n) i++;
    105                         while ((cmp(data + j * e_size, pivot) >=0) && j > 0) j--;
    106                         if (i<j) {
     104                        while ((cmp(data + i * e_size, pivot) < 0) && (i < n))
     105                                i++;
     106                        while ((cmp(data + j * e_size, pivot) >= 0) && (j > 0))
     107                                j--;
     108                       
     109                        if (i < j) {
    107110                                memcpy(tmp, data + i * e_size, e_size);
    108111                                memcpy(data + i * e_size, data + j * e_size, e_size);
  • kernel/generic/src/main/main.c

    rfdb7795 r6c441cf8  
    8787/** Initial user-space tasks */
    8888init_t init = {
    89         0
     89        .cnt = 0
    9090};
    9191
  • kernel/generic/src/mm/as.c

    rfdb7795 r6c441cf8  
    432432                                count_t c =
    433433                                    (count_t) node->value[node->keys - 1];
    434                                 int i = 0;
     434                                unsigned int i = 0;
    435435                       
    436436                                if (overlaps(b, c * PAGE_SIZE, area->base,
     
    562562            cur != &area->used_space.leaf_head; cur = cur->next) {
    563563                btree_node_t *node;
    564                 int i;
     564                unsigned int i;
    565565               
    566566                node = list_get_instance(cur, btree_node_t, leaf_link);
     
    10981098        as_area_t *a;
    10991099        btree_node_t *leaf, *lnode;
    1100         int i;
     1100        unsigned int i;
    11011101       
    11021102        a = (as_area_t *) btree_search(&as->as_area_btree, va, &leaf);
     
    11561156        as_area_t *a;
    11571157        btree_node_t *leaf, *node;
    1158         int i;
     1158        unsigned int i;
    11591159       
    11601160        /*
     
    12651265        btree_node_t *leaf, *node;
    12661266        count_t pages;
    1267         int i;
     1267        unsigned int i;
    12681268
    12691269        ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
     
    15471547        btree_node_t *leaf, *node;
    15481548        count_t pages;
    1549         int i;
     1549        unsigned int i;
    15501550
    15511551        ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
     
    17351735                    cur != &sh_info->pagemap.leaf_head; cur = cur->next) {
    17361736                        btree_node_t *node;
    1737                         int i;
     1737                        unsigned int i;
    17381738                       
    17391739                        node = list_get_instance(cur, btree_node_t, leaf_link);
     
    17961796                node = list_get_instance(cur, btree_node_t, leaf_link);
    17971797               
    1798                 int i;
     1798                unsigned int i;
    17991799                for (i = 0; i < node->keys; i++) {
    18001800                        as_area_t *area = node->value[i];
  • kernel/generic/src/mm/backend_anon.c

    rfdb7795 r6c441cf8  
    9999                if (!frame) {
    100100                        bool allocate = true;
    101                         int i;
     101                        unsigned int i;
    102102                       
    103103                        /*
     
    194194            cur != &area->used_space.leaf_head; cur = cur->next) {
    195195                btree_node_t *node;
    196                 int i;
     196                unsigned int i;
    197197               
    198198                node = list_get_instance(cur, btree_node_t, leaf_link);
     
    200200                        uintptr_t base = node->key[i];
    201201                        count_t count = (count_t) node->value[i];
    202                         int j;
     202                        unsigned int j;
    203203                       
    204204                        for (j = 0; j < count; j++) {
  • kernel/generic/src/mm/backend_elf.c

    rfdb7795 r6c441cf8  
    104104                        ALIGN_DOWN(addr, PAGE_SIZE) - area->base, &leaf);
    105105                if (!frame) {
    106                         int i;
     106                        unsigned int i;
    107107
    108108                        /*
     
    291291        for (cur = &node->leaf_link; cur != &area->used_space.leaf_head;
    292292            cur = cur->next) {
    293                 int i;
     293                unsigned int i;
    294294               
    295295                node = list_get_instance(cur, btree_node_t, leaf_link);
     
    298298                        uintptr_t base = node->key[i];
    299299                        count_t count = (count_t) node->value[i];
    300                         int j;
     300                        unsigned int j;
    301301                       
    302302                        /*
  • kernel/generic/src/mm/frame.c

    rfdb7795 r6c441cf8  
    121121static inline int frame_index_valid(zone_t *zone, index_t index)
    122122{
    123         return (index >= 0) && (index < zone->count);
     123        return (index < zone->count);
    124124}
    125125
     
    211211        spinlock_lock(&zones.lock);
    212212
    213         if (hint >= zones.count || hint < 0)
     213        if (hint >= zones.count)
    214214                hint = 0;
    215215       
     
    720720        spinlock_lock(&zones.lock);
    721721
    722         if (z1 < 0 || z1 >= zones.count || z2 < 0 || z2 >= zones.count)
     722        if ((z1 >= zones.count) || (z2 >= zones.count))
    723723                goto errout;
    724724        /* We can join only 2 zones with none existing inbetween */
  • kernel/generic/src/mm/slab.c

    rfdb7795 r6c441cf8  
    173173        slab_t *slab;
    174174        size_t fsize;
    175         int i;
     175        unsigned int i;
    176176        unsigned int zone = 0;
    177177       
     
    192192       
    193193        /* Fill in slab structures */
    194         for (i=0; i < (1 << cache->order); i++)
    195                 frame_set_parent(ADDR2PFN(KA2PA(data))+i, slab, zone);
     194        for (i = 0; i < ((unsigned int) 1 << cache->order); i++)
     195                frame_set_parent(ADDR2PFN(KA2PA(data)) + i, slab, zone);
    196196
    197197        slab->start = data;
     
    200200        slab->cache = cache;
    201201
    202         for (i=0; i<cache->objects;i++)
     202        for (i = 0; i < cache->objects; i++)
    203203                *((int *) (slab->start + i*cache->size)) = i+1;
    204204
     
    372372                                slab_magazine_t *mag)
    373373{
    374         int i;
     374        unsigned int i;
    375375        count_t frames = 0;
    376376
    377         for (i=0;i < mag->busy; i++) {
     377        for (i = 0; i < mag->busy; i++) {
    378378                frames += slab_obj_destroy(cache, mag->objs[i], NULL);
    379379                atomic_dec(&cache->cached_objs);
     
    528528
    529529/** Return number of objects that fit in certain cache size */
    530 static int comp_objects(slab_cache_t *cache)
     530static unsigned int comp_objects(slab_cache_t *cache)
    531531{
    532532        if (cache->flags & SLAB_CACHE_SLINSIDE)
     
    537537
    538538/** Return wasted space in slab */
    539 static int badness(slab_cache_t *cache)
    540 {
    541         int objects;
    542         int ssize;
     539static unsigned int badness(slab_cache_t *cache)
     540{
     541        unsigned int objects;
     542        unsigned int ssize;
    543543
    544544        objects = comp_objects(cache);
     
    546546        if (cache->flags & SLAB_CACHE_SLINSIDE)
    547547                ssize -= sizeof(slab_t);
    548         return ssize - objects*cache->size;
     548        return ssize - objects * cache->size;
    549549}
    550550
     
    554554static void make_magcache(slab_cache_t *cache)
    555555{
    556         int i;
     556        unsigned int i;
    557557       
    558558        ASSERT(_slab_initialized >= 2);
    559559
    560560        cache->mag_cache = malloc(sizeof(slab_mag_cache_t)*config.cpu_count,0);
    561         for (i=0; i < config.cpu_count; i++) {
     561        for (i = 0; i < config.cpu_count; i++) {
    562562                memsetb((uintptr_t)&cache->mag_cache[i],
    563563                        sizeof(cache->mag_cache[i]), 0);
    564                 spinlock_initialize(&cache->mag_cache[i].lock,
    565                                     "slab_maglock_cpu");
     564                spinlock_initialize(&cache->mag_cache[i].lock, "slab_maglock_cpu");
    566565        }
    567566}
     
    655654static count_t _slab_reclaim(slab_cache_t *cache, int flags)
    656655{
    657         int i;
     656        unsigned int i;
    658657        slab_magazine_t *mag;
    659658        count_t frames = 0;
     
    676675                /* Free cpu-bound magazines */
    677676                /* Destroy CPU magazines */
    678                 for (i=0; i<config.cpu_count; i++) {
     677                for (i = 0; i < config.cpu_count; i++) {
    679678                        spinlock_lock(&cache->mag_cache[i].lock);
    680679
  • kernel/generic/src/mm/tlb.c

    rfdb7795 r6c441cf8  
    8282    uintptr_t page, count_t count)
    8383{
    84         int i;
     84        unsigned int i;
    8585
    8686        CPU->tlb_active = 0;
     
    145145        uintptr_t page;
    146146        count_t count;
    147         int i;
     147        unsigned int i;
    148148       
    149149        ASSERT(CPU);
  • kernel/generic/src/printf/printf_core.c

    rfdb7795 r6c441cf8  
    9494    struct printf_spec *ps)
    9595{
    96         return ps->write((void *)buf, count, ps->data);
     96        return ps->write((void *) buf, count, ps->data);
    9797}
    9898
     
    178178 * @return              Number of characters printed, negative value on failure.
    179179 */
    180 static int print_string(char *s, int width, int precision, uint64_t flags,
    181     struct printf_spec *ps)
     180static int print_string(char *s, int width, unsigned int precision,
     181        uint64_t flags, struct printf_spec *ps)
    182182{
    183183        int counter = 0;
  • kernel/generic/src/proc/task.c

    rfdb7795 r6c441cf8  
    245245        as_t *as;
    246246        as_area_t *a;
    247         int rc;
     247        unsigned int rc;
    248248        thread_t *t;
    249249        task_t *task;
  • kernel/generic/src/synch/futex.c

    rfdb7795 r6c441cf8  
    325325            cur != &TASK->futexes.leaf_head; cur = cur->next) {
    326326                btree_node_t *node;
    327                 int i;
     327                unsigned int i;
    328328               
    329329                node = list_get_instance(cur, btree_node_t, leaf_link);
  • kernel/generic/src/time/clock.c

    rfdb7795 r6c441cf8  
    138138        void *arg;
    139139        count_t missed_clock_ticks = CPU->missed_clock_ticks;
    140         int i;
     140        unsigned int i;
    141141
    142142        /*
Note: See TracChangeset for help on using the changeset viewer.