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");
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)
{
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 (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 && !fdisk_context_listonly(cxt)) {
+ 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;
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;
}
/**