libfdisk: fdisk_label_is_labeltype()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
5175ae8738
commit
4af064f3fc
|
@ -252,15 +252,15 @@ int fdisk_has_label(struct fdisk_context *cxt)
|
||||||
/**
|
/**
|
||||||
* fdisk_is_labeltype:
|
* fdisk_is_labeltype:
|
||||||
* @cxt: fdisk context
|
* @cxt: fdisk context
|
||||||
* @l: disklabel type
|
* @l: FDISK_DISKLABEL_*
|
||||||
*
|
*
|
||||||
* See also fdisk_is_label() macro in libfdisk.h.
|
* 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)
|
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)
|
static void reset_context(struct fdisk_context *cxt)
|
||||||
|
|
|
@ -70,6 +70,18 @@ const char *fdisk_label_get_name(struct fdisk_label *lb)
|
||||||
return lb ? lb->name : NULL;
|
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:
|
* fdisk_label_require_geometry:
|
||||||
* @lb: label
|
* @lb: label
|
||||||
|
|
|
@ -169,6 +169,7 @@ enum {
|
||||||
FDISK_FIELD_UUID,
|
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);
|
const char *fdisk_label_get_name(struct fdisk_label *lb);
|
||||||
int fdisk_label_require_geometry(struct fdisk_label *lb);
|
int fdisk_label_require_geometry(struct fdisk_label *lb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue