Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt Add a third argument to the "cfn" function that is ...



details:   https://anonhg.NetBSD.org/src/rev/5632ea631047
branches:  trunk
changeset: 452186:5632ea631047
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Fri Jun 21 02:14:59 2019 +0000

description:
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.

diffstat:

 sbin/gpt/gpt.c    |  8 ++++----
 sbin/gpt/gpt.h    |  2 +-
 sbin/gpt/label.c  |  4 ++--
 sbin/gpt/remove.c |  4 ++--
 sbin/gpt/type.c   |  4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diffs (113 lines):

diff -r 23a5ea83cdda -r 5632ea631047 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Fri Jun 21 02:08:55 2019 +0000
+++ b/sbin/gpt/gpt.c    Fri Jun 21 02:14:59 2019 +0000
@@ -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 @@
 
 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 @@
                        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;
diff -r 23a5ea83cdda -r 5632ea631047 sbin/gpt/gpt.h
--- a/sbin/gpt/gpt.h    Fri Jun 21 02:08:55 2019 +0000
+++ b/sbin/gpt/gpt.h    Fri Jun 21 02:14:59 2019 +0000
@@ -115,7 +115,7 @@
        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:"
diff -r 23a5ea83cdda -r 5632ea631047 sbin/gpt/label.c
--- a/sbin/gpt/label.c  Fri Jun 21 02:08:55 2019 +0000
+++ b/sbin/gpt/label.c  Fri Jun 21 02:14:59 2019 +0000
@@ -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 @@
 #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));
diff -r 23a5ea83cdda -r 5632ea631047 sbin/gpt/remove.c
--- a/sbin/gpt/remove.c Fri Jun 21 02:08:55 2019 +0000
+++ b/sbin/gpt/remove.c Fri Jun 21 02:14:59 2019 +0000
@@ -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 @@
 #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);
diff -r 23a5ea83cdda -r 5632ea631047 sbin/gpt/type.c
--- a/sbin/gpt/type.c   Fri Jun 21 02:08:55 2019 +0000
+++ b/sbin/gpt/type.c   Fri Jun 21 02:14:59 2019 +0000
@@ -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 @@
 #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);



Home | Main Index | Thread Index | Old Index