fdisk_table_add_partition
fdisk_table_get_nents
fdisk_table_get_partition
+fdisk_table_get_partition_by_partno
fdisk_table_is_empty
fdisk_table_next_partition
fdisk_table_remove_partition
struct fdisk_partition *b);
int fdisk_partition_partno_follow_default(struct fdisk_partition *pa, int enable);
-
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 struct fdisk_partition *fdisk_table_get_partition(
struct fdisk_table *tb,
size_t n);
+extern struct fdisk_partition *fdisk_table_get_partition_by_partno(
+ struct fdisk_table *tb,
+ size_t partno);
+
extern int fdisk_apply_table(struct fdisk_context *cxt, struct fdisk_table *tb);
/* alignment.c */
FDISK_2.27 {
fdisk_enable_bootbits_protection;
fdisk_has_protected_bootbits;
+ fdisk_table_get_partition_by_partno;
} FDISK_2.26;
return rc;
}
+/**
+ * fdisk_table_get_partition:
+ * @tb: tab pointer
+ * @n: number of entry in table
+ *
+ * Returns: n-th entry from table or NULL
+ */
struct fdisk_partition *fdisk_table_get_partition(
struct fdisk_table *tb,
size_t n)
return NULL;
}
+/**
+ * fdisk_table_get_partition_by_partno:
+ * @tb: tab pointer
+ * @partno: partition number
+ *
+ * Returns: partition with @partno or NULL.
+ */
+struct fdisk_partition *fdisk_table_get_partition_by_partno(
+ struct fdisk_table *tb,
+ size_t partno)
+{
+ struct fdisk_partition *pa = NULL;
+ struct fdisk_iter itr;
+
+ if (!tb)
+ return NULL;
+
+ fdisk_reset_iter(&itr, FDISK_ITER_FORWARD);
+
+ while (fdisk_table_next_partition(tb, &itr, &pa) == 0) {
+ if (pa->partno == partno)
+ return pa;
+ }
+
+ return NULL;
+}
+
/**
* fdisk_table_add_partition
* @tb: tab pointer