Thu Nov 30 03:31:08 2017 UTC ()
clang does not like dead unused functions.


(christos)
diff -r1.3 -r1.4 src/sbin/mount_qemufwcfg/fwcfg.c

cvs diff -r1.3 -r1.4 src/sbin/mount_qemufwcfg/fwcfg.c (expand / switch to unified diff)

--- src/sbin/mount_qemufwcfg/fwcfg.c 2017/11/26 15:03:15 1.3
+++ src/sbin/mount_qemufwcfg/fwcfg.c 2017/11/30 03:31:08 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fwcfg.c,v 1.3 2017/11/26 15:03:15 christos Exp $ */ 1/* $NetBSD: fwcfg.c,v 1.4 2017/11/30 03:31:08 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__RCSID("$NetBSD: fwcfg.c,v 1.3 2017/11/26 15:03:15 christos Exp $"); 30__RCSID("$NetBSD: fwcfg.c,v 1.4 2017/11/30 03:31:08 christos Exp $");
31 31
32#include <sys/ioctl.h> 32#include <sys/ioctl.h>
33 33
34#include <err.h> 34#include <err.h>
35#include <errno.h> 35#include <errno.h>
36#include <fcntl.h> 36#include <fcntl.h>
37#include <fuse.h> 37#include <fuse.h>
38#include <stdio.h> 38#include <stdio.h>
39#include <stdlib.h> 39#include <stdlib.h>
40#include <string.h> 40#include <string.h>
41#include <unistd.h> 41#include <unistd.h>
42 42
43#include <dev/ic/qemufwcfgio.h> 43#include <dev/ic/qemufwcfgio.h>
@@ -198,33 +198,35 @@ build_tree(virtdir_t *v) @@ -198,33 +198,35 @@ build_tree(virtdir_t *v)
198 st.st_gid = fwcfg_gid; 198 st.st_gid = fwcfg_gid;
199 virtdir_init(v, NULL, &st, &st, &st); 199 virtdir_init(v, NULL, &st, &st, &st);
200 200
201 set_index(FW_CFG_FILE_DIR); 201 set_index(FW_CFG_FILE_DIR);
202 read_data(&count, sizeof(count)); 202 read_data(&count, sizeof(count));
203 for (n = 0; n < be32toh(count); n++) { 203 for (n = 0; n < be32toh(count); n++) {
204 read_data(&f, sizeof(f)); 204 read_data(&f, sizeof(f));
205 snprintf(path, sizeof(path), "/%s", f.name); 205 snprintf(path, sizeof(path), "/%s", f.name);
206 virtdir_add(v, path, strlen(path), 'f', NULL, 206 virtdir_add(v, path, strlen(path), 'f', NULL,
207 be32toh(f.size), be16toh(f.select)); 207 be32toh(f.size), be16toh(f.select));
208 } 208 }
209} 209}
210 210
 211#if 0
211static __dead void 212static __dead void
212usage(void) 213usage(void)
213{ 214{
214 fprintf(stderr, "Usage: %s [-F <path>] [-g <gid>] [-m <file-mode>] " 215 fprintf(stderr, "Usage: %s [-F <path>] [-g <gid>] [-m <file-mode>] "
215 "[-M <dir-mode>] [-u <uid>] [<fuse-options>]", getprogname()); 216 "[-M <dir-mode>] [-u <uid>] [<fuse-options>]", getprogname());
216 exit(EXIT_FAILURE); 217 exit(EXIT_FAILURE);
217} 218}
 219#endif
218 220
219int 221int
220main(int argc, char *argv[]) 222main(int argc, char *argv[])
221{ 223{
222 const char *path = _PATH_FWCFG; 224 const char *path = _PATH_FWCFG;
223 int ch; 225 int ch;
224 long m; 226 long m;
225 char *ep; 227 char *ep;
226 228
227 fwcfg_uid = geteuid(); 229 fwcfg_uid = geteuid();
228 fwcfg_gid = getegid(); 230 fwcfg_gid = getegid();
229 231
230 while ((ch = getopt(argc, argv, "F:g:m:M:u:")) != -1) { 232 while ((ch = getopt(argc, argv, "F:g:m:M:u:")) != -1) {