Changeset 1d8cdb1 in mainline for uspace/srv/fs
- Timestamp:
- 2008-11-18T20:28:17Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 18c485a
- Parents:
- 26fa0f9f
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 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; -
uspace/srv/fs/fat/fat_fat.h
r26fa0f9f r1d8cdb1 64 64 fat_cluster_t *, uint16_t); 65 65 66 #define fat_block_get(bs, np, bn ) \67 _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (bn) )66 #define fat_block_get(bs, np, bn, flags) \ 67 _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (bn), (flags)) 68 68 69 69 extern struct block *_fat_block_get(struct fat_bs *, dev_handle_t, 70 fat_cluster_t, bn_t );70 fat_cluster_t, bn_t, int); 71 71 72 72 extern void fat_append_clusters(struct fat_bs *, struct fat_node *, -
uspace/srv/fs/fat/fat_ops.c
r26fa0f9f r1d8cdb1 90 90 /* Read the block that contains the dentry of interest. */ 91 91 b = _fat_block_get(bs, node->idx->dev_handle, node->idx->pfc, 92 (node->idx->pdi * sizeof(fat_dentry_t)) / bps );92 (node->idx->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE); 93 93 94 94 d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps); … … 182 182 /* Read the block that contains the dentry of interest. */ 183 183 b = _fat_block_get(bs, idxp->dev_handle, idxp->pfc, 184 (idxp->pdi * sizeof(fat_dentry_t)) / bps );184 (idxp->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE); 185 185 assert(b); 186 186 … … 283 283 blocks = parentp->size / bps; 284 284 for (i = 0; i < blocks; i++) { 285 b = fat_block_get(bs, parentp, i );285 b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE); 286 286 for (j = 0; j < dps; j++) { 287 287 d = ((fat_dentry_t *)b->data) + j; … … 373 373 fat_dentry_t *d; 374 374 375 b = fat_block_get(bs, nodep, i );375 b = fat_block_get(bs, nodep, i, BLOCK_FLAGS_NONE); 376 376 for (j = 0; j < dps; j++) { 377 377 d = ((fat_dentry_t *)b->data) + j; … … 575 575 bytes = min(len, bps - pos % bps); 576 576 bytes = min(bytes, nodep->size - pos); 577 b = fat_block_get(bs, nodep, pos / bps); 577 b = fat_block_get(bs, nodep, pos / bps, 578 BLOCK_FLAGS_NONE); 578 579 (void) ipc_data_read_finalize(callid, b->data + pos % bps, 579 580 bytes); … … 600 601 off_t o; 601 602 602 b = fat_block_get(bs, nodep, bnum );603 b = fat_block_get(bs, nodep, bnum, BLOCK_FLAGS_NONE); 603 604 for (o = pos % (bps / sizeof(fat_dentry_t)); 604 605 o < bps / sizeof(fat_dentry_t); … … 648 649 unsigned bpc; /* bytes per cluster */ 649 650 off_t boundary; 651 int flags = BLOCK_FLAGS_NONE; 650 652 651 653 if (!nodep) { … … 676 678 */ 677 679 bytes = min(len, bps - pos % bps); 680 if (bytes == bps) 681 flags |= BLOCK_FLAGS_NOREAD; 678 682 679 683 boundary = ROUND_UP(nodep->size, bpc); … … 686 690 */ 687 691 fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos); 688 b = fat_block_get(bs, nodep, pos / bps );692 b = fat_block_get(bs, nodep, pos / bps, flags); 689 693 (void) ipc_data_write_finalize(callid, b->data + pos % bps, 690 694 bytes); … … 719 723 /* zero fill any gaps */ 720 724 fat_fill_gap(bs, nodep, mcl, pos); 721 b = _fat_block_get(bs, dev_handle, lcl, (pos / bps) % spc); 725 b = _fat_block_get(bs, dev_handle, lcl, (pos / bps) % spc, 726 flags); 722 727 (void) ipc_data_write_finalize(callid, b->data + pos % bps, 723 728 bytes);
Note:
See TracChangeset
for help on using the changeset viewer.