Changeset e8f0158 in mainline
- Timestamp:
- 2013-07-11T21:17:42Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d0a1e9b6
- Parents:
- 67632f7
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/app/df/df.c ¶
r67632f7 re8f0158 38 38 #include <stdlib.h> 39 39 #include <unistd.h> 40 #include <stdint.h> 40 41 #include <sys/statfs.h> 41 42 #include <errno.h> … … 47 48 #define HEADER_TABLE "Filesystem 512-blocks Used Available Used% Mounted on" 48 49 49 #define PERCENTAGE(x, tot) (( long) (100L * (x) / (tot)))50 #define PERCENTAGE(x, tot) ((unsigned long long) (100L * (x) / (tot))) 50 51 51 52 int main(int argc, char *argv[]) … … 60 61 link); 61 62 statfs(mtab_ent->mp, &st); 62 printf("block size:%l d\n",st.f_bsize);63 printf("%13s %15ll d %9lld %9lld %3ld%% %s\n",63 printf("block size:%lu\n", (unsigned long)st.f_bsize); 64 printf("%13s %15llu %9llu %9llu %3llu%% %s\n", 64 65 mtab_ent->fs_name, 65 ( long long) st.f_blocks * st.f_bsize,66 ( long long) (st.f_blocks - st.f_bfree) * st.f_bsize,67 ( long long) st.f_bfree * st.f_bsize,66 (unsigned long long) st.f_blocks * st.f_bsize, 67 (unsigned long long) (st.f_blocks - st.f_bfree) * st.f_bsize, 68 (unsigned long long) st.f_bfree * st.f_bsize, 68 69 (st.f_blocks)?PERCENTAGE(st.f_blocks - st.f_bfree, st.f_blocks):0L, 69 70 mtab_ent->mp); -
TabularUnified uspace/lib/c/include/sys/statfs.h ¶
r67632f7 re8f0158 39 39 40 40 struct statfs { 41 shortf_type; /* type of file system */42 longf_bsize; /* fundamental file system block size */43 longf_blocks; /* total data blocks in file system */44 longf_bfree; /* free blocks in fs */41 uint32_t f_type; /* type of file system */ 42 uint32_t f_bsize; /* fundamental file system block size */ 43 uint64_t f_blocks; /* total data blocks in file system */ 44 uint64_t f_bfree; /* free blocks in fs */ 45 45 }; 46 46 -
TabularUnified uspace/srv/fs/ext4fs/ext4fs_ops.c ¶
r67632f7 re8f0158 102 102 static service_id_t ext4fs_service_get(fs_node_t *node); 103 103 static long ext4fs_size_block(service_id_t); 104 static long ext4fs_total_block(service_id_t); 105 static long ext4fs_free_block(service_id_t); 104 106 105 107 /* Static variables */ … … 847 849 if (NULL == inst) 848 850 return ENOENT; 851 849 852 ext4_superblock_t *sb = inst->filesystem->superblock; 850 853 uint32_t block_size = ext4_superblock_get_block_size(sb); 854 851 855 return block_size; 856 } 857 858 long ext4fs_total_block(service_id_t service_id) 859 { 860 ext4fs_instance_t *inst; 861 int rc = ext4fs_instance_get(service_id, &inst); 862 if (rc != EOK) 863 return rc; 864 if (NULL == inst) 865 return ENOENT; 866 867 ext4_superblock_t *sb = inst->filesystem->superblock; 868 uint32_t block_count = ext4_superblock_get_blocks_count(sb); 869 870 return block_count; 871 } 872 873 long ext4fs_free_block(service_id_t service_id) 874 { 875 ext4fs_instance_t *inst; 876 int rc = ext4fs_instance_get(service_id, &inst); 877 if (rc != EOK) 878 return rc; 879 if (NULL == inst) 880 return ENOENT; 881 882 ext4_superblock_t *sb = inst->filesystem->superblock; 883 uint32_t block_count = ext4_superblock_get_free_blocks_count(sb); 884 885 return block_count; 852 886 } 853 887 … … 872 906 .is_file = ext4fs_is_file, 873 907 .service_get = ext4fs_service_get, 874 .size_block = ext4fs_size_block 908 .size_block = ext4fs_size_block, 909 .total_block = ext4fs_total_block, 910 .free_block = ext4fs_free_block 875 911 }; 876 912
Note:
See TracChangeset
for help on using the changeset viewer.