aboutsummaryrefslogtreecommitdiffstats
path: root/disk-utils/cfdisk.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-08-14 12:01:38 +0200
committerKarel Zak <kzak@redhat.com>2014-08-14 12:01:38 +0200
commit5ab37600712d476156160ba7fe1b5d51e52b33cd (patch)
tree179314c95398b411a7ae3b4fd9ef4cdff3f4988f /disk-utils/cfdisk.c
parent773aae5c51e9573be5c66e14b4a33e4dde5f5f95 (diff)
downloadutil-linux-5ab37600712d476156160ba7fe1b5d51e52b33cd.tar.gz
libfdisk: move get_parttypes to label API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/cfdisk.c')
-rw-r--r--disk-utils/cfdisk.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index b86b609efb..e38052591b 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -1509,25 +1509,27 @@ static struct fdisk_parttype *ui_get_parttype(struct cfdisk *cf,
{
struct cfdisk_menuitem *d, *cm;
size_t i = 0, nitems, idx = 0;
- struct fdisk_parttype *t = NULL;
+ struct fdisk_parttype *types, *t = NULL;
+ struct fdisk_label *lb;
int has_typestr = 0;
DBG(UI, ul_debug("asking for parttype."));
+ lb = fdisk_get_label(cf->cxt, NULL);
+
/* create cfdisk menu according to label types, note that the
* last cm[] item has to be empty -- so nitems + 1 */
- nitems = cf->cxt->label->nparttypes;
- if (!nitems)
+ if (fdisk_label_get_parttypes(lb, &types, &nitems) || !nitems)
return NULL;
+
cm = xcalloc(nitems + 1, sizeof(struct cfdisk_menuitem));
if (!cm)
return NULL;
- has_typestr = cf->cxt->label->parttypes[0].typestr &&
- *cf->cxt->label->parttypes[0].typestr;
+ has_typestr = fdisk_label_is_parttype_string(lb);
for (i = 0; i < nitems; i++) {
- struct fdisk_parttype *x = &cf->cxt->label->parttypes[i];
+ struct fdisk_parttype *x = &types[i];
char *name;
if (!x || !x->name)