Ignore:
File:
1 edited

Legend:

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

    r1558d85 r44ecf89  
    5555#include <assert.h>
    5656#include <fibril_synch.h>
     57#include <sys/mman.h>
    5758#include <align.h>
    5859#include <malloc.h>
     60#include <str.h>
    5961
    6062#define FAT_NODE(node)  ((node) ? (fat_node_t *) (node)->data : NULL)
     
    8991static bool fat_is_file(fs_node_t *node);
    9092static service_id_t fat_service_get(fs_node_t *node);
    91 static int fat_size_block(service_id_t, uint32_t *);
    92 static int fat_total_block_count(service_id_t, uint64_t *);
    93 static int fat_free_block_count(service_id_t, uint64_t *);
    9493
    9594/*
     
    150149static int fat_node_fini_by_service_id(service_id_t service_id)
    151150{
     151        fat_node_t *nodep;
    152152        int rc;
    153153
     
    160160restart:
    161161        fibril_mutex_lock(&ffn_mutex);
    162         list_foreach(ffn_list, ffn_link, fat_node_t, nodep) {
     162        list_foreach(ffn_list, lnk) {
     163                nodep = list_get_instance(lnk, fat_node_t, ffn_link);
    163164                if (!fibril_mutex_trylock(&nodep->lock)) {
    164165                        fibril_mutex_unlock(&ffn_mutex);
     
    842843}
    843844
    844 int fat_size_block(service_id_t service_id, uint32_t *size)
    845 {
    846         fat_bs_t *bs;
    847 
    848         bs = block_bb_get(service_id);
    849         *size = BPC(bs);
    850 
    851         return EOK;
    852 }
    853 
    854 int fat_total_block_count(service_id_t service_id, uint64_t *count)
    855 {
    856         fat_bs_t *bs;
    857        
    858         bs = block_bb_get(service_id);
    859         *count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    860 
    861         return EOK;
    862 }
    863 
    864 int fat_free_block_count(service_id_t service_id, uint64_t *count)
    865 {
    866         fat_bs_t *bs;
    867         fat_cluster_t e0;
    868         uint64_t block_count;
    869         int rc;
    870         uint32_t cluster_no, clusters;
    871 
    872         block_count = 0;
    873         bs = block_bb_get(service_id);
    874         clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
    875         for (cluster_no = 0; cluster_no < clusters; cluster_no++) {
    876                 rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0);
    877                 if (rc != EOK)
    878                         return EIO;
    879 
    880                 if (e0 == FAT_CLST_RES0)
    881                         block_count++;
    882         }
    883         *count = block_count;
    884        
    885         return EOK;
    886 }
    887 
    888845/** libfs operations */
    889846libfs_ops_t fat_libfs_ops = {
     
    903860        .is_directory = fat_is_directory,
    904861        .is_file = fat_is_file,
    905         .service_get = fat_service_get,
    906         .size_block = fat_size_block,
    907         .total_block_count = fat_total_block_count,
    908         .free_block_count = fat_free_block_count
     862        .service_get = fat_service_get
    909863};
    910864
     
    929883        /* Parse mount options. */
    930884        char *mntopts = (char *) opts;
     885        char *saveptr;
    931886        char *opt;
    932         while ((opt = str_tok(mntopts, " ,", &mntopts)) != NULL) {
     887        while ((opt = strtok_r(mntopts, " ,", &saveptr)) != NULL) {
    933888                if (str_cmp(opt, "wtcache") == 0)
    934889                        cmode = CACHE_MODE_WT;
    935890                else if (str_cmp(opt, "nolfn") == 0)
    936891                        instance->lfn_enabled = false;
     892                mntopts = NULL;
    937893        }
    938894
    939895        /* initialize libblock */
    940         rc = block_init(service_id, BS_SIZE);
     896        rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE);
    941897        if (rc != EOK) {
    942898                free(instance);
Note: See TracChangeset for help on using the changeset viewer.