Changeset a248234 in mainline
- Timestamp:
- 2009-05-06T19:30:07Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8bb129d
- Parents:
- 0be3e8b
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/mkfat.py
r0be3e8b ra248234 139 139 char ext[3] /* file extension */ 140 140 uint8_t attr /* file attributes */ 141 padding[1] /* reserved for NT*/141 uint8_t lcase /* file name case (NT extension) */ 142 142 uint8_t ctime_fine /* create time (fine resolution) */ 143 143 uint16_t ctime /* create time */ … … 218 218 dir_entry.attr = 0x20 219 219 220 dir_entry.lcase = 0x18 220 221 dir_entry.ctime_fine = 0 # FIXME 221 222 dir_entry.ctime = 0 # FIXME -
uspace/srv/fs/fat/fat_dentry.c
r0be3e8b ra248234 115 115 void fat_dentry_name_get(const fat_dentry_t *d, char *buf) 116 116 { 117 int i;118 117 unsigned int i; 118 119 119 for (i = 0; i < FAT_NAME_LEN; i++) { 120 120 if (d->name[i] == FAT_PAD) 121 121 break; 122 122 123 if (d->name[i] == FAT_DENTRY_E5_ESC) 123 124 *buf++ = 0xe5; 124 else 125 *buf++ = d->name[i]; 126 } 125 else { 126 if (d->lcase & FAT_LCASE_LOWER_NAME) 127 *buf++ = tolower(d->name[i]); 128 else 129 *buf++ = d->name[i]; 130 } 131 } 132 127 133 if (d->ext[0] != FAT_PAD) 128 134 *buf++ = '.'; 135 129 136 for (i = 0; i < FAT_EXT_LEN; i++) { 130 137 if (d->ext[i] == FAT_PAD) { … … 132 139 return; 133 140 } 141 134 142 if (d->ext[i] == FAT_DENTRY_E5_ESC) 135 143 *buf++ = 0xe5; 136 else 137 *buf++ = d->ext[i]; 138 } 144 else { 145 if (d->lcase & FAT_LCASE_LOWER_EXT) 146 *buf++ = tolower(d->ext[i]); 147 else 148 *buf++ = d->ext[i]; 149 } 150 } 151 139 152 *buf = '\0'; 140 153 } … … 142 155 void fat_dentry_name_set(fat_dentry_t *d, const char *name) 143 156 { 144 int i;157 unsigned int i; 145 158 const char fake_ext[] = " "; 146 147 159 bool lower_name = true; 160 bool lower_ext = true; 161 148 162 for (i = 0; i < FAT_NAME_LEN; i++) { 149 163 switch ((uint8_t) *name) { … … 157 171 break; 158 172 default: 173 if (isalpha(*name)) { 174 if (!islower(*name)) 175 lower_name = false; 176 } 177 159 178 d->name[i] = toupper(*name++); 160 179 break; 161 180 } 162 181 } 182 163 183 if (*name++ != '.') 164 184 name = fake_ext; 185 165 186 for (i = 0; i < FAT_EXT_LEN; i++) { 166 187 switch ((uint8_t) *name) { … … 173 194 break; 174 195 default: 196 if (isalpha(*name)) { 197 if (!islower(*name)) 198 lower_ext = false; 199 } 200 175 201 d->ext[i] = toupper(*name++); 176 202 break; 177 203 } 178 204 } 205 206 if (lower_name) 207 d->lcase |= FAT_LCASE_LOWER_NAME; 208 else 209 d->lcase &= ~FAT_LCASE_LOWER_NAME; 210 211 if (lower_ext) 212 d->lcase |= FAT_LCASE_LOWER_EXT; 213 else 214 d->lcase &= ~FAT_LCASE_LOWER_EXT; 179 215 } 180 216 -
uspace/srv/fs/fat/fat_dentry.h
r0be3e8b ra248234 48 48 #define FAT_ATTR_SUBDIR (1 << 4) 49 49 50 #define FAT_LCASE_LOWER_NAME 0x08 51 #define FAT_LCASE_LOWER_EXT 0x10 52 50 53 #define FAT_PAD ' ' 51 54 … … 66 69 uint8_t ext[3]; 67 70 uint8_t attr; 68 uint8_t reserved;71 uint8_t lcase; 69 72 uint8_t ctime_fine; 70 73 uint16_t ctime;
Note:
See TracChangeset
for help on using the changeset viewer.