Changeset 033ef7d3 in mainline for uspace/srv/fs/fat/fat_dentry.c
- Timestamp:
- 2008-10-26T13:09:24Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f57d0e
- Parents:
- 6ebaff9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_dentry.c
r6ebaff9 r033ef7d3 36 36 */ 37 37 38 #include "fat_dentry.h" 39 40 #define FAT_PAD ' ' 41 42 #define FAT_DENTRY_UNUSED 0x00 43 #define FAT_DENTRY_E5_ESC 0x05 44 #define FAT_DENTRY_DOT 0x2e 45 #define FAT_DENTRY_ERASED 0xe5 46 47 void dentry_name_canonify(fat_dentry_t *d, char *buf) 48 { 49 int i; 50 51 for (i = 0; i < FAT_NAME_LEN; i++) { 52 if (d->name[i] == FAT_PAD) 53 break; 54 if (d->name[i] == FAT_DENTRY_E5_ESC) 55 *buf++ = 0xe5; 56 else 57 *buf++ = d->name[i]; 58 } 59 if (d->ext[0] != FAT_PAD) 60 *buf++ = '.'; 61 for (i = 0; i < FAT_EXT_LEN; i++) { 62 if (d->ext[i] == FAT_PAD) { 63 *buf = '\0'; 64 return; 65 } 66 if (d->ext[i] == FAT_DENTRY_E5_ESC) 67 *buf++ = 0xe5; 68 else 69 *buf++ = d->ext[i]; 70 } 71 *buf = '\0'; 72 } 73 74 fat_dentry_clsf_t fat_classify_dentry(fat_dentry_t *d) 75 { 76 if (d->attr & FAT_ATTR_VOLLABEL) { 77 /* volume label entry */ 78 return FAT_DENTRY_SKIP; 79 } 80 if (d->name[0] == FAT_DENTRY_ERASED) { 81 /* not-currently-used entry */ 82 return FAT_DENTRY_SKIP; 83 } 84 if (d->name[0] == FAT_DENTRY_UNUSED) { 85 /* never used entry */ 86 return FAT_DENTRY_LAST; 87 } 88 if (d->name[0] == FAT_DENTRY_DOT) { 89 /* 90 * Most likely '.' or '..'. 91 * It cannot occur in a regular file name. 92 */ 93 return FAT_DENTRY_SKIP; 94 } 95 return FAT_DENTRY_VALID; 96 } 38 97 39 98 /**
Note:
See TracChangeset
for help on using the changeset viewer.