Changeset 66366470 in mainline


Ignore:
Timestamp:
2013-07-04T18:55:31Z (11 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9dc6083
Parents:
d8b47eca
Message:

Start to implement df command line tool.

Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    rd8b47eca r66366470  
    202202        $(USPACE_PATH)/app/websrv/websrv \
    203203        $(USPACE_PATH)/app/date/date \
    204         $(USPACE_PATH)/app/vdemo/vdemo
     204        $(USPACE_PATH)/app/vdemo/vdemo \
     205        $(USPACE_PATH)/app/df/df
    205206
    206207ifeq ($(CONFIG_PCC),y)
  • uspace/Makefile

    rd8b47eca r66366470  
    8080        app/vlaunch \
    8181        app/vterm \
     82        app/df \
    8283        srv/clipboard \
    8384        srv/locsrv \
  • uspace/lib/c/generic/vfs/vfs.c

    rd8b47eca r66366470  
    892892}
    893893
     894int statfs(const char *path, struct statfs *buf)
     895{
     896        sysarg_t rc;
     897        //aid_t req;
     898
     899        if ( NULL == buf )
     900                return 1;
     901
     902        sysarg_t value;
     903        async_exch_t *exch = vfs_exchange_begin();     
     904        rc = async_req_0_1(exch, VFS_IN_STATFS, &value);
     905        if (rc != EOK)
     906                goto exit;
     907
     908        buf->f_bsize = value;
     909exit:
     910        vfs_exchange_end(exch);
     911        return rc;
     912}
     913
    894914/** @}
    895915 */
  • uspace/lib/c/include/ipc/vfs.h

    rd8b47eca r66366470  
    8282        VFS_IN_WAIT_HANDLE,
    8383        VFS_IN_MTAB_GET,
     84        VFS_IN_STATFS
    8485} vfs_in_request_t;
    8586
  • uspace/lib/c/include/vfs/vfs.h

    rd8b47eca r66366470  
    4444#include "vfs_mtab.h"
    4545
     46
    4647enum vfs_change_state_type {
    4748        VFS_PASS_HANDLE
    4849};
     50
     51struct statfs {
     52        short   f_type;     /* type of file system  */
     53        long    f_bsize;    /* fundamental file system block size */
     54        long    f_blocks;   /* total data blocks in file system */
     55        long    f_bfree;    /* free blocks in fs */
     56};
     57
    4958
    5059extern char *absolutize(const char *, size_t *);
     
    6170extern async_exch_t *vfs_exchange_begin(void);
    6271extern void vfs_exchange_end(async_exch_t *);
    63 
     72extern int statfs(const char *path, struct statfs *buf);
    6473#endif
    6574
  • uspace/lib/fs/libfs.h

    rd8b47eca r66366470  
    9393        bool (* is_file)(fs_node_t *);
    9494        service_id_t (* service_get)(fs_node_t *);
     95        unsigned int (* size_block)(fs_node_t *);
    9596} libfs_ops_t;
    9697
  • uspace/srv/fs/mfs/mfs_ops.c

    rd8b47eca r66366470  
    6464static int mfs_check_sanity(struct mfs_sb_info *sbi);
    6565static bool is_power_of_two(uint32_t n);
     66static unsigned int mfs_size_block(fs_node_t *fsnode);
    6667
    6768static hash_table_t open_nodes;
     
    8485        .destroy = mfs_destroy_node,
    8586        .has_children = mfs_has_children,
    86         .lnkcnt_get = mfs_lnkcnt_get
     87        .lnkcnt_get = mfs_lnkcnt_get,
     88        .size_block = mfs_size_block
    8789};
    8890
     
    11361138}
    11371139
     1140static unsigned int
     1141mfs_size_block(fs_node_t *fsnode)
     1142{
     1143        if ( NULL == fsnode )
     1144                return 0;
     1145        /* Get block size from superblock */
     1146        return 512;
     1147}
     1148
    11381149vfs_out_ops_t mfs_ops = {
    11391150        .mounted = mfs_mounted,
  • uspace/srv/vfs/vfs.c

    rd8b47eca r66366470  
    130130                        vfs_get_mtab(callid, &call);
    131131                        break;
     132                case VFS_IN_STATFS:
     133                        vfs_statfs(callid, &call);
     134                        break;
    132135                default:
    133136                        async_answer_0(callid, ENOTSUP);
  • uspace/srv/vfs/vfs.h

    rd8b47eca r66366470  
    222222extern void vfs_wait_handle(ipc_callid_t, ipc_call_t *);
    223223extern void vfs_get_mtab(ipc_callid_t, ipc_call_t *);
     224extern void vfs_statfs(ipc_callid_t, ipc_call_t *);
    224225
    225226#endif
  • uspace/srv/vfs/vfs_ops.c

    rd8b47eca r66366470  
    14181418}
    14191419
     1420void vfs_statfs(ipc_callid_t rid, ipc_call_t *request)
     1421{
     1422        long long reply;
     1423
     1424        /* Get information about fs */
     1425        reply = 512;
     1426        async_answer_1(rid, EOK, reply);
     1427}
     1428
    14201429/**
    14211430 * @}
Note: See TracChangeset for help on using the changeset viewer.