Changeset c91f2d1b in mainline for uspace/srv/fs/fat/fat_fat.c
- Timestamp:
- 2009-08-27T18:31:27Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cd688d9
- Parents:
- 02ee6bf5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
r02ee6bf5 rc91f2d1b 75 75 uint16_t clusters = 0; 76 76 fat_cluster_t clst = firstc; 77 int rc; 77 78 78 79 bps = uint16_t_le2host(bs->bps); … … 96 97 fidx = clst % (bps / sizeof(fat_cluster_t)); 97 98 /* read FAT1 */ 98 b = block_get(dev_handle, rscnt + fsec, BLOCK_FLAGS_NONE); 99 rc = block_get(&b, dev_handle, rscnt + fsec, BLOCK_FLAGS_NONE); 100 assert(rc == EOK); 99 101 clst = uint16_t_le2host(((fat_cluster_t *)b->data)[fidx]); 100 102 assert(clst != FAT_CLST_BAD); 101 block_put(b); 103 rc = block_put(b); 104 assert(rc == EOK); 102 105 clusters++; 103 106 } … … 133 136 unsigned clusters, max_clusters; 134 137 fat_cluster_t lastc; 138 int rc; 135 139 136 140 bps = uint16_t_le2host(bs->bps); … … 146 150 /* root directory special case */ 147 151 assert(bn < rds); 148 b = block_get(dev_handle, rscnt + bs->fatcnt * sf + bn, flags); 152 rc = block_get(&b, dev_handle, rscnt + bs->fatcnt * sf + bn, 153 flags); 154 assert(rc == EOK); 149 155 return b; 150 156 } … … 155 161 assert(clusters == max_clusters); 156 162 157 b = block_get(dev_handle, ssa + (lastc - FAT_CLST_FIRST) * bs->spc + 158 bn % bs->spc, flags); 163 rc = block_get(&b, dev_handle, ssa + 164 (lastc - FAT_CLST_FIRST) * bs->spc + bn % bs->spc, flags); 165 assert(rc == EOK); 159 166 160 167 return b; … … 177 184 block_t *b; 178 185 off_t o, boundary; 186 int rc; 179 187 180 188 bps = uint16_t_le2host(bs->bps); … … 191 199 memset(b->data + o % bps, 0, bps - o % bps); 192 200 b->dirty = true; /* need to sync node */ 193 block_put(b); 201 rc = block_put(b); 202 assert(rc == EOK); 194 203 } 195 204 … … 203 212 memset(b->data, 0, min(bps, pos - o)); 204 213 b->dirty = true; /* need to sync node */ 205 block_put(b); 214 rc = block_put(b); 215 assert(rc == EOK); 206 216 } 207 217 } … … 222 232 uint16_t rscnt; 223 233 fat_cluster_t *cp, value; 234 int rc; 224 235 225 236 bps = uint16_t_le2host(bs->bps); 226 237 rscnt = uint16_t_le2host(bs->rscnt); 227 238 228 b = block_get(dev_handle, rscnt + (clst * sizeof(fat_cluster_t)) / bps, 229 BLOCK_FLAGS_NONE); 239 rc = block_get(&b, dev_handle, rscnt + 240 (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE); 241 assert(rc == EOK); 230 242 cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t)); 231 243 value = uint16_t_le2host(*cp); 232 block_put(b); 244 rc = block_put(b); 245 assert(rc == EOK); 233 246 234 247 return value; … … 252 265 uint16_t sf; 253 266 fat_cluster_t *cp; 267 int rc; 254 268 255 269 bps = uint16_t_le2host(bs->bps); … … 258 272 259 273 assert(fatno < bs->fatcnt); 260 b = block_get(dev_handle, rscnt + sf * fatno +274 rc = block_get(&b, dev_handle, rscnt + sf * fatno + 261 275 (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE); 276 assert(rc == EOK); 262 277 cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t)); 263 278 *cp = host2uint16_t_le(value); 264 279 b->dirty = true; /* need to sync block */ 265 block_put(b); 280 rc = block_put(b); 281 assert(rc == EOK); 266 282 } 267 283 … … 315 331 unsigned found = 0; /* top of the free cluster number stack */ 316 332 unsigned b, c, cl; 333 int rc; 317 334 318 335 lifo = (fat_cluster_t *) malloc(nclsts * sizeof(fat_cluster_t)); … … 329 346 fibril_mutex_lock(&fat_alloc_lock); 330 347 for (b = 0, cl = 0; b < sf; b++) { 331 blk = block_get(dev_handle, rscnt + b, BLOCK_FLAGS_NONE);348 rc = block_get(&blk, dev_handle, rscnt + b, BLOCK_FLAGS_NONE); 332 349 for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) { 333 350 fat_cluster_t *clst = (fat_cluster_t *)blk->data + c; … … 344 361 if (++found == nclsts) { 345 362 /* we are almost done */ 346 block_put(blk); 363 rc = block_put(blk); 364 assert(rc == EOK); 347 365 /* update the shadow copies of FAT */ 348 366 fat_alloc_shadow_clusters(bs, … … 356 374 } 357 375 } 358 block_put(blk); 376 rc = block_put(blk); 377 assert(rc == EOK); 359 378 } 360 379 fibril_mutex_unlock(&fat_alloc_lock); … … 457 476 block_t *b; 458 477 unsigned bps; 478 int rc; 459 479 460 480 bps = uint16_t_le2host(bs->bps); … … 464 484 memset(b->data, 0, bps); 465 485 b->dirty = true; 466 block_put(b); 486 rc = block_put(b); 487 assert(rc == EOK); 467 488 } 468 489 }
Note:
See TracChangeset
for help on using the changeset viewer.