device-mapper-multipath/0133-multipath-tools-fix-compilation-errors-on-32-bit-mus.patch
Benjamin Marzinski b05147c356 device-mapper-multipath-0.8.5-6
Change patch format to remove Git version
  * Patches 0001-0122 only have the patch format modified
Update to the head of the upstream staging branch plus redhat patches
  * Patches 0123-0134 & 1036-0142 are from the upstream staging branch
  * Patches 0143-1046 have been submitted upstream
  * Patch 0156 is a Red Hat only patch. Red Hat udev rules set ID_SERIAL
    from 60-persistent-storage.rules instead of 55-scsi-sg3_id.rules.
    Multipath's parse_vpd_pg83() function needs to match the ID_SERIAL
    value from udev.
Rename files
  * Previous patches 0123-0132 are now patches 1035 & 0147-0155
2021-03-26 13:33:56 -05:00

97 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 12 Feb 2021 00:38:44 +0100
Subject: [PATCH] multipath-tools: fix compilation errors on 32-bit musl
gcc on alpine Linux/i386 throws errors because the "tv_sec" element
of struct timespec is a time_t, which is a "long long" in that
environment. In general, time_t is signed. As we only use CLOCK_MONOTONIC,
which starts at boot time, a cast to long should be no problem, even
in 32bit environments.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 2 +-
multipathd/main.c | 16 ++++++++--------
multipathd/uxlsnr.c | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index 9ac42869..3f97582b 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -417,7 +417,7 @@ static int print_cmd_valid(int k, const vector pathvec,
wait = find_multipaths_check_timeout(pp, 0, &until);
if (wait == FIND_MULTIPATHS_WAITING)
printf("FIND_MULTIPATHS_WAIT_UNTIL=\"%ld.%06ld\"\n",
- until.tv_sec, until.tv_nsec/1000);
+ (long)until.tv_sec, until.tv_nsec/1000);
else if (wait == FIND_MULTIPATHS_WAIT_DONE)
printf("FIND_MULTIPATHS_WAIT_UNTIL=\"0\"\n");
printf("DM_MULTIPATH_DEVICE_PATH=\"%d\"\n",
diff --git a/multipathd/main.c b/multipathd/main.c
index 637a53bf..e0797ccd 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2486,8 +2486,8 @@ checkerloop (void *ap)
get_monotonic_time(&start_time);
if (start_time.tv_sec && last_time.tv_sec) {
timespecsub(&start_time, &last_time, &diff_time);
- condlog(4, "tick (%lu.%06lu secs)",
- diff_time.tv_sec, diff_time.tv_nsec / 1000);
+ condlog(4, "tick (%ld.%06lu secs)",
+ (long)diff_time.tv_sec, diff_time.tv_nsec / 1000);
last_time = start_time;
ticks = diff_time.tv_sec;
} else {
@@ -2548,18 +2548,18 @@ checkerloop (void *ap)
if (num_paths) {
unsigned int max_checkint;
- condlog(4, "checked %d path%s in %lu.%06lu secs",
+ condlog(4, "checked %d path%s in %ld.%06lu secs",
num_paths, num_paths > 1 ? "s" : "",
- diff_time.tv_sec,
+ (long)diff_time.tv_sec,
diff_time.tv_nsec / 1000);
conf = get_multipath_config();
max_checkint = conf->max_checkint;
put_multipath_config(conf);
if (diff_time.tv_sec > (time_t)max_checkint)
condlog(1, "path checkers took longer "
- "than %lu seconds, consider "
+ "than %ld seconds, consider "
"increasing max_polling_interval",
- diff_time.tv_sec);
+ (long)diff_time.tv_sec);
}
}
@@ -2585,8 +2585,8 @@ checkerloop (void *ap)
} else
diff_time.tv_sec = 1;
- condlog(3, "waiting for %lu.%06lu secs",
- diff_time.tv_sec,
+ condlog(3, "waiting for %ld.%06lu secs",
+ (long)diff_time.tv_sec,
diff_time.tv_nsec / 1000);
if (nanosleep(&diff_time, NULL) != 0) {
condlog(3, "nanosleep failed with error %d",
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index cd462b6d..dbee0d6f 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -154,8 +154,8 @@ static void check_timeout(struct timespec start_time, char *inbuf,
diff_time.tv_nsec / (1000 * 1000);
if (msecs > timeout)
condlog(2, "cli cmd '%s' timeout reached "
- "after %lu.%06lu secs", inbuf,
- diff_time.tv_sec, diff_time.tv_nsec / 1000);
+ "after %ld.%06lu secs", inbuf,
+ (long)diff_time.tv_sec, diff_time.tv_nsec / 1000);
}
}