Changes in uspace/srv/vfs/vfs_register.c [79ae36dd:15f3c3f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_register.c
r79ae36dd r15f3c3f 52 52 #include "vfs.h" 53 53 54 FIBRIL_CONDVAR_INITIALIZE(fs_ head_cv);55 FIBRIL_MUTEX_INITIALIZE(fs_ head_lock);56 LIST_INITIALIZE(fs_ head);54 FIBRIL_CONDVAR_INITIALIZE(fs_list_cv); 55 FIBRIL_MUTEX_INITIALIZE(fs_list_lock); 56 LIST_INITIALIZE(fs_list); 57 57 58 58 atomic_t fs_handle_next = { … … 149 149 } 150 150 151 fibril_mutex_lock(&fs_ head_lock);151 fibril_mutex_lock(&fs_list_lock); 152 152 153 153 /* … … 159 159 */ 160 160 dprintf("FS is already registered.\n"); 161 fibril_mutex_unlock(&fs_ head_lock);161 fibril_mutex_unlock(&fs_list_lock); 162 162 free(fs_info); 163 163 async_answer_0(rid, EEXISTS); … … 169 169 */ 170 170 dprintf("Inserting FS into the list of registered file systems.\n"); 171 list_append(&fs_info->fs_link, &fs_ head);171 list_append(&fs_info->fs_link, &fs_list); 172 172 173 173 /* … … 180 180 dprintf("Callback connection expected\n"); 181 181 list_remove(&fs_info->fs_link); 182 fibril_mutex_unlock(&fs_ head_lock);182 fibril_mutex_unlock(&fs_list_lock); 183 183 free(fs_info); 184 184 async_answer_0(rid, EINVAL); … … 197 197 dprintf("Unexpected call, method = %d\n", IPC_GET_IMETHOD(call)); 198 198 list_remove(&fs_info->fs_link); 199 fibril_mutex_unlock(&fs_ head_lock);199 fibril_mutex_unlock(&fs_list_lock); 200 200 async_hangup(fs_info->sess); 201 201 free(fs_info); … … 211 211 dprintf("Client suggests wrong size of PFB, size = %d\n", size); 212 212 list_remove(&fs_info->fs_link); 213 fibril_mutex_unlock(&fs_ head_lock);213 fibril_mutex_unlock(&fs_list_lock); 214 214 async_hangup(fs_info->sess); 215 215 free(fs_info); … … 235 235 async_answer_1(rid, EOK, (sysarg_t) fs_info->fs_handle); 236 236 237 fibril_condvar_broadcast(&fs_ head_cv);238 fibril_mutex_unlock(&fs_ head_lock);237 fibril_condvar_broadcast(&fs_list_cv); 238 fibril_mutex_unlock(&fs_list_lock); 239 239 240 240 dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n", … … 254 254 /* 255 255 * For now, we don't try to be very clever and very fast. 256 * We simply lookup the session in the fs_headlist and256 * We simply lookup the session in fs_list and 257 257 * begin an exchange. 258 258 */ 259 fibril_mutex_lock(&fs_head_lock); 260 261 link_t *cur; 262 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 259 fibril_mutex_lock(&fs_list_lock); 260 261 list_foreach(fs_list, cur) { 263 262 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 264 263 265 264 if (fs->fs_handle == handle) { 266 fibril_mutex_unlock(&fs_ head_lock);265 fibril_mutex_unlock(&fs_list_lock); 267 266 268 267 assert(fs->sess); … … 274 273 } 275 274 276 fibril_mutex_unlock(&fs_ head_lock);275 fibril_mutex_unlock(&fs_list_lock); 277 276 278 277 return NULL; … … 293 292 * @param name File system name. 294 293 * @param lock If true, the function will lock and unlock the 295 * fs_ head_lock.294 * fs_list_lock. 296 295 * 297 296 * @return File system handle or zero if file system not found. … … 303 302 304 303 if (lock) 305 fibril_mutex_lock(&fs_head_lock); 306 307 link_t *cur; 308 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 304 fibril_mutex_lock(&fs_list_lock); 305 306 list_foreach(fs_list, cur) { 309 307 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 310 if (str_cmp(fs->vfs_info.name, name) == 0) { 308 if (str_cmp(fs->vfs_info.name, name) == 0) { 311 309 handle = fs->fs_handle; 312 310 break; … … 315 313 316 314 if (lock) 317 fibril_mutex_unlock(&fs_ head_lock);315 fibril_mutex_unlock(&fs_list_lock); 318 316 319 317 return handle; … … 330 328 { 331 329 vfs_info_t *info = NULL; 332 link_t *cur; 333 334 fibril_mutex_lock(&fs_head_lock); 335 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 330 331 fibril_mutex_lock(&fs_list_lock); 332 list_foreach(fs_list, cur) { 336 333 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 337 334 if (fs->fs_handle == handle) { … … 340 337 } 341 338 } 342 fibril_mutex_unlock(&fs_ head_lock);339 fibril_mutex_unlock(&fs_list_lock); 343 340 344 341 return info;
Note:
See TracChangeset
for help on using the changeset viewer.