Module Name: src
Committed By: christos
Date: Sun Feb 23 20:47:19 UTC 2025
Modified Files:
src/sbin/gpt: add.c backup.c biosboot.c create.c destroy.c gpt.c gpt.h
gpt_uuid.c header.c label.c main.c migrate.c recover.c remove.c
resize.c resizedisk.c restore.c set.c show.c type.c unset.c uuid.c
Log Message:
Pass some lint.
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sbin/gpt/add.c
cvs rdiff -u -r1.20 -r1.21 src/sbin/gpt/backup.c src/sbin/gpt/restore.c
cvs rdiff -u -r1.33 -r1.34 src/sbin/gpt/biosboot.c
cvs rdiff -u -r1.23 -r1.24 src/sbin/gpt/create.c src/sbin/gpt/remove.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/destroy.c src/sbin/gpt/main.c
cvs rdiff -u -r1.90 -r1.91 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.44 -r1.45 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.24 -r1.25 src/sbin/gpt/gpt_uuid.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/gpt/header.c
cvs rdiff -u -r1.30 -r1.31 src/sbin/gpt/label.c
cvs rdiff -u -r1.35 -r1.36 src/sbin/gpt/migrate.c
cvs rdiff -u -r1.19 -r1.20 src/sbin/gpt/recover.c
cvs rdiff -u -r1.25 -r1.26 src/sbin/gpt/resize.c
cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/resizedisk.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/gpt/set.c src/sbin/gpt/unset.c
cvs rdiff -u -r1.46 -r1.47 src/sbin/gpt/show.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/gpt/type.c
cvs rdiff -u -r1.3 -r1.4 src/sbin/gpt/uuid.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/add.c
diff -u src/sbin/gpt/add.c:1.45 src/sbin/gpt/add.c:1.46
--- src/sbin/gpt/add.c:1.45 Sat Nov 2 08:46:49 2024
+++ src/sbin/gpt/add.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.45 2024/11/02 12:46:49 kre Exp $");
+__RCSID("$NetBSD: add.c,v 1.46 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -58,7 +58,7 @@ static const char *addhelp[] = {
"[-s size] [-t type]",
};
-struct gpt_cmd c_add = {
+const struct gpt_cmd c_add = {
"add",
cmd_add,
addhelp, __arraycount(addhelp),
@@ -81,7 +81,7 @@ ent_set(struct gpt_ent *ent, const map_t
}
static int
-add(gpt_t gpt, off_t alignment, off_t block, off_t sectors, off_t size,
+add(gpt_t gpt, off_t alignment, off_t block, off_t sectors, off_t size __unused,
u_int entry, uint8_t *name, gpt_uuid_t type)
{
map_t map;
@@ -184,11 +184,15 @@ cmd_add(gpt_t gpt, int argc, char *argv[
if (gpt_uuid_get(gpt, &type) == -1)
goto usage;
break;
- default:
+ case 'a':
+ case 's':
+ case 'i':
if (gpt_add_ais(gpt, &alignment, &entry, &size, ch)
== -1)
goto usage;
break;
+ default:
+ goto usage;
}
}
Index: src/sbin/gpt/backup.c
diff -u src/sbin/gpt/backup.c:1.20 src/sbin/gpt/backup.c:1.21
--- src/sbin/gpt/backup.c:1.20 Mon Jun 8 18:52:09 2020
+++ src/sbin/gpt/backup.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: backup.c,v 1.20 2020/06/08 22:52:09 thorpej Exp $");
+__RCSID("$NetBSD: backup.c,v 1.21 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/bootblock.h>
@@ -59,7 +59,7 @@ static const char *backuphelp[] = {
static int cmd_backup(gpt_t, int, char *[]);
-struct gpt_cmd c_backup = {
+const struct gpt_cmd c_backup = {
"backup",
cmd_backup,
backuphelp, __arraycount(backuphelp),
@@ -120,7 +120,8 @@ cleanup:
}
static int
-store_gpt(gpt_t gpt, const struct gpt_hdr *hdr, prop_dictionary_t *type_dict)
+store_gpt(gpt_t gpt __unused, const struct gpt_hdr *hdr,
+ prop_dictionary_t *type_dict)
{
char buf[128];
Index: src/sbin/gpt/restore.c
diff -u src/sbin/gpt/restore.c:1.20 src/sbin/gpt/restore.c:1.21
--- src/sbin/gpt/restore.c:1.20 Sun Jun 7 01:42:25 2020
+++ src/sbin/gpt/restore.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: restore.c,v 1.20 2020/06/07 05:42:25 thorpej Exp $");
+__RCSID("$NetBSD: restore.c,v 1.21 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -58,7 +58,7 @@ static const char *restorehelp[] = {
"[-F] [-i infile]",
};
-struct gpt_cmd c_restore = {
+const struct gpt_cmd c_restore = {
"restore",
cmd_restore,
restorehelp, __arraycount(restorehelp),
@@ -111,7 +111,7 @@ restore_mbr(gpt_t gpt, struct mbr *mbr,
} else {
mbr->mbr_part[0].part_size_lo = htole16((uint16_t)last);
mbr->mbr_part[0].part_size_hi = htole16(
- (uint16_t)(last >> 16));
+ (uint16_t)((uint64_t)last >> 16));
}
} else {
PROP_ERR(prop_dictionary_get_uint16(mbr_dict, "lba_size_low",
@@ -125,8 +125,8 @@ restore_mbr(gpt_t gpt, struct mbr *mbr,
}
static int
-restore_ent(gpt_t gpt, prop_dictionary_t gpt_dict, void *secbuf, u_int gpt_size,
- u_int entries)
+restore_ent(gpt_t gpt, prop_dictionary_t gpt_dict, void *secbuf,
+ u_int gpt_size __unused, u_int entries)
{
unsigned int i;
struct gpt_ent ent;
Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.33 src/sbin/gpt/biosboot.c:1.34
--- src/sbin/gpt/biosboot.c:1.33 Fri Sep 13 07:11:29 2024
+++ src/sbin/gpt/biosboot.c Sun Feb 23 15:47:19 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: biosboot.c,v 1.33 2024/09/13 11:11:29 mlelstv Exp $ */
+/* $NetBSD: biosboot.c,v 1.34 2025/02/23 20:47:19 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.33 2024/09/13 11:11:29 mlelstv Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.34 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/stat.h>
@@ -79,7 +79,7 @@ static const char *biosboothelp[] = {
#endif
};
-struct gpt_cmd c_biosboot = {
+const struct gpt_cmd c_biosboot = {
"biosboot",
cmd_biosboot,
biosboothelp, __arraycount(biosboothelp),
Index: src/sbin/gpt/create.c
diff -u src/sbin/gpt/create.c:1.23 src/sbin/gpt/create.c:1.24
--- src/sbin/gpt/create.c:1.23 Fri Sep 23 15:36:50 2016
+++ src/sbin/gpt/create.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: create.c,v 1.23 2016/09/23 19:36:50 christos Exp $");
+__RCSID("$NetBSD: create.c,v 1.24 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -58,7 +58,7 @@ static const char *createhelp[] = {
"[-AfP] [-p partitions]",
};
-struct gpt_cmd c_create = {
+const struct gpt_cmd c_create = {
"create",
cmd_create,
createhelp, __arraycount(createhelp),
Index: src/sbin/gpt/remove.c
diff -u src/sbin/gpt/remove.c:1.23 src/sbin/gpt/remove.c:1.24
--- src/sbin/gpt/remove.c:1.23 Thu Jun 20 22:14:59 2019
+++ src/sbin/gpt/remove.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.23 2019/06/21 02:14:59 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.24 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -56,7 +56,7 @@ static const char *removehelp[] = {
"[-b blocknr] [-i index] [-L label] [-s sectors] [-t type]",
};
-struct gpt_cmd c_remove = {
+const struct gpt_cmd c_remove = {
"remove",
cmd_remove,
removehelp, __arraycount(removehelp),
@@ -66,7 +66,7 @@ struct gpt_cmd c_remove = {
#define usage() gpt_usage(NULL, &c_remove)
static void
-change(struct gpt_ent *ent, void *v, int backup)
+change(struct gpt_ent *ent, void *v __unused, int backup __unused)
{
/* Remove the primary entry by clearing the partition type. */
gpt_uuid_copy(ent->ent_type, gpt_uuid_nil);
Index: src/sbin/gpt/destroy.c
diff -u src/sbin/gpt/destroy.c:1.14 src/sbin/gpt/destroy.c:1.15
--- src/sbin/gpt/destroy.c:1.14 Sun Nov 20 06:57:02 2022
+++ src/sbin/gpt/destroy.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/destroy.c,v 1.6 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: destroy.c,v 1.14 2022/11/20 11:57:02 mlelstv Exp $");
+__RCSID("$NetBSD: destroy.c,v 1.15 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -55,7 +55,7 @@ static const char *destroyhelp[] = {
"[-r]",
};
-struct gpt_cmd c_destroy = {
+const struct gpt_cmd c_destroy = {
"destroy",
cmd_destroy,
destroyhelp, __arraycount(destroyhelp),
@@ -66,7 +66,7 @@ struct gpt_cmd c_destroy = {
static int
-destroy(gpt_t gpt, int force, int recoverable)
+destroy(gpt_t gpt, int force __unused, int recoverable)
{
map_t pri_hdr, sec_hdr, pmbr;
Index: src/sbin/gpt/main.c
diff -u src/sbin/gpt/main.c:1.14 src/sbin/gpt/main.c:1.15
--- src/sbin/gpt/main.c:1.14 Sun May 24 14:42:20 2020
+++ src/sbin/gpt/main.c Sun Feb 23 15:47:19 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.14 2020/05/24 18:42:20 jmcneill Exp $ */
+/* $NetBSD: main.c,v 1.15 2025/02/23 20:47:19 christos Exp $ */
/*-
* Copyright (c) 2002 Marcel Moolenaar
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: main.c,v 1.14 2020/05/24 18:42:20 jmcneill Exp $");
+__RCSID("$NetBSD: main.c,v 1.15 2025/02/23 20:47:19 christos Exp $");
#endif
#include <stdio.h>
@@ -50,31 +50,7 @@ __RCSID("$NetBSD: main.c,v 1.14 2020/05/
#include "map.h"
#include "gpt.h"
-static const struct gpt_cmd c_null;
-
-extern const struct gpt_cmd
- c_add,
-#ifndef HAVE_NBTOOL_CONFIG_H
- c_backup,
-#endif
- c_biosboot,
- c_create,
- c_destroy,
- c_header,
- c_label,
- c_migrate,
- c_recover,
- c_remove,
- c_resize,
- c_resizedisk,
-#ifndef HAVE_NBTOOL_CONFIG_H
- c_restore,
-#endif
- c_set,
- c_show,
- c_type,
- c_unset,
- c_uuid;
+static const struct gpt_cmd c_null = { 0 };
static const struct gpt_cmd *cmdsw[] = {
&c_add,
Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.90 src/sbin/gpt/gpt.c:1.91
--- src/sbin/gpt/gpt.c:1.90 Sun Oct 20 04:21:30 2024
+++ src/sbin/gpt/gpt.c Sun Feb 23 15:47:19 2025
@@ -35,7 +35,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.90 2024/10/20 08:21:30 mlelstv Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.91 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/param.h>
@@ -483,7 +483,7 @@ gpt_open(const char *dev, int flags, int
int mode, found;
off_t devsz;
gpt_t gpt;
- unsigned int index;
+ unsigned int idx;
if ((gpt = calloc(1, sizeof(*gpt))) == NULL) {
if (!(flags & GPT_QUIET))
@@ -573,8 +573,8 @@ gpt_open(const char *dev, int flags, int
if (map_init(gpt, devsz) == -1)
goto close;
- index = 1;
- if (gpt_mbr(gpt, 0LL, &index, 0U) == -1)
+ idx = 1;
+ if (gpt_mbr(gpt, 0LL, &idx, 0U) == -1)
goto close;
if ((found = gpt_gpt(gpt, 1LL, 1)) == -1)
goto close;
@@ -766,7 +766,7 @@ gpt_create_pmbr_part(struct mbr_part *pa
part->part_size_hi = htole16(0xffff);
} else {
part->part_size_lo = htole16((uint16_t)last);
- part->part_size_hi = htole16((uint16_t)(last >> 16));
+ part->part_size_hi = htole16((uint16_t)((uint64_t)last >> 16));
}
}
@@ -830,7 +830,7 @@ gpt_last(gpt_t gpt)
off_t
gpt_create(gpt_t gpt, off_t last, u_int parts, int primary_only)
{
- off_t blocks;
+ off_t blocks, lastoff;
map_t map;
struct gpt_hdr *hdr;
struct gpt_ent *ent;
@@ -861,8 +861,9 @@ gpt_create(gpt_t gpt, off_t last, u_int
}
/* Never cross the median of the device. */
- if ((blocks + 1LL) > ((last + 1LL) >> 1))
- blocks = ((last + 1LL) >> 1) - 1LL;
+ lastoff = (off_t)(((uint64_t)last + 1LL) >> 1);
+ if ((blocks + 1LL) > lastoff)
+ blocks = lastoff - 1LL;
/*
* Get the amount of free space at the end of the device and
@@ -1042,7 +1043,6 @@ gpt_change_ent(gpt_t gpt, const struct g
void (*cfn)(struct gpt_ent *, void *, int), void *v)
{
map_t m;
- struct gpt_hdr *hdr;
struct gpt_ent *ent;
unsigned int i;
uint8_t utfbuf[__arraycount(ent->ent_name) * 3 + 1];
@@ -1052,7 +1052,7 @@ gpt_change_ent(gpt_t gpt, const struct g
|| find->size > 0 || !gpt_uuid_is_nil(find->type)))
return -1;
- if ((hdr = gpt_hdr(gpt)) == NULL)
+ if (gpt_hdr(gpt) == NULL)
return -1;
/* Relabel all matching entries in the map. */
Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.44 src/sbin/gpt/gpt.h:1.45
--- src/sbin/gpt/gpt.h:1.44 Sun Nov 20 06:57:02 2022
+++ src/sbin/gpt/gpt.h Sun Feb 23 15:47:19 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: gpt.h,v 1.44 2022/11/20 11:57:02 mlelstv Exp $ */
+/* $NetBSD: gpt.h,v 1.45 2025/02/23 20:47:19 christos Exp $ */
/*-
* Copyright (c) 2002 Marcel Moolenaar
@@ -139,4 +139,28 @@ int gpt_name_get(gpt_t, void *);
int gpt_add_hdr(gpt_t, int, off_t);
void gpt_show_num(const char *, uintmax_t);
+extern const struct gpt_cmd
+ c_add,
+#ifndef HAVE_NBTOOL_CONFIG_H
+ c_backup,
+#endif
+ c_biosboot,
+ c_create,
+ c_destroy,
+ c_header,
+ c_label,
+ c_migrate,
+ c_recover,
+ c_remove,
+ c_resize,
+ c_resizedisk,
+#ifndef HAVE_NBTOOL_CONFIG_H
+ c_restore,
+#endif
+ c_set,
+ c_show,
+ c_type,
+ c_unset,
+ c_uuid;
+
#endif /* _GPT_H_ */
Index: src/sbin/gpt/gpt_uuid.c
diff -u src/sbin/gpt/gpt_uuid.c:1.24 src/sbin/gpt/gpt_uuid.c:1.25
--- src/sbin/gpt/gpt_uuid.c:1.24 Wed Dec 18 15:56:40 2024
+++ src/sbin/gpt/gpt_uuid.c Sun Feb 23 15:47:19 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: gpt_uuid.c,v 1.24 2024/12/18 20:56:40 andvar Exp $ */
+/* $NetBSD: gpt_uuid.c,v 1.25 2025/02/23 20:47:19 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: gpt_uuid.c,v 1.24 2024/12/18 20:56:40 andvar Exp $");
+__RCSID("$NetBSD: gpt_uuid.c,v 1.25 2025/02/23 20:47:19 christos Exp $");
#endif
#include <err.h>
@@ -319,7 +319,7 @@ out:
* passed as input.
*/
static int
-gpt_uuid_tstamp(gpt_t gpt, struct dce_uuid *u, size_t l)
+gpt_uuid_tstamp(gpt_t gpt, struct dce_uuid *u, size_t l __unused)
{
uint64_t x;
@@ -338,7 +338,7 @@ gpt_uuid_tstamp(gpt_t gpt, struct dce_uu
x += gpt->uuidgen++;
/* Set UUID fields for version 1 */
- u->time_low = x & 0xffffffff;
+ u->time_low = x & UINT64_C(0xffffffff);
u->time_mid = (x >> 32) & 0xffff;
u->time_hi_and_version = 0x1000 | ((x >> 48) & 0xfff);
@@ -372,7 +372,7 @@ gpt_uuid_generate(gpt_t gpt, gpt_uuid_t
return -1;
/* Fix the reserved bits. */
- u.clock_seq_hi_and_reserved &= (uint8_t)~0x40;
+ u.clock_seq_hi_and_reserved &= (uint8_t)~0x40U;
u.clock_seq_hi_and_reserved |= 0x80;
gpt_dce_to_uuid(&u, t);
Index: src/sbin/gpt/header.c
diff -u src/sbin/gpt/header.c:1.10 src/sbin/gpt/header.c:1.11
--- src/sbin/gpt/header.c:1.10 Thu Mar 14 06:26:10 2019
+++ src/sbin/gpt/header.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: header.c,v 1.10 2019/03/14 10:26:10 mlelstv Exp $");
+__RCSID("$NetBSD: header.c,v 1.11 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -55,7 +55,7 @@ static const char *headerhelp[] = {
"",
};
-struct gpt_cmd c_header = {
+const struct gpt_cmd c_header = {
"header",
cmd_header,
headerhelp, __arraycount(headerhelp),
@@ -99,7 +99,7 @@ header(gpt_t gpt)
}
static int
-cmd_header(gpt_t gpt, int argc, char *argv[])
+cmd_header(gpt_t gpt, int argc, char *argv[] __unused)
{
if (argc != optind)
return usage();
Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.30 src/sbin/gpt/label.c:1.31
--- src/sbin/gpt/label.c:1.30 Thu Jun 20 22:14:59 2019
+++ src/sbin/gpt/label.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.30 2019/06/21 02:14:59 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.31 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -58,7 +58,7 @@ static const char *labelhelp[] = {
"<-l label | -f file>",
};
-struct gpt_cmd c_label = {
+const struct gpt_cmd c_label = {
"label",
cmd_label,
labelhelp, __arraycount(labelhelp),
@@ -68,7 +68,7 @@ struct gpt_cmd c_label = {
#define usage() gpt_usage(NULL, &c_label)
static void
-change(struct gpt_ent *ent, void *v, int backup)
+change(struct gpt_ent *ent, void *v, int backup __unused)
{
uint8_t *name = v;
utf8_to_utf16(name, ent->ent_name, __arraycount(ent->ent_name));
@@ -141,10 +141,17 @@ cmd_label(gpt_t gpt, int argc, char *arg
if (gpt_name_get(gpt, &name) == -1)
goto usage;
break;
- default:
+ case 'L':
+ case 'a':
+ case 'b':
+ case 'i':
+ case 's':
+ case 't':
if (gpt_add_find(gpt, &find, ch) == -1)
goto usage;
break;
+ default:
+ goto usage;
}
}
Index: src/sbin/gpt/migrate.c
diff -u src/sbin/gpt/migrate.c:1.35 src/sbin/gpt/migrate.c:1.36
--- src/sbin/gpt/migrate.c:1.35 Sat Mar 2 21:28:14 2019
+++ src/sbin/gpt/migrate.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.35 2019/03/03 02:28:14 jnemeth Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.36 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -84,7 +84,7 @@ static const char *migratehelp[] = {
"[-Afs] [-p partitions]",
};
-struct gpt_cmd c_migrate = {
+const struct gpt_cmd c_migrate = {
"migrate",
cmd_migrate,
migratehelp, __arraycount(migratehelp),
@@ -119,7 +119,7 @@ mbrptypename(u_int t)
}
static gpt_type_t
-freebsd_fstype_to_gpt_type(gpt_t gpt, u_int i, u_int fstype)
+freebsd_fstype_to_gpt_type(gpt_t gpt, u_int i __unused, u_int fstype)
{
switch (fstype) {
case FS_UNUSED:
Index: src/sbin/gpt/recover.c
diff -u src/sbin/gpt/recover.c:1.19 src/sbin/gpt/recover.c:1.20
--- src/sbin/gpt/recover.c:1.19 Sun Dec 13 16:55:25 2020
+++ src/sbin/gpt/recover.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: recover.c,v 1.19 2020/12/13 21:55:25 jnemeth Exp $");
+__RCSID("$NetBSD: recover.c,v 1.20 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -55,7 +55,7 @@ static const char *recoverhelp[] = {
"",
};
-struct gpt_cmd c_recover = {
+const struct gpt_cmd c_recover = {
"recover",
cmd_recover,
recoverhelp, __arraycount(recoverhelp),
@@ -236,6 +236,7 @@ cmd_recover(gpt_t gpt, int argc, char *a
while ((ch = getopt(argc, argv, "r")) != -1) {
switch(ch) {
+ case 'r':
default:
return usage();
}
Index: src/sbin/gpt/resize.c
diff -u src/sbin/gpt/resize.c:1.25 src/sbin/gpt/resize.c:1.26
--- src/sbin/gpt/resize.c:1.25 Sun May 24 10:42:44 2020
+++ src/sbin/gpt/resize.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: resize.c,v 1.25 2020/05/24 14:42:44 jmcneill Exp $");
+__RCSID("$NetBSD: resize.c,v 1.26 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -56,7 +56,7 @@ static const char *resizehelp[] = {
"[-i index | -b blocknr] [-a alignment] [-s size] [-q]",
};
-struct gpt_cmd c_resize = {
+const struct gpt_cmd c_resize = {
"resize",
cmd_resize,
resizehelp, __arraycount(resizehelp),
@@ -66,17 +66,17 @@ struct gpt_cmd c_resize = {
#define usage() gpt_usage(NULL, &c_resize)
static int
-resize(gpt_t gpt, u_int entry, off_t alignment, off_t sectors, off_t size, bool quiet)
+resize(gpt_t gpt, u_int entry, off_t alignment, off_t sectors,
+ off_t size __unused, bool quiet)
{
map_t map;
- struct gpt_hdr *hdr;
struct gpt_ent *ent;
unsigned int i;
off_t alignsecs, newsize, oldsize;
uint64_t end;
- if ((hdr = gpt_hdr(gpt)) == NULL)
+ if (gpt_hdr(gpt) == NULL)
return -1;
i = entry - 1;
Index: src/sbin/gpt/resizedisk.c
diff -u src/sbin/gpt/resizedisk.c:1.21 src/sbin/gpt/resizedisk.c:1.22
--- src/sbin/gpt/resizedisk.c:1.21 Tue Feb 6 15:25:11 2024
+++ src/sbin/gpt/resizedisk.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: resizedisk.c,v 1.21 2024/02/06 20:25:11 christos Exp $");
+__RCSID("$NetBSD: resizedisk.c,v 1.22 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/bootblock.h>
@@ -58,7 +58,7 @@ static const char *resizediskhelp[] = {
"[-s size] [-q]",
};
-struct gpt_cmd c_resizedisk = {
+const struct gpt_cmd c_resizedisk = {
"resizedisk",
cmd_resizedisk,
resizediskhelp, __arraycount(resizediskhelp),
@@ -79,7 +79,7 @@ struct gpt_cmd c_resizedisk = {
* - when shrinking, verify that table fits
*/
static int
-resizedisk(gpt_t gpt, off_t sector, off_t size, bool quiet)
+resizedisk(gpt_t gpt, off_t sector, off_t size __unused, bool quiet)
{
map_t mbrmap;
struct gpt_hdr *hdr;
@@ -222,7 +222,7 @@ resizedisk(gpt_t gpt, off_t sector, off_
mbr->mbr_part[0].part_size_hi = htole16(0xffff);
} else {
mbr->mbr_part[0].part_size_lo = htole16((uint16_t)last);
- mbr->mbr_part[0].part_size_hi = htole16((uint16_t)(last >> 16));
+ mbr->mbr_part[0].part_size_hi = htole16((uint16_t)((uint64_t)last >> 16));
}
if (gpt_write(gpt, mbrmap) == -1) {
gpt_warnx(gpt, "Error writing PMBR");
Index: src/sbin/gpt/set.c
diff -u src/sbin/gpt/set.c:1.15 src/sbin/gpt/set.c:1.16
--- src/sbin/gpt/set.c:1.15 Mon Mar 25 16:15:49 2019
+++ src/sbin/gpt/set.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: set.c,v 1.15 2019/03/25 20:15:49 martin Exp $");
+__RCSID("$NetBSD: set.c,v 1.16 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -57,7 +57,7 @@ static const char *sethelp[] = {
"-l",
};
-struct gpt_cmd c_set = {
+const struct gpt_cmd c_set = {
"set",
cmd_set,
sethelp, __arraycount(sethelp),
Index: src/sbin/gpt/unset.c
diff -u src/sbin/gpt/unset.c:1.15 src/sbin/gpt/unset.c:1.16
--- src/sbin/gpt/unset.c:1.15 Tue Mar 26 10:55:02 2019
+++ src/sbin/gpt/unset.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: unset.c,v 1.15 2019/03/26 14:55:02 martin Exp $");
+__RCSID("$NetBSD: unset.c,v 1.16 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -57,7 +57,7 @@ static const char *unsethelp[] = {
"-l",
};
-struct gpt_cmd c_unset = {
+const struct gpt_cmd c_unset = {
"unset",
cmd_unset,
unsethelp, __arraycount(unsethelp),
Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.46 src/sbin/gpt/show.c:1.47
--- src/sbin/gpt/show.c:1.46 Mon Nov 4 13:36:16 2024
+++ src/sbin/gpt/show.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.46 2024/11/04 18:36:16 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.47 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/bootblock.h>
@@ -63,7 +63,7 @@ static const char *showhelp[] = {
#define SHOW_ALL 8
#define SHOW_HEX 16
-struct gpt_cmd c_show = {
+const struct gpt_cmd c_show = {
"show",
cmd_show,
showhelp, __arraycount(showhelp),
Index: src/sbin/gpt/type.c
diff -u src/sbin/gpt/type.c:1.16 src/sbin/gpt/type.c:1.17
--- src/sbin/gpt/type.c:1.16 Thu Jun 20 22:14:59 2019
+++ src/sbin/gpt/type.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: type.c,v 1.16 2019/06/21 02:14:59 jnemeth Exp $");
+__RCSID("$NetBSD: type.c,v 1.17 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -57,7 +57,7 @@ static const char *typehelp[] = {
"-l",
};
-struct gpt_cmd c_type = {
+const struct gpt_cmd c_type = {
"type",
cmd_type,
typehelp, __arraycount(typehelp),
@@ -67,7 +67,7 @@ struct gpt_cmd c_type = {
#define usage() gpt_usage(NULL, &c_type)
static void
-change(struct gpt_ent *ent, void *v, int backup)
+change(struct gpt_ent *ent, void *v, int backup __unused)
{
gpt_uuid_t *newtype = v;
gpt_uuid_copy(ent->ent_type, *newtype);
@@ -94,10 +94,17 @@ cmd_type(gpt_t gpt, int argc, char *argv
if (gpt == NULL || gpt_uuid_get(gpt, &newtype) == -1)
return -1;
break;
- default:
+ case 'L':
+ case 'a':
+ case 'b':
+ case 'i':
+ case 's':
+ case 't':
if (gpt == NULL || gpt_add_find(gpt, &find, ch) == -1)
return usage();
break;
+ default:
+ return usage();
}
}
Index: src/sbin/gpt/uuid.c
diff -u src/sbin/gpt/uuid.c:1.3 src/sbin/gpt/uuid.c:1.4
--- src/sbin/gpt/uuid.c:1.3 Sun Oct 20 04:21:30 2024
+++ src/sbin/gpt/uuid.c Sun Feb 23 15:47:19 2025
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: uuid.c,v 1.3 2024/10/20 08:21:30 mlelstv Exp $");
+__RCSID("$NetBSD: uuid.c,v 1.4 2025/02/23 20:47:19 christos Exp $");
#endif
#include <sys/types.h>
@@ -56,7 +56,7 @@ static const char *uuidhelp[] = {
"[-b blocknr] [-i index] [-L label] [-s sectors] [-t type] [-U newuuid]",
};
-struct gpt_cmd c_uuid = {
+const struct gpt_cmd c_uuid = {
"uuid",
cmd_uuid,
uuidhelp, __arraycount(uuidhelp),
@@ -120,10 +120,17 @@ cmd_uuid(gpt_t gpt, int argc, char *argv
return usage();
ctx.uuid = &new_uuid;
break;
- default:
+ case 'L':
+ case 'a':
+ case 'b':
+ case 'i':
+ case 's':
+ case 't':
if (gpt_add_find(gpt, &find, ch) == -1)
return usage();
break;
+ default:
+ return usage();
}
}