[PATCH] erofs-utils: add ERR_CAST macro

Jingbo Xu jefflexu at linux.alibaba.com
Tue Jul 11 13:55:40 AEST 2023


Add ERR_CAST macro.

Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
 include/erofs/err.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/erofs/err.h b/include/erofs/err.h
index 08b0bdb..2ae9e21 100644
--- a/include/erofs/err.h
+++ b/include/erofs/err.h
@@ -33,6 +33,12 @@ static inline long PTR_ERR(const void *ptr)
 	return (long) ptr;
 }
 
+static inline void * ERR_CAST(const void *ptr)
+{
+	/* cast away the const */
+	return (void *) ptr;
+}
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.19.1.6.gb485710b



More information about the Linux-erofs mailing list