summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/label.c
diff options
context:
space:
mode:
authorKarel Zak2014-08-13 10:10:11 +0200
committerKarel Zak2014-08-13 10:10:11 +0200
commitd44115f3b5866f76ceaefd0d145468e68d7e2688 (patch)
treed7d83433edd97bbefaf9539c10f95b42937b4145 /libfdisk/src/label.c
parentlib/colors: add function to return color from scheme (diff)
downloadkernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.tar.gz
kernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.tar.xz
kernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.zip
libfdisk: remove dependence on libsmartcols
It's application business to convert libfdisk_table to string. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r--libfdisk/src/label.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index f2cc255cd..f6bef31d1 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -113,10 +113,9 @@ int fdisk_missing_geometry(struct fdisk_context *cxt)
* @cols: returns allocated array with FDISK_COL_* IDs
* @ncols: returns number of items in cols
*
- * This function returns the default or all columns for the current label. The
- * library uses the columns for list operations (see fdisk_list_disklabel() and
- * fdisk_list_partitions()). Note that the set of the default columns depends
- * on fdisk_context_enable_details() function. If the details are eanable then
+ * This function returns the default or all columns for the current label.
+ * Note that the set of the default columns depends on
+ * fdisk_context_enable_details() function. If the details are enabled then
* this function usually returns more columns.
*
* Returns 0 on success, otherwise, a corresponding error.
@@ -176,6 +175,26 @@ const struct fdisk_column *fdisk_label_get_column(
return NULL;
}
+int fdisk_column_get_id(const struct fdisk_column *col)
+{
+ return col ? col->id : -EINVAL;
+}
+
+const char *fdisk_column_get_name(const struct fdisk_column *col)
+{
+ return col ? col->name : NULL;
+}
+
+double fdisk_column_get_width(const struct fdisk_column *col)
+{
+ return col ? col->width : -EINVAL;
+}
+
+int fdisk_column_is_number(const struct fdisk_column *col)
+{
+ return col->flags ? col->flags & FDISK_COLFL_NUMBER : 0;
+}
+
/**
* fdisk_verify_disklabel:
* @cxt: fdisk context