Changes in uspace/srv/fs/fat/fat_fat.h [d963742:15f3c3f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.h
rd963742 r15f3c3f 1 1 /* 2 2 * Copyright (c) 2008 Jakub Jermar 3 * Copyright (c) 2011 Oleg Romanenko4 3 * All rights reserved. 5 4 * … … 30 29 /** @addtogroup fs 31 30 * @{ 32 */ 31 */ 33 32 34 33 #ifndef FAT_FAT_FAT_H_ … … 41 40 #define FAT1 0 42 41 43 #define FAT_CLST_RES0 0 44 #define FAT_CLST_RES1 1 45 #define FAT_CLST_FIRST 2 46 47 #define FAT32_CLST_BAD 0x0ffffff7 48 #define FAT32_CLST_LAST1 0x0ffffff8 49 #define FAT32_CLST_LAST8 0x0fffffff 50 51 #define FAT12_MASK 0x0fff 52 #define FAT16_MASK 0xffff 53 #define FAT32_MASK 0x0fffffff 54 55 #define FAT12_CLST_MAX 4085 56 #define FAT16_CLST_MAX 65525 57 58 /* Size in bytes for cluster value of FAT */ 59 #define FAT12_CLST_SIZE 2 60 #define FAT16_CLST_SIZE 2 61 #define FAT32_CLST_SIZE 4 42 #define FAT_CLST_RES0 0x0000 43 #define FAT_CLST_RES1 0x0001 44 #define FAT_CLST_FIRST 0x0002 45 #define FAT_CLST_BAD 0xfff7 46 #define FAT_CLST_LAST1 0xfff8 47 #define FAT_CLST_LAST8 0xffff 62 48 63 49 /* internally used to mark root directory's parent */ … … 66 52 #define FAT_CLST_ROOT FAT_CLST_RES1 67 53 68 /*69 * Convenience macros for computing some frequently used values from the70 * primitive boot sector members.71 */72 #define RDS(bs) ((sizeof(fat_dentry_t) * RDE((bs))) / BPS((bs))) + \73 (((sizeof(fat_dentry_t) * RDE((bs))) % BPS((bs))) != 0)74 #define SSA(bs) (RSCNT((bs)) + FATCNT((bs)) * SF((bs)) + RDS(bs))75 #define DS(bs) (TS(bs) - SSA(bs))76 #define CC(bs) (DS(bs) / SPC(bs))77 78 #define FAT_IS_FAT12(bs) (CC(bs) < FAT12_CLST_MAX)79 #define FAT_IS_FAT16(bs) \80 ((CC(bs) >= FAT12_CLST_MAX) && (CC(bs) < FAT16_CLST_MAX))81 #define FAT_IS_FAT32(bs) (CC(bs) >= FAT16_CLST_MAX)82 83 #define FAT_CLST_SIZE(bs) \84 (FAT_IS_FAT32(bs) ? FAT32_CLST_SIZE : FAT16_CLST_SIZE)85 86 #define FAT_MASK(bs) \87 (FAT_IS_FAT12(bs) ? FAT12_MASK : \88 (FAT_IS_FAT32(bs) ? FAT32_MASK : FAT16_MASK))89 90 #define FAT_CLST_LAST1(bs) (FAT32_CLST_LAST1 & FAT_MASK((bs)))91 #define FAT_CLST_LAST8(bs) (FAT32_CLST_LAST8 & FAT_MASK((bs)))92 #define FAT_CLST_BAD(bs) (FAT32_CLST_BAD & FAT_MASK((bs)))93 94 #define FAT_ROOT_CLST(bs) \95 (FAT_IS_FAT32(bs) ? uint32_t_le2host(bs->fat32.root_cluster) : \96 FAT_CLST_ROOT)97 98 54 /* forward declarations */ 99 55 struct block; … … 101 57 struct fat_bs; 102 58 103 typedef uint 32_t fat_cluster_t;59 typedef uint16_t fat_cluster_t; 104 60 105 61 #define fat_clusters_get(numc, bs, dh, fc) \ 106 fat_cluster_walk((bs), (dh), (fc), NULL, (numc), (uint 32_t) -1)107 extern int fat_cluster_walk(struct fat_bs *, devmap_handle_t, fat_cluster_t,108 fat_cluster_t *, uint 32_t *, uint32_t);62 fat_cluster_walk((bs), (dh), (fc), NULL, (numc), (uint16_t) -1) 63 extern int fat_cluster_walk(struct fat_bs *, service_id_t, fat_cluster_t, 64 fat_cluster_t *, uint16_t *, uint16_t); 109 65 110 66 extern int fat_block_get(block_t **, struct fat_bs *, struct fat_node *, 111 67 aoff64_t, int); 112 extern int _fat_block_get(block_t **, struct fat_bs *, devmap_handle_t,68 extern int _fat_block_get(block_t **, struct fat_bs *, service_id_t, 113 69 fat_cluster_t, fat_cluster_t *, aoff64_t, int); 114 70 … … 117 73 extern int fat_chop_clusters(struct fat_bs *, struct fat_node *, 118 74 fat_cluster_t); 119 extern int fat_alloc_clusters(struct fat_bs *, devmap_handle_t, unsigned,75 extern int fat_alloc_clusters(struct fat_bs *, service_id_t, unsigned, 120 76 fat_cluster_t *, fat_cluster_t *); 121 extern int fat_free_clusters(struct fat_bs *, devmap_handle_t, fat_cluster_t);122 extern int fat_alloc_shadow_clusters(struct fat_bs *, devmap_handle_t,77 extern int fat_free_clusters(struct fat_bs *, service_id_t, fat_cluster_t); 78 extern int fat_alloc_shadow_clusters(struct fat_bs *, service_id_t, 123 79 fat_cluster_t *, unsigned); 124 extern int fat_get_cluster _fat12(struct fat_bs *, devmap_handle_t, unsigned,80 extern int fat_get_cluster(struct fat_bs *, service_id_t, unsigned, 125 81 fat_cluster_t, fat_cluster_t *); 126 extern int fat_get_cluster_fat16(struct fat_bs *, devmap_handle_t, unsigned, 127 fat_cluster_t, fat_cluster_t *); 128 extern int fat_get_cluster_fat32(struct fat_bs *, devmap_handle_t, unsigned, 129 fat_cluster_t, fat_cluster_t *); 130 extern int fat_get_cluster(struct fat_bs *, devmap_handle_t, unsigned, 131 fat_cluster_t, fat_cluster_t *); 132 extern int fat_set_cluster_fat12(struct fat_bs *, devmap_handle_t, unsigned, 133 fat_cluster_t, fat_cluster_t); 134 extern int fat_set_cluster_fat16(struct fat_bs *, devmap_handle_t, unsigned, 135 fat_cluster_t, fat_cluster_t); 136 extern int fat_set_cluster_fat32(struct fat_bs *, devmap_handle_t, unsigned, 137 fat_cluster_t, fat_cluster_t); 138 extern int fat_set_cluster(struct fat_bs *, devmap_handle_t, unsigned, 82 extern int fat_set_cluster(struct fat_bs *, service_id_t, unsigned, 139 83 fat_cluster_t, fat_cluster_t); 140 84 extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t, 141 85 aoff64_t); 142 extern int fat_zero_cluster(struct fat_bs *, devmap_handle_t, fat_cluster_t);143 extern int fat_sanity_check(struct fat_bs *, devmap_handle_t);86 extern int fat_zero_cluster(struct fat_bs *, service_id_t, fat_cluster_t); 87 extern int fat_sanity_check(struct fat_bs *, service_id_t); 144 88 145 89 #endif
Note:
See TracChangeset
for help on using the changeset viewer.