Rev 2822 | Rev 2831 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2822 | Rev 2828 | ||
---|---|---|---|
Line 111... | Line 111... | ||
111 | static void *fat_match(void *prnt, const char *component) |
111 | static void *fat_match(void *prnt, const char *component) |
112 | { |
112 | { |
113 | fat_node_t *parentp = (fat_node_t *)prnt; |
113 | fat_node_t *parentp = (fat_node_t *)prnt; |
114 | char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1]; |
114 | char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1]; |
115 | unsigned i, j; |
115 | unsigned i, j; |
- | 116 | unsigned bps; /* bytes per sector */ |
|
116 | unsigned dps; /* dentries per sector */ |
117 | unsigned dps; /* dentries per sector */ |
117 | unsigned blocks; |
118 | unsigned blocks; |
118 | fat_dentry_t *d; |
119 | fat_dentry_t *d; |
119 | block_t *bb; |
120 | block_t *bb; |
120 | block_t *b; |
121 | block_t *b; |
121 | fat_bs_t *bs; |
- | |
122 | 122 | ||
123 | bb = block_get(parentp->dev_handle, BS_BLOCK); |
123 | bb = block_get(parentp->dev_handle, BS_BLOCK); |
124 | if (!bb) |
124 | if (!bb) |
125 | return NULL; |
125 | return NULL; |
126 | bs = (fat_bs_t *)bb->data; |
126 | bps = uint16_t_le2host(((fat_bs_t *)bb->data)->bps); |
127 | dps = bs->bps / sizeof(fat_dentry_t); |
- | |
128 | blocks = parentp->size / bs->bps + (parentp->size % bs->bps != 0); |
- | |
129 | block_put(bb); |
127 | block_put(bb); |
- | 128 | dps = bps / sizeof(fat_dentry_t); |
|
- | 129 | blocks = parentp->size / bps + (parentp->size % bps != 0); |
|
130 | for (i = 0; i < blocks; i++) { |
130 | for (i = 0; i < blocks; i++) { |
131 | unsigned dentries; |
131 | unsigned dentries; |
132 | 132 | ||
133 | b = fat_block_get(parentp, i); |
133 | b = fat_block_get(parentp, i); |
134 | if (!b) |
134 | if (!b) |