Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 4637c72 in mainline


Ignore:
Timestamp:
2010-08-03T10:57:19Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
482dde7, db4ec8d
Parents:
dba4a23
Message:

Instead of checking whether the first sector in a cluster is not beyond the end
of the device, check the last sector in a cluster for the same.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_fat.c

    rdba4a23 r4637c72  
    424424                for (c = 0; c < BPS(bs) / sizeof(fat_cluster_t); c++, cl++) {
    425425                        /*
    426                          * Check if the cluster is physically there. This check
    427                          * becomes necessary when the file system is created
    428                          * with fewer total sectors than how many is inferred
    429                          * from the size of the file allocation table.
     426                         * Check if the entire cluster is physically there.
     427                         * This check becomes necessary when the file system is
     428                         * created with fewer total sectors than how many is
     429                         * inferred from the size of the file allocation table
     430                         * or when the last cluster ends beyond the end of the
     431                         * device.
    430432                         */
    431                         if ((cl >= 2) &&
    432                             ((cl - 2) * SPC(bs) + SSA(bs) >= TS(bs))) {
     433                        if ((cl >= FAT_CLST_FIRST) &&
     434                            CLBN2PBN(bs, cl, SPC(bs) - 1) >= TS(bs)) {
    433435                                rc = block_put(blk);
    434436                                if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.