unable_to_write
};
-/*
- * labels
- */
-extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum);
-extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
- struct fdisk_parttype *t);
-
/* prototypes for fdisk.c */
extern char *line_ptr;
extern int partitions;
return cxt->label->create(cxt);
}
+
+/**
+ * fdisk_get_partition_type:
+ * @cxt: fdisk context
+ * @partnum: partition number
+ *
+ * Returns partition type or NULL upon failure.
+ */
+struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum)
+{
+ if (!cxt || !cxt->label || !cxt->label->part_get_type)
+ return NULL;
+
+ DBG(LABEL, dbgprint("partition: %d: get type", partnum));
+ return cxt->label->part_get_type(cxt, partnum);
+}
+
+/**
+ * fdisk_set_partition_type:
+ * @cxt: fdisk context
+ * @partnum: partition number
+ * @t: new type
+ *
+ * Returns 0 on success, < 0 on error.
+ */
+int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
+ struct fdisk_parttype *t)
+{
+ if (!cxt || !cxt->label || !cxt->label->part_set_type)
+ return -EINVAL;
+
+ DBG(LABEL, dbgprint("partition: %d: set type", partnum));
+ return cxt->label->part_set_type(cxt, partnum, t);
+}
+
+/**
+ * fdisk_get_nparttypes:
+ * @cxt: fdisk context
+ *
+ * Returns: number of partition types supported by the current label
+ */
+size_t fdisk_get_nparttypes(struct fdisk_context *cxt)
+{
+ if (!cxt || !cxt->label)
+ return 0;
+
+ return cxt->label->nparttypes;
+}
extern int fdisk_write_disklabel(struct fdisk_context *cxt);
extern int fdisk_verify_disklabel(struct fdisk_context *cxt);
+extern int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name);
extern int fdisk_add_partition(struct fdisk_context *cxt, int partnum, struct fdisk_parttype *t);
extern int fdisk_delete_partition(struct fdisk_context *cxt, int partnum);
+extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum);
+extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
+ struct fdisk_parttype *t);
+
/* alignment.c */
extern int fdisk_reset_alignment(struct fdisk_context *cxt);
}
}
-/**
- * fdisk_get_partition_type:
- * @cxt: fdisk context
- * @partnum: partition number
- *
- * Returns partition type or NULL upon failure.
- */
-struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum)
-{
- if (!cxt || !cxt->label || !cxt->label->part_get_type)
- return NULL;
-
- DBG(LABEL, dbgprint("partition: %d: get type", partnum));
- return cxt->label->part_get_type(cxt, partnum);
-}
-
-/**
- * fdisk_set_partition_type:
- * @cxt: fdisk context
- * @partnum: partition number
- * @t: new type
- *
- * Returns 0 on success, < 0 on error.
- */
-int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
- struct fdisk_parttype *t)
-{
- if (!cxt || !cxt->label || !cxt->label->part_set_type)
- return -EINVAL;
-
- DBG(LABEL, dbgprint("partition: %d: set type", partnum));
- return cxt->label->part_set_type(cxt, partnum, t);
-}
-
-/**
- * fdisk_get_nparttypes:
- * @cxt: fdisk context
- *
- * Returns: number of partition types supported by the current label
- */
-size_t fdisk_get_nparttypes(struct fdisk_context *cxt)
-{
- if (!cxt || !cxt->label)
- return 0;
- return cxt->label->nparttypes;
-}