Changeset 1b20da0 in mainline for uspace/srv/fs/fat
- Timestamp:
- 2018-02-28T17:52:03Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- Location:
- uspace/srv/fs/fat
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.c
rdf6ded8 r1b20da0 31 31 /** @addtogroup fs 32 32 * @{ 33 */ 33 */ 34 34 35 35 /** -
uspace/srv/fs/fat/fat.h
rdf6ded8 r1b20da0 30 30 /** @addtogroup fs 31 31 * @{ 32 */ 32 */ 33 33 34 34 #ifndef FAT_FAT_H_ -
uspace/srv/fs/fat/fat_dentry.c
rdf6ded8 r1b20da0 30 30 /** @addtogroup fs 31 31 * @{ 32 */ 32 */ 33 33 34 34 /** … … 263 263 * 264 264 * @param str NULL-terminated (or not) string. The pointer comes from a packed 265 * structure and as such is expected to be unaligned. 265 * structure and as such is expected to be unaligned. 266 266 * @param size Maximum number of bytes to consider. 267 267 * … … 274 274 275 275 while (offset < size) { 276 if (str[offset] == 0 || str[offset] == FAT_LFN_PAD) 276 if (str[offset] == 0 || str[offset] == FAT_LFN_PAD) 277 277 break; 278 278 offset++; … … 294 294 size += fat_lfn_str_nlength(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE); 295 295 size += fat_lfn_str_nlength(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE); 296 size += fat_lfn_str_nlength(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE); 296 size += fat_lfn_str_nlength(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE); 297 297 298 298 return size; … … 429 429 /** 430 430 * @} 431 */ 431 */ -
uspace/srv/fs/fat/fat_dentry.h
rdf6ded8 r1b20da0 30 30 /** @addtogroup fs 31 31 * @{ 32 */ 32 */ 33 33 34 34 #ifndef FAT_FAT_DENTRY_H_ -
uspace/srv/fs/fat/fat_directory.c
rdf6ded8 r1b20da0 29 29 /** @addtogroup fs 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** … … 49 49 { 50 50 di->b = NULL; 51 di->nodep = nodep; 51 di->nodep = nodep; 52 52 if (di->nodep->type != FAT_DIRECTORY) 53 53 return EINVAL; … … 183 183 /* We found long entry */ 184 184 long_entry_count--; 185 if ((FAT_LFN_ORDER(d) == long_entry_count) && 185 if ((FAT_LFN_ORDER(d) == long_entry_count) && 186 186 (checksum == FAT_LFN_CHKSUM(d))) { 187 187 /* Right order! */ … … 201 201 long_entry = true; 202 202 long_entry_count = FAT_LFN_COUNT(d); 203 lfn_size = (FAT_LFN_ENTRY_SIZE * 203 lfn_size = (FAT_LFN_ENTRY_SIZE * 204 204 (FAT_LFN_COUNT(d) - 1)) + 205 205 fat_lfn_size(d); … … 212 212 break; 213 213 case FAT_DENTRY_VALID: 214 if (long_entry && 214 if (long_entry && 215 215 (checksum == fat_dentry_chksum(d->name))) { 216 216 wname[lfn_size] = '\0'; … … 253 253 while (!flag && fat_directory_prev(di) == EOK) { 254 254 if (fat_directory_get(di, &d) == EOK && 255 fat_classify_dentry(d) == FAT_DENTRY_LFN && 255 fat_classify_dentry(d) == FAT_DENTRY_LFN && 256 256 checksum == FAT_LFN_CHKSUM(d)) { 257 257 if (FAT_IS_LFN(d)) … … 479 479 break; 480 480 } 481 } while (fat_directory_next(di) == EOK); 481 } while (fat_directory_next(di) == EOK); 482 482 } while (fat_directory_expand(di) == EOK); 483 483 … … 564 564 /** 565 565 * @} 566 */ 566 */ -
uspace/srv/fs/fat/fat_fat.c
rdf6ded8 r1b20da0 520 520 return rc; 521 521 } 522 } else 522 } else 523 523 ((uint8_t *) b->data)[(offset % BPS(bs)) + 1] = byte2; 524 524 … … 966 966 * set to one. 967 967 */ 968 if (!FAT_IS_FAT12(bs) && 968 if (!FAT_IS_FAT12(bs) && 969 969 ((e0 >> 8) != (FAT_MASK(bs) >> 8) || e1 != FAT_MASK(bs))) 970 970 return ENOTSUP; -
uspace/srv/fs/fat/fat_idx.c
rdf6ded8 r1b20da0 29 29 /** @addtogroup fs 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** … … 92 92 93 93 list_foreach(unused_list, link, unused_t, u) { 94 if (u->service_id == service_id) 94 if (u->service_id == service_id) 95 95 return u; 96 96 } … … 108 108 * The index structures are hashed by the service_id, parent node's first 109 109 * cluster and index within the parent directory. 110 */ 110 */ 111 111 static hash_table_t up_hash; 112 112 … … 211 211 u = unused_find(service_id, true); 212 212 if (!u) 213 return false; 213 return false; 214 214 215 215 if (list_empty(&u->freed_list)) { 216 if (u->remaining) { 216 if (u->remaining) { 217 217 /* 218 218 * There are no freed indices, allocate one directly … … 333 333 334 334 fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t)); 335 if (!fidx) 335 if (!fidx) 336 336 return ENOMEM; 337 337 if (!fat_index_alloc(service_id, &fidx->index)) { … … 469 469 errno_t fat_idx_init(void) 470 470 { 471 if (!hash_table_create(&up_hash, 0, 0, &uph_ops)) 471 if (!hash_table_create(&up_hash, 0, 0, &uph_ops)) 472 472 return ENOMEM; 473 473 if (!hash_table_create(&ui_hash, 0, 0, &uih_ops)) { … … 535 535 * Remove this instance's index structure from up_hash and ui_hash. 536 536 * Process up_hash first and ui_hash second because the index structure 537 * is actually removed in idx_remove_callback(). 537 * is actually removed in idx_remove_callback(). 538 538 */ 539 539 fibril_mutex_lock(&used_lock); … … 556 556 free(f); 557 557 } 558 free(u); 558 free(u); 559 559 } 560 560 561 561 /** 562 562 * @} 563 */ 563 */ -
uspace/srv/fs/fat/fat_ops.c
rdf6ded8 r1b20da0 312 312 d = ((fat_dentry_t *)b->data) + (idxp->pdi % DPS(bs)); 313 313 if (FAT_IS_FAT32(bs)) { 314 nodep->firstc = uint16_t_le2host(d->firstc_lo) | 314 nodep->firstc = uint16_t_le2host(d->firstc_lo) | 315 315 (uint16_t_le2host(d->firstc_hi) << 16); 316 316 } else … … 535 535 if (flags & L_DIRECTORY) 536 536 (void) fat_free_clusters(bs, service_id, mcl); 537 return rc; 537 return rc; 538 538 } 539 539
Note:
See TracChangeset
for help on using the changeset viewer.
