Changeset 32f623d9 in mainline
- Timestamp:
- 2011-09-24T20:49:11Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 40cdbec
- Parents:
- 5bf76c1
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.h
r5bf76c1 r32f623d9 230 230 } fat_node_t; 231 231 232 typedef struct { 233 bool lfn_enabled; 234 } fat_instance_t; 235 232 236 extern vfs_out_ops_t fat_ops; 233 237 extern libfs_ops_t fat_libfs_ops; -
uspace/srv/fs/fat/fat_directory.c
r5bf76c1 r32f623d9 262 262 { 263 263 int rc; 264 bool enable_lfn = true; /* TODO: make this a mount option */ 264 void *data; 265 fat_instance_t *instance; 266 267 rc = fs_instance_get(di->nodep->idx->service_id, &data); 268 assert(rc == EOK); 269 instance = (fat_instance_t *) data; 265 270 266 271 if (fat_valid_short_name(name)) { … … 277 282 rc = fat_directory_write_dentry(di, de); 278 283 return rc; 279 } else if ( enable_lfn&& fat_valid_name(name)) {284 } else if (instance->lfn_enabled && fat_valid_name(name)) { 280 285 /* We should create long entries to store name */ 281 286 int long_entry_count; … … 292 297 if (lfn_size % FAT_LFN_ENTRY_SIZE) 293 298 long_entry_count++; 294 rc = fat_directory_lookup_free(di, long_entry_count +1);299 rc = fat_directory_lookup_free(di, long_entry_count + 1); 295 300 if (rc != EOK) 296 301 return rc; … … 328 333 FAT_LFN_ORDER(d) |= FAT_LFN_LAST; 329 334 330 rc = fat_directory_seek(di, start_pos +long_entry_count);335 rc = fat_directory_seek(di, start_pos + long_entry_count); 331 336 return rc; 332 337 } -
uspace/srv/fs/fat/fat_ops.c
r5bf76c1 r32f623d9 873 873 enum cache_mode cmode; 874 874 fat_bs_t *bs; 875 int rc; 875 fat_instance_t *instance; 876 int rc; 877 878 instance = malloc(sizeof(fat_instance_t)); 879 if (!instance) 880 return ENOMEM; 881 882 instance->lfn_enabled = true; 876 883 877 884 /* Check for option enabling write through. */ … … 883 890 /* initialize libblock */ 884 891 rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE); 885 if (rc != EOK) 886 return rc; 892 if (rc != EOK) { 893 free(instance); 894 return rc; 895 } 887 896 888 897 /* prepare the boot block */ 889 898 rc = block_bb_read(service_id, BS_BLOCK); 890 899 if (rc != EOK) { 900 free(instance); 891 901 block_fini(service_id); 892 902 return rc; … … 897 907 898 908 if (BPS(bs) != BS_SIZE) { 909 free(instance); 899 910 block_fini(service_id); 900 911 return ENOTSUP; … … 904 915 rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode); 905 916 if (rc != EOK) { 917 free(instance); 906 918 block_fini(service_id); 907 919 return rc; … … 911 923 rc = fat_sanity_check(bs, service_id); 912 924 if (rc != EOK) { 925 free(instance); 913 926 (void) block_cache_fini(service_id); 914 927 block_fini(service_id); … … 918 931 rc = fat_idx_init_by_service_id(service_id); 919 932 if (rc != EOK) { 933 free(instance); 920 934 (void) block_cache_fini(service_id); 921 935 block_fini(service_id); … … 926 940 fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t)); 927 941 if (!rfn) { 942 free(instance); 928 943 (void) block_cache_fini(service_id); 929 944 block_fini(service_id); … … 935 950 fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t)); 936 951 if (!rootp) { 952 free(instance); 937 953 free(rfn); 938 954 (void) block_cache_fini(service_id); … … 945 961 fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0); 946 962 if (!ridxp) { 963 free(instance); 947 964 free(rfn); 948 965 free(rootp); … … 964 981 rc = fat_clusters_get(&clusters, bs, service_id, rootp->firstc); 965 982 if (rc != EOK) { 983 fibril_mutex_unlock(&ridxp->lock); 984 free(instance); 966 985 free(rfn); 967 986 free(rootp); … … 974 993 } else 975 994 rootp->size = RDE(bs) * sizeof(fat_dentry_t); 995 996 rc = fs_instance_create(service_id, instance); 997 if (rc != EOK) { 998 fibril_mutex_unlock(&ridxp->lock); 999 free(instance); 1000 free(rfn); 1001 free(rootp); 1002 (void) block_cache_fini(service_id); 1003 block_fini(service_id); 1004 fat_idx_fini_by_service_id(service_id); 1005 return rc; 1006 } 976 1007 977 1008 rootp->idx = ridxp; … … 1024 1055 (void) block_cache_fini(service_id); 1025 1056 block_fini(service_id); 1057 1058 void *data; 1059 if (fs_instance_get(service_id, &data) == EOK) { 1060 fs_instance_destroy(service_id); 1061 free(data); 1062 } 1026 1063 1027 1064 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.