Subversion Repositories HelenOS

Rev

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

Rev 4585 Rev 4587
Line 961... Line 961...
961
    ipc_answer_0(rid, rc);
961
    ipc_answer_0(rid, rc);
962
}
962
}
963
 
963
 
964
void vfs_stat(ipc_callid_t rid, ipc_call_t *request)
964
void vfs_stat(ipc_callid_t rid, ipc_call_t *request)
965
{
965
{
-
 
966
    size_t len;
-
 
967
    ipc_callid_t callid;
-
 
968
 
-
 
969
    if (!ipc_data_write_receive(&callid, &len)) {
-
 
970
        ipc_answer_0(callid, EINVAL);
-
 
971
        ipc_answer_0(rid, EINVAL);
-
 
972
        return;
-
 
973
    }
-
 
974
    char *path = malloc(len + 1);
-
 
975
    if (!path) {
-
 
976
        ipc_answer_0(callid, ENOMEM);
-
 
977
        ipc_answer_0(rid, ENOMEM);
-
 
978
        return;
-
 
979
    }
-
 
980
    int rc;
-
 
981
    if ((rc = ipc_data_write_finalize(callid, path, len))) {
-
 
982
        ipc_answer_0(rid, rc);
-
 
983
        free(path);
-
 
984
        return;
-
 
985
    }
-
 
986
    path[len] = '\0';
-
 
987
 
-
 
988
    if (!ipc_data_read_receive(&callid, NULL)) {
-
 
989
        free(path);
-
 
990
        ipc_answer_0(callid, EINVAL);
-
 
991
        ipc_answer_0(rid, EINVAL);
-
 
992
        return;
-
 
993
    }
-
 
994
 
-
 
995
    vfs_lookup_res_t lr;
-
 
996
    fibril_rwlock_read_lock(&namespace_rwlock);
-
 
997
    rc = vfs_lookup_internal(path, L_NONE, &lr, NULL);
-
 
998
    free(path);
-
 
999
    if (rc != EOK) {
-
 
1000
        fibril_rwlock_read_unlock(&namespace_rwlock);
-
 
1001
        ipc_answer_0(callid, rc);
-
 
1002
        ipc_answer_0(rid, rc);
-
 
1003
        return;
-
 
1004
    }
-
 
1005
    vfs_node_t *node = vfs_node_get(&lr);
-
 
1006
    if (!node) {
-
 
1007
        fibril_rwlock_read_unlock(&namespace_rwlock);
-
 
1008
        ipc_answer_0(callid, ENOMEM);
-
 
1009
        ipc_answer_0(rid, ENOMEM);
-
 
1010
        return;
-
 
1011
    }
-
 
1012
 
-
 
1013
    fibril_rwlock_read_unlock(&namespace_rwlock);
-
 
1014
 
-
 
1015
    int fs_phone = vfs_grab_phone(node->fs_handle);
-
 
1016
    aid_t msg;
-
 
1017
    msg = async_send_3(fs_phone, VFS_OUT_STAT, node->dev_handle,
-
 
1018
        node->index, false, NULL);
-
 
1019
    ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
-
 
1020
    async_wait_for(msg, &rc);
-
 
1021
    vfs_release_phone(fs_phone);
-
 
1022
 
-
 
1023
    ipc_answer_0(rid, rc);
-
 
1024
 
-
 
1025
    vfs_node_put(node);
966
}
1026
}
967
 
1027
 
968
void vfs_mkdir(ipc_callid_t rid, ipc_call_t *request)
1028
void vfs_mkdir(ipc_callid_t rid, ipc_call_t *request)
969
{
1029
{
970
    int mode = IPC_GET_ARG1(*request);
1030
    int mode = IPC_GET_ARG1(*request);