Changeset 98000fb in mainline for kernel/generic/src


Ignore:
Timestamp:
2009-06-03T19:34:45Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
301ff30
Parents:
69e68e3
Message:

remove redundant index_t and count_t types (which were always quite ambiguous and not actually needed)

Location:
kernel/generic/src
Files:
28 edited

Legend:

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

    r69e68e3 r98000fb  
    5555 * @param bits Number of bits stored in bitmap.
    5656 */
    57 void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, count_t bits)
     57void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits)
    5858{
    5959        bitmap->map = map;
     
    6767 * @param bits Number of bits to set.
    6868 */
    69 void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits)
     69void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits)
    7070{
    71         index_t i=0;
    72         index_t aligned_start;
    73         count_t lub;            /* leading unaligned bits */
    74         count_t amb;            /* aligned middle bits */
    75         count_t tab;            /* trailing aligned bits */
     71        size_t i = 0;
     72        size_t aligned_start;
     73        size_t lub;             /* leading unaligned bits */
     74        size_t amb;             /* aligned middle bits */
     75        size_t tab;             /* trailing aligned bits */
    7676       
    7777        ASSERT(start + bits <= bitmap->bits);
     
    117117 * @param bits Number of bits to clear.
    118118 */
    119 void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits)
     119void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits)
    120120{
    121         index_t i=0;
    122         index_t aligned_start;
    123         count_t lub;            /* leading unaligned bits */
    124         count_t amb;            /* aligned middle bits */
    125         count_t tab;            /* trailing aligned bits */
     121        size_t i = 0;
     122        size_t aligned_start;
     123        size_t lub;             /* leading unaligned bits */
     124        size_t amb;             /* aligned middle bits */
     125        size_t tab;             /* trailing aligned bits */
    126126       
    127127        ASSERT(start + bits <= bitmap->bits);
     
    169169 * @param bits Number of bits to copy.
    170170 */
    171 void bitmap_copy(bitmap_t *dst, bitmap_t *src, count_t bits)
     171void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits)
    172172{
    173         index_t i;
     173        size_t i;
    174174       
    175175        ASSERT(bits <= dst->bits);
  • kernel/generic/src/adt/btree.c

    r69e68e3 r98000fb  
    6464static btree_node_t *node_split(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree, btree_key_t *median);
    6565static btree_node_t *node_combine(btree_node_t *node);
    66 static index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right);
    67 static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx);
    68 static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx);
     66static size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right);
     67static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx);
     68static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx);
    6969static bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree);
    7070static bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree);
     
    138138void btree_destroy_subtree(btree_node_t *root)
    139139{
    140         count_t i;
     140        size_t i;
    141141
    142142        if (root->keys) {
     
    270270       
    271271        if (node->keys > FILL_FACTOR) {
    272                 count_t i;
     272                size_t i;
    273273
    274274                /*
     
    286286               
    287287        } else {
    288                 index_t idx;
     288                size_t idx;
    289289                btree_node_t *rnode, *parent;
    290290
     
    336336                } else {
    337337                        void *val;
    338                         count_t i;
     338                        size_t i;
    339339               
    340340                        /*
     
    443443void node_insert_key_and_lsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *lsubtree)
    444444{
    445         count_t i;
     445        size_t i;
    446446
    447447        for (i = 0; i < node->keys; i++) {
    448448                if (key < node->key[i]) {
    449                         count_t j;
     449                        size_t j;
    450450               
    451451                        for (j = node->keys; j > i; j--) {
     
    479479void node_insert_key_and_rsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree)
    480480{
    481         count_t i;
     481        size_t i;
    482482
    483483        for (i = 0; i < node->keys; i++) {
    484484                if (key < node->key[i]) {
    485                         count_t j;
     485                        size_t j;
    486486               
    487487                        for (j = node->keys; j > i; j--) {
     
    511511void node_remove_key_and_lsubtree(btree_node_t *node, btree_key_t key)
    512512{
    513         count_t i, j;
     513        size_t i, j;
    514514       
    515515        for (i = 0; i < node->keys; i++) {
     
    539539void node_remove_key_and_rsubtree(btree_node_t *node, btree_key_t key)
    540540{
    541         count_t i, j;
     541        size_t i, j;
    542542       
    543543        for (i = 0; i < node->keys; i++) {
     
    577577{
    578578        btree_node_t *rnode;
    579         count_t i, j;
     579        size_t i, j;
    580580
    581581        ASSERT(median);
     
    604604         * If this is an index node, do not copy the median.
    605605         */
    606         i = (count_t) INDEX_NODE(node);
     606        i = (size_t) INDEX_NODE(node);
    607607        for (i += MEDIAN_HIGH_INDEX(node), j = 0; i < node->keys; i++, j++) {
    608608                rnode->key[j] = node->key[i];
     
    637637btree_node_t *node_combine(btree_node_t *node)
    638638{
    639         index_t idx;
     639        size_t idx;
    640640        btree_node_t *rnode;
    641         count_t i;
     641        size_t i;
    642642
    643643        ASSERT(!ROOT_NODE(node));
     
    686686 * @return Index of the key associated with the subtree.
    687687 */
    688 index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right)
    689 {
    690         count_t i;
     688size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right)
     689{
     690        size_t i;
    691691       
    692692        for (i = 0; i < node->keys + 1; i++) {
     
    707707 * @param idx Index of the parent node key that is taking part in the rotation.
    708708 */
    709 void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx)
     709void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx)
    710710{
    711711        btree_key_t key;
     
    744744 * @param idx Index of the parent node key that is taking part in the rotation.
    745745 */
    746 void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx)
     746void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx)
    747747{
    748748        btree_key_t key;
     
    787787bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree)
    788788{
    789         index_t idx;
     789        size_t idx;
    790790        btree_node_t *lnode;
    791791
     
    834834bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree)
    835835{
    836         index_t idx;
     836        size_t idx;
    837837        btree_node_t *rnode;
    838838
     
    873873bool try_rotation_from_left(btree_node_t *rnode)
    874874{
    875         index_t idx;
     875        size_t idx;
    876876        btree_node_t *lnode;
    877877
     
    908908bool try_rotation_from_right(btree_node_t *lnode)
    909909{
    910         index_t idx;
     910        size_t idx;
    911911        btree_node_t *rnode;
    912912
     
    941941void btree_print(btree_t *t)
    942942{
    943         count_t i;
     943        size_t i;
    944944        int depth = t->root->depth;
    945945        link_t head, *cur;
  • kernel/generic/src/adt/hash_table.c

    r69e68e3 r98000fb  
    5252 * @param op Hash table operations structure.
    5353 */
    54 void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op)
     54void hash_table_create(hash_table_t *h, size_t m, size_t max_keys, hash_table_operations_t *op)
    5555{
    56         index_t i;
     56        size_t i;
    5757
    5858        ASSERT(h);
     
    8484void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
    8585{
    86         index_t chain;
     86        size_t chain;
    8787       
    8888        ASSERT(item);
     
    108108{
    109109        link_t *cur;
    110         index_t chain;
     110        size_t chain;
    111111       
    112112        ASSERT(h);
     
    138138 * @param keys Number of keys in the key array.
    139139 */
    140 void hash_table_remove(hash_table_t *h, unative_t key[], count_t keys)
     140void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys)
    141141{
    142         index_t chain;
     142        size_t chain;
    143143        link_t *cur;
    144144       
  • kernel/generic/src/console/cmd.c

    r69e68e3 r98000fb  
    514514       
    515515        link_t *cur;
    516         count_t len = 0;
     516        size_t len = 0;
    517517        for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
    518518                cmd_info_t *hlp;
     
    652652         */
    653653       
    654         count_t i;
     654        size_t i;
    655655        for (i = 0; i < config.cpu_count; i++) {
    656656                if (!cpus[i].active)
     
    971971int cmd_tests(cmd_arg_t *argv)
    972972{
    973         count_t len = 0;
     973        size_t len = 0;
    974974        test_t *test;
    975975        for (test = tests; test->name != NULL; test++) {
  • kernel/generic/src/console/console.c

    r69e68e3 r98000fb  
    6262static bool klog_inited = false;
    6363/** First kernel log characters */
    64 static index_t klog_start = 0;
     64static size_t klog_start = 0;
    6565/** Number of valid kernel log characters */
    6666static size_t klog_len = 0;
     
    171171 *
    172172 */
    173 count_t gets(indev_t *indev, char *buf, size_t buflen)
     173size_t gets(indev_t *indev, char *buf, size_t buflen)
    174174{
    175175        size_t offset = 0;
    176         count_t count = 0;
     176        size_t count = 0;
    177177        buf[offset] = 0;
    178178       
     
    227227        if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
    228228                /* Print charaters stored in kernel log */
    229                 index_t i;
     229                size_t i;
    230230                for (i = klog_len - klog_stored; i < klog_len; i++)
    231231                        stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent);
  • kernel/generic/src/console/kconsole.c

    r69e68e3 r98000fb  
    8787
    8888static wchar_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
    89 static count_t history_pos = 0;
     89static size_t history_pos = 0;
    9090
    9191/** Initialize kconsole data structures
     
    160160
    161161/** Print count times a character */
    162 static void print_cc(wchar_t ch, count_t count)
    163 {
    164         count_t i;
     162static void print_cc(wchar_t ch, size_t count)
     163{
     164        size_t i;
    165165        for (i = 0; i < count; i++)
    166166                putchar(ch);
     
    170170static const char *cmdtab_search_one(const char *name, link_t **startpos)
    171171{
    172         count_t namelen = str_length(name);
     172        size_t namelen = str_length(name);
    173173       
    174174        spinlock_lock(&cmd_lock);
     
    206206        const char *name = input;
    207207       
    208         count_t found = 0;
     208        size_t found = 0;
    209209        link_t *pos = NULL;
    210210        const char *hint;
     
    241241        printf("%s> ", prompt);
    242242       
    243         count_t position = 0;
     243        size_t position = 0;
    244244        wchar_t *current = history[history_pos];
    245245        current[0] = 0;
     
    281281                        /* Find the beginning of the word
    282282                           and copy it to tmp */
    283                         count_t beg;
     283                        size_t beg;
    284284                        for (beg = position - 1; (beg > 0) && (!isspace(current[beg]));
    285285                            beg--);
     
    314314                       
    315315                        size_t off = 0;
    316                         count_t i = 0;
     316                        size_t i = 0;
    317317                        while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) {
    318318                                if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
     
    543543                if (str_lcmp(hlp->name, cmdline + start,
    544544                    max(str_length(hlp->name),
    545                     str_nlength(cmdline + start, (count_t) (end - start) - 1))) == 0) {
     545                    str_nlength(cmdline + start, (size_t) (end - start) - 1))) == 0) {
    546546                        cmd = hlp;
    547547                        break;
     
    569569       
    570570        bool error = false;
    571         count_t i;
     571        size_t i;
    572572        for (i = 0; i < cmd->argc; i++) {
    573573                start = end;
     
    660660        while (true) {
    661661                wchar_t *tmp = clever_readline((char *) prompt, stdin);
    662                 count_t len = wstr_length(tmp);
     662                size_t len = wstr_length(tmp);
    663663                if (!len)
    664664                        continue;
  • kernel/generic/src/ddi/ddi.c

    r69e68e3 r98000fb  
    9898 *
    9999 */
    100 static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
     100static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags)
    101101{
    102102        ASSERT(TASK);
     
    119119        /* Find the zone of the physical memory */
    120120        spinlock_lock(&zones.lock);
    121         count_t znum = find_zone(ADDR2PFN(pf), pages, 0);
    122        
    123         if (znum == (count_t) -1) {
     121        size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
     122       
     123        if (znum == (size_t) -1) {
    124124                /* Frames not found in any zones
    125125                 * -> assume it is hardware device and allow mapping
     
    243243        return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
    244244            FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
    245             (count_t) pages, (int) flags);
     245            (size_t) pages, (int) flags);
    246246}
    247247
  • kernel/generic/src/ddi/irq.c

    r69e68e3 r98000fb  
    100100 * there will be collisions between different keys.
    101101 */
    102 static index_t irq_ht_hash(unative_t *key);
    103 static bool irq_ht_compare(unative_t *key, count_t keys, link_t *item);
     102static size_t irq_ht_hash(unative_t *key);
     103static bool irq_ht_compare(unative_t *key, size_t keys, link_t *item);
    104104static void irq_ht_remove(link_t *item);
    105105
     
    116116 * elements with single key (sharing of one IRQ).
    117117 */
    118 static index_t irq_lin_hash(unative_t *key);
    119 static bool irq_lin_compare(unative_t *key, count_t keys, link_t *item);
     118static size_t irq_lin_hash(unative_t *key);
     119static bool irq_lin_compare(unative_t *key, size_t keys, link_t *item);
    120120static void irq_lin_remove(link_t *item);
    121121
     
    127127
    128128/** Number of buckets in either of the hash tables. */
    129 static count_t buckets;
     129static size_t buckets;
    130130
    131131/** Initialize IRQ subsystem.
     
    134134 * @param chains Number of chains in the hash table.
    135135 */
    136 void irq_init(count_t inrs, count_t chains)
     136void irq_init(size_t inrs, size_t chains)
    137137{
    138138        buckets = chains;
     
    299299 * @return Index into the hash table.
    300300 */
    301 index_t irq_ht_hash(unative_t key[])
     301size_t irq_ht_hash(unative_t key[])
    302302{
    303303        inr_t inr = (inr_t) key[KEY_INR];
     
    325325 * @return True on match or false otherwise.
    326326 */
    327 bool irq_ht_compare(unative_t key[], count_t keys, link_t *item)
     327bool irq_ht_compare(unative_t key[], size_t keys, link_t *item)
    328328{
    329329        irq_t *irq = hash_table_get_instance(item, irq_t, link);
     
    372372 * @return Index into the hash table.
    373373 */
    374 index_t irq_lin_hash(unative_t key[])
     374size_t irq_lin_hash(unative_t key[])
    375375{
    376376        inr_t inr = (inr_t) key[KEY_INR];
     
    398398 * @return True on match or false otherwise.
    399399 */
    400 bool irq_lin_compare(unative_t key[], count_t keys, link_t *item)
     400bool irq_lin_compare(unative_t key[], size_t keys, link_t *item)
    401401{
    402402        irq_t *irq = list_get_instance(item, irq_t, link);
  • kernel/generic/src/debug/symtab.c

    r69e68e3 r98000fb  
    5656{
    5757#ifdef CONFIG_SYMTAB
    58         count_t i;
     58        size_t i;
    5959       
    6060        for (i = 1; symbol_table[i].address_le; i++) {
     
    113113 *
    114114 */
    115 static const char *symtab_search_one(const char *name, count_t *startpos)
    116 {
    117         count_t namelen = str_length(name);
    118        
    119         count_t pos;
     115static const char *symtab_search_one(const char *name, size_t *startpos)
     116{
     117        size_t namelen = str_length(name);
     118       
     119        size_t pos;
    120120        for (pos = *startpos; symbol_table[pos].address_le; pos++) {
    121121                const char *curname = symbol_table[pos].symbol_name;
     
    154154{
    155155#ifdef CONFIG_SYMTAB
    156         count_t found = 0;
    157         count_t pos = 0;
     156        size_t found = 0;
     157        size_t pos = 0;
    158158        const char *hint;
    159159       
     
    183183{
    184184#ifdef CONFIG_SYMTAB
    185         count_t pos = 0;
     185        size_t pos = 0;
    186186        while (symtab_search_one(name, &pos)) {
    187187                uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
     
    204204 *
    205205 */
    206 int symtab_compl(char *input, count_t size)
     206int symtab_compl(char *input, size_t size)
    207207{
    208208#ifdef CONFIG_SYMTAB
     
    217217                return 0;
    218218       
    219         count_t found = 0;
    220         count_t pos = 0;
     219        size_t found = 0;
     220        size_t pos = 0;
    221221        const char *hint;
    222222        char output[MAX_SYMBOL_NAME];
  • kernel/generic/src/ipc/event.c

    r69e68e3 r98000fb  
    6565}
    6666
    67 static int
    68 event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox)
     67static int event_subscribe(event_type_t evno, unative_t method,
     68    answerbox_t *answerbox)
    6969{
    7070        if (evno >= EVENT_END)
     
    123123}
    124124
    125 void
    126 event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
     125void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
    127126    unative_t a4, unative_t a5)
    128127{
  • kernel/generic/src/lib/sort.c

    r69e68e3 r98000fb  
    4646#define EBUFSIZE        32
    4747
    48 void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot);
    49 void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot);
     48void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot);
     49void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot);
    5050
    5151/** Quicksort wrapper
     
    6262 *
    6363 */
    64 void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b))
     64void qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b))
    6565{
    6666        uint8_t buf_tmp[EBUFSIZE];
     
    9494 *
    9595 */
    96 void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot)
     96void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot)
    9797{
    9898        if (n > 4) {
     
    134134 *
    135135 */
    136 void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b))
     136void bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b))
    137137{
    138138        uint8_t buf_slot[EBUFSIZE];
     
    161161 *
    162162 */
    163 void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot)
     163void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot)
    164164{
    165165        bool done = false;
  • kernel/generic/src/lib/string.c

    r69e68e3 r98000fb  
    6363 *
    6464 *  [wide] string length  number of CHARACTERS in a [wide] string (excluding
    65  *                        the NULL-terminator), count_t
     65 *                        the NULL-terminator), size_t
    6666 *
    6767 *  [wide] string width   number of display cells on a monospace display taken
    68  *                        by a [wide] string, count_t
     68 *                        by a [wide] string, size_t
    6969 *
    7070 *
     
    7676 *                            NULL-terminator)
    7777 *
    78  *  length  l        count_t  number of CHARACTERS in a string (excluding the
     78 *  length  l        size_t   number of CHARACTERS in a string (excluding the
    7979 *                            null terminator)
    8080 *
    81  *  width  w         count_t  number of display cells on a monospace display
     81 *  width  w         size_t   number of display cells on a monospace display
    8282 *                            taken by a string
    8383 *
     
    9898 *  pointer (char *, wchar_t *)
    9999 *  byte offset (size_t)
    100  *  character index (count_t)
     100 *  character index (size_t)
    101101 *
    102102 */
     
    310310 *
    311311 */
    312 size_t str_lsize(const char *str, count_t max_len)
    313 {
    314         count_t len = 0;
     312size_t str_lsize(const char *str, size_t max_len)
     313{
     314        size_t len = 0;
    315315        size_t offset = 0;
    316316       
     
    338338 *
    339339 */
    340 size_t wstr_lsize(const wchar_t *str, count_t max_len)
     340size_t wstr_lsize(const wchar_t *str, size_t max_len)
    341341{
    342342        return (wstr_nlength(str, max_len * sizeof(wchar_t)) * sizeof(wchar_t));
     
    350350 *
    351351 */
    352 count_t str_length(const char *str)
    353 {
    354         count_t len = 0;
     352size_t str_length(const char *str)
     353{
     354        size_t len = 0;
    355355        size_t offset = 0;
    356356       
     
    368368 *
    369369 */
    370 count_t wstr_length(const wchar_t *wstr)
    371 {
    372         count_t len = 0;
     370size_t wstr_length(const wchar_t *wstr)
     371{
     372        size_t len = 0;
    373373       
    374374        while (*wstr++ != 0)
     
    386386 *
    387387 */
    388 count_t str_nlength(const char *str, size_t size)
    389 {
    390         count_t len = 0;
     388size_t str_nlength(const char *str, size_t size)
     389{
     390        size_t len = 0;
    391391        size_t offset = 0;
    392392       
     
    405405 *
    406406 */
    407 count_t wstr_nlength(const wchar_t *str, size_t size)
    408 {
    409         count_t len = 0;
    410         count_t limit = ALIGN_DOWN(size, sizeof(wchar_t));
    411         count_t offset = 0;
     407size_t wstr_nlength(const wchar_t *str, size_t size)
     408{
     409        size_t len = 0;
     410        size_t limit = ALIGN_DOWN(size, sizeof(wchar_t));
     411        size_t offset = 0;
    412412       
    413413        while ((offset < limit) && (*str++ != 0)) {
     
    497497 *
    498498 */
    499 int str_lcmp(const char *s1, const char *s2, count_t max_len)
     499int str_lcmp(const char *s1, const char *s2, size_t max_len)
    500500{
    501501        wchar_t c1 = 0;
     
    505505        size_t off2 = 0;
    506506       
    507         count_t len = 0;
     507        size_t len = 0;
    508508
    509509        while (true) {
     
    616616       
    617617        wchar_t ch;
    618         count_t src_idx = 0;
     618        size_t src_idx = 0;
    619619        size_t dst_off = 0;
    620620       
     
    667667 *
    668668 */
    669 bool wstr_linsert(wchar_t *str, wchar_t ch, count_t pos, count_t max_pos)
    670 {
    671         count_t len = wstr_length(str);
     669bool wstr_linsert(wchar_t *str, wchar_t ch, size_t pos, size_t max_pos)
     670{
     671        size_t len = wstr_length(str);
    672672       
    673673        if ((pos > len) || (pos + 1 > max_pos))
    674674                return false;
    675675       
    676         count_t i;
     676        size_t i;
    677677        for (i = len; i + 1 > pos; i--)
    678678                str[i + 1] = str[i];
     
    695695 *
    696696 */
    697 bool wstr_remove(wchar_t *str, count_t pos)
    698 {
    699         count_t len = wstr_length(str);
     697bool wstr_remove(wchar_t *str, size_t pos)
     698{
     699        size_t len = wstr_length(str);
    700700       
    701701        if (pos >= len)
    702702                return false;
    703703       
    704         count_t i;
     704        size_t i;
    705705        for (i = pos + 1; i <= len; i++)
    706706                str[i - 1] = str[i];
  • kernel/generic/src/main/kinit.c

    r69e68e3 r98000fb  
    128128       
    129129        if (config.cpu_count > 1) {
    130                 count_t i;
     130                size_t i;
    131131               
    132132                /*
     
    141141                                thread_ready(thread);
    142142                        } else
    143                                 printf("Unable to create kcpulb thread for cpu" PRIc "\n", i);
     143                                printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
    144144                }
    145145        }
     
    169169         * Create user tasks, load RAM disk images.
    170170         */
    171         count_t i;
     171        size_t i;
    172172        program_t programs[CONFIG_INIT_TASKS];
    173173       
    174174        for (i = 0; i < init.cnt; i++) {
    175175                if (init.tasks[i].addr % FRAME_SIZE) {
    176                         printf("init[%" PRIc "].addr is not frame aligned\n", i);
     176                        printf("init[%" PRIs "].addr is not frame aligned\n", i);
    177177                        continue;
    178178                }
     
    214214                       
    215215                        if (rd != RE_OK)
    216                                 printf("Init binary %" PRIc " not used (error %d)\n", i, rd);
     216                                printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
    217217                }
    218218        }
  • kernel/generic/src/main/main.c

    r69e68e3 r98000fb  
    154154       
    155155        /* Avoid placing stack on top of init */
    156         count_t i;
     156        size_t i;
    157157        for (i = 0; i < init.cnt; i++) {
    158158                if (PA_overlaps(config.stack_base, config.stack_size,
     
    234234        LOG_EXEC(slab_enable_cpucache());
    235235       
    236         printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n",
     236        printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n",
    237237            config.cpu_count, SIZE2MB(zone_total_size()));
    238238       
     
    248248       
    249249        if (init.cnt > 0) {
    250                 count_t i;
     250                size_t i;
    251251                for (i = 0; i < init.cnt; i++)
    252                         LOG("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc
     252                        LOG("init[%" PRIs "].addr=%#" PRIp ", init[%" PRIs
    253253                            "].size=%#" PRIs, i, init.tasks[i].addr, i,
    254254                            init.tasks[i].size);
  • kernel/generic/src/mm/as.c

    r69e68e3 r98000fb  
    419419                        if ((cond = (bool) node->keys)) {
    420420                                uintptr_t b = node->key[node->keys - 1];
    421                                 count_t c =
    422                                     (count_t) node->value[node->keys - 1];
     421                                size_t c =
     422                                    (size_t) node->value[node->keys - 1];
    423423                                unsigned int i = 0;
    424424                       
     
    556556                for (i = 0; i < node->keys; i++) {
    557557                        uintptr_t b = node->key[i];
    558                         count_t j;
     558                        size_t j;
    559559                        pte_t *pte;
    560560                       
    561                         for (j = 0; j < (count_t) node->value[i]; j++) {
     561                        for (j = 0; j < (size_t) node->value[i]; j++) {
    562562                                page_table_lock(as, false);
    563563                                pte = page_mapping_find(as, b + j * PAGE_SIZE);
     
    789789        int page_flags;
    790790        uintptr_t *old_frame;
    791         index_t frame_idx;
    792         count_t used_pages;
     791        size_t frame_idx;
     792        size_t used_pages;
    793793       
    794794        /* Flags for the new memory mapping */
     
    828828                node = list_get_instance(cur, btree_node_t, leaf_link);
    829829                for (i = 0; i < node->keys; i++) {
    830                         used_pages += (count_t) node->value[i];
     830                        used_pages += (size_t) node->value[i];
    831831                }
    832832        }
     
    854854                for (i = 0; i < node->keys; i++) {
    855855                        uintptr_t b = node->key[i];
    856                         count_t j;
     856                        size_t j;
    857857                        pte_t *pte;
    858858                       
    859                         for (j = 0; j < (count_t) node->value[i]; j++) {
     859                        for (j = 0; j < (size_t) node->value[i]; j++) {
    860860                                page_table_lock(as, false);
    861861                                pte = page_mapping_find(as, b + j * PAGE_SIZE);
     
    904904                for (i = 0; i < node->keys; i++) {
    905905                        uintptr_t b = node->key[i];
    906                         count_t j;
     906                        size_t j;
    907907                       
    908                         for (j = 0; j < (count_t) node->value[i]; j++) {
     908                        for (j = 0; j < (size_t) node->value[i]; j++) {
    909909                                page_table_lock(as, false);
    910910
     
    13981398 * @return              Zero on failure and non-zero on success.
    13991399 */
    1400 int used_space_insert(as_area_t *a, uintptr_t page, count_t count)
     1400int used_space_insert(as_area_t *a, uintptr_t page, size_t count)
    14011401{
    14021402        btree_node_t *leaf, *node;
    1403         count_t pages;
     1403        size_t pages;
    14041404        unsigned int i;
    14051405
     
    14071407        ASSERT(count);
    14081408
    1409         pages = (count_t) btree_search(&a->used_space, page, &leaf);
     1409        pages = (size_t) btree_search(&a->used_space, page, &leaf);
    14101410        if (pages) {
    14111411                /*
     
    14241424                uintptr_t left_pg = node->key[node->keys - 1];
    14251425                uintptr_t right_pg = leaf->key[0];
    1426                 count_t left_cnt = (count_t) node->value[node->keys - 1];
    1427                 count_t right_cnt = (count_t) leaf->value[0];
     1426                size_t left_cnt = (size_t) node->value[node->keys - 1];
     1427                size_t right_cnt = (size_t) leaf->value[0];
    14281428               
    14291429                /*
     
    14791479        } else if (page < leaf->key[0]) {
    14801480                uintptr_t right_pg = leaf->key[0];
    1481                 count_t right_cnt = (count_t) leaf->value[0];
     1481                size_t right_cnt = (size_t) leaf->value[0];
    14821482       
    14831483                /*
     
    15141514                uintptr_t left_pg = leaf->key[leaf->keys - 1];
    15151515                uintptr_t right_pg = node->key[0];
    1516                 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
    1517                 count_t right_cnt = (count_t) node->value[0];
     1516                size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
     1517                size_t right_cnt = (size_t) node->value[0];
    15181518               
    15191519                /*
     
    15691569        } else if (page >= leaf->key[leaf->keys - 1]) {
    15701570                uintptr_t left_pg = leaf->key[leaf->keys - 1];
    1571                 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
     1571                size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
    15721572       
    15731573                /*
     
    16071607                        uintptr_t left_pg = leaf->key[i - 1];
    16081608                        uintptr_t right_pg = leaf->key[i];
    1609                         count_t left_cnt = (count_t) leaf->value[i - 1];
    1610                         count_t right_cnt = (count_t) leaf->value[i];
     1609                        size_t left_cnt = (size_t) leaf->value[i - 1];
     1610                        size_t right_cnt = (size_t) leaf->value[i];
    16111611
    16121612                        /*
     
    16661666        }
    16671667
    1668         panic("Inconsistency detected while adding %" PRIc " pages of used "
     1668        panic("Inconsistency detected while adding %" PRIs " pages of used "
    16691669            "space at %p.", count, page);
    16701670}
     
    16801680 * @return              Zero on failure and non-zero on success.
    16811681 */
    1682 int used_space_remove(as_area_t *a, uintptr_t page, count_t count)
     1682int used_space_remove(as_area_t *a, uintptr_t page, size_t count)
    16831683{
    16841684        btree_node_t *leaf, *node;
    1685         count_t pages;
     1685        size_t pages;
    16861686        unsigned int i;
    16871687
     
    16891689        ASSERT(count);
    16901690
    1691         pages = (count_t) btree_search(&a->used_space, page, &leaf);
     1691        pages = (size_t) btree_search(&a->used_space, page, &leaf);
    16921692        if (pages) {
    16931693                /*
     
    17181718        if (node && page < leaf->key[0]) {
    17191719                uintptr_t left_pg = node->key[node->keys - 1];
    1720                 count_t left_cnt = (count_t) node->value[node->keys - 1];
     1720                size_t left_cnt = (size_t) node->value[node->keys - 1];
    17211721
    17221722                if (overlaps(left_pg, left_cnt * PAGE_SIZE, page,
     
    17341734                        } else if (page + count * PAGE_SIZE <
    17351735                            left_pg + left_cnt*PAGE_SIZE) {
    1736                                 count_t new_cnt;
     1736                                size_t new_cnt;
    17371737                               
    17381738                                /*
     
    17581758        if (page > leaf->key[leaf->keys - 1]) {
    17591759                uintptr_t left_pg = leaf->key[leaf->keys - 1];
    1760                 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
     1760                size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
    17611761
    17621762                if (overlaps(left_pg, left_cnt * PAGE_SIZE, page,
     
    17731773                        } else if (page + count * PAGE_SIZE < left_pg +
    17741774                            left_cnt * PAGE_SIZE) {
    1775                                 count_t new_cnt;
     1775                                size_t new_cnt;
    17761776                               
    17771777                                /*
     
    18001800                if (page < leaf->key[i]) {
    18011801                        uintptr_t left_pg = leaf->key[i - 1];
    1802                         count_t left_cnt = (count_t) leaf->value[i - 1];
     1802                        size_t left_cnt = (size_t) leaf->value[i - 1];
    18031803
    18041804                        /*
     
    18201820                                } else if (page + count * PAGE_SIZE <
    18211821                                    left_pg + left_cnt * PAGE_SIZE) {
    1822                                         count_t new_cnt;
     1822                                        size_t new_cnt;
    18231823                               
    18241824                                        /*
     
    18451845
    18461846error:
    1847         panic("Inconsistency detected while removing %" PRIc " pages of used "
     1847        panic("Inconsistency detected while removing %" PRIs " pages of used "
    18481848            "space from %p.", count, page);
    18491849}
     
    19441944               
    19451945                        mutex_lock(&area->lock);
    1946                         printf("as_area: %p, base=%p, pages=%" PRIc
     1946                        printf("as_area: %p, base=%p, pages=%" PRIs
    19471947                            " (%p - %p)\n", area, area->base, area->pages,
    19481948                            area->base, area->base + FRAMES2SIZE(area->pages));
  • kernel/generic/src/mm/backend_anon.c

    r69e68e3 r98000fb  
    196196                for (i = 0; i < node->keys; i++) {
    197197                        uintptr_t base = node->key[i];
    198                         count_t count = (count_t) node->value[i];
     198                        size_t count = (size_t) node->value[i];
    199199                        unsigned int j;
    200200                       
  • kernel/generic/src/mm/backend_elf.c

    r69e68e3 r98000fb  
    8383        btree_node_t *leaf;
    8484        uintptr_t base, frame, page, start_anon;
    85         index_t i;
     85        size_t i;
    8686        bool dirty = false;
    8787
     
    235235        elf_segment_header_t *entry = area->backend_data.segment;
    236236        uintptr_t base, start_anon;
    237         index_t i;
     237        size_t i;
    238238
    239239        ASSERT((page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) &&
     
    305305                for (i = 0; i < node->keys; i++) {
    306306                        uintptr_t base = node->key[i];
    307                         count_t count = (count_t) node->value[i];
     307                        size_t count = (size_t) node->value[i];
    308308                        unsigned int j;
    309309                       
  • kernel/generic/src/mm/frame.c

    r69e68e3 r98000fb  
    6868mutex_t mem_avail_mtx;
    6969condvar_t mem_avail_cv;
    70 count_t mem_avail_req = 0;  /**< Number of frames requested. */
    71 count_t mem_avail_gen = 0;  /**< Generation counter. */
     70size_t mem_avail_req = 0;  /**< Number of frames requested. */
     71size_t mem_avail_gen = 0;  /**< Generation counter. */
    7272
    7373/********************/
     
    7575/********************/
    7676
    77 static inline index_t frame_index(zone_t *zone, frame_t *frame)
    78 {
    79         return (index_t) (frame - zone->frames);
    80 }
    81 
    82 static inline index_t frame_index_abs(zone_t *zone, frame_t *frame)
    83 {
    84         return (index_t) (frame - zone->frames) + zone->base;
    85 }
    86 
    87 static inline bool frame_index_valid(zone_t *zone, index_t index)
     77static inline size_t frame_index(zone_t *zone, frame_t *frame)
     78{
     79        return (size_t) (frame - zone->frames);
     80}
     81
     82static inline size_t frame_index_abs(zone_t *zone, frame_t *frame)
     83{
     84        return (size_t) (frame - zone->frames) + zone->base;
     85}
     86
     87static inline bool frame_index_valid(zone_t *zone, size_t index)
    8888{
    8989        return (index < zone->count);
    9090}
    9191
    92 static inline index_t make_frame_index(zone_t *zone, frame_t *frame)
     92static inline size_t make_frame_index(zone_t *zone, frame_t *frame)
    9393{
    9494        return (frame - zone->frames);
     
    121121 *
    122122 */
    123 static count_t zones_insert_zone(pfn_t base, count_t count)
     123static size_t zones_insert_zone(pfn_t base, size_t count)
    124124{
    125125        if (zones.count + 1 == ZONES_MAX) {
    126126                printf("Maximum zone count %u exceeded!\n", ZONES_MAX);
    127                 return (count_t) -1;
    128         }
    129        
    130         count_t i;
     127                return (size_t) -1;
     128        }
     129       
     130        size_t i;
    131131        for (i = 0; i < zones.count; i++) {
    132132                /* Check for overlap */
     
    134134                    zones.info[i].base, zones.info[i].count)) {
    135135                        printf("Zones overlap!\n");
    136                         return (count_t) -1;
     136                        return (size_t) -1;
    137137                }
    138138                if (base < zones.info[i].base)
     
    141141       
    142142        /* Move other zones up */
    143         count_t j;
     143        size_t j;
    144144        for (j = zones.count; j > i; j--) {
    145145                zones.info[j] = zones.info[j - 1];
     
    162162 */
    163163#ifdef CONFIG_DEBUG
    164 static count_t total_frames_free(void)
    165 {
    166         count_t total = 0;
    167         count_t i;
     164static size_t total_frames_free(void)
     165{
     166        size_t total = 0;
     167        size_t i;
    168168        for (i = 0; i < zones.count; i++)
    169169                total += zones.info[i].free_count;
     
    185185 *
    186186 */
    187 count_t find_zone(pfn_t frame, count_t count, count_t hint)
     187size_t find_zone(pfn_t frame, size_t count, size_t hint)
    188188{
    189189        if (hint >= zones.count)
    190190                hint = 0;
    191191       
    192         count_t i = hint;
     192        size_t i = hint;
    193193        do {
    194194                if ((zones.info[i].base <= frame)
     
    201201        } while (i != hint);
    202202       
    203         return (count_t) -1;
     203        return (size_t) -1;
    204204}
    205205
     
    221221 *
    222222 */
    223 static count_t find_free_zone(uint8_t order, zone_flags_t flags, count_t hint)
     223static size_t find_free_zone(uint8_t order, zone_flags_t flags, size_t hint)
    224224{
    225225        if (hint >= zones.count)
    226226                hint = 0;
    227227       
    228         count_t i = hint;
     228        size_t i = hint;
    229229        do {
    230230                /*
     
    244244        } while (i != hint);
    245245       
    246         return (count_t) -1;
     246        return (size_t) -1;
    247247}
    248248
     
    266266        zone_t *zone = (zone_t *) buddy->data;
    267267       
    268         index_t index = frame_index(zone, frame);
     268        size_t index = frame_index(zone, frame);
    269269        do {
    270270                if (zone->frames[index].buddy_order != order)
     
    292292        bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame);
    293293       
    294         index_t index;
     294        size_t index;
    295295        if (is_left) {
    296296                index = (frame_index(zone, frame)) +
     
    447447 *
    448448 */
    449 static void zone_frame_free(zone_t *zone, index_t frame_idx)
     449static void zone_frame_free(zone_t *zone, size_t frame_idx)
    450450{
    451451        ASSERT(zone_flags_available(zone->flags));
     
    468468
    469469/** Return frame from zone. */
    470 static frame_t *zone_get_frame(zone_t *zone, index_t frame_idx)
     470static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx)
    471471{
    472472        ASSERT(frame_idx < zone->count);
     
    475475
    476476/** Mark frame in zone unavailable to allocation. */
    477 static void zone_mark_unavailable(zone_t *zone, index_t frame_idx)
     477static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)
    478478{
    479479        ASSERT(zone_flags_available(zone->flags));
     
    504504 *
    505505 */
    506 static void zone_merge_internal(count_t z1, count_t z2, zone_t *old_z1, buddy_system_t *buddy)
     506static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, buddy_system_t *buddy)
    507507{
    508508        ASSERT(zone_flags_available(zones.info[z1].flags));
     
    530530       
    531531        /* This marks all frames busy */
    532         count_t i;
     532        size_t i;
    533533        for (i = 0; i < zones.info[z1].count; i++)
    534534                frame_initialize(&zones.info[z1].frames[i]);
     
    600600 *
    601601 */
    602 static void return_config_frames(count_t znum, pfn_t pfn, count_t count)
     602static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
    603603{
    604604        ASSERT(zone_flags_available(zones.info[znum].flags));
    605605       
    606         count_t cframes = SIZE2FRAMES(zone_conf_size(count));
     606        size_t cframes = SIZE2FRAMES(zone_conf_size(count));
    607607       
    608608        if ((pfn < zones.info[znum].base)
     
    615615        ASSERT(!frame->buddy_order);
    616616       
    617         count_t i;
     617        size_t i;
    618618        for (i = 0; i < cframes; i++) {
    619619                zones.info[znum].busy_count++;
     
    635635 *
    636636 */
    637 static void zone_reduce_region(count_t znum, pfn_t frame_idx, count_t count)
     637static void zone_reduce_region(size_t znum, pfn_t frame_idx, size_t count)
    638638{
    639639        ASSERT(zone_flags_available(zones.info[znum].flags));
     
    641641       
    642642        uint8_t order = zones.info[znum].frames[frame_idx].buddy_order;
    643         ASSERT((count_t) (1 << order) >= count);
     643        ASSERT((size_t) (1 << order) >= count);
    644644       
    645645        /* Reduce all blocks to order 0 */
    646         count_t i;
    647         for (i = 0; i < (count_t) (1 << order); i++) {
     646        size_t i;
     647        for (i = 0; i < (size_t) (1 << order); i++) {
    648648                frame_t *frame = &zones.info[znum].frames[i + frame_idx];
    649649                frame->buddy_order = 0;
     
    654654       
    655655        /* Free unneeded frames */
    656         for (i = count; i < (count_t) (1 << order); i++)
     656        for (i = count; i < (size_t) (1 << order); i++)
    657657                zone_frame_free(&zones.info[znum], i + frame_idx);
    658658}
     
    671671 *
    672672 */
    673 bool zone_merge(count_t z1, count_t z2)
     673bool zone_merge(size_t z1, size_t z2)
    674674{
    675675        ipl_t ipl = interrupts_disable();
     
    734734       
    735735        /* Move zones down */
    736         count_t i;
     736        size_t i;
    737737        for (i = z2 + 1; i < zones.count; i++) {
    738738                zones.info[i - 1] = zones.info[i];
     
    759759void zone_merge_all(void)
    760760{
    761         count_t i = 0;
     761        size_t i = 0;
    762762        while (i < zones.count) {
    763763                if (!zone_merge(i, i + 1))
     
    777777 *
    778778 */
    779 static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, count_t count, zone_flags_t flags)
     779static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, size_t count, zone_flags_t flags)
    780780{
    781781        zone->base = start;
     
    800800                    buddy_conf_size(order));
    801801               
    802                 count_t i;
     802                size_t i;
    803803                for (i = 0; i < count; i++)
    804804                        frame_initialize(&zone->frames[i]);
     
    820820 *
    821821 */
    822 uintptr_t zone_conf_size(count_t count)
     822uintptr_t zone_conf_size(size_t count)
    823823{
    824824        return (count * sizeof(frame_t) + buddy_conf_size(fnzb(count)));
     
    841841 *
    842842 */
    843 count_t zone_create(pfn_t start, count_t count, pfn_t confframe, zone_flags_t flags)
     843size_t zone_create(pfn_t start, size_t count, pfn_t confframe, zone_flags_t flags)
    844844{
    845845        ipl_t ipl = interrupts_disable();
     
    856856                 * it does not span kernel & init
    857857                 */
    858                 count_t confcount = SIZE2FRAMES(zone_conf_size(count));
     858                size_t confcount = SIZE2FRAMES(zone_conf_size(count));
    859859                if ((confframe >= start) && (confframe < start + count)) {
    860860                        for (; confframe < start + count; confframe++) {
     
    869869                               
    870870                                bool overlap = false;
    871                                 count_t i;
     871                                size_t i;
    872872                                for (i = 0; i < init.cnt; i++)
    873873                                        if (overlaps(addr, PFN2ADDR(confcount),
     
    887887                }
    888888               
    889                 count_t znum = zones_insert_zone(start, count);
    890                 if (znum == (count_t) -1) {
     889                size_t znum = zones_insert_zone(start, count);
     890                if (znum == (size_t) -1) {
    891891                        spinlock_unlock(&zones.lock);
    892892                        interrupts_restore(ipl);
    893                         return (count_t) -1;
     893                        return (size_t) -1;
    894894                }
    895895               
     
    899899                /* If confdata in zone, mark as unavailable */
    900900                if ((confframe >= start) && (confframe < start + count)) {
    901                         count_t i;
     901                        size_t i;
    902902                        for (i = confframe; i < confframe + confcount; i++)
    903903                                zone_mark_unavailable(&zones.info[znum],
     
    912912       
    913913        /* Non-available zone */
    914         count_t znum = zones_insert_zone(start, count);
    915         if (znum == (count_t) -1) {
     914        size_t znum = zones_insert_zone(start, count);
     915        if (znum == (size_t) -1) {
    916916                spinlock_unlock(&zones.lock);
    917917                interrupts_restore(ipl);
    918                 return (count_t) -1;
     918                return (size_t) -1;
    919919        }
    920920        zone_construct(&zones.info[znum], NULL, start, count, flags);
     
    931931
    932932/** Set parent of frame. */
    933 void frame_set_parent(pfn_t pfn, void *data, count_t hint)
     933void frame_set_parent(pfn_t pfn, void *data, size_t hint)
    934934{
    935935        ipl_t ipl = interrupts_disable();
    936936        spinlock_lock(&zones.lock);
    937937       
    938         count_t znum = find_zone(pfn, 1, hint);
    939        
    940         ASSERT(znum != (count_t) -1);
     938        size_t znum = find_zone(pfn, 1, hint);
     939       
     940        ASSERT(znum != (size_t) -1);
    941941       
    942942        zone_get_frame(&zones.info[znum],
     
    947947}
    948948
    949 void *frame_get_parent(pfn_t pfn, count_t hint)
     949void *frame_get_parent(pfn_t pfn, size_t hint)
    950950{
    951951        ipl_t ipl = interrupts_disable();
    952952        spinlock_lock(&zones.lock);
    953953       
    954         count_t znum = find_zone(pfn, 1, hint);
    955        
    956         ASSERT(znum != (count_t) -1);
     954        size_t znum = find_zone(pfn, 1, hint);
     955       
     956        ASSERT(znum != (size_t) -1);
    957957       
    958958        void *res = zone_get_frame(&zones.info[znum],
     
    974974 *
    975975 */
    976 void *frame_alloc_generic(uint8_t order, frame_flags_t flags, count_t *pzone)
    977 {
    978         count_t size = ((count_t) 1) << order;
     976void *frame_alloc_generic(uint8_t order, frame_flags_t flags, size_t *pzone)
     977{
     978        size_t size = ((size_t) 1) << order;
    979979        ipl_t ipl;
    980         count_t hint = pzone ? (*pzone) : 0;
     980        size_t hint = pzone ? (*pzone) : 0;
    981981       
    982982loop:
     
    987987         * First, find suitable frame zone.
    988988         */
    989         count_t znum = find_free_zone(order,
     989        size_t znum = find_free_zone(order,
    990990            FRAME_TO_ZONE_FLAGS(flags), hint);
    991991       
    992992        /* If no memory, reclaim some slab memory,
    993993           if it does not help, reclaim all */
    994         if ((znum == (count_t) -1) && (!(flags & FRAME_NO_RECLAIM))) {
     994        if ((znum == (size_t) -1) && (!(flags & FRAME_NO_RECLAIM))) {
    995995                spinlock_unlock(&zones.lock);
    996996                interrupts_restore(ipl);
    997997               
    998                 count_t freed = slab_reclaim(0);
     998                size_t freed = slab_reclaim(0);
    999999               
    10001000                ipl = interrupts_disable();
     
    10051005                            FRAME_TO_ZONE_FLAGS(flags), hint);
    10061006               
    1007                 if (znum == (count_t) -1) {
     1007                if (znum == (size_t) -1) {
    10081008                        spinlock_unlock(&zones.lock);
    10091009                        interrupts_restore(ipl);
     
    10201020        }
    10211021       
    1022         if (znum == (count_t) -1) {
     1022        if (znum == (size_t) -1) {
    10231023                if (flags & FRAME_ATOMIC) {
    10241024                        spinlock_unlock(&zones.lock);
     
    10281028               
    10291029#ifdef CONFIG_DEBUG
    1030                 count_t avail = total_frames_free();
     1030                size_t avail = total_frames_free();
    10311031#endif
    10321032               
     
    10391039               
    10401040#ifdef CONFIG_DEBUG
    1041                 printf("Thread %" PRIu64 " waiting for %" PRIc " frames, "
    1042                     "%" PRIc " available.\n", THREAD->tid, size, avail);
     1041                printf("Thread %" PRIu64 " waiting for %" PRIs " frames, "
     1042                    "%" PRIs " available.\n", THREAD->tid, size, avail);
    10431043#endif
    10441044               
     
    10491049                else
    10501050                        mem_avail_req = size;
    1051                 count_t gen = mem_avail_gen;
     1051                size_t gen = mem_avail_gen;
    10521052               
    10531053                while (gen == mem_avail_gen)
     
    10961096         */
    10971097        pfn_t pfn = ADDR2PFN(frame);
    1098         count_t znum = find_zone(pfn, 1, NULL);
    1099        
    1100         ASSERT(znum != (count_t) -1);
     1098        size_t znum = find_zone(pfn, 1, NULL);
     1099       
     1100        ASSERT(znum != (size_t) -1);
    11011101       
    11021102        zone_frame_free(&zones.info[znum], pfn - zones.info[znum].base);
     
    11351135         * First, find host frame zone for addr.
    11361136         */
    1137         count_t znum = find_zone(pfn, 1, NULL);
    1138        
    1139         ASSERT(znum != (count_t) -1);
     1137        size_t znum = find_zone(pfn, 1, NULL);
     1138       
     1139        ASSERT(znum != (size_t) -1);
    11401140       
    11411141        zones.info[znum].frames[pfn - zones.info[znum].base].refcount++;
     
    11461146
    11471147/** Mark given range unavailable in frame zones. */
    1148 void frame_mark_unavailable(pfn_t start, count_t count)
     1148void frame_mark_unavailable(pfn_t start, size_t count)
    11491149{
    11501150        ipl_t ipl = interrupts_disable();
    11511151        spinlock_lock(&zones.lock);
    11521152       
    1153         count_t i;
     1153        size_t i;
    11541154        for (i = 0; i < count; i++) {
    1155                 count_t znum = find_zone(start + i, 1, 0);
    1156                 if (znum == (count_t) -1)  /* PFN not found */
     1155                size_t znum = find_zone(start + i, 1, 0);
     1156                if (znum == (size_t) -1)  /* PFN not found */
    11571157                        continue;
    11581158               
     
    11831183                    SIZE2FRAMES(config.stack_size));
    11841184               
    1185                 count_t i;
     1185                size_t i;
    11861186                for (i = 0; i < init.cnt; i++) {
    11871187                        pfn_t pfn = ADDR2PFN(KA2PA(init.tasks[i].addr));
     
    12081208       
    12091209        uint64_t total = 0;
    1210         count_t i;
     1210        size_t i;
    12111211        for (i = 0; i < zones.count; i++)
    12121212                total += (uint64_t) FRAMES2SIZE(zones.info[i].count);
     
    12421242         */
    12431243       
    1244         count_t i;
     1244        size_t i;
    12451245        for (i = 0;; i++) {
    12461246                ipl_t ipl = interrupts_disable();
     
    12541254               
    12551255                uintptr_t base = PFN2ADDR(zones.info[i].base);
    1256                 count_t count = zones.info[i].count;
     1256                size_t count = zones.info[i].count;
    12571257                zone_flags_t flags = zones.info[i].flags;
    1258                 count_t free_count = zones.info[i].free_count;
    1259                 count_t busy_count = zones.info[i].busy_count;
     1258                size_t free_count = zones.info[i].free_count;
     1259                size_t busy_count = zones.info[i].busy_count;
    12601260               
    12611261                spinlock_unlock(&zones.lock);
     
    12641264                bool available = zone_flags_available(flags);
    12651265               
    1266                 printf("%-2" PRIc, i);
     1266                printf("%-2" PRIs, i);
    12671267               
    12681268#ifdef __32_BITS__
     
    12741274#endif
    12751275               
    1276                 printf(" %12" PRIc " %c%c%c      ", count,
     1276                printf(" %12" PRIs " %c%c%c      ", count,
    12771277                    available ? 'A' : ' ',
    12781278                    (flags & ZONE_RESERVED) ? 'R' : ' ',
     
    12801280               
    12811281                if (available)
    1282                         printf("%12" PRIc " %12" PRIc,
     1282                        printf("%12" PRIs " %12" PRIs,
    12831283                            free_count, busy_count);
    12841284               
     
    12921292 *
    12931293 */
    1294 void zone_print_one(count_t num)
     1294void zone_print_one(size_t num)
    12951295{
    12961296        ipl_t ipl = interrupts_disable();
    12971297        spinlock_lock(&zones.lock);
    1298         count_t znum = (count_t) -1;
    1299        
    1300         count_t i;
     1298        size_t znum = (size_t) -1;
     1299       
     1300        size_t i;
    13011301        for (i = 0; i < zones.count; i++) {
    13021302                if ((i == num) || (PFN2ADDR(zones.info[i].base) == num)) {
     
    13061306        }
    13071307       
    1308         if (znum == (count_t) -1) {
     1308        if (znum == (size_t) -1) {
    13091309                spinlock_unlock(&zones.lock);
    13101310                interrupts_restore(ipl);
     
    13151315        uintptr_t base = PFN2ADDR(zones.info[i].base);
    13161316        zone_flags_t flags = zones.info[i].flags;
    1317         count_t count = zones.info[i].count;
    1318         count_t free_count = zones.info[i].free_count;
    1319         count_t busy_count = zones.info[i].busy_count;
     1317        size_t count = zones.info[i].count;
     1318        size_t free_count = zones.info[i].free_count;
     1319        size_t busy_count = zones.info[i].busy_count;
    13201320       
    13211321        spinlock_unlock(&zones.lock);
     
    13241324        bool available = zone_flags_available(flags);
    13251325       
    1326         printf("Zone number:       %" PRIc "\n", znum);
     1326        printf("Zone number:       %" PRIs "\n", znum);
    13271327        printf("Zone base address: %p\n", base);
    1328         printf("Zone size:         %" PRIc " frames (%" PRIs " KiB)\n", count,
     1328        printf("Zone size:         %" PRIs " frames (%" PRIs " KiB)\n", count,
    13291329            SIZE2KB(FRAMES2SIZE(count)));
    13301330        printf("Zone flags:        %c%c%c\n",
     
    13341334       
    13351335        if (available) {
    1336                 printf("Allocated space:   %" PRIc " frames (%" PRIs " KiB)\n",
     1336                printf("Allocated space:   %" PRIs " frames (%" PRIs " KiB)\n",
    13371337                    busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
    1338                 printf("Available space:   %" PRIc " frames (%" PRIs " KiB)\n",
     1338                printf("Available space:   %" PRIs " frames (%" PRIs " KiB)\n",
    13391339                    free_count, SIZE2KB(FRAMES2SIZE(free_count)));
    13401340        }
  • kernel/generic/src/mm/slab.c

    r69e68e3 r98000fb  
    157157        link_t link;            /**< List of full/partial slabs. */
    158158        void *start;            /**< Start address of first available item. */
    159         count_t available;      /**< Count of available items in this slab. */
    160         index_t nextavail;      /**< The index of next available item. */
     159        size_t available;       /**< Count of available items in this slab. */
     160        size_t nextavail;       /**< The index of next available item. */
    161161} slab_t;
    162162
     
    178178        size_t fsize;
    179179        unsigned int i;
    180         count_t zone = 0;
     180        size_t zone = 0;
    181181       
    182182        data = frame_alloc_generic(cache->order, FRAME_KA | flags, &zone);
     
    216216 * @return number of freed frames
    217217 */
    218 static count_t slab_space_free(slab_cache_t *cache, slab_t *slab)
     218static size_t slab_space_free(slab_cache_t *cache, slab_t *slab)
    219219{
    220220        frame_free(KA2PA(slab->start));
     
    244244 * @return Number of freed pages
    245245 */
    246 static count_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
     246static size_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
    247247{
    248248        int freed = 0;
     
    372372 * @return Number of freed pages
    373373 */
    374 static count_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
     374static size_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
    375375{
    376376        unsigned int i;
    377         count_t frames = 0;
     377        size_t frames = 0;
    378378
    379379        for (i = 0; i < mag->busy; i++) {
     
    650650 * @return Number of freed pages
    651651 */
    652 static count_t _slab_reclaim(slab_cache_t *cache, int flags)
     652static size_t _slab_reclaim(slab_cache_t *cache, int flags)
    653653{
    654654        unsigned int i;
    655655        slab_magazine_t *mag;
    656         count_t frames = 0;
     656        size_t frames = 0;
    657657        int magcount;
    658658       
     
    772772
    773773/* Go through all caches and reclaim what is possible */
    774 count_t slab_reclaim(int flags)
     774size_t slab_reclaim(int flags)
    775775{
    776776        slab_cache_t *cache;
    777777        link_t *cur;
    778         count_t frames = 0;
     778        size_t frames = 0;
    779779
    780780        spinlock_lock(&slab_cache_lock);
  • kernel/generic/src/mm/tlb.c

    r69e68e3 r98000fb  
    8080 */
    8181void tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid,
    82     uintptr_t page, count_t count)
     82    uintptr_t page, size_t count)
    8383{
    8484        unsigned int i;
     
    109109                         * Enqueue the message.
    110110                         */
    111                         index_t idx = cpu->tlb_messages_count++;
     111                        size_t idx = cpu->tlb_messages_count++;
    112112                        cpu->tlb_messages[idx].type = type;
    113113                        cpu->tlb_messages[idx].asid = asid;
     
    144144        asid_t asid;
    145145        uintptr_t page;
    146         count_t count;
     146        size_t count;
    147147        unsigned int i;
    148148       
  • kernel/generic/src/printf/printf_core.c

    r69e68e3 r98000fb  
    175175static int print_char(const char ch, int width, uint32_t flags, printf_spec_t *ps)
    176176{
    177         count_t counter = 0;
     177        size_t counter = 0;
    178178        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
    179179                while (--width > 0) {
     
    213213static int print_wchar(const wchar_t ch, int width, uint32_t flags, printf_spec_t *ps)
    214214{
    215         count_t counter = 0;
     215        size_t counter = 0;
    216216        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
    217217                while (--width > 0) {
     
    256256
    257257        /* Print leading spaces. */
    258         count_t strw = str_length(str);
     258        size_t strw = str_length(str);
    259259        if (precision == 0)
    260260                precision = strw;
    261261
    262262        /* Left padding */
    263         count_t counter = 0;
     263        size_t counter = 0;
    264264        width -= precision;
    265265        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
     
    312312       
    313313        /* Left padding */
    314         count_t counter = 0;
     314        size_t counter = 0;
    315315        width -= precision;
    316316        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
     
    434434       
    435435        width -= precision + size - number_size;
    436         count_t counter = 0;
     436        size_t counter = 0;
    437437       
    438438        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
     
    597597        size_t j = 0;    /* Index to the first not printed nonformating character */
    598598       
    599         count_t counter = 0;  /* Number of characters printed */
     599        size_t counter = 0;   /* Number of characters printed */
    600600        int retval;           /* Return values from nested functions */
    601601       
  • kernel/generic/src/printf/vprintf.c

    r69e68e3 r98000fb  
    4747{
    4848        size_t offset = 0;
    49         count_t chars = 0;
     49        size_t chars = 0;
    5050       
    5151        while (offset < size) {
     
    6060{
    6161        size_t offset = 0;
    62         count_t chars = 0;
     62        size_t chars = 0;
    6363       
    6464        while (offset < size) {
     
    7474{
    7575        size_t offset = 0;
    76         count_t chars = 0;
     76        size_t chars = 0;
    7777        wchar_t uc;
    7878       
  • kernel/generic/src/printf/vsnprintf.c

    r69e68e3 r98000fb  
    8383                 * of string
    8484                 */
    85                 index_t index = 0;
     85                size_t index = 0;
    8686               
    8787                while (index < size) {
     
    131131static int vsnprintf_wstr_write(const wchar_t *str, size_t size, vsnprintf_data_t *data)
    132132{
    133         index_t index = 0;
     133        size_t index = 0;
    134134       
    135135        while (index < (size / sizeof(wchar_t))) {
  • kernel/generic/src/proc/scheduler.c

    r69e68e3 r98000fb  
    709709
    710710                spinlock_lock(&cpus[cpu].lock);
    711                 printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIc "\n",
     711                printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIs "\n",
    712712                    cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
    713713                    cpus[cpu].needs_relink);
  • kernel/generic/src/synch/futex.c

    r69e68e3 r98000fb  
    6060
    6161static futex_t *futex_find(uintptr_t paddr);
    62 static index_t futex_ht_hash(unative_t *key);
    63 static bool futex_ht_compare(unative_t *key, count_t keys, link_t *item);
     62static size_t futex_ht_hash(unative_t *key);
     63static bool futex_ht_compare(unative_t *key, size_t keys, link_t *item);
    6464static void futex_ht_remove_callback(link_t *item);
    6565
     
    289289 * @return Index into futex hash table.
    290290 */
    291 index_t futex_ht_hash(unative_t *key)
    292 {
    293         return *key & (FUTEX_HT_SIZE-1);
     291size_t futex_ht_hash(unative_t *key)
     292{
     293        return (*key & (FUTEX_HT_SIZE - 1));
    294294}
    295295
     
    301301 * @return True if the item matches the key. False otherwise.
    302302 */
    303 bool futex_ht_compare(unative_t *key, count_t keys, link_t *item)
     303bool futex_ht_compare(unative_t *key, size_t keys, link_t *item)
    304304{
    305305        futex_t *futex;
  • kernel/generic/src/synch/spinlock.c

    r69e68e3 r98000fb  
    7676void spinlock_lock_debug(spinlock_t *sl)
    7777{
    78         count_t i = 0;
     78        size_t i = 0;
    7979        bool deadlock_reported = false;
    8080
  • kernel/generic/src/synch/waitq.c

    r69e68e3 r98000fb  
    416416{
    417417        thread_t *t;
    418         count_t count = 0;
     418        size_t count = 0;
    419419
    420420loop:   
  • kernel/generic/src/time/clock.c

    r69e68e3 r98000fb  
    135135        timeout_handler_t f;
    136136        void *arg;
    137         count_t missed_clock_ticks = CPU->missed_clock_ticks;
     137        size_t missed_clock_ticks = CPU->missed_clock_ticks;
    138138        unsigned int i;
    139139
Note: See TracChangeset for help on using the changeset viewer.