Changeset e8f0158 in mainline for uspace/app/df/df.c


Ignore:
Timestamp:
2013-07-11T21:17:42Z (12 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d0a1e9b6
Parents:
67632f7
Message:

Change statfs structure fields [64bit].
Add total_block and free_block operation for ext4fs.

File:
1 edited

Legend:

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

    r67632f7 re8f0158  
    3838#include <stdlib.h>
    3939#include <unistd.h>
     40#include <stdint.h>
    4041#include <sys/statfs.h>
    4142#include <errno.h>
     
    4748#define HEADER_TABLE "Filesystem    512-blocks      Used      Available  Used%  Mounted on"
    4849
    49 #define PERCENTAGE(x, tot) ((long) (100L * (x) / (tot))) 
     50#define PERCENTAGE(x, tot) ((unsigned long long) (100L * (x) / (tot))) 
    5051
    5152int main(int argc, char *argv[])
     
    6061                    link);
    6162                statfs(mtab_ent->mp, &st);
    62                 printf("block size:%ld\n", st.f_bsize);
    63                 printf("%13s %15lld %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",
    6465                        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,
    6869                        (st.f_blocks)?PERCENTAGE(st.f_blocks - st.f_bfree, st.f_blocks):0L,
    6970                        mtab_ent->mp);
Note: See TracChangeset for help on using the changeset viewer.