summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/fdiskP.h
diff options
context:
space:
mode:
authorKarel Zak2013-01-28 16:14:21 +0100
committerKarel Zak2013-03-11 13:00:54 +0100
commit7845ca8dc28c93939d99a1d0564f97eddcba1079 (patch)
treedb23e3fa2004ad30bd4ddfad0ad252706aa55be6 /libfdisk/src/fdiskP.h
parentlibfdisk: fix gpt status, don't use xcalloc() in library (diff)
downloadkernel-qcow2-util-linux-7845ca8dc28c93939d99a1d0564f97eddcba1079.tar.gz
kernel-qcow2-util-linux-7845ca8dc28c93939d99a1d0564f97eddcba1079.tar.xz
kernel-qcow2-util-linux-7845ca8dc28c93939d99a1d0564f97eddcba1079.zip
libfdisk: add "ask" interface
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/fdiskP.h')
-rw-r--r--libfdisk/src/fdiskP.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index 3a40bb449..58c8393cc 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -47,6 +47,7 @@
#define FDISK_DEBUG_TOPOLOGY (1 << 3)
#define FDISK_DEBUG_GEOMETRY (1 << 4)
#define FDISK_DEBUG_LABEL (1 << 5)
+#define FDISK_DEBUG_ASK (1 << 6)
#define FDISK_DEBUG_ALL 0xFFFF
# define ON_DBG(m, x) do { \
@@ -206,6 +207,33 @@ extern struct fdisk_label *fdisk_new_mac_label(struct fdisk_context *cxt);
extern struct fdisk_label *fdisk_new_sgi_label(struct fdisk_context *cxt);
extern struct fdisk_label *fdisk_new_sun_label(struct fdisk_context *cxt);
+
+/* fdisk dialog -- note that nothing from this stuff will be directly exported,
+ * we will have get/set() function for everything.
+ */
+struct fdisk_ask {
+ const char *name;
+ int type; /* FDISK_ASKTYPE_* */
+
+ char *query;
+ char *hint;
+
+ union {
+ struct ask_number {
+ uint64_t hig; /* high limit */
+ uint64_t low; /* low limit */
+ uint64_t dfl; /* default */
+ uint64_t result;
+ const char *range; /* by library generated list */
+ } num;
+ } data;
+};
+
+enum {
+ FDISK_ASKTYPE_NONE,
+ FDISK_ASKTYPE_NUMBER
+};
+
struct fdisk_context {
int dev_fd; /* device descriptor */
char *dev_path; /* device path */
@@ -232,8 +260,10 @@ struct fdisk_context {
size_t nlabels; /* number of initialized label drivers */
struct fdisk_label *labels[8]; /* all supported labels,
* FIXME: use any enum rather than hardcoded number */
-};
+ int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *); /* fdisk dialogs callback */
+ void *ask_data; /* ask_cb() data */
+};
/* context.c */
extern int __fdisk_context_switch_label(struct fdisk_context *cxt,
@@ -276,4 +306,7 @@ extern void fdisk_deinit_label(struct fdisk_label *lb);
/* gpt.c -- temporary bypass library API... */
extern void gpt_list_table(struct fdisk_context *cxt, int xtra);
+/* ask.c */
+extern int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew);
+
#endif /* _LIBFDISK_PRIVATE_H */