If available, show additional names of foreign partitions in the
size menu. Makes installing on machines with other OSes installed a lot less confusing.
This commit is contained in:
parent
ed312f011f
commit
4c36c108f4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bsddisklabel.c,v 1.22 2019/07/28 16:03:00 martin Exp $ */
|
||||
/* $NetBSD: bsddisklabel.c,v 1.23 2019/07/28 16:30:36 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -319,8 +319,15 @@ draw_size_menu_line(menudesc *m, int opt, void *arg)
|
|||
} else if (pset->infos[opt].mount[0]) {
|
||||
mount = pset->infos[opt].mount;
|
||||
} else {
|
||||
mount = getfslabelname(pset->infos[opt].fs_type,
|
||||
pset->infos[opt].fs_version);
|
||||
mount = NULL;
|
||||
if (pset->infos[opt].parts->pscheme->other_partition_identifier
|
||||
&& pset->infos[opt].cur_part_id != NO_PART)
|
||||
mount = pset->infos[opt].parts->pscheme->
|
||||
other_partition_identifier(pset->infos[opt].parts,
|
||||
pset->infos[opt].cur_part_id);
|
||||
if (mount == NULL)
|
||||
mount = getfslabelname(pset->infos[opt].fs_type,
|
||||
pset->infos[opt].fs_version);
|
||||
mount = str_arg_subst(msg_string(MSG_size_ptn_not_mounted),
|
||||
1, &mount);
|
||||
free_mount = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gpt.c,v 1.5 2019/07/28 13:17:46 martin Exp $ */
|
||||
/* $NetBSD: gpt.c,v 1.6 2019/07/28 16:30:36 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -1423,6 +1423,26 @@ gpt_custom_attribute_writable(const struct disk_partitions *arg,
|
|||
return true;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gpt_get_label_str(const struct disk_partitions *arg, part_id ptn)
|
||||
{
|
||||
const struct gpt_disk_partitions *parts =
|
||||
(const struct gpt_disk_partitions*)arg;
|
||||
size_t i;
|
||||
struct gpt_part_entry *p;
|
||||
|
||||
for (i = 0, p = parts->partitions; p != NULL; i++, p = p->gp_next)
|
||||
if (i == ptn)
|
||||
break;
|
||||
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
if (p->gp_label[0] != 0)
|
||||
return p->gp_label;
|
||||
return p->gp_id;
|
||||
}
|
||||
|
||||
static bool
|
||||
gpt_format_custom_attribute(const struct disk_partitions *arg,
|
||||
part_id ptn, size_t attr_no, const struct disk_part_info *info,
|
||||
|
@ -1570,6 +1590,7 @@ gpt_parts = {
|
|||
.format_custom_attribute = gpt_format_custom_attribute,
|
||||
.custom_attribute_toggle = gpt_custom_attribute_toggle,
|
||||
.custom_attribute_set_str = gpt_custom_attribute_set_str,
|
||||
.other_partition_identifier = gpt_get_label_str,
|
||||
.get_part_device = gpt_get_part_device,
|
||||
.max_free_space_at = gpt_max_free_space_at,
|
||||
.get_free_spaces = gpt_get_free_spaces,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: partitions.h,v 1.3 2019/07/24 02:37:17 msaitoh Exp $ */
|
||||
/* $NetBSD: partitions.h,v 1.4 2019/07/28 16:30:36 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -292,6 +292,13 @@ struct disk_partitioning_scheme {
|
|||
bool (*custom_attribute_set_str)(struct disk_partitions*,
|
||||
part_id, size_t attr_no, const char *new_val);
|
||||
|
||||
/*
|
||||
* Optional: additional user information when showing the size
|
||||
* editor (especially for existing unknown partitions)
|
||||
*/
|
||||
const char * (*other_partition_identifier)(const struct
|
||||
disk_partitions*, part_id);
|
||||
|
||||
|
||||
/* Retrieve device and partition names, e.g. for checking
|
||||
* against kern.root_device or invoking newfs.
|
||||
|
|
Loading…
Reference in New Issue