diff -puriN cluster-3.2.0.orig/cman/qdisk/disk_util.c cluster-3.2.0/cman/qdisk/disk_util.c --- cluster-3.2.0.orig/cman/qdisk/disk_util.c 2012-11-25 22:13:22.000000000 -0600 +++ cluster-3.2.0/cman/qdisk/disk_util.c 2018-11-23 00:58:23.000000000 -0600 @@ -16,74 +16,9 @@ #include #include #include +#include "disk_util.h" -inline void _diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end); -inline int get_time(struct timeval *tv, int use_uptime); -inline void -_diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end) -{ - dest->tv_sec = end->tv_sec - start->tv_sec; - dest->tv_usec = end->tv_usec - start->tv_usec; - - if (dest->tv_usec < 0) { - dest->tv_usec += 1000000; - dest->tv_sec--; - } -} - - -/** - * - * Grab the uptime from /proc/uptime. - * - * @param tv Timeval struct to store time in. The sec - * field contains seconds, the usec field - * contains the hundredths-of-seconds (converted - * to micro-seconds) - * @return -1 on failure, 0 on success. - */ -static inline int -getuptime(struct timeval *tv) -{ - FILE *fp; - struct timeval junk; - int rv; - - fp = fopen("/proc/uptime","r"); - if (!fp) - return -1; - -#if defined(__sparc__) - rv = fscanf(fp,"%ld.%d %ld.%d\n", &tv->tv_sec, &tv->tv_usec, - &junk.tv_sec, &junk.tv_usec); -#else - rv = fscanf(fp,"%ld.%ld %ld.%ld\n", &tv->tv_sec, &tv->tv_usec, - &junk.tv_sec, &junk.tv_usec); -#endif - fclose(fp); - - if (rv != 4) { - return -1; - } - - tv->tv_usec *= 10000; - - return 0; -} - - -inline int -get_time(struct timeval *tv, int use_uptime) -{ - if (use_uptime) { - return getuptime(tv); - } else { - return gettimeofday(tv, NULL); - } -} - - /** Update write times and calculate a new average time */ diff -puriN cluster-3.2.0.orig/cman/qdisk/disk_util.h cluster-3.2.0/cman/qdisk/disk_util.h --- cluster-3.2.0.orig/cman/qdisk/disk_util.h 1969-12-31 18:00:00.000000000 -0600 +++ cluster-3.2.0/cman/qdisk/disk_util.h 2018-11-23 00:58:21.000000000 -0600 @@ -0,0 +1,67 @@ + +static inline void +_diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end) +{ + dest->tv_sec = end->tv_sec - start->tv_sec; + dest->tv_usec = end->tv_usec - start->tv_usec; + + if (dest->tv_usec < 0) { + dest->tv_usec += 1000000; + dest->tv_sec--; + } +} + + + + +/** + * + * Grab the uptime from /proc/uptime. + * + * @param tv Timeval struct to store time in. The sec + * field contains seconds, the usec field + * contains the hundredths-of-seconds (converted + * to micro-seconds) + * @return -1 on failure, 0 on success. + */ +static inline int +getuptime(struct timeval *tv) +{ + FILE *fp; + struct timeval junk; + int rv; + + fp = fopen("/proc/uptime","r"); + if (!fp) + return -1; + +#if defined(__sparc__) + rv = fscanf(fp,"%ld.%d %ld.%d\n", &tv->tv_sec, &tv->tv_usec, + &junk.tv_sec, &junk.tv_usec); +#else + rv = fscanf(fp,"%ld.%ld %ld.%ld\n", &tv->tv_sec, &tv->tv_usec, + &junk.tv_sec, &junk.tv_usec); +#endif + fclose(fp); + + if (rv != 4) { + return -1; + } + + tv->tv_usec *= 10000; + + return 0; +} + +static inline int +get_time(struct timeval *tv, int use_uptime) +{ + if (use_uptime) { + return getuptime(tv); + } else { + return gettimeofday(tv, NULL); + } +} + + + diff -puriN cluster-3.2.0.orig/cman/qdisk/main.c cluster-3.2.0/cman/qdisk/main.c --- cluster-3.2.0.orig/cman/qdisk/main.c 2012-11-25 22:13:22.000000000 -0600 +++ cluster-3.2.0/cman/qdisk/main.c 2018-11-23 01:09:15.000000000 -0600 @@ -31,6 +31,7 @@ #define LOG_DAEMON_NAME "qdiskd" #define LOG_MODE_DEFAULT LOG_MODE_OUTPUT_SYSLOG|LOG_MODE_OUTPUT_FILE #include "iostate.h" +#include "disk_util.h" /* from main.c */ @@ -57,11 +58,6 @@ extern int clear_bit(uint8_t *mask, uint extern int set_bit(uint8_t *mask, uint32_t bitidx, uint32_t masklen); extern int is_bit_set(uint8_t *mask, uint32_t bitidx, uint32_t masklen); -/* From disk_utils.c */ -extern inline int get_time(struct timeval *tv, int use_uptime); -extern inline void _diff_tv(struct timeval *dest, struct timeval *start, - struct timeval *end); - static int _running = 1, _reconfig = 0, _cman_shutdown = 0; static int _debug = 0, _foreground = 0;