summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/libfdisk.h
diff options
context:
space:
mode:
authorKarel Zak2014-10-15 14:10:25 +0200
committerKarel Zak2014-10-15 14:10:25 +0200
commitdfc6db2a3558d2a2cedbeb381e2cc8feda41a214 (patch)
tree2d21b109a09da5aac2ec36a7ef4ccb6433203b86 /libfdisk/src/libfdisk.h
parentlibfdisk: cleanup partno API (diff)
downloadkernel-qcow2-util-linux-dfc6db2a3558d2a2cedbeb381e2cc8feda41a214.tar.gz
kernel-qcow2-util-linux-dfc6db2a3558d2a2cedbeb381e2cc8feda41a214.tar.xz
kernel-qcow2-util-linux-dfc6db2a3558d2a2cedbeb381e2cc8feda41a214.zip
libfdisk: cleanup parttype API
* add reference counting * add functions to set allocated types Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/libfdisk.h')
-rw-r--r--libfdisk/src/libfdisk.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h
index 92f641678..cb40ecf01 100644
--- a/libfdisk/src/libfdisk.h
+++ b/libfdisk/src/libfdisk.h
@@ -137,26 +137,27 @@ sector_t fdisk_get_geom_cylinders(struct fdisk_context *cxt);
/* parttype.c */
-const struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, size_t n);
+struct fdisk_parttype *fdisk_new_parttype(void);
+void fdisk_ref_parttype(struct fdisk_parttype *t);
+void fdisk_unref_parttype(struct fdisk_parttype *t);
+int fdisk_parttype_set_name(struct fdisk_parttype *t, const char *str);
+int fdisk_parttype_set_typestr(struct fdisk_parttype *t, const char *str);
+int fdisk_parttype_set_code(struct fdisk_parttype *t, int code);
size_t fdisk_label_get_nparttypes(const struct fdisk_label *lb);
-
+struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, size_t n);
int fdisk_label_has_code_parttypes(const struct fdisk_label *lb);
struct fdisk_parttype *fdisk_label_get_parttype_from_code(
const struct fdisk_label *lb,
unsigned int code);
-
struct fdisk_parttype *fdisk_label_get_parttype_from_string(
const struct fdisk_label *lb,
const char *str);
struct fdisk_parttype *fdisk_new_unknown_parttype(unsigned int code,
const char *typestr);
+struct fdisk_parttype *fdisk_copy_parttype(const struct fdisk_parttype *type);
struct fdisk_parttype *fdisk_label_parse_parttype(
const struct fdisk_label *lb,
const char *str);
-
-struct fdisk_parttype *fdisk_copy_parttype(const struct fdisk_parttype *type);
-void fdisk_free_parttype(struct fdisk_parttype *t); /* TODO: use refcount */
-
const char *fdisk_parttype_get_string(const struct fdisk_parttype *t);
unsigned int fdisk_parttype_get_code(const struct fdisk_parttype *t);
const char *fdisk_parttype_get_name(const struct fdisk_parttype *t);
@@ -271,8 +272,8 @@ int fdisk_partition_cmp_partno(struct fdisk_partition *a,
int fdisk_partition_partno_follow_default(struct fdisk_partition *pa, int enable);
-extern int fdisk_partition_set_type(struct fdisk_partition *pa, const struct fdisk_parttype *type);
-extern const struct fdisk_parttype *fdisk_partition_get_type(struct fdisk_partition *pa);
+extern int fdisk_partition_set_type(struct fdisk_partition *pa, struct fdisk_parttype *type);
+extern struct fdisk_parttype *fdisk_partition_get_type(struct fdisk_partition *pa);
extern int fdisk_partition_set_name(struct fdisk_partition *pa, const char *name);
extern const char *fdisk_partition_get_name(struct fdisk_partition *pa);
extern int fdisk_partition_set_uuid(struct fdisk_partition *pa, const char *uuid);