Changes in uspace/srv/fs/fat/fat_ops.c [5ca5eaa7:96b02eb9] in mainline
- File:
-
- 1 edited
-
uspace/srv/fs/fat/fat_ops.c (modified) (41 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r5ca5eaa7 r96b02eb9 42 42 #include <libfs.h> 43 43 #include <libblock.h> 44 #include <ipc/ipc.h> 44 45 #include <ipc/services.h> 45 46 #include <ipc/devmap.h> … … 325 326 uint16_t_le2host(d->firstc)); 326 327 if (rc != EOK) { 327 (void) block_put(b);328 328 (void) fat_node_put(FS_NODE(nodep)); 329 329 return rc; … … 812 812 fibril_mutex_unlock(&childp->idx->lock); 813 813 childp->lnkcnt = 0; 814 childp->refcnt++; /* keep the node in memory until destroyed */815 814 childp->dirty = true; 816 815 fibril_mutex_unlock(&childp->lock); … … 956 955 957 956 if (rc != EOK) { 958 async_answer_0(rid, rc);957 ipc_answer_0(rid, rc); 959 958 return; 960 959 } … … 971 970 rc = block_init(devmap_handle, BS_SIZE); 972 971 if (rc != EOK) { 973 async_answer_0(rid, rc);972 ipc_answer_0(rid, rc); 974 973 return; 975 974 } … … 979 978 if (rc != EOK) { 980 979 block_fini(devmap_handle); 981 async_answer_0(rid, rc);980 ipc_answer_0(rid, rc); 982 981 return; 983 982 } … … 988 987 if (BPS(bs) != BS_SIZE) { 989 988 block_fini(devmap_handle); 990 async_answer_0(rid, ENOTSUP);989 ipc_answer_0(rid, ENOTSUP); 991 990 return; 992 991 } … … 996 995 if (rc != EOK) { 997 996 block_fini(devmap_handle); 998 async_answer_0(rid, rc);997 ipc_answer_0(rid, rc); 999 998 return; 1000 999 } … … 1005 1004 (void) block_cache_fini(devmap_handle); 1006 1005 block_fini(devmap_handle); 1007 async_answer_0(rid, rc);1006 ipc_answer_0(rid, rc); 1008 1007 return; 1009 1008 } … … 1013 1012 (void) block_cache_fini(devmap_handle); 1014 1013 block_fini(devmap_handle); 1015 async_answer_0(rid, rc);1014 ipc_answer_0(rid, rc); 1016 1015 return; 1017 1016 } … … 1023 1022 block_fini(devmap_handle); 1024 1023 fat_idx_fini_by_devmap_handle(devmap_handle); 1025 async_answer_0(rid, ENOMEM);1024 ipc_answer_0(rid, ENOMEM); 1026 1025 return; 1027 1026 } … … 1033 1032 block_fini(devmap_handle); 1034 1033 fat_idx_fini_by_devmap_handle(devmap_handle); 1035 async_answer_0(rid, ENOMEM);1034 ipc_answer_0(rid, ENOMEM); 1036 1035 return; 1037 1036 } … … 1045 1044 block_fini(devmap_handle); 1046 1045 fat_idx_fini_by_devmap_handle(devmap_handle); 1047 async_answer_0(rid, ENOMEM);1046 ipc_answer_0(rid, ENOMEM); 1048 1047 return; 1049 1048 } … … 1063 1062 fibril_mutex_unlock(&ridxp->lock); 1064 1063 1065 async_answer_3(rid, EOK, ridxp->index, rootp->size, rootp->lnkcnt);1064 ipc_answer_3(rid, EOK, ridxp->index, rootp->size, rootp->lnkcnt); 1066 1065 } 1067 1066 … … 1080 1079 rc = fat_root_get(&fn, devmap_handle); 1081 1080 if (rc != EOK) { 1082 async_answer_0(rid, rc);1081 ipc_answer_0(rid, rc); 1083 1082 return; 1084 1083 } … … 1091 1090 if (nodep->refcnt != 2) { 1092 1091 (void) fat_node_put(fn); 1093 async_answer_0(rid, EBUSY);1092 ipc_answer_0(rid, EBUSY); 1094 1093 return; 1095 1094 } … … 1111 1110 block_fini(devmap_handle); 1112 1111 1113 async_answer_0(rid, EOK);1112 ipc_answer_0(rid, EOK); 1114 1113 } 1115 1114 … … 1139 1138 rc = fat_node_get(&fn, devmap_handle, index); 1140 1139 if (rc != EOK) { 1141 async_answer_0(rid, rc);1140 ipc_answer_0(rid, rc); 1142 1141 return; 1143 1142 } 1144 1143 if (!fn) { 1145 async_answer_0(rid, ENOENT);1144 ipc_answer_0(rid, ENOENT); 1146 1145 return; 1147 1146 } … … 1152 1151 if (!async_data_read_receive(&callid, &len)) { 1153 1152 fat_node_put(fn); 1154 async_answer_0(callid, EINVAL);1155 async_answer_0(rid, EINVAL);1153 ipc_answer_0(callid, EINVAL); 1154 ipc_answer_0(rid, EINVAL); 1156 1155 return; 1157 1156 } … … 1176 1175 if (rc != EOK) { 1177 1176 fat_node_put(fn); 1178 async_answer_0(callid, rc);1179 async_answer_0(rid, rc);1177 ipc_answer_0(callid, rc); 1178 ipc_answer_0(rid, rc); 1180 1179 return; 1181 1180 } … … 1185 1184 if (rc != EOK) { 1186 1185 fat_node_put(fn); 1187 async_answer_0(rid, rc);1186 ipc_answer_0(rid, rc); 1188 1187 return; 1189 1188 } … … 1242 1241 miss: 1243 1242 rc = fat_node_put(fn); 1244 async_answer_0(callid, rc != EOK ? rc : ENOENT);1245 async_answer_1(rid, rc != EOK ? rc : ENOENT, 0);1243 ipc_answer_0(callid, rc != EOK ? rc : ENOENT); 1244 ipc_answer_1(rid, rc != EOK ? rc : ENOENT, 0); 1246 1245 return; 1247 1246 1248 1247 err: 1249 1248 (void) fat_node_put(fn); 1250 async_answer_0(callid, rc);1251 async_answer_0(rid, rc);1249 ipc_answer_0(callid, rc); 1250 ipc_answer_0(rid, rc); 1252 1251 return; 1253 1252 … … 1258 1257 1259 1258 rc = fat_node_put(fn); 1260 async_answer_1(rid, rc, (sysarg_t)bytes);1259 ipc_answer_1(rid, rc, (sysarg_t)bytes); 1261 1260 } 1262 1261 … … 1278 1277 rc = fat_node_get(&fn, devmap_handle, index); 1279 1278 if (rc != EOK) { 1280 async_answer_0(rid, rc);1279 ipc_answer_0(rid, rc); 1281 1280 return; 1282 1281 } 1283 1282 if (!fn) { 1284 async_answer_0(rid, ENOENT);1283 ipc_answer_0(rid, ENOENT); 1285 1284 return; 1286 1285 } … … 1291 1290 if (!async_data_write_receive(&callid, &len)) { 1292 1291 (void) fat_node_put(fn); 1293 async_answer_0(callid, EINVAL);1294 async_answer_0(rid, EINVAL);1292 ipc_answer_0(callid, EINVAL); 1293 ipc_answer_0(rid, EINVAL); 1295 1294 return; 1296 1295 } … … 1320 1319 if (rc != EOK) { 1321 1320 (void) fat_node_put(fn); 1322 async_answer_0(callid, rc);1323 async_answer_0(rid, rc);1321 ipc_answer_0(callid, rc); 1322 ipc_answer_0(rid, rc); 1324 1323 return; 1325 1324 } … … 1327 1326 if (rc != EOK) { 1328 1327 (void) fat_node_put(fn); 1329 async_answer_0(callid, rc);1330 async_answer_0(rid, rc);1328 ipc_answer_0(callid, rc); 1329 ipc_answer_0(rid, rc); 1331 1330 return; 1332 1331 } … … 1337 1336 if (rc != EOK) { 1338 1337 (void) fat_node_put(fn); 1339 async_answer_0(rid, rc);1338 ipc_answer_0(rid, rc); 1340 1339 return; 1341 1340 } … … 1346 1345 size = nodep->size; 1347 1346 rc = fat_node_put(fn); 1348 async_answer_2(rid, rc, bytes, nodep->size);1347 ipc_answer_2(rid, rc, bytes, nodep->size); 1349 1348 return; 1350 1349 } else { … … 1362 1361 /* could not allocate a chain of nclsts clusters */ 1363 1362 (void) fat_node_put(fn); 1364 async_answer_0(callid, rc);1365 async_answer_0(rid, rc);1363 ipc_answer_0(callid, rc); 1364 ipc_answer_0(rid, rc); 1366 1365 return; 1367 1366 } … … 1371 1370 (void) fat_free_clusters(bs, devmap_handle, mcl); 1372 1371 (void) fat_node_put(fn); 1373 async_answer_0(callid, rc);1374 async_answer_0(rid, rc);1372 ipc_answer_0(callid, rc); 1373 ipc_answer_0(rid, rc); 1375 1374 return; 1376 1375 } … … 1380 1379 (void) fat_free_clusters(bs, devmap_handle, mcl); 1381 1380 (void) fat_node_put(fn); 1382 async_answer_0(callid, rc);1383 async_answer_0(rid, rc);1381 ipc_answer_0(callid, rc); 1382 ipc_answer_0(rid, rc); 1384 1383 return; 1385 1384 } … … 1391 1390 (void) fat_free_clusters(bs, devmap_handle, mcl); 1392 1391 (void) fat_node_put(fn); 1393 async_answer_0(rid, rc);1392 ipc_answer_0(rid, rc); 1394 1393 return; 1395 1394 } … … 1402 1401 (void) fat_free_clusters(bs, devmap_handle, mcl); 1403 1402 (void) fat_node_put(fn); 1404 async_answer_0(rid, rc);1403 ipc_answer_0(rid, rc); 1405 1404 return; 1406 1405 } … … 1408 1407 nodep->dirty = true; /* need to sync node */ 1409 1408 rc = fat_node_put(fn); 1410 async_answer_2(rid, rc, bytes, size);1409 ipc_answer_2(rid, rc, bytes, size); 1411 1410 return; 1412 1411 } … … 1426 1425 rc = fat_node_get(&fn, devmap_handle, index); 1427 1426 if (rc != EOK) { 1428 async_answer_0(rid, rc);1427 ipc_answer_0(rid, rc); 1429 1428 return; 1430 1429 } 1431 1430 if (!fn) { 1432 async_answer_0(rid, ENOENT);1431 ipc_answer_0(rid, ENOENT); 1433 1432 return; 1434 1433 } … … 1476 1475 out: 1477 1476 fat_node_put(fn); 1478 async_answer_0(rid, rc);1477 ipc_answer_0(rid, rc); 1479 1478 return; 1480 1479 } … … 1482 1481 void fat_close(ipc_callid_t rid, ipc_call_t *request) 1483 1482 { 1484 async_answer_0(rid, EOK);1483 ipc_answer_0(rid, EOK); 1485 1484 } 1486 1485 … … 1490 1489 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1491 1490 fs_node_t *fn; 1492 fat_node_t *nodep;1493 1491 int rc; 1494 1492 1495 1493 rc = fat_node_get(&fn, devmap_handle, index); 1496 1494 if (rc != EOK) { 1497 async_answer_0(rid, rc);1495 ipc_answer_0(rid, rc); 1498 1496 return; 1499 1497 } 1500 1498 if (!fn) { 1501 async_answer_0(rid, ENOENT); 1502 return; 1503 } 1504 1505 nodep = FAT_NODE(fn); 1506 /* 1507 * We should have exactly two references. One for the above 1508 * call to fat_node_get() and one from fat_unlink(). 1509 */ 1510 assert(nodep->refcnt == 2); 1499 ipc_answer_0(rid, ENOENT); 1500 return; 1501 } 1511 1502 1512 1503 rc = fat_destroy_node(fn); 1513 async_answer_0(rid, rc);1504 ipc_answer_0(rid, rc); 1514 1505 } 1515 1506 … … 1532 1523 int rc = fat_node_get(&fn, devmap_handle, index); 1533 1524 if (rc != EOK) { 1534 async_answer_0(rid, rc);1525 ipc_answer_0(rid, rc); 1535 1526 return; 1536 1527 } 1537 1528 if (!fn) { 1538 async_answer_0(rid, ENOENT);1529 ipc_answer_0(rid, ENOENT); 1539 1530 return; 1540 1531 } … … 1546 1537 1547 1538 fat_node_put(fn); 1548 async_answer_0(rid, rc);1539 ipc_answer_0(rid, rc); 1549 1540 } 1550 1541
Note:
See TracChangeset
for help on using the changeset viewer.
