Changeset d7ff048 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2011-10-08T13:08:53Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf08ff0
Parents:
8367d1d (diff), 80099c19 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r8367d1d rd7ff048  
    10251025}
    10261026
     1027static int fat_update_fat32_fsinfo(service_id_t service_id)
     1028{
     1029        fat_bs_t *bs;
     1030        fat32_fsinfo_t *info;
     1031        block_t *b;
     1032        int rc;
     1033
     1034        bs = block_bb_get(service_id);
     1035        assert(FAT_IS_FAT32(bs));
     1036
     1037        rc = block_get(&b, service_id, uint16_t_le2host(bs->fat32.fsinfo_sec),
     1038            BLOCK_FLAGS_NONE);
     1039        if (rc != EOK)
     1040                return rc;
     1041
     1042        info = (fat32_fsinfo_t *) b->data;
     1043
     1044        if (bcmp(info->sig1, FAT32_FSINFO_SIG1, sizeof(info->sig1)) ||
     1045            bcmp(info->sig2, FAT32_FSINFO_SIG2, sizeof(info->sig2)) ||
     1046            bcmp(info->sig3, FAT32_FSINFO_SIG3, sizeof(info->sig3))) {
     1047                (void) block_put(b);
     1048                return EINVAL;
     1049        }
     1050
     1051        /* For now, invalidate the counter. */
     1052        info->free_clusters = host2uint16_t_le(-1);
     1053
     1054        b->dirty = true;
     1055        return block_put(b);
     1056}
     1057
    10271058static int fat_unmounted(service_id_t service_id)
    10281059{
    10291060        fs_node_t *fn;
    10301061        fat_node_t *nodep;
    1031         int rc;
     1062        fat_bs_t *bs;
     1063        int rc;
     1064
     1065        bs = block_bb_get(service_id);
    10321066
    10331067        rc = fat_root_get(&fn, service_id);
     
    10431077                (void) fat_node_put(fn);
    10441078                return EBUSY;
     1079        }
     1080
     1081        if (FAT_IS_FAT32(bs)) {
     1082                /*
     1083                 * Attempt to update the FAT32 FS info.
     1084                 */
     1085                (void) fat_update_fat32_fsinfo(service_id);
    10451086        }
    10461087
Note: See TracChangeset for help on using the changeset viewer.