[PATCH v2 21/29] xfsprogs: Stop using platform_crash()

Pavel Reichl
2021-08-06T21:23:58Z

---
include/linux.h | 8 +++++++-
libxfs/libxfs_io.h | 2 +-
repair/xfs_repair.c | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/linux.h b/include/linux.h
index 4ee4288f..591b4b05 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -239,12 +239,18 @@ platform_zero_range(
* atexit handlers.
*/
static inline void
-platform_crash(void)
+crash(void)
{
kill(getpid(), SIGKILL);
assert(0);
}

+static inline void
+platform_crash(void)
+{
+ return crash();
+}
+
/*
* Check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves. These
* are a copy of the definitions moved to linux/uapi/fs.h in the 4.5 kernel,
diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index 3cc4f4ee..a81bd659 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -46,7 +46,7 @@ xfs_buftarg_trip_write(
pthread_mutex_lock(&btp->lock);
btp->writes_left--;
if (!btp->writes_left)
- platform_crash();
+ crash();
pthread_mutex_unlock(&btp->lock);
}

diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 38406eea..a5410919 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -882,7 +882,7 @@ phase_end(int phase)

/* Fail if someone injected an post-phase error. */
if (fail_after_phase && phase == fail_after_phase)
- platform_crash();
+ crash();
}

int
--
2.31.1