Changeset 9dc6083 in mainline for uspace/lib/fs/libfs.c


Ignore:
Timestamp:
2013-07-06T15:53:01Z (11 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11baebb
Parents:
66366470
Message:

Implement statfs operation.

File:
1 edited

Legend:

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

    r66366470 r9dc6083  
    4545#include <mem.h>
    4646#include <sys/stat.h>
     47#include <sys/statfs.h>
    4748#include <stdlib.h>
    4849
     
    218219        async_answer_0(rid, rc);
    219220}
     221#include<stdio.h>
     222static void vfs_out_statfs(ipc_callid_t rid, ipc_call_t *req)
     223{       
     224        printf("TRACE: vfs_out_statfs\n");
     225        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
     226        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
     227       
     228        fs_node_t *fn;
     229        int rc = libfs_ops->node_get(&fn, service_id, index);
     230        on_error(rc, answer_and_return(rid, rc));
     231       
     232        ipc_callid_t callid;
     233        size_t size;
     234        if ((!async_data_read_receive(&callid, &size)) ||
     235            (size != sizeof(struct stat))) {
     236                libfs_ops->node_put(fn);
     237                async_answer_0(callid, EINVAL);
     238                async_answer_0(rid, EINVAL);
     239                return;
     240        }
     241       
     242        struct statfs statfs;
     243        memset(&statfs, 0, sizeof(struct statfs));
     244       
     245        statfs.f_bsize = libfs_ops->size_block(service_id);
     246
     247        libfs_ops->node_put(fn);
     248       
     249        async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
     250        async_answer_0(rid, EOK);
     251}
    220252
    221253static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     
    276308                case VFS_OUT_SYNC:
    277309                        vfs_out_sync(callid, &call);
     310                        break;
     311                case VFS_OUT_STATFS:
     312                        vfs_out_statfs(callid, &call);
    278313                        break;
    279314                default:
Note: See TracChangeset for help on using the changeset viewer.