Changeset f4cbf9dd in mainline
- Timestamp:
- 2013-07-19T22:16:59Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17a0fb8
- Parents:
- 330df83
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/df/df.c
r330df83 rf4cbf9dd 47 47 #define NAME "df" 48 48 49 #define HEADER_TABLE "Filesystem 512-blocks Used Available Used% Mounted on"49 #define HEADER_TABLE "Filesystem %4u-blocks Used Available Used%% Mounted on\n" 50 50 51 51 #define PERCENTAGE(x, tot) ((unsigned long long) (100L * (x) / (tot))) … … 54 54 (unsigned long long) ((x) / ((bk) / (fsbk))) : \ 55 55 (unsigned long long) ((x) * ((fsbk) / (bk)))) 56 57 static unsigned int unit_size; 56 58 57 59 static void print_statfs(struct statfs *, char *, char *); … … 63 65 struct statfs st; 64 66 67 unit_size = 512; 68 65 69 /******************************************/ 66 70 /* Parse command line options... */ 67 71 /******************************************/ 68 while ((optres = getopt(argc, argv, ":hi ")) != -1) {72 while ((optres = getopt(argc, argv, ":hib:")) != -1) { 69 73 switch(optres) { 70 74 case 'h': … … 72 76 73 77 case 'i': 78 break; 79 80 case 'b': 81 str_uint32_t(optarg, NULL, 0, 0, &unit_size); 74 82 break; 75 83 … … 103 111 LIST_INITIALIZE(mtab_list); 104 112 get_mtab_list(&mtab_list); 105 printf( "%s\n", HEADER_TABLE);113 printf(HEADER_TABLE, unit_size); 106 114 list_foreach(mtab_list, cur) { 107 115 mtab_ent_t *mtab_ent = list_get_instance(cur, mtab_ent_t, … … 117 125 { 118 126 printf("%10s", name); 119 printf(" %1 4llu %14llu %14llu %4llu%% %s\n",120 FSBK_TO_BK(st->f_blocks, st->f_bsize, 512), /* Blocks */121 FSBK_TO_BK(st->f_blocks - st->f_bfree, st->f_bsize, 512), /* Used */122 FSBK_TO_BK(st->f_bfree, st->f_bsize, 512), /* Available */123 (st->f_blocks)?PERCENTAGE(st->f_blocks - st->f_bfree, st->f_blocks):0L, /* Used% */124 mountpoint /* Mounted on */127 printf(" %15llu %14llu %14llu %4llu%% %s\n", 128 FSBK_TO_BK(st->f_blocks, st->f_bsize, unit_size), /* Blocks */ 129 FSBK_TO_BK(st->f_blocks - st->f_bfree, st->f_bsize, unit_size), /* Used */ 130 FSBK_TO_BK(st->f_bfree, st->f_bsize, unit_size), /* Available */ 131 (st->f_blocks)?PERCENTAGE(st->f_blocks - st->f_bfree, st->f_blocks):0L, /* Used% */ 132 mountpoint /* Mounted on */ 125 133 ); 126 134 }
Note:
See TracChangeset
for help on using the changeset viewer.