git: 9f093bf1e897 - stable/13 - newfs_msdos: Fix warnings that arise when compiled for makefs

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 24 May 2022 13:51:46 UTC
The branch stable/13 has been updated by markj:

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

commit 9f093bf1e89796bec0a88873a29146faa50fa8ed
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-29 13:16:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-24 13:51:27 +0000

    newfs_msdos: Fix warnings that arise when compiled for makefs
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit f775c417fd9dd29d7bd987fc1cd30c6024540312)
---
 sbin/newfs_msdos/mkfs_msdos.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c
index 18545a79ea01..a3a86bd7d233 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -222,7 +222,9 @@ static const u_int8_t bootcode[] = {
 static volatile sig_atomic_t got_siginfo;
 static void infohandler(int);
 
+#ifndef MAKEFS
 static int check_mounted(const char *, mode_t);
+#endif
 static ssize_t getchunksize(void);
 static int getstdfmt(const char *, struct bpb *);
 static int getdiskinfo(int, const char *, const char *, int, struct bpb *);
@@ -800,6 +802,7 @@ done:
 /*
  * return -1 with error if file system is mounted.
  */
+#ifndef MAKEFS
 static int
 check_mounted(const char *fname, mode_t mode)
 {
@@ -807,7 +810,6 @@ check_mounted(const char *fname, mode_t mode)
  * If getmntinfo() is not available (e.g. Linux) don't check. This should
  * not be a problem since we will only be using makefs to create images.
  */
-#if !defined(MAKEFS)
     struct statfs *mp;
     const char *s1, *s2;
     size_t len;
@@ -832,9 +834,9 @@ check_mounted(const char *fname, mode_t mode)
 	    return -1;
 	}
     }
-#endif
     return 0;
 }
+#endif
 
 /*
  * Get optimal I/O size
@@ -977,6 +979,7 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
 	lp = &dlp;
     }
 #else
+    (void)dtype;
     /* In the makefs case we only support image files: */
     compute_geometry_from_file(fd, fname, &dlp);
     lp = &dlp;