Signed-off-by: Karel Zak <kzak@redhat.com>
/**
* fdisk_is_labeltype:
* @cxt: fdisk context
- * @l: disklabel type
+ * @l: FDISK_DISKLABEL_*
*
* See also fdisk_is_label() macro in libfdisk.h.
- *
- * Returns: return 1 if there is @l disklabel on the device.
+ *
+ * Returns: return 1 if the current label is @l
*/
int fdisk_is_labeltype(struct fdisk_context *cxt, enum fdisk_labeltype l)
{
- return cxt && cxt->label && cxt->label->id == l;
+ return cxt && fdisk_label_is_labeltype(cxt->label, l);
}
static void reset_context(struct fdisk_context *cxt)
return lb ? lb->name : NULL;
}
+/**
+ * fdisk_label_is_labeltype:
+ * @lb: label
+ * @id: FDISK_DISKLABEL_*
+ *
+ * Returns: 1 if the label type matches with id.
+ */
+int fdisk_label_is_labeltype(struct fdisk_label *lb, enum fdisk_labeltype id)
+{
+ return lb && lb->id == id;
+}
+
/**
* fdisk_label_require_geometry:
* @lb: label
FDISK_FIELD_UUID,
};
+int fdisk_label_is_labeltype(struct fdisk_label *lb, enum fdisk_labeltype id);
const char *fdisk_label_get_name(struct fdisk_label *lb);
int fdisk_label_require_geometry(struct fdisk_label *lb);