summaryrefslogtreecommitdiffstats
path: root/fdisk/utils.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-06-03 20:15:34 +0200
committerKarel Zak2012-06-06 10:41:51 +0200
commit6e89f25e8b386069be7f2021177a3b26ad148aa3 (patch)
tree6e8fbe3dce2d8aa1af2bb0604936e7e80cfbcdba /fdisk/utils.c
parentfdisk: use EXIT_SUCCESS for -l option (diff)
downloadkernel-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.c14
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
*