Changeset 65ccd23 in mainline
- Timestamp:
- 2011-06-10T17:17:24Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- da2f8d10
- Parents:
- 34fdb75
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_dentry.c
r34fdb75 r65ccd23 219 219 fat_dentry_clsf_t fat_classify_dentry(const fat_dentry_t *d) 220 220 { 221 /* if (d->attr == FAT_ATTR_LFN) { */ 221 if (d->attr == FAT_ATTR_LFN) { 222 222 /* long name entry */ 223 /*if (d->attr & FAT_LFN_ERASED)223 if (d->attr & FAT_LFN_ERASED) 224 224 return FAT_DENTRY_FREE; 225 225 else 226 226 return FAT_DENTRY_LFN; 227 } */227 } 228 228 if (d->attr & FAT_ATTR_VOLLABEL) { 229 229 /* volume label entry */ -
uspace/srv/fs/fat/fat_dentry.h
r34fdb75 r65ccd23 88 88 FAT_DENTRY_LAST, 89 89 FAT_DENTRY_FREE, 90 FAT_DENTRY_VALID 91 /* FAT_DENTRY_LFN */90 FAT_DENTRY_VALID, 91 FAT_DENTRY_LFN 92 92 } fat_dentry_clsf_t; 93 93 -
uspace/srv/fs/fat/fat_ops.c
r34fdb75 r65ccd23 56 56 #include <align.h> 57 57 #include <malloc.h> 58 #include <str.h> 58 59 59 60 #define FAT_NODE(node) ((node) ? (fat_node_t *) (node)->data : NULL) … … 642 643 d = ((fat_dentry_t *)b->data) + j; 643 644 switch (fat_classify_dentry(d)) { 645 case FAT_DENTRY_LFN: 644 646 case FAT_DENTRY_SKIP: 645 647 case FAT_DENTRY_VALID: … … 1219 1221 unsigned bnum; 1220 1222 aoff64_t spos = pos; 1221 char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1]; 1223 char name[FAT_LFN_NAME_SIZE]; 1224 uint8_t lfn_utf16[FAT_LFN_MAX_COUNT * FAT_LFN_ENTRY_SIZE]; 1225 size_t lfn_offset; 1226 size_t lfn_size; 1227 bool long_entry = false; 1228 int long_entry_count = 0; 1222 1229 fat_dentry_t *d; 1230 uint8_t checksum=0; 1223 1231 1224 1232 assert(nodep->type == FAT_DIRECTORY); … … 1247 1255 case FAT_DENTRY_SKIP: 1248 1256 case FAT_DENTRY_FREE: 1257 long_entry_count = 0; 1258 long_entry = false; 1249 1259 continue; 1250 1260 case FAT_DENTRY_LAST: 1261 long_entry_count = 0; 1262 long_entry = false; 1251 1263 rc = block_put(b); 1252 1264 if (rc != EOK) 1253 1265 goto err; 1254 1266 goto miss; 1267 case FAT_DENTRY_LFN: 1268 if (long_entry) { 1269 /* We found long entry */ 1270 long_entry_count--; 1271 if ((FAT_LFN_ORDER(d) == long_entry_count) && 1272 (checksum == FAT_LFN_CHKSUM(d))) { 1273 /* Right order! */ 1274 fat_lfn_copy_entry(d, lfn_utf16, &lfn_offset); 1275 } else { 1276 /* Something wrong with order. Skip this long entries set */ 1277 long_entry_count = 0; 1278 long_entry = false; 1279 } 1280 } else { 1281 if (FAT_IS_LFN(d)) { 1282 /* We found Last long entry! */ 1283 if (FAT_LFN_COUNT(d) <= FAT_LFN_MAX_COUNT) { 1284 long_entry = true; 1285 long_entry_count = FAT_LFN_COUNT(d); 1286 lfn_size = (FAT_LFN_ENTRY_SIZE * 1287 (FAT_LFN_COUNT(d) - 1)) + fat_lfn_size(d); 1288 lfn_offset = lfn_size; 1289 fat_lfn_copy_entry(d, lfn_utf16, &lfn_offset); 1290 checksum = FAT_LFN_CHKSUM(d); 1291 } 1292 } 1293 } 1294 break; 1255 1295 default: 1256 1296 case FAT_DENTRY_VALID: 1257 fat_dentry_name_get(d, name); 1297 if (long_entry && 1298 (checksum == fat_dentry_chksum(d->name))) { 1299 rc = fat_lfn_convert_name(lfn_utf16, lfn_size, (uint8_t*)name, FAT_LFN_NAME_SIZE); 1300 if (rc!=EOK) 1301 fat_dentry_name_get(d, name); 1302 } 1303 else 1304 fat_dentry_name_get(d, name); 1305 1306 long_entry_count = 0; 1307 long_entry = false; 1258 1308 rc = block_put(b); 1259 1309 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.