49,7 → 49,6 |
#include <futex.h> |
|
#define BS_BLOCK 0 |
#define BS_SIZE 512 |
|
/** Futex protecting the list of cached free FAT nodes. */ |
static futex_t ffn_futex = FUTEX_INITIALIZER; |
100,7 → 99,7 |
void *data; |
} block_t; |
|
static block_t *block_get(dev_handle_t dev_handle, off_t offset, size_t bs) |
static block_t *block_get(dev_handle_t dev_handle, off_t offset) |
{ |
return NULL; /* TODO */ |
} |
144,7 → 143,7 |
fat_cluster_t clst = firstc; |
unsigned i; |
|
bb = block_get(dev_handle, BS_BLOCK, BS_SIZE); |
bb = block_get(dev_handle, BS_BLOCK); |
bps = uint16_t_le2host(FAT_BS(bb)->bps); |
spc = FAT_BS(bb)->spc; |
rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt); |
160,7 → 159,7 |
if (firstc == FAT_CLST_ROOT) { |
/* root directory special case */ |
assert(offset < rds); |
b = block_get(dev_handle, rscnt + fatcnt * sf + offset, bps); |
b = block_get(dev_handle, rscnt + fatcnt * sf + offset); |
return b; |
} |
|
173,7 → 172,7 |
fsec = (clst * sizeof(fat_cluster_t)) / bps; |
fidx = clst % (bps / sizeof(fat_cluster_t)); |
/* read FAT1 */ |
b = block_get(dev_handle, rscnt + fsec, bps); |
b = block_get(dev_handle, rscnt + fsec); |
clst = uint16_t_le2host(((fat_cluster_t *)b->data)[fidx]); |
assert(clst != FAT_CLST_BAD); |
assert(clst < FAT_CLST_LAST1); |
181,7 → 180,7 |
} |
|
b = block_get(dev_handle, ssa + (clst - FAT_CLST_FIRST) * spc + |
offset % spc, bps); |
offset % spc); |
|
return b; |
} |
203,7 → 202,7 |
block_t *bb; |
uint16_t bps; |
|
bb = block_get(dev_handle, BS_BLOCK, BS_SIZE); |
bb = block_get(dev_handle, BS_BLOCK); |
assert(bb != NULL); |
bps = uint16_t_le2host(FAT_BS(bb)->bps); |
block_put(bb); |
572,7 → 571,7 |
int rc; |
|
/* Read the number of root directory entries. */ |
bb = block_get(dev_handle, BS_BLOCK, BS_SIZE); |
bb = block_get(dev_handle, BS_BLOCK); |
rde = uint16_t_le2host(FAT_BS(bb)->root_ent_max); |
block_put(bb); |
|