Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r3e6a98c5 r9dc6083  
    14181418}
    14191419
     1420void vfs_statfs(ipc_callid_t rid, ipc_call_t *request)
     1421{
     1422        char *path;
     1423        int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
     1424        if (rc != EOK) {
     1425                async_answer_0(rid, rc);
     1426                return;
     1427        }
     1428       
     1429        ipc_callid_t callid;
     1430        if (!async_data_read_receive(&callid, NULL)) {
     1431                free(path);
     1432                async_answer_0(callid, EINVAL);
     1433                async_answer_0(rid, EINVAL);
     1434                return;
     1435        }
     1436
     1437        vfs_lookup_res_t lr;
     1438        fibril_rwlock_read_lock(&namespace_rwlock);
     1439        rc = vfs_lookup_internal(path, L_NONE, &lr, NULL);
     1440        free(path);
     1441        if (rc != EOK) {
     1442                fibril_rwlock_read_unlock(&namespace_rwlock);
     1443                async_answer_0(callid, rc);
     1444                async_answer_0(rid, rc);
     1445                return;
     1446        }
     1447        vfs_node_t *node = vfs_node_get(&lr);
     1448        if (!node) {
     1449                fibril_rwlock_read_unlock(&namespace_rwlock);
     1450                async_answer_0(callid, ENOMEM);
     1451                async_answer_0(rid, ENOMEM);
     1452                return;
     1453        }
     1454
     1455        fibril_rwlock_read_unlock(&namespace_rwlock);
     1456
     1457        async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
     1458       
     1459        aid_t msg;
     1460        msg = async_send_3(exch, VFS_OUT_STATFS, node->service_id,
     1461            node->index, false, NULL);
     1462        async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     1463       
     1464        vfs_exchange_release(exch);
     1465       
     1466        sysarg_t rv;
     1467        async_wait_for(msg, &rv);
     1468
     1469        async_answer_0(rid, rv);
     1470
     1471        vfs_node_put(node);
     1472}
     1473
    14201474/**
    14211475 * @}
Note: See TracChangeset for help on using the changeset viewer.