fdisk: move reorder diag messages to fdisk_reorder_partitions()
The function fdisk_reorder_partitions() is also used in sfdisk and cfdisk and these commands assume info/warn messages from the library. So move all messages from fdisk to fdisk_reorder_partitions(). Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
This commit is contained in:
parent
b948bbf991
commit
f05a5bb2c2
|
@ -636,17 +636,6 @@ static int generic_menu_cb(struct fdisk_context **cxt0,
|
|||
break;
|
||||
case 'f':
|
||||
rc = fdisk_reorder_partitions(cxt);
|
||||
switch (rc) {
|
||||
default:
|
||||
fdisk_warnx(cxt, _("Failed to fix partitions order."));
|
||||
break;
|
||||
case 0:
|
||||
fdisk_info(cxt, _("Partitions order fixed."));
|
||||
break;
|
||||
case 1:
|
||||
fdisk_info(cxt, _("Nothing to do. Ordering is correct already."));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
rc = fdisk_enable_details(cxt, 0);
|
||||
|
|
|
@ -583,12 +583,28 @@ int fdisk_toggle_partition_flag(struct fdisk_context *cxt,
|
|||
*/
|
||||
int fdisk_reorder_partitions(struct fdisk_context *cxt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!cxt || !cxt->label)
|
||||
return -EINVAL;
|
||||
if (!cxt->label->op->reorder)
|
||||
return -ENOSYS;
|
||||
|
||||
return cxt->label->op->reorder(cxt);
|
||||
rc = cxt->label->op->reorder(cxt);
|
||||
|
||||
switch (rc) {
|
||||
case 0:
|
||||
fdisk_info(cxt, _("Partitions order fixed."));
|
||||
break;
|
||||
case 1:
|
||||
fdisk_info(cxt, _("Nothing to do. Ordering is correct already."));
|
||||
break;
|
||||
default:
|
||||
fdisk_warnx(cxt, _("Failed to fix partitions order."));
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue