Changes in uspace/srv/fs/fat/fat_ops.c [40cdbec:b33870b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
r40cdbec rb33870b 871 871 aoff64_t *size, unsigned *linkcnt) 872 872 { 873 enum cache_mode cmode = CACHE_MODE_WB;873 enum cache_mode cmode; 874 874 fat_bs_t *bs; 875 fat_instance_t *instance; 876 int rc; 877 878 instance = malloc(sizeof(fat_instance_t)); 879 if (!instance) 880 return ENOMEM; 881 instance->lfn_enabled = true; 882 883 /* Parse mount options. */ 884 char *mntopts = (char *) opts; 885 char *saveptr; 886 char *opt; 887 while ((opt = strtok_r(mntopts, " ,", &saveptr)) != NULL) { 888 if (str_cmp(opt, "wtcache") == 0) 889 cmode = CACHE_MODE_WT; 890 else if (str_cmp(opt, "nolfn") == 0) 891 instance->lfn_enabled = false; 892 mntopts = NULL; 893 } 875 int rc; 876 877 /* Check for option enabling write through. */ 878 if (str_cmp(opts, "wtcache") == 0) 879 cmode = CACHE_MODE_WT; 880 else 881 cmode = CACHE_MODE_WB; 894 882 895 883 /* initialize libblock */ 896 884 rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE); 897 if (rc != EOK) { 898 free(instance); 899 return rc; 900 } 885 if (rc != EOK) 886 return rc; 901 887 902 888 /* prepare the boot block */ 903 889 rc = block_bb_read(service_id, BS_BLOCK); 904 890 if (rc != EOK) { 905 free(instance);906 891 block_fini(service_id); 907 892 return rc; … … 912 897 913 898 if (BPS(bs) != BS_SIZE) { 914 free(instance);915 899 block_fini(service_id); 916 900 return ENOTSUP; … … 920 904 rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode); 921 905 if (rc != EOK) { 922 free(instance);923 906 block_fini(service_id); 924 907 return rc; … … 928 911 rc = fat_sanity_check(bs, service_id); 929 912 if (rc != EOK) { 930 free(instance);931 913 (void) block_cache_fini(service_id); 932 914 block_fini(service_id); … … 936 918 rc = fat_idx_init_by_service_id(service_id); 937 919 if (rc != EOK) { 938 free(instance);939 920 (void) block_cache_fini(service_id); 940 921 block_fini(service_id); … … 945 926 fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t)); 946 927 if (!rfn) { 947 free(instance);948 928 (void) block_cache_fini(service_id); 949 929 block_fini(service_id); … … 955 935 fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t)); 956 936 if (!rootp) { 957 free(instance);958 937 free(rfn); 959 938 (void) block_cache_fini(service_id); … … 966 945 fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0); 967 946 if (!ridxp) { 968 free(instance);969 947 free(rfn); 970 948 free(rootp); … … 986 964 rc = fat_clusters_get(&clusters, bs, service_id, rootp->firstc); 987 965 if (rc != EOK) { 988 fibril_mutex_unlock(&ridxp->lock);989 free(instance);990 966 free(rfn); 991 967 free(rootp); … … 998 974 } else 999 975 rootp->size = RDE(bs) * sizeof(fat_dentry_t); 1000 1001 rc = fs_instance_create(service_id, instance);1002 if (rc != EOK) {1003 fibril_mutex_unlock(&ridxp->lock);1004 free(instance);1005 free(rfn);1006 free(rootp);1007 (void) block_cache_fini(service_id);1008 block_fini(service_id);1009 fat_idx_fini_by_service_id(service_id);1010 return rc;1011 }1012 976 1013 977 rootp->idx = ridxp; … … 1060 1024 (void) block_cache_fini(service_id); 1061 1025 block_fini(service_id); 1062 1063 void *data;1064 if (fs_instance_get(service_id, &data) == EOK) {1065 fs_instance_destroy(service_id);1066 free(data);1067 }1068 1026 1069 1027 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.