Changeset 7234617 in mainline for uspace/srv/fs/fat/fat_dentry.c
- Timestamp:
- 2011-08-21T15:27:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9fbe05e
- Parents:
- c56c4576
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_dentry.c
rc56c4576 r7234617 266 266 } 267 267 268 size_t fat_lfn_get_ part(const uint16_t *src, size_t src_size, uint16_t *dst, size_t *offset)269 { 270 while (src_size!=0 && (*offset)!=0) {271 src_size--;272 if ( src[src_size] == 0 || src[src_size] == FAT_LFN_PAD)268 size_t fat_lfn_get_entry(const fat_dentry_t *d, uint16_t *dst, size_t *offset) 269 { 270 int i; 271 for (i=1; i>=0 && *offset>0; i--) { 272 if (d->lfn.part3[i] == 0 || d->lfn.part3[i] == FAT_LFN_PAD) 273 273 continue; 274 275 274 (*offset)--; 276 dst[(*offset)] = uint16_t_le2host(src[src_size]); 277 } 278 return (*offset); 279 } 280 281 size_t fat_lfn_get_entry(const fat_dentry_t *d, uint16_t *dst, size_t *offset) 282 { 283 fat_lfn_get_part(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE, dst, offset); 284 fat_lfn_get_part(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE, dst, offset); 285 fat_lfn_get_part(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE, dst, offset); 286 275 dst[(*offset)] = uint16_t_le2host(d->lfn.part3[i]); 276 } 277 for (i=5; i>=0 && *offset>0; i--) { 278 if (d->lfn.part2[i] == 0 || d->lfn.part2[i] == FAT_LFN_PAD) 279 continue; 280 (*offset)--; 281 dst[(*offset)] = uint16_t_le2host(d->lfn.part2[i]); 282 } 283 for (i=4; i>=0 && *offset>0; i--) { 284 if (d->lfn.part1[i] == 0 || d->lfn.part1[i] == FAT_LFN_PAD) 285 continue; 286 (*offset)--; 287 dst[(*offset)] = uint16_t_le2host(d->lfn.part1[i]); 288 } 287 289 return *offset; 288 290 } 289 291 290 size_t fat_lfn_set_ part(const uint16_t *src, size_t *offset, size_t src_size, uint16_t *dst, size_t dst_size)292 size_t fat_lfn_set_entry(const uint16_t *src, size_t *offset, size_t size, fat_dentry_t *d) 291 293 { 292 294 size_t idx; 293 for (idx=0; idx < dst_size; idx++) {294 if (*offset < s rc_size) {295 d st[idx] = uint16_t_le2host(src[*offset]);295 for (idx=0; idx < 5; idx++) { 296 if (*offset < size) { 297 d->lfn.part1[idx] = host2uint16_t_le(src[*offset]); 296 298 (*offset)++; 297 299 } 298 300 else 299 dst[idx] = FAT_LFN_PAD; 300 } 301 return *offset; 302 } 303 304 size_t fat_lfn_set_entry(const uint16_t *src, size_t *offset, size_t size, fat_dentry_t *d) 305 { 306 fat_lfn_set_part(src, offset, size, FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE); 307 fat_lfn_set_part(src, offset, size, FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE); 308 fat_lfn_set_part(src, offset, size, FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE); 301 d->lfn.part1[idx] = FAT_LFN_PAD; 302 } 303 for (idx=0; idx < 6; idx++) { 304 if (*offset < size) { 305 d->lfn.part2[idx] = host2uint16_t_le(src[*offset]); 306 (*offset)++; 307 } 308 else 309 d->lfn.part2[idx] = FAT_LFN_PAD; 310 } 311 for (idx=0; idx < 2; idx++) { 312 if (*offset < size) { 313 d->lfn.part3[idx] = host2uint16_t_le(src[*offset]); 314 (*offset)++; 315 } 316 else 317 d->lfn.part3[idx] = FAT_LFN_PAD; 318 } 319 309 320 if (src[*offset] == 0) 310 321 offset++;
Note:
See TracChangeset
for help on using the changeset viewer.