Changeset e17d986 in mainline
- Timestamp:
- 2008-10-26T19:49:14Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cb682eb
- Parents:
- a429bfb
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
ra429bfb re17d986 109 109 * @param dev_handle Device handle of the device with the file. 110 110 * @param firstc First cluster of the file. 111 * @param lastc If non-NULL, output argument holding the 112 * last cluster. 111 113 * 112 114 * @return Number of blocks allocated to the file. 113 115 */ 114 116 uint16_t 115 _fat_blcks_get(dev_handle_t dev_handle, fat_cluster_t firstc) 117 _fat_blcks_get(dev_handle_t dev_handle, fat_cluster_t firstc, 118 fat_cluster_t *lastc) 116 119 { 117 120 block_t *bb; … … 131 134 if (firstc == FAT_CLST_RES0) { 132 135 /* No space allocated to the file. */ 136 if (lastc) 137 *lastc = firstc; 133 138 return 0; 134 139 } … … 139 144 140 145 assert(clst >= FAT_CLST_FIRST); 146 if (lastc) 147 *lastc = clst; /* remember the last cluster */ 141 148 fsec = (clst * sizeof(fat_cluster_t)) / bps; 142 149 fidx = clst % (bps / sizeof(fat_cluster_t)); … … 149 156 } 150 157 158 if (lastc) 159 *lastc = clst; 151 160 return clusters * spc; 152 161 } … … 325 334 void fat_append_clusters(fat_node_t *nodep, fat_cluster_t mcl) 326 335 { 336 block_t *bb; 337 fat_cluster_t lcl; 338 uint8_t fatcnt, fatno; 339 340 if (_fat_blcks_get(nodep->idx->dev_handle, nodep->firstc, &lcl) == 0) { 341 nodep->firstc = host2uint16_t_le(mcl); 342 nodep->dirty = true; /* need to sync node */ 343 return; 344 } 345 346 bb = block_get(nodep->idx->dev_handle, BS_BLOCK, BS_SIZE); 347 fatcnt = FAT_BS(bb)->fatcnt; 348 block_put(bb); 349 350 for (fatno = FAT1; fatno < fatcnt; fatno++) 351 fat_mark_cluster(nodep->idx->dev_handle, fatno, lcl, mcl); 327 352 } 328 353 -
uspace/srv/fs/fat/fat_fat.h
ra429bfb re17d986 62 62 63 63 extern struct block *_fat_block_get(dev_handle_t, fat_cluster_t, off_t); 64 extern uint16_t _fat_blcks_get(dev_handle_t, fat_cluster_t );64 extern uint16_t _fat_blcks_get(dev_handle_t, fat_cluster_t, fat_cluster_t *); 65 65 extern uint16_t fat_bps_get(dev_handle_t); 66 66 -
uspace/srv/fs/fat/fat_ops.c
ra429bfb re17d986 201 201 */ 202 202 nodep->size = bps * _fat_blcks_get(idxp->dev_handle, 203 uint16_t_le2host(d->firstc) );203 uint16_t_le2host(d->firstc), NULL); 204 204 } else { 205 205 nodep->type = FAT_FILE;
Note:
See TracChangeset
for help on using the changeset viewer.