Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_balloc.c

    rc2e50d7 r7a46bfe  
    3636static int
    3737find_free_bit_and_set(bitchunk_t *b, const int bsize,
    38     const bool native, unsigned start_bit);
     38                      const bool native, unsigned start_bit);
    3939
    4040static int
     
    122122        block_t *b;
    123123
     124        assert(inst != NULL);
    124125        sbi = inst->sbi;
     126        assert(sbi != NULL);
    125127
    126128        if (bid == BMAP_ZONE) {
     
    129131                if (idx > sbi->nzones) {
    130132                        printf(NAME ": Error! Trying to free beyond the" \
    131                             "bitmap max size\n");
     133                               "bitmap max size\n");
    132134                        return -1;
    133135                }
    134136        } else {
    135                 /* bid == BMAP_INODE */
     137                /*bid == BMAP_INODE*/
    136138                search = &sbi->isearch;
    137139                start_block = 2;
    138140                if (idx > sbi->ninodes) {
    139141                        printf(NAME ": Error! Trying to free beyond the" \
    140                             "bitmap max size\n");
     142                               "bitmap max size\n");
    141143                        return -1;
    142144                }
    143145        }
    144146
    145         /* Compute the bitmap block */
     147        /*Compute the bitmap block*/
    146148        uint32_t block = idx / (sbi->block_size * 8) + start_block;
    147149
     
    150152                goto out_err;
    151153
    152         /* Compute the bit index in the block */
     154        /*Compute the bit index in the block*/
    153155        idx %= (sbi->block_size * 8);
    154156        bitchunk_t *ptr = b->data;
     
    190192        int r, freebit;
    191193
     194        assert(inst != NULL);
    192195        sbi = inst->sbi;
     196        assert(sbi != NULL);
    193197
    194198        if (bid == BMAP_ZONE) {
     
    198202                limit = sbi->nzones - sbi->firstdatazone - 1;
    199203        } else {
    200                 /* bid == BMAP_INODE */
     204                /*bid == BMAP_INODE*/
    201205                search = &sbi->isearch;
    202206                start_block = 2;
     
    212216        for (i = *search / bits_per_block; i < nblocks; ++i) {
    213217                r = block_get(&b, inst->service_id, i + start_block,
    214                     BLOCK_FLAGS_NONE);
     218                              BLOCK_FLAGS_NONE);
    215219
    216220                if (r != EOK)
     
    220224
    221225                freebit = find_free_bit_and_set(b->data, sbi->block_size,
    222                     sbi->native, tmp);
     226                                                sbi->native, tmp);
    223227                if (freebit == -1) {
    224                         /* No free bit in this block */
     228                        /*No free bit in this block*/
    225229                        r = block_put(b);
    226230                        if (r != EOK)
     
    229233                }
    230234
    231                 /* Free bit found in this block, compute the real index */
     235                /*Free bit found in this block, compute the real index*/
    232236                *idx = freebit + bits_per_block * i;
    233237                if (*idx > limit) {
    234                         /* Index is beyond the limit, it is invalid */
     238                        /*Index is beyond the limit, it is invalid*/
    235239                        r = block_put(b);
    236240                        if (r != EOK)
     
    246250
    247251        if (*search > 0) {
    248                 /* Repeat the search from the first bitmap block */
     252                /*Repeat the search from the first bitmap block*/
    249253                *search = 0;
    250254                goto retry;
    251255        }
    252256
    253         /* Free bit not found, return error */
     257        /*Free bit not found, return error*/
    254258        return ENOSPC;
    255259
     
    260264static int
    261265find_free_bit_and_set(bitchunk_t *b, const int bsize,
    262     const bool native, unsigned start_bit)
     266                      const bool native, unsigned start_bit)
    263267{
    264268        int r = -1;
     
    268272
    269273        for (i = start_bit / chunk_bits;
    270             i < bsize / sizeof(bitchunk_t); ++i) {
    271 
     274             i < bsize / sizeof(bitchunk_t); ++i) {
    272275                if (!(~b[i])) {
    273                         /* No free bit in this chunk */
     276                        /*No free bit in this chunk*/
    274277                        continue;
    275278                }
Note: See TracChangeset for help on using the changeset viewer.