git: 3334a537ed38 - main - Convert fsidcmp(9) from macro to inline function

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 27 Dec 2023 10:04:35 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3334a537ed385e487a47208dab8f36b25643bcdb

commit 3334a537ed385e487a47208dab8f36b25643bcdb
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-12-26 19:39:33 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-27 09:50:16 +0000

    Convert fsidcmp(9) from macro to inline function
    
    This allows type checking the arguments.
    
    Explicit structure members comparisions are done to avoid introducting
    string.h pollution for userspace.
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D43205
---
 sys/sys/mount.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 6cb7ea810682..dd5eaad184f6 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -50,7 +50,12 @@
 
 typedef struct fsid { int32_t val[2]; } fsid_t;	/* filesystem id type */
 
-#define fsidcmp(a, b) memcmp((a), (b), sizeof(fsid_t))
+/* Returns non-zero if fsids are different. */
+static inline int
+fsidcmp(const fsid_t *a, const fsid_t *b)
+{
+	return (a->val[0] != b->val[0] || a->val[1] != b->val[1]);
+}
 
 /*
  * File identifier.