Changeset 1d8cdb1 in mainline for uspace/srv/fs/fat/fat_fat.c
- Timestamp:
- 2008-11-18T20:28:17Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 18c485a
- Parents:
- 26fa0f9f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
r26fa0f9f r1d8cdb1 95 95 fidx = clst % (bps / sizeof(fat_cluster_t)); 96 96 /* read FAT1 */ 97 b = block_get(dev_handle, rscnt + fsec );97 b = block_get(dev_handle, rscnt + fsec, BLOCK_FLAGS_NONE); 98 98 clst = uint16_t_le2host(((fat_cluster_t *)b->data)[fidx]); 99 99 assert(clst != FAT_CLST_BAD); … … 115 115 * is empty. 116 116 * @param bn Block number. 117 * @param flags Flags passed to libblock. 117 118 * 118 119 * @return Block structure holding the requested block. … … 120 121 block_t * 121 122 _fat_block_get(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc, 122 bn_t bn )123 bn_t bn, int flags) 123 124 { 124 125 block_t *b; … … 144 145 /* root directory special case */ 145 146 assert(bn < rds); 146 b = block_get(dev_handle, rscnt + bs->fatcnt * sf + bn );147 b = block_get(dev_handle, rscnt + bs->fatcnt * sf + bn, flags); 147 148 return b; 148 149 } … … 154 155 155 156 b = block_get(dev_handle, ssa + (lastc - FAT_CLST_FIRST) * bs->spc + 156 bn % bs->spc );157 bn % bs->spc, flags); 157 158 158 159 return b; … … 184 185 for (o = nodep->size - 1; o < pos && o < boundary; 185 186 o = ALIGN_DOWN(o + bps, bps)) { 186 b = fat_block_get(bs, nodep, o / bps); 187 int flags = (o % bps == 0) ? 188 BLOCK_FLAGS_NOREAD : BLOCK_FLAGS_NONE; 189 b = fat_block_get(bs, nodep, o / bps, flags); 187 190 memset(b->data + o % bps, 0, bps - o % bps); 188 191 b->dirty = true; /* need to sync node */ … … 196 199 for (o = boundary; o < pos; o += bps) { 197 200 b = _fat_block_get(bs, nodep->idx->dev_handle, mcl, 198 (o - boundary) / bps );201 (o - boundary) / bps, BLOCK_FLAGS_NOREAD); 199 202 memset(b->data, 0, min(bps, pos - o)); 200 203 b->dirty = true; /* need to sync node */ … … 222 225 rscnt = uint16_t_le2host(bs->rscnt); 223 226 224 b = block_get(dev_handle, rscnt + (clst * sizeof(fat_cluster_t)) / bps); 227 b = block_get(dev_handle, rscnt + (clst * sizeof(fat_cluster_t)) / bps, 228 BLOCK_FLAGS_NONE); 225 229 cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t)); 226 230 value = uint16_t_le2host(*cp); … … 254 258 assert(fatno < bs->fatcnt); 255 259 b = block_get(dev_handle, rscnt + sf * fatno + 256 (clst * sizeof(fat_cluster_t)) / bps );260 (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE); 257 261 cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t)); 258 262 *cp = host2uint16_t_le(value); … … 324 328 futex_down(&fat_alloc_lock); 325 329 for (b = 0, cl = 0; b < sf; blk++) { 326 blk = block_get(dev_handle, rscnt + b );330 blk = block_get(dev_handle, rscnt + b, BLOCK_FLAGS_NOREAD); 327 331 for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) { 328 332 fat_cluster_t *clst = (fat_cluster_t *)blk->data + c;
Note:
See TracChangeset
for help on using the changeset viewer.