diff options
author | Davidlohr Bueso | 2012-06-03 20:15:34 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-06 10:41:51 +0200 |
commit | 6e89f25e8b386069be7f2021177a3b26ad148aa3 (patch) | |
tree | 6e8fbe3dce2d8aa1af2bb0604936e7e80cfbcdba /fdisk/utils.c | |
parent | fdisk: use EXIT_SUCCESS for -l option (diff) | |
download | kernel-qcow2-util-linux-6e89f25e8b386069be7f2021177a3b26ad148aa3.tar.gz kernel-qcow2-util-linux-6e89f25e8b386069be7f2021177a3b26ad148aa3.tar.xz kernel-qcow2-util-linux-6e89f25e8b386069be7f2021177a3b26ad148aa3.zip |
fdisk: add fdisk_dev_sectsz_is_default helper
Instead of printing this warning from the API, add a helper and call it from
fdisk logic.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisk/utils.c')
-rw-r--r-- | fdisk/utils.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fdisk/utils.c b/fdisk/utils.c index 3162c7054..94b8bd84e 100644 --- a/fdisk/utils.c +++ b/fdisk/utils.c @@ -80,14 +80,22 @@ static int __discover_topology(struct fdisk_context *cxt) cxt->sector_size = __get_sector_size(cxt->dev_fd); if (!cxt->phy_sector_size) /* could not discover physical size */ cxt->phy_sector_size = cxt->sector_size; - if (cxt->sector_size != DEFAULT_SECTOR_SIZE) - printf(_("Note: sector size is %ld (not %d)\n"), - cxt->sector_size, DEFAULT_SECTOR_SIZE); return 0; } /** + * fdisk_dev_sectsz_is_default: + * @cxt: fdisk context + * + * Returns 1 if the device's sector size is the default value, otherwise 0. + */ +int fdisk_dev_sectsz_is_default(struct fdisk_context *cxt) +{ + return cxt->sector_size == DEFAULT_SECTOR_SIZE; +} + +/** * fdisk_dev_has_topology: * @cxt: fdisk context * |