Changeset 0773396 in mainline for uspace/srv/fs/ext4fs/ext4fs_ops.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/srv/fs/ext4fs/ext4fs_ops.c

    rf4a47e52 r0773396  
    101101static bool ext4fs_is_file(fs_node_t *node);
    102102static service_id_t ext4fs_service_get(fs_node_t *node);
     103static int ext4fs_size_block(service_id_t, uint32_t *);
     104static int ext4fs_total_block_count(service_id_t, uint64_t *);
     105static int ext4fs_free_block_count(service_id_t, uint64_t *);
    103106
    104107/* Static variables */
     
    194197        }
    195198       
    196         list_foreach(instance_list, link) {
    197                 ext4fs_instance_t *tmp =
    198                     list_get_instance(link, ext4fs_instance_t, link);
    199                
     199        list_foreach(instance_list, link, ext4fs_instance_t, tmp) {
    200200                if (tmp->service_id == service_id) {
    201201                        *inst = tmp;
     
    836836        ext4fs_node_t *enode = EXT4FS_NODE(fn);
    837837        return enode->instance->service_id;
     838}
     839
     840int ext4fs_size_block(service_id_t service_id, uint32_t *size)
     841{
     842        ext4fs_instance_t *inst;
     843        int rc = ext4fs_instance_get(service_id, &inst);
     844        if (rc != EOK)
     845                return rc;
     846
     847        if (NULL == inst)
     848                return ENOENT;
     849
     850        ext4_superblock_t *sb = inst->filesystem->superblock;
     851        *size = ext4_superblock_get_block_size(sb);
     852
     853        return EOK;
     854}
     855
     856int ext4fs_total_block_count(service_id_t service_id, uint64_t *count)
     857{
     858        ext4fs_instance_t *inst;
     859        int rc = ext4fs_instance_get(service_id, &inst);
     860        if (rc != EOK)
     861                return rc;
     862
     863        if (NULL == inst)
     864                return ENOENT;
     865
     866        ext4_superblock_t *sb = inst->filesystem->superblock;
     867        *count = ext4_superblock_get_blocks_count(sb);
     868
     869        return EOK;
     870}
     871
     872int ext4fs_free_block_count(service_id_t service_id, uint64_t *count)
     873{
     874        ext4fs_instance_t *inst;
     875        int rc = ext4fs_instance_get(service_id, &inst);
     876        if (rc != EOK)
     877                return rc;
     878
     879        ext4_superblock_t *sb = inst->filesystem->superblock;
     880        *count = ext4_superblock_get_free_blocks_count(sb);
     881
     882        return EOK;
    838883}
    839884
     
    857902        .is_directory = ext4fs_is_directory,
    858903        .is_file = ext4fs_is_file,
    859         .service_get = ext4fs_service_get
     904        .service_get = ext4fs_service_get,
     905        .size_block = ext4fs_size_block,
     906        .total_block_count = ext4fs_total_block_count,
     907        .free_block_count = ext4fs_free_block_count
    860908};
    861909
Note: See TracChangeset for help on using the changeset viewer.