Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Slightly improved error handling when conve...



details:   https://anonhg.NetBSD.org/src/rev/12cececd77c4
branches:  trunk
changeset: 366746:12cececd77c4
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jun 11 18:30:02 2022 +0000

description:
Slightly improved error handling when converion from one partition table
format to another is not lossless.

diffstat:

 usr.sbin/sysinst/disks.c   |  25 ++++++++++++++++---------
 usr.sbin/sysinst/msg.mi.de |   4 +++-
 usr.sbin/sysinst/msg.mi.en |   4 +++-
 usr.sbin/sysinst/msg.mi.es |   4 +++-
 usr.sbin/sysinst/msg.mi.fr |   4 +++-
 usr.sbin/sysinst/msg.mi.pl |   4 +++-
 6 files changed, 31 insertions(+), 14 deletions(-)

diffs (156 lines):

diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/disks.c  Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.82 2022/06/09 18:26:06 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.83 2022/06/11 18:30:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -779,12 +779,13 @@
 }
 
 
-static void
+static bool
 convert_copy(struct disk_partitions *old_parts,
     struct disk_partitions *new_parts)
 {
        struct disk_part_info oinfo, ninfo;
        part_id i;
+       bool err = false;
 
        for (i = 0; i < old_parts->num_part; i++) {
                if (!old_parts->pscheme->get_part_info(old_parts, i, &oinfo))
@@ -799,17 +800,23 @@
                                        old_parts->pscheme->
                                            secondary_partitions(
                                            old_parts, oinfo.start, false);
-                               if (sec_part)
-                                       convert_copy(sec_part, new_parts);
+                               if (sec_part && !convert_copy(sec_part,
+                                   new_parts))
+                                       err = true;
                        }
                        continue;
                }
 
                if (!new_parts->pscheme->adapt_foreign_part_info(new_parts,
-                           &ninfo, old_parts->pscheme, &oinfo))
+                           &ninfo, old_parts->pscheme, &oinfo)) {
+                       err = true;
                        continue;
-               new_parts->pscheme->add_partition(new_parts, &ninfo, NULL);
+               }
+               if (!new_parts->pscheme->add_partition(new_parts, &ninfo,
+                   NULL))
+                       err = true;
        }
+       return !err;
 }
 
 bool
@@ -838,10 +845,10 @@
                return false;
        }
 
-       convert_copy(old_parts, new_parts);
-
-       if (new_parts->num_part == 0 && old_parts->num_part != 0) {
+       if (!convert_copy(old_parts, new_parts)) {
                /* need to cleanup */
+               if (err_msg)
+                       *err_msg = MSG_cvtscheme_error;
                new_parts->pscheme->free(new_parts);
                return false;
        }
diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/msg.mi.de
--- a/usr.sbin/sysinst/msg.mi.de        Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.de        Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.de,v 1.39 2022/06/09 18:26:06 martin Exp $      */
+/*     $NetBSD: msg.mi.de,v 1.40 2022/06/11 18:30:02 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -305,6 +305,8 @@
 message cvtscheme_delete       {löschen (alle Daten gehen verloren!)}
 message cvtscheme_convert      {in ein anderes Schema konvertieren}
 message cvtscheme_abort                {abbrechen}
+message cvtscheme_error
+{Nicht alle Partitionen konnten übernommen werden}
 
 /* Called with:                                Example
  *  $0 = device name                   wd0
diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/msg.mi.en
--- a/usr.sbin/sysinst/msg.mi.en        Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.en        Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.42 2022/06/09 18:26:06 martin Exp $      */
+/*     $NetBSD: msg.mi.en,v 1.43 2022/06/11 18:30:02 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -292,6 +292,8 @@
 message cvtscheme_delete       {delete (all data will be lost!)}
 message cvtscheme_convert      {convert to another partitioning method}
 message cvtscheme_abort                {abort}
+message cvtscheme_error
+{Could not convert all partitions}
 
 /* Called with:                                Example
  *  $0 = device name                   wd0
diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/msg.mi.es
--- a/usr.sbin/sysinst/msg.mi.es        Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.es        Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.es,v 1.35 2022/06/09 18:26:06 martin Exp $      */
+/*     $NetBSD: msg.mi.es,v 1.36 2022/06/11 18:30:02 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -299,6 +299,8 @@
 message cvtscheme_delete       {delete (all data will be lost!)}
 message cvtscheme_convert      {convert to another partitioning method}
 message cvtscheme_abort                {abort}
+message cvtscheme_error
+{Could not convert all partitions}
 
 /* Called with:                                Example
  *  $0 = device name                   wd0
diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/msg.mi.fr
--- a/usr.sbin/sysinst/msg.mi.fr        Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.fr        Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.fr,v 1.40 2022/06/09 18:26:06 martin Exp $      */
+/*     $NetBSD: msg.mi.fr,v 1.41 2022/06/11 18:30:02 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -303,6 +303,8 @@
 message cvtscheme_delete       {delete (all data will be lost!)}
 message cvtscheme_convert      {convert to another partitioning method}
 message cvtscheme_abort                {abort}
+message cvtscheme_error
+{Could not convert all partitions}
 
 /* Called with:                                Example
  *  $0 = device name                   wd0
diff -r 97fd471a91d0 -r 12cececd77c4 usr.sbin/sysinst/msg.mi.pl
--- a/usr.sbin/sysinst/msg.mi.pl        Sat Jun 11 18:27:22 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.pl        Sat Jun 11 18:30:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.pl,v 1.41 2022/06/09 18:26:06 martin Exp $      */
+/*     $NetBSD: msg.mi.pl,v 1.42 2022/06/11 18:30:02 martin Exp $      */
 /*     Based on english version: */
 /*     NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp       */
 
@@ -286,6 +286,8 @@
 message cvtscheme_delete       {skasuj (wszystkie dane beda utracone!)}
 message cvtscheme_convert      {uzyj innego typu tablicy partycji}
 message cvtscheme_abort                {anuluj}
+message cvtscheme_error
+{Could not convert all partitions}
 
 /* Called with:                                Example
  *  $0 = device name                   wd0



Home | Main Index | Thread Index | Old Index