From 8eb925b14a34d65e5e33861ea4aa1f565fb3d7ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Thu, 5 Oct 2023 13:18:15 +0200 Subject: [PATCH] libmount: change syscall status macros to be functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Functions are easier to modify and reason about. Signed-off-by: Thomas Weißschuh --- libmount/src/mountP.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index 339e2761a5..de44c064ab 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -479,22 +479,24 @@ struct libmnt_context /* Flags usable with MS_BIND|MS_REMOUNT */ #define MNT_BIND_SETTABLE (MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_NOATIME|MS_NODIRATIME|MS_RELATIME|MS_RDONLY|MS_NOSYMFOLLOW) -#define set_syscall_status(_cxt, _name, _x) __extension__ ({ \ - if (!(_x)) { \ - DBG(CXT, ul_debug("syscall '%s' [%m]", _name)); \ - (_cxt)->syscall_status = -errno; \ - (_cxt)->syscall_name = (_name); \ - } else { \ - DBG(CXT, ul_debug("syscall '%s' [success]", _name)); \ - (_cxt)->syscall_status = 0; \ - } \ - }) - -#define reset_syscall_status(_cxt) __extension__ ({ \ - DBG(CXT, ul_debug("reset syscall status")); \ - (_cxt)->syscall_status = 0; \ - (_cxt)->syscall_name = NULL; \ - }) +static inline void set_syscall_status(struct libmnt_context *cxt, const char *name, int x) +{ + if (!x) { + DBG(CXT, ul_debug("syscall '%s' [%m]", name)); + cxt->syscall_status = -errno; + cxt->syscall_name = name; + } else { + DBG(CXT, ul_debug("syscall '%s' [success]", name)); + cxt->syscall_status = 0; + } +} + +static inline void reset_syscall_status(struct libmnt_context *cxt) +{ + DBG(CXT, ul_debug("reset syscall status")); + cxt->syscall_status = 0; + cxt->syscall_name = NULL; +} /* optmap.c */ extern const struct libmnt_optmap *mnt_optmap_get_entry( -- 2.47.2