* @heads: user specified heads
* @sectors: user specified sectors
*
- * Overrides auto-discovery. The function fdisk_reset_device_properties()
+ * Overrides auto-discovery. The function fdisk_reset_device_properties()
* restores the original setting.
*
* The difference between fdisk_override_geometry() and fdisk_save_user_geometry()
- * is that saved user geometry is persistent setting and it's applied always
+ * is that saved user geometry is persistent setting and it's applied always
* when device is assigned to the context or device properties are reseted.
*
* Returns: 0 on success, < 0 on error.
*
* Save user defined geometry to use it for partitioning.
*
- * The user properties are applied by fdisk_assign_device() or
+ * The user properties are applied by fdisk_assign_device() or
* fdisk_reset_device_properties().
* Returns: <0 on error, 0 on success.
*
* If no @name specified then returns the current context label.
*
+ * The label is allocated and maintained within the context #cxt. There is
+ * nothing like reference counting for labels, you cannot delallocate the
+ * label.
+ *
* Returns: label struct or NULL in case of error.
*/
struct fdisk_label *fdisk_get_label(struct fdisk_context *cxt, const char *name)
* The fdisk_new_context() initializes all label drivers, and allocate
* per-label specific data struct. This concept allows to store label specific
* settings to the label driver independently on the currently active label
- * driver.
+ * driver. Note that lable struct cannot be deallocated, so there is no
+ * reference counting for fdisk_label objects. All is destroyed by
+ * fdisk_unref_context() only.
*
* Anyway, all label drives share in-memory first sector. The function
* fdisk_create_disklabel() overwrites the sector. But it's possible that
#include "fdiskP.h"
+/**
+ * SECTION: partition
+ * @title: partition abstraction
+ * @short_description: generic label independent partition
+ *
+ * The fdisk_partition provides label independent abstraction. The partitions
+ * are not directly connected with partition table (label) data. Any change to
+ * fdisk_partition does not affects in-memory or on-disk label data.
+ *
+ * The fdisk_partition is possible to use as a template for
+ * fdisk_add_partition() or fdisk_set_partition() operations.
+ */
static void init_partition(struct fdisk_partition *pa)
{
#include <ctype.h>
#include "nls.h"
-
#include "fdiskP.h"
+/**
+ * SECTION: parttypw
+ * @title: Partition types
+ * @short_description: abstraction to partition types
+ *
+ * There are two basic types of parttypes, string based (e.g. GPT)
+ * and code/hex based (e.g. MBR).
+ */
/**
* fdisk_new_parttype:
#include "fdiskP.h"
#include "strutils.h"
+/**
+ * SECTION: script
+ * @title: Partition table script
+ * @short_description: text based description of partition table
+ *
+ * The libfdisk scripts are based on original sfdisk script (dumps). Each
+ * script has two parts: script headers and partition table entries
+ * (partitions).
+ *
+ * For more details about script format see sfdisk man page.
+ */
+
/* script header (e.g. unit: sectors) */
struct fdisk_scriptheader {
struct list_head headers;
#include "fdiskP.h"
+/**
+ * SECTION: table
+ * @title: table
+ * @short_description: container for fdisk partitions
+ *
+ * The fdisk_table is simple container for fdisk_partitions. The table is no
+ * directly connected to label data (partition table), and table changes don't
+ * affect in-memory or on-disk data.
+ */
+
/**
* fdisk_new_table:
*
#include <ctype.h>
+/**
+ * SECTION: utils
+ * @title: Misc utils
+ * @short_description: misc fdisk functions
+ */
+
/*
* Zeros in-memory first sector buffer
*/
* dev: device name
* @partno: partition name
*
- * Return: allocated buffer with partition name
+ * Return: allocated buffer with partition name, use free() to deallocate.
*/
char *fdisk_partname(const char *dev, size_t partno)
{
/* Default is to follow the current line speend and then default to 9600 */
if ((options.flags & F_VCONSOLE) == 0 && options.numspeed == 0) {
options.speeds[options.numspeed++] = bcode("9600");
- options.flags |= F_KEEPSPEED
+ options.flags |= F_KEEPSPEED;
}
/* Initialize the termios settings (raw mode, eight-bit, blocking i/o). */