From 0d17ac0fbdd827af4f2014e89320720ca179aae8 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Mon, 30 Sep 2019 14:57:23 +0200 Subject: [PATCH] sar/sadf: Change 'flags' type from unsigned int to uint64_t Need more bits for future extensions. Signed-off-by: Sebastien GODARD --- sa.h | 29 +++++++++++++++-------------- sa_common.c | 28 ++++++++++++++-------------- sadc.c | 5 +++-- sadf.c | 3 ++- sar.c | 3 ++- 5 files changed, 36 insertions(+), 32 deletions(-) diff --git a/sa.h b/sa.h index 37da7a9..db74fd6 100644 --- a/sa.h +++ b/sa.h @@ -7,6 +7,7 @@ #define _SA_H #include +#include #include "common.h" #include "rd_stats.h" @@ -1438,7 +1439,7 @@ void allocate_structures int check_disk_reg (struct activity *, int, int, int); void check_file_actlst - (int *, char *, struct activity * [], unsigned int, struct file_magic *, + (int *, char *, struct activity * [], uint64_t, struct file_magic *, struct file_header *, struct file_activity **, unsigned int [], int, int *, int *); int check_net_dev_reg (struct activity *, int, int, int); @@ -1459,13 +1460,13 @@ void free_structures char *get_devname (unsigned int, unsigned int, int); char *get_sa_devname - (unsigned int, unsigned int, unsigned long long [], unsigned int, unsigned int); + (unsigned int, unsigned int, unsigned long long [], unsigned int, uint64_t); void get_file_timestamp_struct - (unsigned int, struct tm *, struct file_header *); + (uint64_t, struct tm *, struct file_header *); unsigned long long get_global_cpu_statistics - (struct activity *, int, int, unsigned int, unsigned char []); + (struct activity *, int, int, uint64_t, unsigned char []); void get_global_soft_statistics - (struct activity *, int, int, unsigned int, unsigned char []); + (struct activity *, int, int, uint64_t, unsigned char []); void get_itv_value (struct record_header *, struct record_header *, unsigned long long *); void init_custom_color_palette @@ -1475,11 +1476,11 @@ int next_slice void parse_sa_devices (char *, struct activity *, int, int *, int); int parse_sar_opt - (char * [], int *, struct activity * [], unsigned int *, int); + (char * [], int *, struct activity * [], uint64_t *, int); int parse_sar_I_opt - (char * [], int *, unsigned int *, struct activity * []); + (char * [], int *, uint64_t *, struct activity * []); int parse_sa_P_opt - (char * [], int *, unsigned int *, struct activity * []); + (char * [], int *, uint64_t *, struct activity * []); int parse_sar_m_opt (char * [], int *, struct activity * []); int parse_sar_n_opt @@ -1487,14 +1488,14 @@ int parse_sar_n_opt int parse_timestamp (char * [], int *, struct tstamp *, const char *); void print_report_hdr - (unsigned int, struct tm *, struct file_header *); + (uint64_t, struct tm *, struct file_header *); void print_sar_comment (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); __printf_funct_t print_sar_restart (int *, int, char *, char *, int, struct file_header *, struct record_header *); int print_special_record - (struct record_header *, unsigned int, struct tstamp *, struct tstamp *, + (struct record_header *, uint64_t, struct tstamp *, struct tstamp *, int, int, struct tm *, char *, int, struct file_magic *, struct file_header *, struct activity * [], struct report_format *, int, int); int read_file_stat_bunch @@ -1504,7 +1505,7 @@ __nr_t read_nr_value (int, char *, struct file_magic *, int, int, int); int read_record_hdr (int, void *, struct record_header *, struct file_header *, int, int, - int, size_t, unsigned int); + int, size_t, uint64_t); void reallocate_all_buffers (struct activity *, __nr_t); void replace_nonprintable_char @@ -1512,7 +1513,7 @@ void replace_nonprintable_char int sa_fread (int, void *, size_t, int, int); int sa_get_record_timestamp_struct - (unsigned int, struct record_header *, struct tm *); + (uint64_t, struct record_header *, struct tm *); int sa_open_read_magic (int *, char *, struct file_magic *, int, int *, int); int search_list_item @@ -1522,11 +1523,11 @@ void select_all_activities void select_default_activity (struct activity * []); void set_bitmaps - (struct activity * [], unsigned int *); + (struct activity * [], uint64_t *); void set_hdr_rectime (unsigned int, struct tm *, struct file_header *); void set_record_timestamp_string - (unsigned int, struct record_header *, char *, char *, int, struct tm *); + (uint64_t, struct record_header *, char *, char *, int, struct tm *); void swap_struct (unsigned int [], void *, int); #endif /* SOURCE_SADC undefined */ diff --git a/sa_common.c b/sa_common.c index 969c236..4242934 100644 --- a/sa_common.c +++ b/sa_common.c @@ -817,7 +817,7 @@ void get_itv_value(struct record_header *record_hdr_curr, * not the time, should be used by the caller. *************************************************************************** */ -void get_file_timestamp_struct(unsigned int flags, struct tm *rectime, +void get_file_timestamp_struct(uint64_t flags, struct tm *rectime, struct file_header *file_hdr) { if (PRINT_TRUE_TIME(flags)) { @@ -851,7 +851,7 @@ void get_file_timestamp_struct(unsigned int flags, struct tm *rectime, * @rectime Date and time from file header. *************************************************************************** */ -void print_report_hdr(unsigned int flags, struct tm *rectime, +void print_report_hdr(uint64_t flags, struct tm *rectime, struct file_header *file_hdr) { @@ -1539,7 +1539,7 @@ int skip_extra_struct(int ifd, int endian_mismatch, int arch_64) */ int read_record_hdr(int ifd, void *buffer, struct record_header *record_hdr, struct file_header *file_hdr, int arch_64, int endian_mismatch, - int oneof, size_t b_size, unsigned int flags) + int oneof, size_t b_size, uint64_t flags) { int rc; @@ -1935,7 +1935,7 @@ int sa_open_read_magic(int *fd, char *dfile, struct file_magic *file_magic, * @arch_64 TRUE if file's data come from a 64 bit machine. *************************************************************************** */ -void check_file_actlst(int *ifd, char *dfile, struct activity *act[], unsigned int flags, +void check_file_actlst(int *ifd, char *dfile, struct activity *act[], uint64_t flags, struct file_magic *file_magic, struct file_header *file_hdr, struct file_activity **file_actlst, unsigned int id_seq[], int ignore, int *endian_mismatch, int *arch_64) @@ -2205,7 +2205,7 @@ format_error: *************************************************************************** */ int parse_sar_opt(char *argv[], int *opt, struct activity *act[], - unsigned int *flags, int caller) + uint64_t *flags, int caller) { int i, p; @@ -2570,7 +2570,7 @@ int parse_sar_n_opt(char *argv[], int *opt, struct activity *act[]) * 0 on success, 1 otherwise. *************************************************************************** */ -int parse_sar_I_opt(char *argv[], int *opt, unsigned int *flags, struct activity *act[]) +int parse_sar_I_opt(char *argv[], int *opt, uint64_t *flags, struct activity *act[]) { int p; @@ -2607,7 +2607,7 @@ int parse_sar_I_opt(char *argv[], int *opt, unsigned int *flags, struct activity * 0 on success, 1 otherwise. *************************************************************************** */ -int parse_sa_P_opt(char *argv[], int *opt, unsigned int *flags, struct activity *act[]) +int parse_sa_P_opt(char *argv[], int *opt, uint64_t *flags, struct activity *act[]) { int p; @@ -2637,7 +2637,7 @@ int parse_sa_P_opt(char *argv[], int *opt, unsigned int *flags, struct activity * @act Array of selected activities. *************************************************************************** */ -void set_bitmaps(struct activity *act[], unsigned int *flags) +void set_bitmaps(struct activity *act[], uint64_t *flags) { int p; @@ -2878,7 +2878,7 @@ void replace_nonprintable_char(int ifd, char *comment) * 1 if an error was detected, or 0 otherwise. *************************************************************************** */ -int sa_get_record_timestamp_struct(unsigned int l_flags, struct record_header *record_hdr, +int sa_get_record_timestamp_struct(uint64_t l_flags, struct record_header *record_hdr, struct tm *rectime) { struct tm *ltm; @@ -2938,7 +2938,7 @@ int sa_get_record_timestamp_struct(unsigned int l_flags, struct record_header *r * been used. *************************************************************************** */ -void set_record_timestamp_string(unsigned int l_flags, struct record_header *record_hdr, +void set_record_timestamp_string(uint64_t l_flags, struct record_header *record_hdr, char *cur_date, char *cur_time, int len, struct tm *rectime) { /* Set cur_time date value */ @@ -2996,7 +2996,7 @@ void set_record_timestamp_string(unsigned int l_flags, struct record_header *rec * 1 if the record has been successfully displayed, and 0 otherwise. *************************************************************************** */ -int print_special_record(struct record_header *record_hdr, unsigned int l_flags, +int print_special_record(struct record_header *record_hdr, uint64_t l_flags, struct tstamp *tm_start, struct tstamp *tm_end, int rtype, int ifd, struct tm *rectime, char *file, int tab, struct file_magic *file_magic, struct file_header *file_hdr, @@ -3107,7 +3107,7 @@ int print_special_record(struct record_header *record_hdr, unsigned int l_flags, *************************************************************************** */ unsigned long long get_global_cpu_statistics(struct activity *a, int prev, int curr, - unsigned int flags, unsigned char offline_cpu_bitmap[]) + uint64_t flags, unsigned char offline_cpu_bitmap[]) { int i; unsigned long long tot_jiffies_c, tot_jiffies_p; @@ -3254,7 +3254,7 @@ unsigned long long get_global_cpu_statistics(struct activity *a, int prev, int c *************************************************************************** */ void get_global_soft_statistics(struct activity *a, int prev, int curr, - unsigned int flags, unsigned char offline_cpu_bitmap[]) + uint64_t flags, unsigned char offline_cpu_bitmap[]) { int i; struct stats_softnet *ssnc, *ssnp; @@ -3324,7 +3324,7 @@ void get_global_soft_statistics(struct activity *a, int prev, int curr, *************************************************************************** */ char *get_sa_devname(unsigned int major, unsigned int minor, unsigned long long wwn[], - unsigned int part_nr, unsigned int flags) + unsigned int part_nr, uint64_t flags) { char *dev_name = NULL, *persist_dev_name = NULL; static char sid[64]; diff --git a/sadc.c b/sadc.c index 9677b7f..022af00 100644 --- a/sadc.c +++ b/sadc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ extern time_t __unix_time; #endif long interval = 0; -unsigned int flags = 0; +uint64_t flags = 0; int optz = 0; char timestamp[2][TIMESTAMP_LEN]; @@ -1035,7 +1036,7 @@ void rw_sa_stat_loop(long count, int stdfd, int ofd, char ofile[], char sa_dir[]) { int do_sa_rotat = 0; - unsigned int save_flags; + uint64_t save_flags; char new_ofile[MAX_FILE_LEN] = ""; struct tm rectime = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL}; diff --git a/sadf.c b/sadf.c index 619d3d1..570bcf9 100644 --- a/sadf.c +++ b/sadf.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ int dplaces_nr = -1; /* Color palette number */ int palette = SVG_DEFAULT_COL_PALETTE; -unsigned int flags = 0; +uint64_t flags = 0; unsigned int dm_major; /* Device-mapper major number */ unsigned int format = 0; /* Output format */ unsigned int f_position = 0; /* Output format position in array */ diff --git a/sar.c b/sar.c index 964accf..07b879a 100644 --- a/sar.c +++ b/sar.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +61,7 @@ int arch_64 = FALSE; /* Number of decimal places */ int dplaces_nr = -1; -unsigned int flags = 0; +uint64_t flags = 0; unsigned int dm_major; /* Device-mapper major number */ char timestamp[2][TIMESTAMP_LEN]; -- 2.40.0