Changeset 67632f7 in mainline


Ignore:
Timestamp:
2013-07-11T20:03:39Z (11 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e8f0158
Parents:
e6edc8d1
Message:

Add total_block and free_block operation.
Implement total_block and free_block operation for mfs.
Fix df application output.

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/df/df.c

    re6edc8d1 r67632f7  
    6464                        mtab_ent->fs_name,
    6565                        (long long) st.f_blocks * st.f_bsize,
     66                        (long long) (st.f_blocks - st.f_bfree) * st.f_bsize,
    6667                        (long long) st.f_bfree * st.f_bsize,
    67                         (long long) (st.f_blocks - st.f_bfree) * st.f_bsize,
    6868                        (st.f_blocks)?PERCENTAGE(st.f_blocks - st.f_bfree, st.f_blocks):0L,
    6969                        mtab_ent->mp);
  • uspace/lib/fs/libfs.c

    re6edc8d1 r67632f7  
    864864        if (NULL != ops->size_block)   
    865865                statfs.f_bsize = ops->size_block(service_id);
     866        if (NULL != ops->total_block)
     867                statfs.f_blocks = ops->total_block(service_id);
     868        if (NULL != ops->free_block)
     869                statfs.f_bfree = ops->free_block(service_id);
    866870       
    867871        ops->node_put(fn);
  • uspace/lib/fs/libfs.h

    re6edc8d1 r67632f7  
    9494        service_id_t (* service_get)(fs_node_t *);
    9595        long (* size_block)(service_id_t);
     96        long (* total_block)(service_id_t);
     97        long (* free_block)(service_id_t);
    9698} libfs_ops_t;
    9799
  • uspace/srv/fs/mfs/mfs_ops.c

    re6edc8d1 r67632f7  
    6565static bool is_power_of_two(uint32_t n);
    6666static long mfs_size_block(service_id_t service_id);
     67static long mfs_total_block(service_id_t service_id);
     68static long mfs_free_block(service_id_t service_id);
    6769
    6870static hash_table_t open_nodes;
     
    8688        .has_children = mfs_has_children,
    8789        .lnkcnt_get = mfs_lnkcnt_get,
    88         .size_block = mfs_size_block
     90        .size_block = mfs_size_block,
     91        .total_block = mfs_total_block,
     92        .free_block = mfs_free_block
    8993};
    9094
     
    11421146        if (NULL == inst)
    11431147                return ENOENT;
     1148       
    11441149        block_size = inst->sbi->block_size;
     1150
    11451151        return block_size;
     1152}
     1153
     1154static long
     1155mfs_total_block(service_id_t service_id)
     1156{
     1157        long block_total;
     1158       
     1159        struct mfs_instance *inst;
     1160        int rc = mfs_instance_get(service_id, &inst);
     1161        if (rc != EOK)
     1162                return rc;
     1163
     1164        if (NULL == inst)
     1165                return ENOENT;
     1166       
     1167        block_total = inst->sbi->nzones;
     1168
     1169        return block_total;
     1170}
     1171
     1172static long
     1173mfs_free_block(service_id_t service_id)
     1174{
     1175        uint32_t block_free;
     1176       
     1177        struct mfs_instance *inst;
     1178        int rc = mfs_instance_get(service_id, &inst);
     1179        if (rc != EOK)
     1180                return rc;
     1181
     1182        if (NULL == inst)
     1183                return ENOENT;
     1184
     1185        mfs_count_free_zones(inst, &block_free);
     1186
     1187        return (long)block_free;
    11461188}
    11471189
Note: See TracChangeset for help on using the changeset viewer.