Changeset 033ef7d3 in mainline for uspace/srv/fs/fat/fat_ops.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_ops.c
r6ebaff9 r033ef7d3 37 37 38 38 #include "fat.h" 39 #include "fat_dentry.h" 40 #include "fat_fat.h" 39 41 #include "../../vfs/vfs.h" 40 42 #include <libfs.h> … … 62 64 static LIST_INITIALIZE(ffn_head); 63 65 64 #define FAT_NAME_LEN 865 #define FAT_EXT_LEN 366 67 #define FAT_PAD ' '68 69 #define FAT_DENTRY_UNUSED 0x0070 #define FAT_DENTRY_E5_ESC 0x0571 #define FAT_DENTRY_DOT 0x2e72 #define FAT_DENTRY_ERASED 0xe573 74 66 #define min(a, b) ((a) < (b) ? (a) : (b)) 75 76 static void dentry_name_canonify(fat_dentry_t *d, char *buf)77 {78 int i;79 80 for (i = 0; i < FAT_NAME_LEN; i++) {81 if (d->name[i] == FAT_PAD)82 break;83 if (d->name[i] == FAT_DENTRY_E5_ESC)84 *buf++ = 0xe5;85 else86 *buf++ = d->name[i];87 }88 if (d->ext[0] != FAT_PAD)89 *buf++ = '.';90 for (i = 0; i < FAT_EXT_LEN; i++) {91 if (d->ext[i] == FAT_PAD) {92 *buf = '\0';93 return;94 }95 if (d->ext[i] == FAT_DENTRY_E5_ESC)96 *buf++ = 0xe5;97 else98 *buf++ = d->ext[i];99 }100 *buf = '\0';101 }102 67 103 68 static int dev_phone = -1; /* FIXME */ … … 298 263 299 264 return bps; 300 }301 302 typedef enum {303 FAT_DENTRY_SKIP,304 FAT_DENTRY_LAST,305 FAT_DENTRY_VALID306 } fat_dentry_clsf_t;307 308 static fat_dentry_clsf_t fat_classify_dentry(fat_dentry_t *d)309 {310 if (d->attr & FAT_ATTR_VOLLABEL) {311 /* volume label entry */312 return FAT_DENTRY_SKIP;313 }314 if (d->name[0] == FAT_DENTRY_ERASED) {315 /* not-currently-used entry */316 return FAT_DENTRY_SKIP;317 }318 if (d->name[0] == FAT_DENTRY_UNUSED) {319 /* never used entry */320 return FAT_DENTRY_LAST;321 }322 if (d->name[0] == FAT_DENTRY_DOT) {323 /*324 * Most likely '.' or '..'.325 * It cannot occur in a regular file name.326 */327 return FAT_DENTRY_SKIP;328 }329 return FAT_DENTRY_VALID;330 265 } 331 266
Note:
See TracChangeset
for help on using the changeset viewer.