Changeset d260a95 in mainline for uspace/srv/fs/fat/fat_fat.h


Ignore:
Timestamp:
2011-04-19T08:03:45Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3dbe4ca2
Parents:
97bc3ee
Message:

Improve code style for my changes. Adding macros for determining type of FAT and cluster value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_fat.h

    r97bc3ee rd260a95  
    5151#define FAT16_CLST_LAST8  0xffff
    5252
     53#define FAT12_CLST_MAX    4085
     54#define FAT16_CLST_MAX    65525
     55
    5356/* internally used to mark root directory's parent */
    5457#define FAT_CLST_ROOTPAR        FAT_CLST_RES0
     
    6063 * primitive boot sector members.
    6164 */
    62 #define RDS(bs)         ((sizeof(fat_dentry_t) * RDE((bs))) / BPS((bs))) + \
    63                         (((sizeof(fat_dentry_t) * RDE((bs))) % BPS((bs))) != 0)
    64 #define SSA(bs)         (RSCNT((bs)) + FATCNT((bs)) * SF((bs)) + RDS(bs))
    65 #define DS(bs)          (TS(bs) - SSA(bs))
    66 #define CC(bs)          (DS(bs) / SPC(bs))
    67 #define FATTYPE(bs)     (bs)->reserved
     65#define RDS(bs)   ((sizeof(fat_dentry_t) * RDE((bs))) / BPS((bs))) + \
     66                   (((sizeof(fat_dentry_t) * RDE((bs))) % BPS((bs))) != 0)
     67#define SSA(bs)   (RSCNT((bs)) + FATCNT((bs)) * SF((bs)) + RDS(bs))
     68#define DS(bs)    (TS(bs) - SSA(bs))
     69#define CC(bs)    (DS(bs) / SPC(bs))
     70
     71#define FAT_IS_FAT12(bs)        (CC(bs) < FAT12_CLST_MAX)
     72#define FAT_IS_FAT16(bs) \
     73    ((CC(bs) >= FAT12_CLST_MAX) && (CC(bs) < FAT16_CLST_MAX))
     74
     75#define FAT_CLST_LAST1(bs) \
     76    (FAT_IS_FAT12(bs) ? FAT12_CLST_LAST1 : FAT16_CLST_LAST1)
     77#define FAT_CLST_LAST8(bs) \
     78    (FAT_IS_FAT12(bs) ? FAT12_CLST_LAST8 : FAT16_CLST_LAST8)
     79#define FAT_CLST_BAD(bs) \
     80    (FAT_IS_FAT12(bs) ? FAT12_CLST_BAD : FAT16_CLST_BAD)
    6881
    6982/* forward declarations */
Note: See TracChangeset for help on using the changeset viewer.