Subversion Repositories HelenOS

Rev

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

Rev 4368 Rev 4409
Line 82... Line 82...
82
 
82
 
83
static void vfs_mount_internal(ipc_callid_t rid, dev_handle_t dev_handle,
83
static void vfs_mount_internal(ipc_callid_t rid, dev_handle_t dev_handle,
84
    fs_handle_t fs_handle, char *mp, char *opts)
84
    fs_handle_t fs_handle, char *mp, char *opts)
85
{
85
{
86
    vfs_lookup_res_t mp_res;
86
    vfs_lookup_res_t mp_res;
-
 
87
    vfs_lookup_res_t mr_res;
87
    vfs_node_t *mp_node = NULL;
88
    vfs_node_t *mp_node = NULL;
-
 
89
    vfs_node_t *mr_node;
-
 
90
    fs_index_t rindex;
-
 
91
    size_t rsize;
-
 
92
    unsigned rlnkcnt;
88
    ipcarg_t rc;
93
    ipcarg_t rc;
89
    int phone;
94
    int phone;
90
    aid_t msg;
95
    aid_t msg;
91
    ipc_call_t answer;
96
    ipc_call_t answer;
-
 
97
           
92
 
98
 
93
    /* Resolve the path to the mountpoint. */
99
    /* Resolve the path to the mountpoint. */
94
    futex_down(&rootfs_futex);
100
    futex_down(&rootfs_futex);
95
    if (rootfs.fs_handle) {
101
    if (rootfs.fs_handle) {
96
        /* We already have the root FS. */
102
        /* We already have the root FS. */
Line 127... Line 133...
127
         */
133
         */
128
        rwlock_write_unlock(&namespace_rwlock);
134
        rwlock_write_unlock(&namespace_rwlock);
129
    } else {
135
    } else {
130
        /* We still don't have the root file system mounted. */
136
        /* We still don't have the root file system mounted. */
131
        if (str_cmp(mp, "/") == 0) {
137
        if (str_cmp(mp, "/") == 0) {
132
            vfs_lookup_res_t mr_res;
-
 
133
            vfs_node_t *mr_node;
-
 
134
            fs_index_t rindex;
-
 
135
            size_t rsize;
-
 
136
            unsigned rlnkcnt;
-
 
137
           
-
 
138
            /*
138
            /*
139
             * For this simple, but important case,
139
             * For this simple, but important case,
140
             * we are almost done.
140
             * we are almost done.
141
             */
141
             */
142
           
142
           
Line 199... Line 199...
199
    /*
199
    /*
200
     * At this point, we have all necessary pieces: file system and device
200
     * At this point, we have all necessary pieces: file system and device
201
     * handles, and we know the mount point VFS node.
201
     * handles, and we know the mount point VFS node.
202
     */
202
     */
203
   
203
   
-
 
204
    int mountee_phone = vfs_grab_phone(fs_handle);
-
 
205
    assert(mountee_phone >= 0);
-
 
206
    vfs_release_phone(mountee_phone);
-
 
207
 
204
    phone = vfs_grab_phone(mp_res.triplet.fs_handle);
208
    phone = vfs_grab_phone(mp_res.triplet.fs_handle);
205
    msg = async_send_4(phone, VFS_MOUNT,
209
    msg = async_send_4(phone, VFS_MOUNT,
206
        (ipcarg_t) mp_res.triplet.dev_handle,
210
        (ipcarg_t) mp_res.triplet.dev_handle,
207
        (ipcarg_t) mp_res.triplet.index,
211
        (ipcarg_t) mp_res.triplet.index,
208
        (ipcarg_t) fs_handle,
212
        (ipcarg_t) fs_handle,
209
        (ipcarg_t) dev_handle, &answer);
213
        (ipcarg_t) dev_handle, &answer);
-
 
214
   
-
 
215
    /* send connection */
-
 
216
    rc = async_req_1_0(phone, IPC_M_CONNECTION_CLONE, mountee_phone);
-
 
217
    if (rc != EOK) {
-
 
218
        async_wait_for(msg, NULL);
-
 
219
        vfs_release_phone(phone);
-
 
220
        /* Mount failed, drop reference to mp_node. */
-
 
221
        if (mp_node)
-
 
222
            vfs_node_put(mp_node);
-
 
223
        ipc_answer_0(rid, rc);
-
 
224
        return;
-
 
225
    }
-
 
226
   
210
    /* send the mount options */
227
    /* send the mount options */
211
    rc = ipc_data_write_start(phone, (void *)opts, str_size(opts));
228
    rc = ipc_data_write_start(phone, (void *)opts, str_size(opts));
212
    if (rc != EOK) {
229
    if (rc != EOK) {
213
        async_wait_for(msg, NULL);
230
        async_wait_for(msg, NULL);
214
        vfs_release_phone(phone);
231
        vfs_release_phone(phone);
Line 225... Line 242...
225
        /* Mount failed, drop reference to mp_node. */
242
        /* Mount failed, drop reference to mp_node. */
226
        if (mp_node)
243
        if (mp_node)
227
            vfs_node_put(mp_node);
244
            vfs_node_put(mp_node);
228
    }
245
    }
229
   
246
   
-
 
247
    rindex = (fs_index_t) IPC_GET_ARG1(answer);
-
 
248
    rsize = (size_t) IPC_GET_ARG2(answer);
-
 
249
    rlnkcnt = (unsigned) IPC_GET_ARG3(answer);
-
 
250
   
-
 
251
    mr_res.triplet.fs_handle = fs_handle;
-
 
252
    mr_res.triplet.dev_handle = dev_handle;
-
 
253
    mr_res.triplet.index = rindex;
-
 
254
    mr_res.size = rsize;
-
 
255
    mr_res.lnkcnt = rlnkcnt;
-
 
256
    mr_res.type = VFS_NODE_DIRECTORY;
-
 
257
   
-
 
258
    /* Add reference to the mounted root. */
-
 
259
    mr_node = vfs_node_get(&mr_res);
-
 
260
    assert(mr_node);
-
 
261
 
230
    ipc_answer_0(rid, rc);
262
    ipc_answer_0(rid, rc);
231
}
263
}
232
 
264
 
233
/** Process pending mount requests */
265
/** Process pending mount requests */
234
void vfs_process_pending_mount()
266
void vfs_process_pending_mount()