Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libfs/libfs.c

    rc888102 r1313ee9  
    224224        ipc_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
    225225            IPC_GET_ARG3(answer));
    226 }
    227 
    228 void libfs_unmount(libfs_ops_t *ops, ipc_callid_t rid, ipc_call_t *request)
    229 {
    230         dev_handle_t mp_dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
    231         fs_index_t mp_fs_index = (fs_index_t) IPC_GET_ARG2(*request);
    232         fs_node_t *fn;
    233         int res;
    234 
    235         res = ops->node_get(&fn, mp_dev_handle, mp_fs_index);
    236         if ((res != EOK) || (!fn)) {
    237                 ipc_answer_0(rid, combine_rc(res, ENOENT));
    238                 return;
    239         }
    240 
    241         /*
    242          * We are clearly expecting to find the mount point active.
    243          */
    244         if (!fn->mp_data.mp_active) {
    245                 (void) ops->node_put(fn);
    246                 ipc_answer_0(rid, EINVAL);
    247                 return;
    248         }
    249 
    250         /*
    251          * Tell the mounted file system to unmount.
    252          */
    253         res = async_req_1_0(fn->mp_data.phone, VFS_OUT_UNMOUNTED,
    254             fn->mp_data.dev_handle);
    255 
    256         /*
    257          * If everything went well, perform the clean-up on our side.
    258          */
    259         if (res == EOK) {
    260                 ipc_hangup(fn->mp_data.phone);
    261                 fn->mp_data.mp_active = false;
    262                 fn->mp_data.fs_handle = 0;
    263                 fn->mp_data.dev_handle = 0;
    264                 fn->mp_data.phone = 0;
    265                 /* Drop the reference created in libfs_mount(). */
    266                 (void) ops->node_put(fn);
    267         }
    268 
    269         (void) ops->node_put(fn);
    270         ipc_answer_0(rid, res);
    271226}
    272227
     
    349304                on_error(rc, goto out_with_answer);
    350305               
    351                 /*
    352                  * If the matching component is a mount point, there are two
    353                  * legitimate semantics of the lookup operation. The first is
    354                  * the commonly used one in which the lookup crosses each mount
    355                  * point into the mounted file system. The second semantics is
    356                  * used mostly during unmount() and differs from the first one
    357                  * only in that the last mount point in the looked up path,
    358                  * which is also its last component, is not crossed.
    359                  */
    360 
    361                 if ((tmp) && (tmp->mp_data.mp_active) &&
    362                     (!(lflag & L_MP) || (next <= last))) {
     306                if ((tmp) && (tmp->mp_data.mp_active)) {
    363307                        if (next > last)
    364308                                next = last = first;
     
    531475                goto out;
    532476        }
    533 
    534         if ((lflag & L_ROOT) && par) {
    535                 ipc_answer_0(rid, EINVAL);
    536                 goto out;
    537         }
    538477       
    539478out_with_answer:
Note: See TracChangeset for help on using the changeset viewer.