int i, j, j0, found;
struct stats_filesystem *sfc, *sfp, *sfm;
int unit = NO_UNIT;
+ char *dev_name;
if (DISPLAY_UNIT(flags)) {
/* Default values unit is B */
for (i = 0; i < a->nr[curr]; i++) {
sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
+ /* Get name to display (persistent or standard fs name, or mount point) */
+ dev_name = get_fs_name_to_display(a, flags, sfc);
+
if (a->item_list != NULL) {
/* A list of devices has been entered on the command line */
- if (!search_list_item(a->item_list,
- DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name))
+ if (!search_list_item(a->item_list, dev_name))
/* Device not found */
continue;
}
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
: 0.0);
- cprintf_in(IS_STR, " %s\n",
- DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, 0);
+ cprintf_in(IS_STR, " %s\n", dev_name, 0);
}
if (!dispavg) {
(unsigned int, unsigned int, unsigned long long [], unsigned int, uint64_t);
void get_file_timestamp_struct
(uint64_t, struct tm *, struct file_header *);
+char *get_fs_name_to_display
+ (struct activity *, uint64_t, struct stats_filesystem *);
unsigned long long get_global_cpu_statistics
(struct activity *, int, int, uint64_t, unsigned char []);
void get_global_soft_statistics
ssnp_all->flow_limit += ssnp->flow_limit;
}
}
+
+/*
+ ***************************************************************************
+ * Get filesystem name to display. This may be either the persistent name
+ * if requested by the user, the standard filesystem name (e.g. /dev/sda1,
+ * /dev/sdb3, etc.) or the mount point. This is used when displaying
+ * filesystem statistics: sar -F or sadf -- -F).
+ *
+ * IN:
+ * @a Activity structure.
+ * @flags Flags for common options and system state.
+ * @st_fs Statistics for current filesystem.
+ *
+ * RETURNS:
+ * Filesystem name to display.
+ ***************************************************************************
+ */
+char *get_fs_name_to_display(struct activity *a, uint64_t flags, struct stats_filesystem *st_fs)
+{
+ char *pname = NULL, *persist_dev_name;
+ char fname[MAX_FS_LEN];
+
+ if (DISPLAY_PERSIST_NAME_S(flags) && !DISPLAY_MOUNT(a->opt_flags)) {
+ strncpy(fname, st_fs->fs_name, sizeof(fname));
+ fname[sizeof(fname) - 1] = '\0';
+ if ((persist_dev_name = get_persistent_name_from_pretty(basename(fname))) != NULL) {
+ pname = persist_dev_name;
+ }
+ }
+ if (!pname) {
+ pname = DISPLAY_MOUNT(a->opt_flags) ? st_fs->mountp : st_fs->fs_name;
+ }
+ return pname;
+}
#endif /* SOURCE_SADC undefined */