Changeset 1db44ea7 in mainline for uspace/srv/fs/mfs/mfs_ops.c
- Timestamp:
- 2011-09-25T18:46:45Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36cb22f
- Parents:
- dcc44ca1 (diff), f9d8c3a (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
rdcc44ca1 r1db44ea7 73 73 74 74 75 static LIST_INITIALIZE(inst_list);76 static FIBRIL_MUTEX_INITIALIZE(inst_list_mutex);77 75 static hash_table_t open_nodes; 78 76 static FIBRIL_MUTEX_INITIALIZE(open_nodes_lock); … … 178 176 goto out_error; 179 177 } 180 181 instance->open_nodes_cnt = 0;182 178 183 179 sb = malloc(MFS_SUPERBLOCK_SIZE); … … 271 267 } 272 268 273 /*Initialize the instance structure and add it to the list*/ 274 link_initialize(&instance->link); 269 /*Initialize the instance structure and remember it*/ 275 270 instance->service_id = service_id; 276 271 instance->sbi = sbi; 277 278 fibril_mutex_lock(&inst_list_mutex); 279 list_append(&instance->link, &inst_list); 280 fibril_mutex_unlock(&inst_list_mutex); 272 instance->open_nodes_cnt = 0; 273 rc = fs_instance_create(service_id, instance); 274 if (rc != EOK) { 275 free(instance); 276 free(sbi); 277 block_cache_fini(service_id); 278 block_fini(service_id); 279 mfsdebug("fs instance creation failed\n"); 280 return rc; 281 } 281 282 282 283 mfsdebug("mount successful\n"); … … 323 324 block_fini(service_id); 324 325 325 /* Remove the instance from the list */ 326 fibril_mutex_lock(&inst_list_mutex); 327 list_remove(&inst->link); 328 fibril_mutex_unlock(&inst_list_mutex); 329 326 /* Remove and destroy the instance */ 327 (void) fs_instance_destroy(service_id); 330 328 free(inst->sbi); 331 329 free(inst); … … 1020 1018 mfs_instance_get(service_id_t service_id, struct mfs_instance **instance) 1021 1019 { 1022 struct mfs_instance *instance_ptr; 1023 1024 fibril_mutex_lock(&inst_list_mutex); 1025 1026 if (list_empty(&inst_list)) { 1027 fibril_mutex_unlock(&inst_list_mutex); 1028 return EINVAL; 1029 } 1030 1031 list_foreach(inst_list, link) { 1032 instance_ptr = list_get_instance(link, struct mfs_instance, 1033 link); 1034 1035 if (instance_ptr->service_id == service_id) { 1036 *instance = instance_ptr; 1037 fibril_mutex_unlock(&inst_list_mutex); 1038 return EOK; 1039 } 1040 } 1041 1042 mfsdebug("Instance not found\n"); 1043 1044 fibril_mutex_unlock(&inst_list_mutex); 1045 return EINVAL; 1020 void *data; 1021 int rc; 1022 1023 rc = fs_instance_get(service_id, &data); 1024 if (rc == EOK) { 1025 *instance = (struct mfs_instance *) data; 1026 } else { 1027 mfsdebug("instance not found\n"); 1028 } 1029 1030 return rc; 1046 1031 } 1047 1032
Note:
See TracChangeset
for help on using the changeset viewer.