fdisk: cleanup warning messages
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
c10937dcaf
commit
4f79f8872b
|
@ -149,16 +149,6 @@ void list_partition_types(struct fdisk_context *cxt)
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
int warn_geometry(struct fdisk_context *cxt)
|
||||
{
|
||||
if (fdisk_missing_geometry(cxt)) {
|
||||
fdisk_warnx(cxt, _("Incomplete geometry setting. You can do "
|
||||
"this from the extra functions menu."));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void toggle_dos_compatibility_flag(struct fdisk_context *cxt)
|
||||
{
|
||||
struct fdisk_label *lb = fdisk_context_get_label(cxt, "dos");
|
||||
|
|
|
@ -145,24 +145,6 @@ static int is_cleared_partition(struct dos_partition *p)
|
|||
dos_partition_get_start(p) || dos_partition_get_size(p));
|
||||
}
|
||||
|
||||
static void warn_alignment(struct fdisk_context *cxt)
|
||||
{
|
||||
if (fdisk_context_listonly(cxt))
|
||||
return;
|
||||
|
||||
if (cxt->sector_size != cxt->phy_sector_size)
|
||||
fdisk_info(cxt, _(
|
||||
"The device presents a logical sector size that is smaller than "
|
||||
"the physical sector size. Aligning to a physical sector (or optimal "
|
||||
"I/O) size boundary is recommended, or performance may be impacted."));
|
||||
|
||||
if (is_dos_compatible(cxt))
|
||||
fdisk_warnx(cxt, _("DOS-compatible mode is deprecated."));
|
||||
|
||||
if (fdisk_context_use_cylinders(cxt))
|
||||
fdisk_warnx(cxt, _("Cylinders as display units are deprecated."));
|
||||
|
||||
}
|
||||
|
||||
static int get_partition_unused_primary(struct fdisk_context *cxt)
|
||||
{
|
||||
|
@ -266,10 +248,28 @@ static void dos_init(struct fdisk_context *cxt)
|
|||
pe->changed = 0;
|
||||
}
|
||||
|
||||
warn_geometry(cxt);
|
||||
warn_alignment(cxt);
|
||||
if (fdisk_context_listonly(cxt))
|
||||
return;
|
||||
/*
|
||||
* Various warnings...
|
||||
*/
|
||||
if (fdisk_missing_geometry(cxt))
|
||||
fdisk_warnx(cxt, _("You can set geometry from the extra functions menu."));
|
||||
|
||||
if (cxt->total_sectors > UINT_MAX && !fdisk_context_listonly(cxt)) {
|
||||
if (is_dos_compatible(cxt)) {
|
||||
fdisk_warnx(cxt, _("DOS-compatible mode is deprecated."));
|
||||
|
||||
if (cxt->sector_size != cxt->phy_sector_size)
|
||||
fdisk_info(cxt, _(
|
||||
"The device presents a logical sector size that is smaller than "
|
||||
"the physical sector size. Aligning to a physical sector (or optimal "
|
||||
"I/O) size boundary is recommended, or performance may be impacted."));
|
||||
}
|
||||
|
||||
if (fdisk_context_use_cylinders(cxt))
|
||||
fdisk_warnx(cxt, _("Cylinders as display units are deprecated."));
|
||||
|
||||
if (cxt->total_sectors > UINT_MAX) {
|
||||
unsigned long long bytes = cxt->total_sectors * cxt->sector_size;
|
||||
int giga = bytes / 1000000000;
|
||||
int hectogiga = (giga + 50) / 100;
|
||||
|
|
|
@ -90,12 +90,19 @@ int fdisk_require_geometry(struct fdisk_context *cxt)
|
|||
|
||||
int fdisk_missing_geometry(struct fdisk_context *cxt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
assert(cxt);
|
||||
assert(cxt->label);
|
||||
|
||||
return (fdisk_require_geometry(cxt) &&
|
||||
rc = (fdisk_require_geometry(cxt) &&
|
||||
(!cxt->geom.heads || !cxt->geom.sectors
|
||||
|| !cxt->geom.cylinders));
|
||||
|
||||
if (rc && !fdisk_context_listonly(cxt))
|
||||
fdisk_warnx(cxt, _("Incomplete geometry setting."));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue