]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: change syscall status macros to be functions
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 5 Oct 2023 11:18:15 +0000 (13:18 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Thu, 5 Oct 2023 11:18:15 +0000 (13:18 +0200)
Functions are easier to modify and reason about.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libmount/src/mountP.h

index 339e2761a5305d841ebaffd1ca5df1c5529db262..de44c064ab0d8d167c59ee4a7908defe9c724a7f 100644 (file)
@@ -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(