]> granicus.if.org Git - sysstat/commitdiff
Merge branch 'jaunix-mountpoint-json'
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 Mar 2015 09:09:16 +0000 (10:09 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 Mar 2015 09:09:16 +0000 (10:09 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
1  2 
json_stats.c

diff --cc json_stats.c
index a7c8847efe45c71f854e7564ffd997b038c7d265,ef3f22b676e5996ad98ca258479738a35fbb7ca1..3ee069d66a6edce6f6dcb03451848c3427936f77
@@@ -2139,25 -2140,48 +2139,26 @@@ __print_funct_t json_print_filesystem_s
                }
                sep = TRUE;
  
-               xprintf0(tab, "{\"filesystem\": \"%s\", "
 -              if(DISPLAY_MOUNT(a->opt_flags)) {
 -                      xprintf0(tab, "{\"mountpoint\": \"%s\", "
 -                               "\"MBfsfree\": %.0f, "
 -                               "\"MBfsused\": %.0f, "
 -                               "\"%%fsused\": %.2f, "
 -                               "\"%%ufsused\": %.2f, "
 -                               "\"Ifree\": %llu, "
 -                               "\"Iused\": %llu, "
 -                               "\"%%Iused\": %.2f}",
 -                               sfc->mountp,
 -                               (double) sfc->f_bfree / 1024 / 1024,
 -                               (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
 -                               sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
 -                                           : 0.0,
 -                               sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
 -                                           : 0.0,
 -                               sfc->f_ffree,
 -                               sfc->f_files - sfc->f_ffree,
 -                               sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
 -                                          : 0.0);
 -              } else {
 -                      xprintf0(tab, "{\"filesystem\": \"%s\", "
 -                               "\"MBfsfree\": %.0f, "
 -                               "\"MBfsused\": %.0f, "
 -                               "\"%%fsused\": %.2f, "
 -                               "\"%%ufsused\": %.2f, "
 -                               "\"Ifree\": %llu, "
 -                               "\"Iused\": %llu, "
 -                               "\"%%Iused\": %.2f}",
 -                               sfc->fs_name,
 -                               (double) sfc->f_bfree / 1024 / 1024,
 -                               (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
 -                               sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
 -                                           : 0.0,
 -                               sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
 -                                           : 0.0,
 -                               sfc->f_ffree,
 -                               sfc->f_files - sfc->f_ffree,
 -                               sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
 -                                          : 0.0);
 -
 -              }
++              xprintf0(tab, "{\"%s\": \"%s\", "
 +                       "\"MBfsfree\": %.0f, "
 +                       "\"MBfsused\": %.0f, "
 +                       "\"%%fsused\": %.2f, "
 +                       "\"%%ufsused\": %.2f, "
 +                       "\"Ifree\": %llu, "
 +                       "\"Iused\": %llu, "
 +                       "\"%%Iused\": %.2f}",
-                        sfc->fs_name,
++                       DISPLAY_MOUNT(a->opt_flags) ? "mountpoint" : "filesystem",
++                       DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name,
 +                       (double) sfc->f_bfree / 1024 / 1024,
 +                       (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
 +                       sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
 +                                   : 0.0,
 +                       sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
 +                                   : 0.0,
 +                       sfc->f_ffree,
 +                       sfc->f_files - sfc->f_ffree,
 +                       sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
 +                                  : 0.0);
        }
  
        printf("\n");