git: aa884cdf91ed - stable/14 - nullfs_mount: use symbols instead of string literals for cache mount options

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 24 Oct 2025 09:51:52 UTC
The branch stable/14 has been updated by kib:

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

commit aa884cdf91edf6dc96f25db229ff70dd030b9307
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-10-08 15:44:59 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-10-24 09:47:36 +0000

    nullfs_mount: use symbols instead of string literals for cache mount options
    
    (cherry picked from commit 8e6f6a5fbde78bd8d19445ee6ebaf00b8f4f5aa9)
---
 sys/fs/nullfs/null_vfsops.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 14a6ed5d4d4c..7f4cc5e38f96 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -89,6 +89,8 @@ nullfs_mount(struct mount *mp)
 	char *target;
 	int error, len;
 	bool isvnunlocked;
+	static const char cache_opt_name[] = "cache";
+	static const char nocache_opt_name[] = "nocache";
 
 	NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
 
@@ -209,9 +211,10 @@ nullfs_mount(struct mount *mp)
 		MNT_IUNLOCK(mp);
 	}
 
-	if (vfs_getopt(mp->mnt_optnew, "cache", NULL, NULL) == 0) {
+	if (vfs_getopt(mp->mnt_optnew, cache_opt_name, NULL, NULL) == 0) {
 		xmp->nullm_flags |= NULLM_CACHE;
-	} else if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0) {
+	} else if (vfs_getopt(mp->mnt_optnew, nocache_opt_name, NULL,
+	    NULL) == 0) {
 		;
 	} else if (null_cache_vnodes &&
 	    (xmp->nullm_vfs->mnt_kern_flag & MNTK_NULL_NOCACHE) == 0) {