Changeset af7383f in mainline
- Timestamp:
- 2009-06-15T19:17:11Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c07af37
- Parents:
- 0ed2e0e
- Location:
- uspace/srv/vfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
r0ed2e0e raf7383f 46 46 #include <adt/list.h> 47 47 #include <atomic.h> 48 #include <assert.h> 48 49 #include "vfs.h" 49 50 … … 175 176 176 177 /* 177 * Set a connectio handling function/fibril. 178 */ 179 async_set_pending(vfs_process_pending_mount); 178 * Set a connection handling function/fibril. 179 */ 180 180 async_set_client_connection(vfs_connection); 181 182 /* 183 * Add a fibril for handling pending mounts. 184 */ 185 fid_t fid = fibril_create(vfs_process_pending_mount, NULL); 186 assert(fid); 187 fibril_add_ready(fid); 181 188 182 189 /* -
uspace/srv/vfs/vfs.h
r0ed2e0e raf7383f 170 170 extern int vfs_grab_phone(fs_handle_t); 171 171 extern void vfs_release_phone(int); 172 173 extern fibril_mutex_t fs_head_lock; 174 extern bool pending_new_fs; 175 extern fibril_condvar_t pending_cv; 172 176 173 177 extern fs_handle_t fs_name_to_handle(char *, bool); -
uspace/srv/vfs/vfs_ops.c
r0ed2e0e raf7383f 67 67 } pending_req_t; 68 68 69 FIBRIL_MUTEX_INITIALIZE(pending_lock); 69 FIBRIL_CONDVAR_INITIALIZE(pending_cv); 70 bool pending_new_fs = false; /**< True if a new file system was mounted. */ 70 71 LIST_INITIALIZE(pending_req); 71 72 … … 264 265 link_t *cur; 265 266 266 loop: 267 fibril_mutex_lock(&pending_lock); 268 for (cur = pending_req.next; cur != &pending_req; cur = cur->next) { 269 pending_req_t *pr = list_get_instance(cur, pending_req_t, link); 270 271 fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, true); 272 if (!fs_handle) 273 continue; 267 while (true) { 268 fibril_mutex_lock(&fs_head_lock); 269 while (!pending_new_fs) 270 fibril_condvar_wait(&pending_cv, &fs_head_lock); 271 rescan: 272 for (cur = pending_req.next; cur != &pending_req; 273 cur = cur->next) { 274 pending_req_t *pr = list_get_instance(cur, 275 pending_req_t, link); 276 fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, 277 false); 278 if (!fs_handle) 279 continue; 274 280 275 /* Acknowledge that we know fs_name. */276 ipc_answer_0(pr->callid, EOK);281 /* Acknowledge that we know fs_name. */ 282 ipc_answer_0(pr->callid, EOK); 277 283 278 /* Do the mount */ 279 vfs_mount_internal(pr->rid, pr->dev_handle, fs_handle, pr->mp, 280 pr->opts); 284 list_remove(cur); 285 fibril_mutex_unlock(&fs_head_lock); 286 287 /* Do the mount */ 288 vfs_mount_internal(pr->rid, pr->dev_handle, fs_handle, 289 pr->mp, pr->opts); 290 291 free(pr->fs_name); 292 free(pr->mp); 293 free(pr->opts); 294 free(pr); 281 295 282 free(pr->fs_name); 283 free(pr->mp); 284 free(pr->opts); 285 list_remove(cur); 286 free(pr); 287 fibril_mutex_unlock(&pending_lock); 288 fibril_yield(); 289 goto loop; 290 } 291 fibril_mutex_unlock(&pending_lock); 296 fibril_mutex_lock(&fs_head_lock); 297 goto rescan; 298 } 299 pending_new_fs = false; 300 fibril_mutex_unlock(&fs_head_lock); 301 } 292 302 } 293 303 … … 445 455 * This will also give us its file system handle. 446 456 */ 447 fs_handle_t fs_handle = fs_name_to_handle(fs_name, true); 457 fibril_mutex_lock(&fs_head_lock); 458 fs_handle_t fs_handle = fs_name_to_handle(fs_name, false); 448 459 if (!fs_handle) { 449 460 if (flags & IPC_FLAG_BLOCKING) { … … 453 464 pr = (pending_req_t *) malloc(sizeof(pending_req_t)); 454 465 if (!pr) { 466 fibril_mutex_unlock(&fs_head_lock); 455 467 ipc_answer_0(callid, ENOMEM); 456 468 ipc_answer_0(rid, ENOMEM); … … 468 480 pr->dev_handle = dev_handle; 469 481 link_initialize(&pr->link); 470 fibril_mutex_lock(&pending_lock);471 482 list_append(&pr->link, &pending_req); 472 fibril_mutex_unlock(& pending_lock);483 fibril_mutex_unlock(&fs_head_lock); 473 484 return; 474 485 } 475 486 487 fibril_mutex_unlock(&fs_head_lock); 476 488 ipc_answer_0(callid, ENOENT); 477 489 ipc_answer_0(rid, ENOENT); … … 481 493 return; 482 494 } 495 fibril_mutex_unlock(&fs_head_lock); 483 496 484 497 /* Acknowledge that we know fs_name. */ -
uspace/srv/vfs/vfs_register.c
r0ed2e0e raf7383f 269 269 ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); 270 270 271 pending_new_fs = true; 272 fibril_condvar_signal(&pending_cv); 271 273 fibril_mutex_unlock(&fs_head_lock); 272 274
Note:
See TracChangeset
for help on using the changeset viewer.