summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/fdiskP.h
diff options
context:
space:
mode:
authorKarel Zak2015-06-11 14:19:47 +0200
committerKarel Zak2015-06-11 14:19:47 +0200
commit5989556ad3dca8246f245eaf0867e89fb6fc9362 (patch)
treeaf5c8a841b82853044a3c9a9625a3c97738375a9 /libfdisk/src/fdiskP.h
parentlibfdisk: (dos) fix cylinders calculation (diff)
downloadkernel-qcow2-util-linux-5989556ad3dca8246f245eaf0867e89fb6fc9362.tar.gz
kernel-qcow2-util-linux-5989556ad3dca8246f245eaf0867e89fb6fc9362.tar.xz
kernel-qcow2-util-linux-5989556ad3dca8246f245eaf0867e89fb6fc9362.zip
libfdisk: add new API to read label specific data
* removes list() label operation from internal API The list() has been based on fdisk_info() it was useless for anything else than print on stdout... * add a new get_item() label operation and fdisk_get_disklabel_item() public API The new API provides abstract and pretty simple way how to get label specific disk label information, for example fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm); return LBA of the array with GPT entries. Note that this patch does not implement public functions to get data from the @item object. * removes get_id() label operation -- it's subset of the new get_item() * the new internal API is also used to implement backwardly compatible fdisk_list_disklabel() and fdisk_get_disklabel_id() Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/fdiskP.h')
-rw-r--r--libfdisk/src/fdiskP.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index 5e8ed9c35..10380e15b 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -197,16 +197,13 @@ struct fdisk_label_operations {
int (*verify)(struct fdisk_context *cxt);
/* create new disk label */
int (*create)(struct fdisk_context *cxt);
- /* list disklabel details */
- int (*list)(struct fdisk_context *cxt);
/* returns offset and size of the 'n' part of the PT */
int (*locate)(struct fdisk_context *cxt, int n, const char **name,
uint64_t *offset, size_t *size);
/* reorder partitions */
int (*reorder)(struct fdisk_context *cxt);
-
- /* get disk label ID */
- int (*get_id)(struct fdisk_context *cxt, char **id);
+ /* get details from label */
+ int (*get_item)(struct fdisk_context *cxt, struct fdisk_labelitem *item);
/* set disk label ID */
int (*set_id)(struct fdisk_context *cxt);
@@ -427,6 +424,18 @@ extern char *fdisk_partname(const char *dev, size_t partno);
extern int fdisk_probe_labels(struct fdisk_context *cxt);
extern void fdisk_deinit_label(struct fdisk_label *lb);
+struct fdisk_labelitem {
+ int id; /* <label>_ITEM_* */
+ char type; /* s = string, j = uint64 */
+ const char *name;
+
+ union {
+ char *str;
+ uint64_t num64;
+ } data;
+};
+
+
/* ask.c */
struct fdisk_ask *fdisk_new_ask(void);
void fdisk_reset_ask(struct fdisk_ask *ask);