Changes in / [1412b7ee:680708d] in mainline


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    r1412b7ee r680708d  
    790790               
    791791                if (config['COMPILER'] == "clang"):
    792                         target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
     792                        target, cc_args, gnu_target, clang_target = get_target(config)
    793793                       
    794794                        if (target is None) or (gnu_target is None) or (clang_target is None):
  • uspace/lib/ext4/libext4_balloc.c

    r1412b7ee r680708d  
    9191        block_t *bitmap_block;
    9292        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    93         if (rc != EOK) {
    94                 ext4_filesystem_put_block_group_ref(bg_ref);
    95                 return rc;
    96         }
     93        if (rc != EOK)
     94                return rc;
    9795       
    9896        /* Modify bitmap */
     
    132130       
    133131        /* Release block group reference */
    134         return ext4_filesystem_put_block_group_ref(bg_ref);
     132        rc = ext4_filesystem_put_block_group_ref(bg_ref);
     133        if (rc != EOK)
     134                return rc;
     135       
     136        return EOK;
    135137}
    136138
     
    171173        block_t *bitmap_block;
    172174        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    173         if (rc != EOK) {
    174                 ext4_filesystem_put_block_group_ref(bg_ref);
    175                 return rc;
    176         }
     175        if (rc != EOK)
     176                return rc;
    177177       
    178178        /* Modify bitmap */
     
    212212       
    213213        /* Release block group reference */
    214         return ext4_filesystem_put_block_group_ref(bg_ref);
     214        rc = ext4_filesystem_put_block_group_ref(bg_ref);
     215        if (rc != EOK)
     216                return rc;
     217       
     218        return EOK;
    215219}
    216220
     
    260264 *
    261265 */
    262 static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
     266static uint32_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref)
    263267{
    264         *goal = 0;
     268        uint32_t goal = 0;
     269       
    265270        ext4_superblock_t *sb = inode_ref->fs->superblock;
    266271       
     
    275280        if (inode_block_count > 0) {
    276281                int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
    277                     inode_block_count - 1, goal);
     282                    inode_block_count - 1, &goal);
    278283                if (rc != EOK)
    279                         return rc;
     284                        return 0;
    280285               
    281286                if (goal != 0) {
    282                         (*goal)++;
    283                         return EOK;
     287                        goal++;
     288                        return goal;
    284289                }
    285290               
     
    297302            block_group, &bg_ref);
    298303        if (rc != EOK)
    299                 return rc;
     304                return 0;
    300305       
    301306        /* Compute indexes */
     
    322327                inode_table_blocks++;
    323328       
    324         *goal = inode_table_first_block + inode_table_blocks;
    325        
    326         return ext4_filesystem_put_block_group_ref(bg_ref);
     329        goal = inode_table_first_block + inode_table_blocks;
     330       
     331        ext4_filesystem_put_block_group_ref(bg_ref);
     332       
     333        return goal;
    327334}
    328335
     
    342349        block_t *bitmap_block;
    343350        uint32_t rel_block_idx = 0;
    344         uint32_t goal;
    345351       
    346352        /* Find GOAL */
    347         int rc = ext4_balloc_find_goal(inode_ref, &goal);
    348         if (rc != EOK)
    349                 return rc;
    350         else if (goal == 0) {
     353        uint32_t goal = ext4_balloc_find_goal(inode_ref);
     354        if (goal == 0) {
    351355                /* no goal found => partition is full */
    352                 return ENOMEM;
     356                return ENOSPC;
    353357        }
    354358       
     
    362366        /* Load block group reference */
    363367        ext4_block_group_ref_t *bg_ref;
    364         rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
     368        int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
    365369            block_group, &bg_ref);
    366370        if (rc != EOK)
     
    463467       
    464468        /* No free block found yet */
    465         rc = block_put(bitmap_block);
    466         if (rc != EOK) {
    467                 ext4_filesystem_put_block_group_ref(bg_ref);
    468                 return rc;
    469         }
    470 
    471         rc = ext4_filesystem_put_block_group_ref(bg_ref);
    472         if (rc != EOK)
    473                 return rc;
     469        block_put(bitmap_block);
     470        ext4_filesystem_put_block_group_ref(bg_ref);
    474471       
    475472        /* Try other block groups */
     
    515512                        bitmap_block->dirty = true;
    516513                        rc = block_put(bitmap_block);
    517                         if (rc != EOK) {
    518                                 ext4_filesystem_put_block_group_ref(bg_ref);
     514                        if (rc != EOK)
    519515                                return rc;
    520                         }
    521516                       
    522517                        allocated_block =
     
    533528                        bitmap_block->dirty = true;
    534529                        rc = block_put(bitmap_block);
    535                         if (rc != EOK) {
    536                                 ext4_filesystem_put_block_group_ref(bg_ref);
     530                        if (rc != EOK)
    537531                                return rc;
    538                         }
    539532                       
    540533                        allocated_block =
     
    545538                }
    546539               
    547                 rc = block_put(bitmap_block);
    548                 if (rc != EOK) {
    549                         ext4_filesystem_put_block_group_ref(bg_ref);
    550                         return rc;
    551                 }
    552 
    553                 rc = ext4_filesystem_put_block_group_ref(bg_ref);
    554                 if (rc != EOK)
    555                         return rc;
     540                block_put(bitmap_block);
     541                ext4_filesystem_put_block_group_ref(bg_ref);
    556542               
    557543                /* Goto next group */
     
    588574        bg_ref->dirty = true;
    589575       
    590         rc = ext4_filesystem_put_block_group_ref(bg_ref);
     576        ext4_filesystem_put_block_group_ref(bg_ref);
    591577       
    592578        *fblock = allocated_block;
    593         return rc;
     579        return EOK;
    594580}
    595581
     
    606592    bool *free)
    607593{
    608         int rc;
     594        int rc = EOK;
    609595       
    610596        ext4_filesystem_t *fs = inode_ref->fs;
     
    627613        block_t *bitmap_block;
    628614        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    629         if (rc != EOK) {
    630                 ext4_filesystem_put_block_group_ref(bg_ref);
    631                 return rc;
    632         }
     615        if (rc != EOK)
     616                return rc;
    633617       
    634618        /* Check if block is free */
  • uspace/lib/ext4/libext4_directory_index.c

    r1412b7ee r680708d  
    527527               
    528528                /* Don't forget to put old block (prevent memory leak) */
    529                 rc = block_put(p->block);
    530                 if (rc != EOK)
    531                         return rc;
     529                block_put(p->block);
    532530               
    533531                p->block = block;
     
    555553        /* Load direct block 0 (index root) */
    556554        uint32_t root_block_addr;
    557         int rc2;
    558555        int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
    559556            &root_block_addr);
     
    623620               
    624621                /* Not found, leave untouched */
    625                 rc2 = block_put(leaf_block);
    626                 if (rc2 != EOK)
    627                         goto cleanup;
     622                block_put(leaf_block);
    628623               
    629624                if (rc != ENOENT)
     
    633628                rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash,
    634629                    dx_block, &dx_blocks[0]);
    635                 if (rc != EOK)
     630                if (rc < 0)
    636631                        goto cleanup;
    637 
    638632        } while (rc == ENOENT);
    639633       
     
    646640       
    647641        while (tmp <= dx_block) {
    648                 rc2 = block_put(tmp->block);
    649                 if (rc == EOK && rc2 != EOK)
    650                         rc = rc2;
     642                block_put(tmp->block);
    651643                ++tmp;
    652644        }
  • uspace/lib/ext4/libext4_extent.c

    r1412b7ee r680708d  
    371371    uint32_t *fblock)
    372372{
    373         int rc;
    374373        /* Compute bound defined by i-node size */
    375374        uint64_t inode_size =
     
    401400                uint64_t child = ext4_extent_index_get_leaf(index);
    402401               
    403                 if (block != NULL) {
    404                         rc = block_put(block);
    405                         if (rc != EOK)
    406                                 return rc;
    407                 }
    408                
    409                 rc = block_get(&block, inode_ref->fs->device, child,
     402                if (block != NULL)
     403                        block_put(block);
     404               
     405                int rc = block_get(&block, inode_ref->fs->device, child,
    410406                    BLOCK_FLAGS_NONE);
    411407                if (rc != EOK)
     
    433429        /* Cleanup */
    434430        if (block != NULL)
    435                 rc = block_put(block);
    436        
    437         return rc;
     431                block_put(block);
     432       
     433        return EOK;
    438434}
    439435
     
    509505       
    510506cleanup:
    511         ;
    512 
    513         int rc2 = EOK;
    514 
    515507        /*
    516508         * Put loaded blocks
     
    518510         */
    519511        for (uint16_t i = 1; i < tmp_path->depth; ++i) {
    520                 if (tmp_path[i].block) {
    521                         rc2 = block_put(tmp_path[i].block);
    522                         if (rc == EOK && rc2 != EOK)
    523                                 rc = rc2;
    524                 }
     512                if (tmp_path[i].block)
     513                        block_put(tmp_path[i].block);
    525514        }
    526515       
     
    605594                return rc;
    606595       
    607         return ext4_balloc_free_block(inode_ref, fblock);
     596        ext4_balloc_free_block(inode_ref, fblock);
     597       
     598        return EOK;
    608599}
    609600
     
    730721       
    731722cleanup:
    732         ;
    733 
    734         int rc2 = EOK;
    735 
    736723        /*
    737724         * Put loaded blocks
     
    739726         */
    740727        for (uint16_t i = 1; i <= path->depth; ++i) {
    741                 if (path[i].block) {
    742                         rc2 = block_put(path[i].block);
    743                         if (rc == EOK && rc2 != EOK)
    744                                 rc = rc2;
    745                 }
     728                if (path[i].block)
     729                        block_put(path[i].block);
    746730        }
    747731       
     
    794778                       
    795779                        /* Put back not modified old block */
    796                         rc = block_put(path_ptr->block);
    797                         if (rc != EOK) {
    798                                 ext4_balloc_free_block(inode_ref, fblock);
    799                                 return rc;
    800                         }
     780                        block_put(path_ptr->block);
    801781                       
    802782                        /* Initialize newly allocated block and remember it */
     
    10811061       
    10821062finish:
    1083         ;
    1084 
    1085         int rc2 = EOK;
    1086 
    10871063        /* Set return values */
    10881064        *iblock = new_block_idx;
     
    10941070         */
    10951071        for (uint16_t i = 1; i <= path->depth; ++i) {
    1096                 if (path[i].block) {
    1097                         rc2 = block_put(path[i].block);
    1098                         if (rc == EOK && rc2 != EOK)
    1099                                 rc = rc2;
    1100                 }
     1072                if (path[i].block)
     1073                        block_put(path[i].block);
    11011074        }
    11021075       
  • uspace/lib/ext4/libext4_filesystem.c

    r1412b7ee r680708d  
    797797                }
    798798               
    799                 rc = block_put(block);
    800                 if (rc != EOK)
    801                         return rc;
    802 
     799                block_put(block);
    803800                rc = ext4_balloc_free_block(inode_ref, fblock);
    804801                if (rc != EOK)
     
    844841                                }
    845842                               
    846                                 rc = block_put(subblock);
    847                                 if (rc != EOK)
    848                                         return rc;
     843                                block_put(subblock);
    849844                        }
    850845                       
     
    856851                }
    857852               
    858                 rc = block_put(block);
    859                 if (rc != EOK)
    860                         return rc;
    861 
     853                block_put(block);
    862854                rc = ext4_balloc_free_block(inode_ref, fblock);
    863855                if (rc != EOK)
  • uspace/lib/ext4/libext4_ialloc.c

    r1412b7ee r680708d  
    204204                        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
    205205                            BLOCK_FLAGS_NONE);
    206                         if (rc != EOK) {
    207                                 ext4_filesystem_put_block_group_ref(bg_ref);
     206                        if (rc != EOK)
    208207                                return rc;
    209                         }
    210208                       
    211209                        /* Try to allocate i-node in the bitmap */
     
    217215                        /* Block group has not any free i-node */
    218216                        if (rc == ENOSPC) {
    219                                 rc = block_put(bitmap_block);
    220                                 if (rc != EOK) {
    221                                         ext4_filesystem_put_block_group_ref(bg_ref);
    222                                         return rc;
    223                                 }
    224 
    225                                 rc = ext4_filesystem_put_block_group_ref(bg_ref);
    226                                 if (rc != EOK)
    227                                         return rc;
    228 
    229                                 bgid++;
     217                                block_put(bitmap_block);
     218                                ext4_filesystem_put_block_group_ref(bg_ref);
    230219                                continue;
    231220                        }
     
    235224                       
    236225                        rc = block_put(bitmap_block);
    237                         if (rc != EOK) {
    238                                 ext4_filesystem_put_block_group_ref(bg_ref);
     226                        if (rc != EOK)
    239227                                return rc;
    240                         }
    241228                       
    242229                        /* Modify filesystem counters */
     
    285272               
    286273                /* Block group not modified, put it and jump to the next block group */
    287                 rc = ext4_filesystem_put_block_group_ref(bg_ref);
    288                 if (rc != EOK)
    289                         return rc;
    290 
     274                ext4_filesystem_put_block_group_ref(bg_ref);
    291275                ++bgid;
    292276        }
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r1412b7ee r680708d  
    259259        rc = ext4fs_node_get_core(rfn, eparent->instance, inode);
    260260        if (rc != EOK)
    261                 goto exit;
    262 
    263 exit:
    264         ;
    265 
     261                return rc;
     262       
    266263        /* Destroy search result structure */
    267         int const rc2 = ext4_directory_destroy_result(&result);
    268         return rc == EOK ? rc2 : rc;
     264        return ext4_directory_destroy_result(&result);
    269265}
    270266
     
    10061002        *lnkcnt = 1;
    10071003       
    1008         return ext4fs_node_put(root_node);
     1004        ext4fs_node_put(root_node);
     1005       
     1006        return EOK;
    10091007}
    10101008
     
    10951093        }
    10961094       
    1097         int const rc2 = ext4_filesystem_put_inode_ref(inode_ref);
    1098        
    1099         return rc == EOK ? rc2 : rc;
     1095        ext4_filesystem_put_inode_ref(inode_ref);
     1096       
     1097        return rc;
    11001098}
    11011099
     
    12701268                memset(buffer, 0, bytes);
    12711269               
    1272                 rc = async_data_read_finalize(callid, buffer, bytes);
     1270                async_data_read_finalize(callid, buffer, bytes);
    12731271                *rbytes = bytes;
    12741272               
    12751273                free(buffer);
    1276                 return rc;
     1274                return EOK;
    12771275        }
    12781276       
     
    12861284       
    12871285        assert(offset_in_block + bytes <= block_size);
    1288         rc = async_data_read_finalize(callid, block->data + offset_in_block, bytes);
    1289         if (rc != EOK) {
    1290                 block_put(block);
    1291                 return rc;
    1292         }
     1286        async_data_read_finalize(callid, block->data + offset_in_block, bytes);
    12931287       
    12941288        rc = block_put(block);
     
    13221316        size_t len;
    13231317        if (!async_data_write_receive(&callid, &len)) {
    1324                 rc = EINVAL;
    1325                 async_answer_0(callid, rc);
    1326                 goto exit;
     1318                ext4fs_node_put(fn);
     1319                async_answer_0(callid, EINVAL);
     1320                return EINVAL;
    13271321        }
    13281322       
     
    13471341            &fblock);
    13481342        if (rc != EOK) {
     1343                ext4fs_node_put(fn);
    13491344                async_answer_0(callid, rc);
    1350                 goto exit;
     1345                return rc;
    13511346        }
    13521347       
     
    13641359                                    &fblock, true);
    13651360                                if (rc != EOK) {
     1361                                        ext4fs_node_put(fn);
    13661362                                        async_answer_0(callid, rc);
    1367                                         goto exit;
     1363                                        return rc;
    13681364                                }
    13691365                        }
     
    13721368                            &fblock, false);
    13731369                        if (rc != EOK) {
     1370                                ext4fs_node_put(fn);
    13741371                                async_answer_0(callid, rc);
    1375                                 goto exit;
     1372                                return rc;
    13761373                        }
    13771374                } else {
    13781375                        rc = ext4_balloc_alloc_block(inode_ref, &fblock);
    13791376                        if (rc != EOK) {
     1377                                ext4fs_node_put(fn);
    13801378                                async_answer_0(callid, rc);
    1381                                 goto exit;
     1379                                return rc;
    13821380                        }
    13831381                       
     
    13861384                        if (rc != EOK) {
    13871385                                ext4_balloc_free_block(inode_ref, fblock);
     1386                                ext4fs_node_put(fn);
    13881387                                async_answer_0(callid, rc);
    1389                                 goto exit;
     1388                                return rc;
    13901389                        }
    13911390                }
     
    13991398        rc = block_get(&write_block, service_id, fblock, flags);
    14001399        if (rc != EOK) {
     1400                ext4fs_node_put(fn);
    14011401                async_answer_0(callid, rc);
    1402                 goto exit;
    1403         }
    1404        
    1405         if (flags == BLOCK_FLAGS_NOREAD) {
     1402                return rc;
     1403        }
     1404       
     1405        if (flags == BLOCK_FLAGS_NOREAD)
    14061406                memset(write_block->data, 0, block_size);
    1407                 write_block->dirty = true;
    1408         }
    1409 
     1407       
    14101408        rc = async_data_write_finalize(callid, write_block->data +
    14111409            (pos % block_size), bytes);
    14121410        if (rc != EOK) {
    1413                 block_put(write_block);
    1414                 goto exit;
    1415         }
    1416 
     1411                ext4fs_node_put(fn);
     1412                return rc;
     1413        }
     1414       
     1415        write_block->dirty = true;
     1416       
    14171417        rc = block_put(write_block);
    1418         if (rc != EOK)
    1419                 goto exit;
    1420 
     1418        if (rc != EOK) {
     1419                ext4fs_node_put(fn);
     1420                return rc;
     1421        }
     1422       
    14211423        /* Do some counting */
    14221424        uint32_t old_inode_size = ext4_inode_get_size(fs->superblock,
     
    14261428                inode_ref->dirty = true;
    14271429        }
    1428 
     1430       
    14291431        *nsize = ext4_inode_get_size(fs->superblock, inode_ref->inode);
    14301432        *wbytes = bytes;
    1431 
    1432 exit:
    1433         ;
    1434 
    1435         int const rc2 = ext4fs_node_put(fn);
    1436         return rc == EOK ? rc2 : rc;
     1433       
     1434        return ext4fs_node_put(fn);
    14371435}
    14381436
     
    14601458       
    14611459        rc = ext4_filesystem_truncate_inode(inode_ref, new_size);
    1462         int const rc2 = ext4fs_node_put(fn);
    1463        
    1464         return rc == EOK ? rc2 : rc;
     1460        ext4fs_node_put(fn);
     1461       
     1462        return rc;
    14651463}
    14661464
Note: See TracChangeset for help on using the changeset viewer.