Changeset 18b6a88 in mainline for uspace/srv/fs
- Timestamp:
- 2018-04-15T09:35:04Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1f44ca
- Parents:
- 8ebe212
- Location:
- uspace/srv/fs
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_directory.c
r8ebe212 r18b6a88 455 455 if (i == df.file.count - 2) { 456 456 chars = ds.stream.name_size - 457 EXFAT_NAME_PART_LEN *(df.file.count - 2);457 EXFAT_NAME_PART_LEN * (df.file.count - 2); 458 458 } 459 459 -
uspace/srv/fs/exfat/exfat_fat.c
r8ebe212 r18b6a88 142 142 */ 143 143 return block_get(block, nodep->idx->service_id, DATA_FS(bs) + 144 (nodep->lastc_cached_value-EXFAT_CLST_FIRST)*SPC(bs) +144 (nodep->lastc_cached_value - EXFAT_CLST_FIRST) * SPC(bs) + 145 145 (bn % SPC(bs)), flags); 146 146 } … … 201 201 if (!fragmented) { 202 202 rc = block_get(block, service_id, DATA_FS(bs) + 203 (fcl - EXFAT_CLST_FIRST) *SPC(bs) + bn, flags);203 (fcl - EXFAT_CLST_FIRST) * SPC(bs) + bn, flags); 204 204 } else { 205 205 max_clusters = bn / SPC(bs); … … 514 514 block_t *b; 515 515 errno_t rc; 516 blocks = ROUND_UP(nodep->size, BPS(bs)) /BPS(bs);516 blocks = ROUND_UP(nodep->size, BPS(bs)) / BPS(bs); 517 517 count = BPS(bs); 518 518 -
uspace/srv/fs/exfat/exfat_idx.c
r8ebe212 r18b6a88 119 119 static inline size_t pos_key_hash(void *key) 120 120 { 121 pos_key_t *pos = (pos_key_t *)key;121 pos_key_t *pos = (pos_key_t *)key; 122 122 123 123 size_t hash = 0; … … 141 141 static bool pos_key_equal(void *key, const ht_link_t *item) 142 142 { 143 pos_key_t *pos = (pos_key_t *)key;143 pos_key_t *pos = (pos_key_t *)key; 144 144 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link); 145 145 146 return pos->service_id == fidx->service_id 147 && pos->pdi == fidx->pdi148 &&pos->pfc == fidx->pfc;146 return pos->service_id == fidx->service_id && 147 pos->pdi == fidx->pdi && 148 pos->pfc == fidx->pfc; 149 149 } 150 150 … … 170 170 static size_t idx_key_hash(void *key_arg) 171 171 { 172 idx_key_t *key = (idx_key_t *)key_arg;172 idx_key_t *key = (idx_key_t *)key_arg; 173 173 return hash_combine(key->service_id, key->index); 174 174 } … … 183 183 { 184 184 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link); 185 idx_key_t *key = (idx_key_t *)key_arg;185 idx_key_t *key = (idx_key_t *)key_arg; 186 186 187 187 return key->index == fidx->index && key->service_id == fidx->service_id; … … 509 509 static bool rm_pos_service_id(ht_link_t *item, void *arg) 510 510 { 511 service_id_t service_id = *(service_id_t *)arg;511 service_id_t service_id = *(service_id_t *)arg; 512 512 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link); 513 513 … … 521 521 static bool rm_idx_service_id(ht_link_t *item, void *arg) 522 522 { 523 service_id_t service_id = *(service_id_t *)arg;523 service_id_t service_id = *(service_id_t *)arg; 524 524 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link); 525 525 -
uspace/srv/fs/exfat/exfat_ops.c
r8ebe212 r18b6a88 248 248 fn = FS_NODE(nodep); 249 249 } else { 250 skip_cache:250 skip_cache: 251 251 /* Try to allocate a new node structure. */ 252 252 fibril_mutex_unlock(&ffn_mutex); … … 533 533 (BPS(di.bs) / sizeof(exfat_dentry_t)); 534 534 exfat_idx_t *idx = exfat_idx_get_by_pos(service_id, 535 535 parentp->firstc, di.bnum * DPS(di.bs) + o); 536 536 if (!idx) { 537 537 /* … … 706 706 if (nodep->fragmented) 707 707 rc = exfat_free_clusters(bs, nodep->idx->service_id, 708 708 nodep->firstc); 709 709 else 710 710 rc = exfat_bitmap_free_clusters(bs, nodep, … … 805 805 806 806 exfat_directory_t di; 807 rc = exfat_directory_open(parentp, &di);807 rc = exfat_directory_open(parentp, &di); 808 808 if (rc != EOK) 809 809 goto error; … … 1062 1062 rc = exfat_node_get_new_by_pos(&rootp, service_id, EXFAT_ROOT_PAR, 1063 1063 EXFAT_ROOT_POS); 1064 if (rc !=EOK) {1064 if (rc != EOK) { 1065 1065 (void) block_cache_fini(service_id); 1066 1066 block_fini(service_id); … … 1183 1183 block_fini(service_id); 1184 1184 exfat_idx_fini_by_service_id(service_id); 1185 1185 return ENOTSUP; 1186 1186 } 1187 1187 } … … 1409 1409 (void) exfat_directory_close(&di); 1410 1410 1411 err:1411 err: 1412 1412 (void) exfat_node_put(fn); 1413 1413 async_answer_0(chandle, rc); 1414 1414 return rc; 1415 1415 1416 miss:1416 miss: 1417 1417 rc = exfat_directory_close(&di); 1418 1418 if (rc != EOK) … … 1423 1423 return rc != EOK ? rc : ENOENT; 1424 1424 1425 hit:1425 hit: 1426 1426 pos = di.pos; 1427 1427 rc = exfat_directory_close(&di); -
uspace/srv/fs/fat/fat_fat.c
r8ebe212 r18b6a88 249 249 for (o = nodep->size; o < pos && o < boundary; 250 250 o = ALIGN_DOWN(o + BPS(bs), BPS(bs))) { 251 251 int flags = (o % BPS(bs) == 0) ? 252 252 BLOCK_FLAGS_NOREAD : BLOCK_FLAGS_NONE; 253 253 rc = fat_block_get(&b, bs, nodep, o / BPS(bs), flags); … … 324 324 * first byte of next sector 325 325 */ 326 byte2 = ((uint8_t *) b1->data)[0];326 byte2 = ((uint8_t *) b1->data)[0]; 327 327 328 328 rc = block_put(b1); … … 469 469 return rc; 470 470 471 byte1 = ((uint8_t *) b->data)[offset % BPS(bs)];471 byte1 = ((uint8_t *) b->data)[offset % BPS(bs)]; 472 472 bool border = false; 473 473 /* This cluster access spans a sector boundary. */ … … 495 495 } 496 496 } else 497 byte2 = ((uint8_t *) b->data)[(offset % BPS(bs)) + 1];497 byte2 = ((uint8_t *) b->data)[(offset % BPS(bs)) + 1]; 498 498 499 499 if (IS_ODD(clst)) { -
uspace/srv/fs/fat/fat_idx.c
r8ebe212 r18b6a88 119 119 static inline size_t pos_key_hash(void *key) 120 120 { 121 pos_key_t *pos = (pos_key_t *)key;121 pos_key_t *pos = (pos_key_t *)key; 122 122 123 123 size_t hash = 0; … … 141 141 static bool pos_key_equal(void *key, const ht_link_t *item) 142 142 { 143 pos_key_t *pos = (pos_key_t *)key;143 pos_key_t *pos = (pos_key_t *)key; 144 144 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link); 145 145 146 return pos->service_id == fidx->service_id 147 && pos->pdi == fidx->pdi148 &&pos->pfc == fidx->pfc;146 return pos->service_id == fidx->service_id && 147 pos->pdi == fidx->pdi && 148 pos->pfc == fidx->pfc; 149 149 } 150 150 … … 170 170 static size_t idx_key_hash(void *key_arg) 171 171 { 172 idx_key_t *key = (idx_key_t *)key_arg;172 idx_key_t *key = (idx_key_t *)key_arg; 173 173 return hash_combine(key->service_id, key->index); 174 174 } … … 183 183 { 184 184 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link); 185 idx_key_t *key = (idx_key_t *)key_arg;185 idx_key_t *key = (idx_key_t *)key_arg; 186 186 187 187 return key->index == fidx->index && key->service_id == fidx->service_id; … … 508 508 static bool rm_pos_service_id(ht_link_t *item, void *arg) 509 509 { 510 service_id_t service_id = *(service_id_t *)arg;510 service_id_t service_id = *(service_id_t *)arg; 511 511 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link); 512 512 … … 520 520 static bool rm_idx_service_id(ht_link_t *item, void *arg) 521 521 { 522 service_id_t service_id = *(service_id_t *)arg;522 service_id_t service_id = *(service_id_t *)arg; 523 523 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link); 524 524 -
uspace/srv/fs/fat/fat_ops.c
r8ebe212 r18b6a88 241 241 fn = FS_NODE(nodep); 242 242 } else { 243 skip_cache:243 skip_cache: 244 244 /* Try to allocate a new node structure. */ 245 245 fibril_mutex_unlock(&ffn_mutex); … … 1289 1289 goto miss; 1290 1290 1291 err:1291 err: 1292 1292 (void) fat_node_put(fn); 1293 1293 async_answer_0(chandle, rc); 1294 1294 return rc; 1295 1295 1296 miss:1296 miss: 1297 1297 rc = fat_directory_close(&di); 1298 1298 if (rc != EOK) … … 1303 1303 return rc != EOK ? rc : ENOENT; 1304 1304 1305 hit:1305 hit: 1306 1306 pos = di.pos; 1307 1307 rc = fat_directory_close(&di); -
uspace/srv/fs/locfs/locfs_ops.c
r8ebe212 r18b6a88 73 73 static size_t services_key_hash(void *key) 74 74 { 75 return *(service_id_t *)key;75 return *(service_id_t *)key; 76 76 } 77 77 … … 85 85 { 86 86 service_t *dev = hash_table_get_inst(item, service_t, link); 87 return (dev->service_id == *(service_id_t *)key);87 return (dev->service_id == *(service_id_t *)key); 88 88 } 89 89 … … 234 234 fibril_mutex_lock(&services_mutex); 235 235 ht_link_t *lnk; 236 restart:236 restart: 237 237 lnk = hash_table_find(&services, &node->service_id); 238 238 if (lnk == NULL) { -
uspace/srv/fs/mfs/mfs_dentry.c
r8ebe212 r18b6a88 171 171 /* Search the directory entry to be removed */ 172 172 unsigned i; 173 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize 173 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 174 174 r = mfs_read_dentry(mnode, &d_info, i); 175 175 if (r != EOK) -
uspace/srv/fs/mfs/mfs_ops.c
r8ebe212 r18b6a88 103 103 open_nodes_key_hash(void *key) 104 104 { 105 node_key_t *node_key = (node_key_t *)key;105 node_key_t *node_key = (node_key_t *)key; 106 106 return hash_combine(node_key->service_id, node_key->index); 107 107 } … … 117 117 open_nodes_key_equal(void *key, const ht_link_t *item) 118 118 { 119 node_key_t *node_key = (node_key_t *)key;119 node_key_t *node_key = (node_key_t *)key; 120 120 struct mfs_node *mnode = hash_table_get_inst(item, struct mfs_node, link); 121 121 122 return node_key->service_id == mnode->instance->service_id 123 &&node_key->index == mnode->ino_i->index;122 return node_key->service_id == mnode->instance->service_id && 123 node_key->index == mnode->ino_i->index; 124 124 } 125 125 … … 361 361 if (sbi) 362 362 free(sbi); 363 if (instance)363 if (instance) 364 364 free(instance); 365 365 return rc; … … 871 871 async_answer_0(chandle, rc != EOK ? rc : ENOENT); 872 872 return rc; 873 found:873 found: 874 874 async_data_read_finalize(chandle, d_info.d_name, 875 875 str_size(d_info.d_name) + 1); … … 1102 1102 static bool 1103 1103 check_magic_number(uint16_t magic, bool *native, 1104 1104 mfs_version_t *version, bool *longfilenames) 1105 1105 { 1106 1106 bool rc = true; -
uspace/srv/fs/tmpfs/tmpfs_ops.c
r8ebe212 r18b6a88 238 238 static bool rm_service_id_nodes(ht_link_t *item, void *arg) 239 239 { 240 service_id_t sid = *(service_id_t *)arg;240 service_id_t sid = *(service_id_t *)arg; 241 241 tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link); 242 242
Note:
See TracChangeset
for help on using the changeset viewer.