Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Add a method to query the partitioning sche...



details:   https://anonhg.NetBSD.org/src/rev/30504706cbdb
branches:  trunk
changeset: 968416:30504706cbdb
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jan 15 19:36:30 2020 +0000

description:
Add a method to query the partitioning schemes "internal idea" of a
cylinder size - whatever that means in the real world.

diffstat:

 usr.sbin/sysinst/disklabel.c  |  12 +++++++++++-
 usr.sbin/sysinst/gpt.c        |   9 ++++++++-
 usr.sbin/sysinst/mbr.c        |  12 +++++++++++-
 usr.sbin/sysinst/partitions.h |   8 +++++++-
 4 files changed, 37 insertions(+), 4 deletions(-)

diffs (118 lines):

diff -r e0acfbb32a8d -r 30504706cbdb usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Wed Jan 15 19:08:24 2020 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Wed Jan 15 19:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.29 2020/01/10 10:47:35 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.30 2020/01/15 19:36:30 martin Exp $    */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -114,6 +114,15 @@
        return true;
 }
 
+static size_t
+disklabel_cylinder_size(const struct disk_partitions *arg)
+{
+       const struct disklabel_disk_partitions *parts =
+           (const struct disklabel_disk_partitions*)arg;
+
+       return parts->l.d_secpercyl;
+}
+
 static struct disk_partitions *
 disklabel_parts_new(const char *dev, daddr_t start, daddr_t len,
     daddr_t total_size, bool is_boot_drive, struct disk_partitions *parent)
@@ -1213,6 +1222,7 @@
        .read_from_disk = disklabel_parts_read,
        .create_new_for_disk = disklabel_parts_new,
        .change_disk_geom = disklabel_change_geom,
+       .get_cylinder_size = disklabel_cylinder_size,
        .find_by_name = disklabel_find_by_name,
        .get_disk_pack_name = disklabel_get_disk_pack_name,
        .set_disk_pack_name = disklabel_set_disk_pack_name,
diff -r e0acfbb32a8d -r 30504706cbdb usr.sbin/sysinst/gpt.c
--- a/usr.sbin/sysinst/gpt.c    Wed Jan 15 19:08:24 2020 +0000
+++ b/usr.sbin/sysinst/gpt.c    Wed Jan 15 19:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpt.c,v 1.14 2020/01/09 13:22:30 martin Exp $  */
+/*     $NetBSD: gpt.c,v 1.15 2020/01/15 19:36:30 martin Exp $  */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -439,6 +439,12 @@
        return &parts->dp;
 }
 
+static size_t
+gpt_cyl_size(const struct disk_partitions *arg)
+{
+       return MEG / 512;
+}
+
 static struct disk_partitions *
 gpt_create_new(const char *disk, daddr_t start, daddr_t len, daddr_t total,
     bool is_boot_drive, struct disk_partitions *parent)
@@ -1777,6 +1783,7 @@
        .create_unknown_part_type = gpt_create_unknown_part_type,
        .get_part_alignment = gpt_get_part_alignment,
        .read_from_disk = gpt_read_from_disk,
+       .get_cylinder_size = gpt_cyl_size,
        .create_new_for_disk = gpt_create_new,
        .have_boot_support = gpt_have_boot_support,
        .find_by_name = gpt_find_by_name,
diff -r e0acfbb32a8d -r 30504706cbdb usr.sbin/sysinst/mbr.c
--- a/usr.sbin/sysinst/mbr.c    Wed Jan 15 19:08:24 2020 +0000
+++ b/usr.sbin/sysinst/mbr.c    Wed Jan 15 19:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.26 2020/01/14 19:28:31 martin Exp $ */
+/*     $NetBSD: mbr.c,v 1.27 2020/01/15 19:36:30 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -2409,6 +2409,15 @@
        return 0;
 }
 
+static size_t
+mbr_get_cylinder(const struct disk_partitions *arg)
+{
+       const struct mbr_disk_partitions *parts =
+           (const struct mbr_disk_partitions*)arg;
+
+       return parts->geo_cyl;
+}
+
 static daddr_t
 mbr_max_part_size(const struct disk_partitions *arg, daddr_t fp_start)
 {
@@ -3026,6 +3035,7 @@
        .read_from_disk = mbr_read_from_disk,
        .create_new_for_disk = mbr_create_new,
        .guess_disk_geom = mbr_guess_geom,
+       .get_cylinder_size = mbr_get_cylinder,
        .change_disk_geom = mbr_change_disk_geom,
        .get_part_device = mbr_get_part_device,
        .max_free_space_at = mbr_max_part_size,
diff -r e0acfbb32a8d -r 30504706cbdb usr.sbin/sysinst/partitions.h
--- a/usr.sbin/sysinst/partitions.h     Wed Jan 15 19:08:24 2020 +0000
+++ b/usr.sbin/sysinst/partitions.h     Wed Jan 15 19:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partitions.h,v 1.13 2020/01/09 13:22:30 martin Exp $   */
+/*     $NetBSD: partitions.h,v 1.14 2020/01/15 19:36:30 martin Exp $   */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -457,6 +457,12 @@
            int *cyl, int *head, int *sec);
 
        /*
+        * Return a "cylinder size" (in number of blocks) - whatever that
+        * means to a particular partitioning scheme.
+        */
+       size_t (*get_cylinder_size)(const struct disk_partitions *);
+
+       /*
         * Optional: change used geometry info and update internal state
         */
        bool (*change_disk_geom)(struct disk_partitions *,



Home | Main Index | Thread Index | Old Index