Changeset e285656 in mainline for uspace/srv/fs/exfat/exfat_fat.c


Ignore:
Timestamp:
2011-12-14T20:45:49Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0cfb05e
Parents:
d6d15ec (diff), 9916841 (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:

Mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_fat.c

    rd6d15ec re285656  
    5050#include <malloc.h>
    5151#include <mem.h>
     52#include <str.h>
    5253
    5354
     
    322323                            (found == 0) ?  EXFAT_CLST_EOF : lifo[found - 1]);
    323324                        if (rc != EOK)
    324                                 break;
     325                                goto exit_error;
    325326                        found++;
    326327                        rc = bitmap_set_cluster(bs, service_id, clst);
    327328                        if (rc != EOK)
    328                                 break;
     329                                goto exit_error;
    329330
    330331                }
     
    339340        }
    340341
     342        rc = ENOSPC;
     343
     344exit_error:
     345
    341346        /* If something wrong - free the clusters */
    342347        while (found--) {
     
    347352        free(lifo);
    348353        fibril_mutex_unlock(&exfat_alloc_lock);
    349         return ENOSPC;
     354        return rc;
    350355}
    351356
     
    537542int exfat_sanity_check(exfat_bs_t *bs, service_id_t service_id)
    538543{
    539         /* TODO */
     544        if (str_cmp((char const *)bs->oem_name, "EXFAT   "))
     545                return ENOTSUP;
     546        else if (uint16_t_le2host(bs->signature) != 0xAA55)
     547                return ENOTSUP;
     548        else if (uint32_t_le2host(bs->fat_sector_count) == 0)
     549                return ENOTSUP;
     550        else if (uint32_t_le2host(bs->data_clusters) == 0)
     551                return ENOTSUP;
     552        else if (bs->fat_count != 1)
     553                return ENOTSUP;
     554        else if ((bs->bytes_per_sector + bs->sec_per_cluster) > 25) {
     555                /* exFAT does not support cluster size > 32 Mb */
     556                return ENOTSUP;
     557        }
    540558        return EOK;
    541559}
Note: See TracChangeset for help on using the changeset viewer.