]> granicus.if.org Git - sysstat/commitdiff
sar: Device names are now pretty-printed by default
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Jul 2020 07:20:14 +0000 (09:20 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Jul 2020 07:20:14 +0000 (09:20 +0200)
sar now pretty-prints device names by default. It means that they will
be displayed as they appear in /dev (e.g. sda, sdb...) instead of
"devM-m", and you don't need to use option -p for that.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa.h
sa_common.c

diff --git a/sa.h b/sa.h
index b84f06f307a5fc15085e057eb0cb40cea5b55d86..3652c9479acf15fad24d3efc43ed27a26e304bd7 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -1499,7 +1499,7 @@ void free_bitmaps
 void free_structures
        (struct activity * []);
 char *get_devname
-       (unsigned int, unsigned int, int);
+       (unsigned int, unsigned int);
 char *get_sa_devname
        (unsigned int, unsigned int, unsigned long long [], unsigned int, uint64_t);
 void get_file_timestamp_struct
index 45d8e4133d9b4aa91cb6296d9d8c0024126aef2d..3fbc1c751a2b07ab1f305f689e6c15a75ae33d41 100644 (file)
@@ -570,24 +570,19 @@ char *get_devname_from_sysfs(unsigned int major, unsigned int minor)
  * IN:
  * @major      Major number of the device.
  * @minor      Minor number of the device.
- * @pretty     TRUE if the real name of the device (as it appears in /dev)
- *             should be returned.
  *
  * RETURNS:
  * The name of the device, which may be the real name (as it appears in /dev)
  * or a string with the following format devM-n.
  ***************************************************************************
  */
-char *get_devname(unsigned int major, unsigned int minor, int pretty)
+char *get_devname(unsigned int major, unsigned int minor)
 {
        static char buf[32];
        char *name;
 
        snprintf(buf, 32, "dev%u-%u", major, minor);
 
-       if (!pretty)
-               return (buf);
-
        name = get_devname_from_sysfs(major, minor);
        if (name != NULL)
                return (name);
@@ -2327,10 +2322,7 @@ int parse_sar_opt(char *argv[], int *opt, struct activity *act[],
                                fprintf(stderr, _("Invalid type of persistent device name\n"));
                                return 2;
                        }
-                       /*
-                        * If persistent device name doesn't exist for device, use
-                        * its pretty name.
-                        */
+                       /* Pretty print report (option -j implies option -p) */
                        *flags |= S_F_PERSIST_NAME + S_F_DEV_PRETTY;
                        return 0;
                        break;
@@ -3411,7 +3403,7 @@ char *get_sa_devname(unsigned int major, unsigned int minor, unsigned long long
        char xsid[32] = "", pn[16] = "";
 
        if (DISPLAY_PERSIST_NAME_S(flags)) {
-               persist_dev_name = get_persistent_name_from_pretty(get_devname(major, minor, TRUE));
+               persist_dev_name = get_persistent_name_from_pretty(get_devname(major, minor));
        }
 
        if (persist_dev_name) {
@@ -3433,8 +3425,7 @@ char *get_sa_devname(unsigned int major, unsigned int minor, unsigned long long
                }
 
                if (!dev_name) {
-                       dev_name = get_devname(major, minor,
-                                              USE_PRETTY_OPTION(flags));
+                       dev_name = get_devname(major, minor);
                }
        }