git: f775c417fd9d - main - newfs_msdos: Fix warnings that arise when compiled for makefs

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 10 May 2022 21:41:49 UTC
The branch main has been updated by markj:

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

commit f775c417fd9dd29d7bd987fc1cd30c6024540312
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-29 13:16:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-10 21:26:50 +0000

    newfs_msdos: Fix warnings that arise when compiled for makefs
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 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 93dc5cf88049..13a804c82625 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;