Changes in / [9131690:b1c21c2] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    r9131690 rb1c21c2  
    363363                                }
    364364                                rc = fat_node_get_core(&nodep, idx);
     365                                assert(rc == EOK);
    365366                                fibril_mutex_unlock(&idx->lock);
    366                                 if (rc != EOK) {
    367                                         (void) block_put(b);
    368                                         return rc;
    369                                 }
     367                                (void) block_put(b);
    370368                                *rfn = FS_NODE(nodep);
    371                                 rc = block_put(b);
    372                                 if (rc != EOK)
    373                                         (void) fat_node_put(*rfn);
    374                                 return rc;
     369                                return EOK;
    375370                        }
    376371                }
     
    10771072                        rc = fat_block_get(&b, bs, nodep, pos / bps,
    10781073                            BLOCK_FLAGS_NONE);
    1079                         if (rc != EOK) {
    1080                                 fat_node_put(fn);
    1081                                 ipc_answer_0(callid, rc);
    1082                                 ipc_answer_0(rid, rc);
    1083                                 return;
    1084                         }
     1074                        assert(rc == EOK);
    10851075                        (void) async_data_read_finalize(callid, b->data + pos % bps,
    10861076                            bytes);
    10871077                        rc = block_put(b);
    1088                         if (rc != EOK) {
    1089                                 fat_node_put(fn);
    1090                                 ipc_answer_0(rid, rc);
    1091                                 return;
    1092                         }
     1078                        assert(rc == EOK);
    10931079                }
    10941080        } else {
     
    11141100                        rc = fat_block_get(&b, bs, nodep, bnum,
    11151101                            BLOCK_FLAGS_NONE);
    1116                         if (rc != EOK)
    1117                                 goto err;
     1102                        assert(rc == EOK);
    11181103                        for (o = pos % (bps / sizeof(fat_dentry_t));
    11191104                            o < bps / sizeof(fat_dentry_t);
     
    11261111                                case FAT_DENTRY_LAST:
    11271112                                        rc = block_put(b);
    1128                                         if (rc != EOK)
    1129                                                 goto err;
     1113                                        assert(rc == EOK);
    11301114                                        goto miss;
    11311115                                default:
     
    11331117                                        fat_dentry_name_get(d, name);
    11341118                                        rc = block_put(b);
    1135                                         if (rc != EOK)
    1136                                                 goto err;
     1119                                        assert(rc == EOK);
    11371120                                        goto hit;
    11381121                                }
    11391122                        }
    11401123                        rc = block_put(b);
    1141                         if (rc != EOK)
    1142                                 goto err;
     1124                        assert(rc == EOK);
    11431125                        bnum++;
    11441126                }
    11451127miss:
    1146                 rc = fat_node_put(fn);
    1147                 ipc_answer_0(callid, rc != EOK ? rc : ENOENT);
    1148                 ipc_answer_1(rid, rc != EOK ? rc : ENOENT, 0);
    1149                 return;
    1150 
    1151 err:
    1152                 (void) fat_node_put(fn);
    1153                 ipc_answer_0(callid, rc);
    1154                 ipc_answer_0(rid, rc);
    1155                 return;
    1156 
     1128                fat_node_put(fn);
     1129                ipc_answer_0(callid, ENOENT);
     1130                ipc_answer_1(rid, ENOENT, 0);
     1131                return;
    11571132hit:
    11581133                (void) async_data_read_finalize(callid, name, str_size(name) + 1);
     
    11601135        }
    11611136
    1162         rc = fat_node_put(fn);
    1163         ipc_answer_1(rid, rc, (ipcarg_t)bytes);
     1137        fat_node_put(fn);
     1138        ipc_answer_1(rid, EOK, (ipcarg_t)bytes);
    11641139}
    11651140
     
    11721147        fat_node_t *nodep;
    11731148        fat_bs_t *bs;
    1174         size_t bytes, size;
     1149        size_t bytes;
    11751150        block_t *b;
    11761151        uint16_t bps;
     
    11951170        size_t len;
    11961171        if (!async_data_write_receive(&callid, &len)) {
    1197                 (void) fat_node_put(fn);
     1172                fat_node_put(fn);
    11981173                ipc_answer_0(callid, EINVAL);
    11991174                ipc_answer_0(rid, EINVAL);
     
    12261201                 */
    12271202                rc = fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
    1228                 if (rc != EOK) {
    1229                         (void) fat_node_put(fn);
    1230                         ipc_answer_0(callid, rc);
    1231                         ipc_answer_0(rid, rc);
    1232                         return;
    1233                 }
     1203                assert(rc == EOK);
    12341204                rc = fat_block_get(&b, bs, nodep, pos / bps, flags);
    1235                 if (rc != EOK) {
    1236                         (void) fat_node_put(fn);
    1237                         ipc_answer_0(callid, rc);
    1238                         ipc_answer_0(rid, rc);
    1239                         return;
    1240                 }
     1205                assert(rc == EOK);
    12411206                (void) async_data_write_finalize(callid, b->data + pos % bps,
    12421207                    bytes);
    12431208                b->dirty = true;                /* need to sync block */
    12441209                rc = block_put(b);
    1245                 if (rc != EOK) {
    1246                         (void) fat_node_put(fn);
    1247                         ipc_answer_0(rid, rc);
    1248                         return;
    1249                 }
     1210                assert(rc == EOK);
    12501211                if (pos + bytes > nodep->size) {
    12511212                        nodep->size = pos + bytes;
    12521213                        nodep->dirty = true;    /* need to sync node */
    12531214                }
    1254                 size = nodep->size;
    1255                 rc = fat_node_put(fn);
    1256                 ipc_answer_2(rid, rc, bytes, nodep->size);
     1215                ipc_answer_2(rid, EOK, bytes, nodep->size);     
     1216                fat_node_put(fn);
    12571217                return;
    12581218        } else {
     
    12611221                 * clusters for the node and zero them out.
    12621222                 */
     1223                int status;
    12631224                unsigned nclsts;
    12641225                fat_cluster_t mcl, lcl;
     
    12661227                nclsts = (ROUND_UP(pos + bytes, bpc) - boundary) / bpc;
    12671228                /* create an independent chain of nclsts clusters in all FATs */
    1268                 rc = fat_alloc_clusters(bs, dev_handle, nclsts, &mcl, &lcl);
    1269                 if (rc != EOK) {
     1229                status = fat_alloc_clusters(bs, dev_handle, nclsts, &mcl, &lcl);
     1230                if (status != EOK) {
    12701231                        /* could not allocate a chain of nclsts clusters */
    1271                         (void) fat_node_put(fn);
    1272                         ipc_answer_0(callid, rc);
    1273                         ipc_answer_0(rid, rc);
     1232                        fat_node_put(fn);
     1233                        ipc_answer_0(callid, status);
     1234                        ipc_answer_0(rid, status);
    12741235                        return;
    12751236                }
    12761237                /* zero fill any gaps */
    12771238                rc = fat_fill_gap(bs, nodep, mcl, pos);
    1278                 if (rc != EOK) {
    1279                         (void) fat_free_clusters(bs, dev_handle, mcl);
    1280                         (void) fat_node_put(fn);
    1281                         ipc_answer_0(callid, rc);
    1282                         ipc_answer_0(rid, rc);
    1283                         return;
    1284                 }
     1239                assert(rc == EOK);
    12851240                rc = _fat_block_get(&b, bs, dev_handle, lcl, (pos / bps) % spc,
    12861241                    flags);
    1287                 if (rc != EOK) {
    1288                         (void) fat_free_clusters(bs, dev_handle, mcl);
    1289                         (void) fat_node_put(fn);
    1290                         ipc_answer_0(callid, rc);
    1291                         ipc_answer_0(rid, rc);
    1292                         return;
    1293                 }
     1242                assert(rc == EOK);
    12941243                (void) async_data_write_finalize(callid, b->data + pos % bps,
    12951244                    bytes);
    12961245                b->dirty = true;                /* need to sync block */
    12971246                rc = block_put(b);
    1298                 if (rc != EOK) {
    1299                         (void) fat_free_clusters(bs, dev_handle, mcl);
    1300                         (void) fat_node_put(fn);
    1301                         ipc_answer_0(rid, rc);
    1302                         return;
    1303                 }
     1247                assert(rc == EOK);
    13041248                /*
    13051249                 * Append the cluster chain starting in mcl to the end of the
     
    13071251                 */
    13081252                rc = fat_append_clusters(bs, nodep, mcl);
    1309                 if (rc != EOK) {
    1310                         (void) fat_free_clusters(bs, dev_handle, mcl);
    1311                         (void) fat_node_put(fn);
    1312                         ipc_answer_0(rid, rc);
    1313                         return;
    1314                 }
    1315                 nodep->size = size = pos + bytes;
     1253                assert(rc == EOK);
     1254                nodep->size = pos + bytes;
    13161255                nodep->dirty = true;            /* need to sync node */
    1317                 rc = fat_node_put(fn);
    1318                 ipc_answer_2(rid, rc, bytes, size);
     1256                ipc_answer_2(rid, EOK, bytes, nodep->size);
     1257                fat_node_put(fn);
    13191258                return;
    13201259        }
Note: See TracChangeset for help on using the changeset viewer.