Changeset 0dbe5ac in mainline for uspace/srv/fs/exfat/exfat_ops.c
- Timestamp:
- 2011-08-26T21:19:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d95f02
- Parents:
- ff0c270
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_ops.c
rff0c270 r0dbe5ac 34 34 /** 35 35 * @file exfat_ops.c 36 * @brief Implementation of VFS operations for the exFAT file system server. 36 * @brief Implementation of VFS operations for the exFAT file system 37 * server. 37 38 */ 38 39 … … 335 336 switch (exfat_classify_dentry(d)) { 336 337 case EXFAT_DENTRY_FILE: 337 nodep->type = (uint16_t_le2host(d->file.attr) & EXFAT_ATTR_SUBDIR)? 338 nodep->type = 339 (uint16_t_le2host(d->file.attr) & EXFAT_ATTR_SUBDIR) ? 338 340 EXFAT_DIRECTORY : EXFAT_FILE; 339 341 rc = exfat_directory_next(&di); … … 395 397 } 396 398 397 int exfat_node_expand(service_id_t service_id, exfat_node_t *nodep, exfat_cluster_t clusters) 399 int exfat_node_expand(service_id_t service_id, exfat_node_t *nodep, 400 exfat_cluster_t clusters) 398 401 { 399 402 exfat_bs_t *bs; … … 439 442 } 440 443 441 static int exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep, aoff64_t size) 444 static int exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep, 445 aoff64_t size) 442 446 { 443 447 exfat_bs_t *bs; … … 505 509 { 506 510 exfat_node_t *parentp = EXFAT_NODE(pfn); 507 char name[EXFAT_FILENAME_LEN +1];511 char name[EXFAT_FILENAME_LEN + 1]; 508 512 exfat_file_dentry_t df; 509 513 exfat_stream_dentry_t ds; … … 520 524 return rc; 521 525 522 while (exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN, 523 &d f, &ds) == EOK) {526 while (exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN, &df, 527 &ds) == EOK) { 524 528 if (stricmp(name, component) == 0) { 525 529 /* hit */ 526 530 exfat_node_t *nodep; 527 aoff64_t o = di.pos % (BPS(di.bs) / sizeof(exfat_dentry_t)); 531 aoff64_t o = di.pos % 532 (BPS(di.bs) / sizeof(exfat_dentry_t)); 528 533 exfat_idx_t *idx = exfat_idx_get_by_pos(service_id, 529 534 parentp->firstc, di.bnum * DPS(di.bs) + o); … … 734 739 */ 735 740 rc = exfat_directory_write_file(&di, name); 736 if (rc !=EOK)741 if (rc != EOK) 737 742 return rc; 738 743 rc = exfat_directory_close(&di); 739 if (rc !=EOK)744 if (rc != EOK) 740 745 return rc; 741 746 … … 962 967 { 963 968 int rc; 964 exfat_node_t *rootp =NULL, *bitmapp=NULL, *uctablep=NULL;969 exfat_node_t *rootp = NULL, *bitmapp = NULL, *uctablep = NULL; 965 970 enum cache_mode cmode; 966 971 exfat_bs_t *bs; … … 1062 1067 rc = exfat_node_get_new_by_pos(&bitmapp, service_id, rootp->firstc, 1063 1068 di.pos); 1064 if (rc !=EOK) {1069 if (rc != EOK) { 1065 1070 free(rootp); 1066 1071 (void) block_cache_fini(service_id); … … 1103 1108 rc = exfat_node_get_new_by_pos(&uctablep, service_id, rootp->firstc, 1104 1109 di.pos); 1105 if (rc !=EOK) {1110 if (rc != EOK) { 1106 1111 free(rootp); 1107 1112 free(bitmapp); … … 1123 1128 1124 1129 rc = exfat_directory_close(&di); 1125 if (rc !=EOK) {1130 if (rc != EOK) { 1126 1131 free(rootp); 1127 1132 free(bitmapp); … … 1188 1193 exfat_node_t *nodep; 1189 1194 exfat_bs_t *bs; 1190 size_t bytes =0;1195 size_t bytes = 0; 1191 1196 block_t *b; 1192 1197 int rc; … … 1244 1249 1245 1250 aoff64_t spos = pos; 1246 char name[EXFAT_FILENAME_LEN +1];1251 char name[EXFAT_FILENAME_LEN + 1]; 1247 1252 exfat_file_dentry_t df; 1248 1253 exfat_stream_dentry_t ds; … … 1260 1265 } 1261 1266 1262 rc = exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN, &df, &ds); 1263 if (rc == EOK) goto hit; 1264 if (rc == ENOENT) goto miss; 1267 rc = exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN, 1268 &df, &ds); 1269 if (rc == EOK) 1270 goto hit; 1271 if (rc == ENOENT) 1272 goto miss; 1265 1273 1266 1274 err: … … 1281 1289 pos = di.pos; 1282 1290 rc = exfat_directory_close(&di); 1283 if (rc !=EOK)1291 if (rc != EOK) 1284 1292 goto err; 1285 (void) async_data_read_finalize(callid, name, str_size(name) + 1); 1286 bytes = (pos - spos)+1; 1293 (void) async_data_read_finalize(callid, name, 1294 str_size(name) + 1); 1295 bytes = (pos - spos) + 1; 1287 1296 } 1288 1297 … … 1395 1404 return rc; 1396 1405 } 1397 1398 1406 1399 1407 *wbytes = bytes; … … 1477 1485 }; 1478 1486 1479 1480 1487 /** 1481 1488 * @}
Note:
See TracChangeset
for help on using the changeset viewer.