Changes in uspace/srv/fs/fat/fat_fat.c [2f636b6:1e4cada] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
r2f636b6 r1e4cada 46 46 #include <align.h> 47 47 #include <assert.h> 48 #include <fibril_sync .h>48 #include <fibril_synch.h> 49 49 #include <mem.h> 50 50 … … 359 359 uint16_t rscnt; 360 360 uint16_t sf; 361 uint16_t ts; 362 unsigned rde; 363 unsigned rds; 364 unsigned ssa; 361 365 block_t *blk; 362 366 fat_cluster_t *lifo; /* stack for storing free cluster numbers */ … … 372 376 rscnt = uint16_t_le2host(bs->rscnt); 373 377 sf = uint16_t_le2host(bs->sec_per_fat); 378 rde = uint16_t_le2host(bs->root_ent_max); 379 ts = uint16_t_le2host(bs->totsec16); 380 381 rds = (sizeof(fat_dentry_t) * rde) / bps; 382 rds += ((sizeof(fat_dentry_t) * rde) % bps != 0); 383 ssa = rscnt + bs->fatcnt * sf + rds; 374 384 375 385 /* … … 382 392 goto error; 383 393 for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) { 394 /* 395 * Check if the cluster is physically there. This check 396 * becomes necessary when the file system is created 397 * with fewer total sectors than how many is inferred 398 * from the size of the file allocation table. 399 */ 400 if ((cl - 2) * bs->spc + ssa >= ts) { 401 rc = block_put(blk); 402 if (rc != EOK) 403 goto error; 404 goto out; 405 } 406 384 407 fat_cluster_t *clst = (fat_cluster_t *)blk->data + c; 385 408 if (uint16_t_le2host(*clst) == FAT_CLST_RES0) { … … 419 442 } 420 443 } 444 out: 421 445 fibril_mutex_unlock(&fat_alloc_lock); 422 446
Note:
See TracChangeset
for help on using the changeset viewer.