diff options
author | Karel Zak | 2014-08-14 00:09:48 +0200 |
---|---|---|
committer | Karel Zak | 2014-08-14 00:09:48 +0200 |
commit | 72d2965c4470b2c740c409db37ed0369bbea98ee (patch) | |
tree | 89eb051f20aab36349bd77c0515ae335e05b680a /libfdisk/src/context.c | |
parent | libfdisk: cleanup fdisk_is_label stuff (diff) | |
download | kernel-qcow2-util-linux-72d2965c4470b2c740c409db37ed0369bbea98ee.tar.gz kernel-qcow2-util-linux-72d2965c4470b2c740c409db37ed0369bbea98ee.tar.xz kernel-qcow2-util-linux-72d2965c4470b2c740c409db37ed0369bbea98ee.zip |
libfdisk: cleanup label geometry API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r-- | libfdisk/src/context.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index 03f358639..c6e99eef4 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -690,4 +690,22 @@ const char *fdisk_get_devname(struct fdisk_context *cxt) } +int fdisk_missing_geometry(struct fdisk_context *cxt) +{ + int rc; + + assert(cxt); + + if (!cxt || !cxt->label) + return 0; + + rc = (fdisk_label_require_geometry(cxt->label) && + (!cxt->geom.heads || !cxt->geom.sectors + || !cxt->geom.cylinders)); + + if (rc && !fdisk_is_listonly(cxt)) + fdisk_warnx(cxt, _("Incomplete geometry setting.")); + + return rc; +} |