Subversion Repositories HelenOS

Rev

Rev 4518 | Rev 4539 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4518 Rev 4520
Line 64... Line 64...
64
    ipc_callid_t callid;      /**< Call ID waiting for the mount */
64
    ipc_callid_t callid;      /**< Call ID waiting for the mount */
65
    ipc_callid_t rid;         /**< Request ID */
65
    ipc_callid_t rid;         /**< Request ID */
66
    dev_handle_t dev_handle;  /**< Device handle */
66
    dev_handle_t dev_handle;  /**< Device handle */
67
} pending_req_t;
67
} pending_req_t;
68
 
68
 
-
 
69
FIBRIL_MUTEX_INITIALIZE(pending_lock);
69
LIST_INITIALIZE(pending_req);
70
LIST_INITIALIZE(pending_req);
70
 
71
 
71
/**
72
/**
72
 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
73
 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
73
 * concurrent VFS operation which modifies the file system namespace.
74
 * concurrent VFS operation which modifies the file system namespace.
Line 261... Line 262...
261
void vfs_process_pending_mount(void)
262
void vfs_process_pending_mount(void)
262
{
263
{
263
    link_t *cur;
264
    link_t *cur;
264
   
265
   
265
loop:
266
loop:
-
 
267
    fibril_mutex_lock(&pending_lock);
266
    for (cur = pending_req.next; cur != &pending_req; cur = cur->next) {
268
    for (cur = pending_req.next; cur != &pending_req; cur = cur->next) {
267
        pending_req_t *pr = list_get_instance(cur, pending_req_t, link);
269
        pending_req_t *pr = list_get_instance(cur, pending_req_t, link);
268
       
270
 
269
        fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, true);
271
        fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, true);
270
        if (!fs_handle)
272
        if (!fs_handle)
271
            continue;
273
            continue;
272
       
274
       
273
        /* Acknowledge that we know fs_name. */
275
        /* Acknowledge that we know fs_name. */
Line 280... Line 282...
280
        free(pr->fs_name);
282
        free(pr->fs_name);
281
        free(pr->mp);
283
        free(pr->mp);
282
        free(pr->opts);
284
        free(pr->opts);
283
        list_remove(cur);
285
        list_remove(cur);
284
        free(pr);
286
        free(pr);
-
 
287
        fibril_mutex_unlock(&pending_lock);
-
 
288
        fibril_yield();
285
        goto loop;
289
        goto loop;
286
    }
290
    }
-
 
291
    fibril_mutex_unlock(&pending_lock);
287
}
292
}
288
 
293
 
289
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
294
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
290
{
295
{
291
    /*
296
    /*
Line 460... Line 465...
460
            pr->opts = opts;
465
            pr->opts = opts;
461
            pr->callid = callid;
466
            pr->callid = callid;
462
            pr->rid = rid;
467
            pr->rid = rid;
463
            pr->dev_handle = dev_handle;
468
            pr->dev_handle = dev_handle;
464
            link_initialize(&pr->link);
469
            link_initialize(&pr->link);
-
 
470
            fibril_mutex_lock(&pending_lock);
465
            list_append(&pr->link, &pending_req);
471
            list_append(&pr->link, &pending_req);
-
 
472
            fibril_mutex_unlock(&pending_lock);
466
            return;
473
            return;
467
        }
474
        }
468
       
475
       
469
        ipc_answer_0(callid, ENOENT);
476
        ipc_answer_0(callid, ENOENT);
470
        ipc_answer_0(rid, ENOENT);
477
        ipc_answer_0(rid, ENOENT);