Changeset 0773396 in mainline for uspace/lib/c/generic/vfs/vfs.c


Ignore:
Timestamp:
2013-12-25T13:05:25Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bc54126c
Parents:
f4a47e52 (diff), 6946f23 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vfs/vfs.c

    rf4a47e52 r0773396  
    4343#include <stdio.h>
    4444#include <sys/stat.h>
     45#include <sys/statfs.h>
    4546#include <sys/types.h>
    4647#include <ipc/services.h>
     
    341342}
    342343
    343 ssize_t read(int fildes, void *buf, size_t nbyte) 
     344ssize_t read(int fildes, void *buf, size_t nbyte)
    344345{
    345346        sysarg_t rc;
     
    347348        aid_t req;
    348349       
     350        if (nbyte > DATA_XFER_LIMIT)
     351                nbyte = DATA_XFER_LIMIT;
     352       
    349353        async_exch_t *exch = vfs_exchange_begin();
    350354       
    351355        req = async_send_1(exch, VFS_IN_READ, fildes, &answer);
    352         rc = async_data_read_start(exch, (void *)buf, nbyte);
     356        rc = async_data_read_start(exch, (void *) buf, nbyte);
    353357        if (rc != EOK) {
    354358                vfs_exchange_end(exch);
     
    376380        aid_t req;
    377381       
     382        if (nbyte > DATA_XFER_LIMIT)
     383                nbyte = DATA_XFER_LIMIT;
     384       
    378385        async_exch_t *exch = vfs_exchange_begin();
    379386       
    380387        req = async_send_1(exch, VFS_IN_WRITE, fildes, &answer);
    381         rc = async_data_write_start(exch, (void *)buf, nbyte);
     388        rc = async_data_write_start(exch, (void *) buf, nbyte);
    382389        if (rc != EOK) {
    383390                vfs_exchange_end(exch);
     
    735742}
    736743
     744int remove(const char *path)
     745{
     746        return unlink(path);
     747}
     748
    737749int chdir(const char *path)
    738750{
     
    892904}
    893905
     906int statfs(const char *path, struct statfs *st)
     907{
     908        sysarg_t rc, rc_orig;
     909        aid_t req;
     910        size_t pa_size;
     911
     912        char *pa = absolutize(path, &pa_size);
     913        if (!pa)
     914                return ENOMEM;
     915
     916        async_exch_t *exch = vfs_exchange_begin();
     917
     918        req = async_send_0(exch, VFS_IN_STATFS, NULL);
     919        rc = async_data_write_start(exch, pa, pa_size);
     920        if (rc != EOK)
     921                goto exit;
     922
     923        rc = async_data_read_start(exch, (void *) st, sizeof(*st));
     924
     925exit:
     926        vfs_exchange_end(exch);
     927        free(pa);
     928        async_wait_for(req, &rc_orig);
     929        return (int) (rc_orig != EOK ? rc_orig : rc);
     930}
     931
    894932/** @}
    895933 */
Note: See TracChangeset for help on using the changeset viewer.