Module Name:    src
Committed By:   jnemeth
Date:           Fri Jun 21 02:14:59 UTC 2019

Modified Files:
        src/sbin/gpt: gpt.c gpt.h label.c remove.c type.c

Log Message:
Add a third argument to the "cfn" function that is an argument to
gpt_change_ent().  The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry.  It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.38 -r1.39 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.29 -r1.30 src/sbin/gpt/label.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/remove.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/gpt/type.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/gpt.c
diff -u src/sbin/gpt/gpt.c:1.78 src/sbin/gpt/gpt.c:1.79
--- src/sbin/gpt/gpt.c:1.78	Thu Jun 20 10:41:58 2019
+++ src/sbin/gpt/gpt.c	Fri Jun 21 02:14:59 2019
@@ -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.78 2019/06/20 10:41:58 martin Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.79 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1015,7 +1015,7 @@ gpt_add_find(gpt_t gpt, struct gpt_find 
 
 int
 gpt_change_ent(gpt_t gpt, const struct gpt_find *find,
-    void (*cfn)(struct gpt_ent *, void *), void *v)
+    void (*cfn)(struct gpt_ent *, void *, int), void *v)
 {
 	map_t m;
 	struct gpt_hdr *hdr;
@@ -1058,14 +1058,14 @@ gpt_change_ent(gpt_t gpt, const struct g
 			continue;
 
 		/* Change the primary entry. */
-		(*cfn)(ent, v);
+		(*cfn)(ent, v, 0);
 
 		if (gpt_write_primary(gpt) == -1)
 			return -1;
 
 		ent = gpt_ent_backup(gpt, i);
 		/* Change the secondary entry. */
-		(*cfn)(ent, v);
+		(*cfn)(ent, v, 1);
 
 		if (gpt_write_backup(gpt) == -1)
 			return -1;

Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.38 src/sbin/gpt/gpt.h:1.39
--- src/sbin/gpt/gpt.h:1.38	Tue Jul  3 03:41:23 2018
+++ src/sbin/gpt/gpt.h	Fri Jun 21 02:14:59 2019
@@ -115,7 +115,7 @@ struct gpt_find {
 	const char *msg;
 };
 int	gpt_change_ent(gpt_t, const struct gpt_find *,
-    void (*)(struct gpt_ent *, void *), void *);
+    void (*)(struct gpt_ent *, void *, int), void *);
 int	gpt_add_find(gpt_t, struct gpt_find *, int);
 
 #define GPT_AIS "a:i:s:"

Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.29 src/sbin/gpt/label.c:1.30
--- src/sbin/gpt/label.c:1.29	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/label.c	Fri Jun 21 02:14:59 2019
@@ -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.29 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.30 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -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)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	uint8_t *name = v;
 	utf8_to_utf16(name, ent->ent_name, __arraycount(ent->ent_name));

Index: src/sbin/gpt/remove.c
diff -u src/sbin/gpt/remove.c:1.22 src/sbin/gpt/remove.c:1.23
--- src/sbin/gpt/remove.c:1.22	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/remove.c	Fri Jun 21 02:14:59 2019
@@ -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.22 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.23 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -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)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	/* Remove the primary entry by clearing the partition type. */
 	gpt_uuid_copy(ent->ent_type, gpt_uuid_nil);

Index: src/sbin/gpt/type.c
diff -u src/sbin/gpt/type.c:1.15 src/sbin/gpt/type.c:1.16
--- src/sbin/gpt/type.c:1.15	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/type.c	Fri Jun 21 02:14:59 2019
@@ -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.15 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: type.c,v 1.16 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -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)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	gpt_uuid_t *newtype = v;
 	gpt_uuid_copy(ent->ent_type, *newtype);

Reply via email to