Blame src/lib/plugin_apis/fs.api

Packit 2ba279
#include <glib.h>
Packit 2ba279
#include <glib-object.h>
Packit 2ba279
#include <blockdev/utils.h>
Packit 2ba279
Packit 2ba279
#ifndef BD_FS_API
Packit 2ba279
#define BD_FS_API
Packit 2ba279
Packit 2ba279
GQuark bd_fs_error_quark (void) {
Packit 2ba279
    return g_quark_from_static_string ("g-bd-fs-error-quark");
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
#define BD_FS_ERROR bd_fs_error_quark ()
Packit 2ba279
typedef enum {
Packit 2ba279
    BD_FS_ERROR_INVAL,
Packit 2ba279
    BD_FS_ERROR_PARSE,
Packit 2ba279
    BD_FS_ERROR_FAIL,
Packit 2ba279
    BD_FS_ERROR_NOFS,
Packit 2ba279
    BD_FS_ERROR_PIPE,
Packit 2ba279
    BD_FS_ERROR_UNMOUNT_FAIL,
Packit 2ba279
    BD_FS_ERROR_NOT_SUPPORTED,
Packit 2ba279
    BD_FS_ERROR_NOT_MOUNTED,
Packit 2ba279
    BD_FS_ERROR_AUTH,
Packit 2ba279
    BD_FS_ERROR_TECH_UNAVAIL,
Packit 2ba279
} BDFsError;
Packit 2ba279
Packit 2ba279
#define BD_FS_TYPE_EXT2_INFO (bd_fs_ext2_info_get_type ())
Packit 2ba279
GType bd_fs_ext2_info_get_type();
Packit 2ba279
#define BD_FS_TYPE_EXT3_INFO (bd_fs_ext3_info_get_type ())
Packit 2ba279
GType bd_fs_ext3_info_get_type();
Packit 2ba279
#define BD_FS_TYPE_EXT4_INFO (bd_fs_ext4_info_get_type ())
Packit 2ba279
GType bd_fs_ext4_info_get_type();
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * BDFSExtInfo:
Packit 2ba279
 * @label: label of the filesystem
Packit 2ba279
 * @uuid: uuid of the filesystem
Packit 2ba279
 * @state: state of the filesystem (e.g. "clean")
Packit 2ba279
 * @block_size: block size used by the filesystem
Packit 2ba279
 * @block_count: number of blocks in the filesystem
Packit 2ba279
 * @free_blocks: number of free blocks in the filesystem
Packit 2ba279
 */
Packit 2ba279
typedef struct BDFSExtInfo {
Packit 2ba279
    gchar *label;
Packit 2ba279
    gchar *uuid;
Packit 2ba279
    gchar *state;
Packit 2ba279
    guint64 block_size;
Packit 2ba279
    guint64 block_count;
Packit 2ba279
    guint64 free_blocks;
Packit 2ba279
} BDFSExtInfo;
Packit 2ba279
Packit 2ba279
typedef struct BDFSExtInfo BDFSExt4Info;
Packit 2ba279
typedef struct BDFSExtInfo BDFSExt3Info;
Packit 2ba279
typedef struct BDFSExtInfo BDFSExt2Info;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSExt2Info* bd_fs_ext2_info_copy (BDFSExt2Info *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return NULL;
Packit 2ba279
Packit 2ba279
    BDFSExt2Info *ret = g_new0 (BDFSExt2Info, 1);
Packit 2ba279
Packit 2ba279
    ret->label = g_strdup (data->label);
Packit 2ba279
    ret->uuid = g_strdup (data->uuid);
Packit 2ba279
    ret->state = g_strdup (data->state);
Packit 2ba279
    ret->block_size = data->block_size;
Packit 2ba279
    ret->block_count = data->block_count;
Packit 2ba279
    ret->free_blocks = data->free_blocks;
Packit 2ba279
Packit 2ba279
    return ret;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSExt3Info* bd_fs_ext3_info_copy (BDFSExt3Info *data) {
Packit 2ba279
    return (BDFSExt3Info*) bd_fs_ext2_info_copy (data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSExt4Info* bd_fs_ext4_info_copy (BDFSExt4Info *data) {
Packit 2ba279
    return (BDFSExt4Info*) bd_fs_ext2_info_copy (data);
Packit 2ba279
};
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_ext2_info_free (BDFSExt2Info *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return;
Packit 2ba279
Packit 2ba279
    g_free (data->label);
Packit 2ba279
    g_free (data->uuid);
Packit 2ba279
    g_free (data->state);
Packit 2ba279
    g_free (data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_ext3_info_free (BDFSExt3Info *data) {
Packit 2ba279
    bd_fs_ext2_info_free ((BDFSExt2Info*) data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_ext4_info_free (BDFSExt4Info *data) {
Packit 2ba279
    bd_fs_ext2_info_free ((BDFSExt2Info*) data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_ext2_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSExt2Info",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_ext2_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_ext2_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_ext3_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSExt3Info",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_ext3_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_ext3_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_ext4_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSExt4Info",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_ext4_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_ext4_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
#define BD_FS_TYPE_XFS_INFO (bd_fs_xfs_info_get_type ())
Packit 2ba279
GType bd_fs_xfs_info_get_type();
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * BDFSXfsInfo:
Packit 2ba279
 * @label: label of the filesystem
Packit 2ba279
 * @uuid: uuid of the filesystem
Packit 2ba279
 * @block_size: block size used by the filesystem
Packit 2ba279
 * @block_count: number of blocks in the filesystem
Packit 2ba279
 */
Packit 2ba279
typedef struct BDFSXfsInfo {
Packit 2ba279
    gchar *label;
Packit 2ba279
    gchar *uuid;
Packit 2ba279
    guint64 block_size;
Packit 2ba279
    guint64 block_count;
Packit 2ba279
} BDFSXfsInfo;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSXfsInfo* bd_fs_xfs_info_copy (BDFSXfsInfo *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return NULL;
Packit 2ba279
Packit 2ba279
    BDFSXfsInfo *ret = g_new0 (BDFSXfsInfo, 1);
Packit 2ba279
Packit 2ba279
    ret->label = g_strdup (data->label);
Packit 2ba279
    ret->uuid = g_strdup (data->uuid);
Packit 2ba279
    ret->block_size = data->block_size;
Packit 2ba279
    ret->block_count = data->block_count;
Packit 2ba279
Packit 2ba279
    return ret;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_xfs_info_free (BDFSXfsInfo *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return;
Packit 2ba279
Packit 2ba279
    g_free (data->label);
Packit 2ba279
    g_free (data->uuid);
Packit 2ba279
    g_free (data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_xfs_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSXfsInfo",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_xfs_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_xfs_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
#define BD_FS_TYPE_VFAT_INFO (bd_fs_vfat_info_get_type ())
Packit 2ba279
GType bd_fs_vfat_info_get_type();
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * BDFSVfatInfo:
Packit 2ba279
 * @label: label of the filesystem
Packit 2ba279
 * @uuid: uuid of the filesystem
Packit 2ba279
 * @cluster_size: cluster size used by the filesystem
Packit 2ba279
 * @cluster_count: number of clusters in the filesystem
Packit 2ba279
 * @free_cluster_count: number of free clusters in the filesystem
Packit 2ba279
 */
Packit 2ba279
typedef struct BDFSVfatInfo {
Packit 2ba279
    gchar *label;
Packit 2ba279
    gchar *uuid;
Packit 2ba279
    guint64 cluster_size;
Packit 2ba279
    guint64 cluster_count;
Packit 2ba279
    guint64 free_cluster_count;
Packit 2ba279
} BDFSVfatInfo;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSVfatInfo* bd_fs_vfat_info_copy (BDFSVfatInfo *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return NULL;
Packit 2ba279
Packit 2ba279
    BDFSVfatInfo *ret = g_new0 (BDFSVfatInfo, 1);
Packit 2ba279
Packit 2ba279
    ret->label = g_strdup (data->label);
Packit 2ba279
    ret->uuid = g_strdup (data->uuid);
Packit 2ba279
    ret->cluster_size = data->cluster_size;
Packit 2ba279
    ret->cluster_count = data->cluster_count;
Packit 2ba279
Packit 2ba279
    return ret;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_vfat_info_free (BDFSVfatInfo *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return;
Packit 2ba279
Packit 2ba279
    g_free (data->label);
Packit 2ba279
    g_free (data->uuid);
Packit 2ba279
    g_free (data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_vfat_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSVfatInfo",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_vfat_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_vfat_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * BDFSNtfsInfo:
Packit 2ba279
 * @size: size of the filesystem in bytes
Packit 2ba279
 * @free_space: number of free space in the filesystem in bytes
Packit 2ba279
 */
Packit 2ba279
typedef struct BDFSNtfsInfo {
Packit 2ba279
    guint64 size;
Packit 2ba279
    guint64 free_space;
Packit 2ba279
} BDFSNtfsInfo;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_info_copy: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Creates a new copy of @data.
Packit 2ba279
 */
Packit 2ba279
BDFSNtfsInfo* bd_fs_ntfs_info_copy (BDFSNtfsInfo *data) {
Packit 2ba279
    if (data == NULL)
Packit 2ba279
        return NULL;
Packit 2ba279
Packit 2ba279
    BDFSNtfsInfo *ret = g_new0 (BDFSNtfsInfo, 1);
Packit 2ba279
Packit 2ba279
    ret->size = data->size;
Packit 2ba279
    ret->free_space = data->free_space;
Packit 2ba279
Packit 2ba279
    return ret;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_info_free: (skip)
Packit 2ba279
 *
Packit 2ba279
 * Frees @data.
Packit 2ba279
 */
Packit 2ba279
void bd_fs_ntfs_info_free (BDFSNtfsInfo *data) {
Packit 2ba279
    g_free (data);
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
GType bd_fs_ntfs_info_get_type () {
Packit 2ba279
    static GType type = 0;
Packit 2ba279
Packit 2ba279
    if (G_UNLIKELY(type == 0)) {
Packit 2ba279
        type = g_boxed_type_register_static("BDFSNtfsInfo",
Packit 2ba279
                                            (GBoxedCopyFunc) bd_fs_ntfs_info_copy,
Packit 2ba279
                                            (GBoxedFreeFunc) bd_fs_ntfs_info_free);
Packit 2ba279
    }
Packit 2ba279
Packit 2ba279
    return type;
Packit 2ba279
}
Packit 2ba279
Packit 2ba279
typedef enum {
Packit 2ba279
    BD_FS_TECH_GENERIC = 0,
Packit 2ba279
    BD_FS_TECH_MOUNT,
Packit 2ba279
    BD_FS_TECH_EXT2,
Packit 2ba279
    BD_FS_TECH_EXT3,
Packit 2ba279
    BD_FS_TECH_EXT4,
Packit 2ba279
    BD_FS_TECH_XFS,
Packit 2ba279
    BD_FS_TECH_VFAT,
Packit 2ba279
    BD_FS_TECH_NTFS
Packit 2ba279
} BDFSTech;
Packit 2ba279
Packit 2ba279
typedef enum {
Packit 2ba279
    BD_FS_TECH_MODE_MKFS      = 1 << 0,
Packit 2ba279
    BD_FS_TECH_MODE_WIPE      = 1 << 1,
Packit 2ba279
    BD_FS_TECH_MODE_CHECK     = 1 << 2,
Packit 2ba279
    BD_FS_TECH_MODE_REPAIR    = 1 << 3,
Packit 2ba279
    BD_FS_TECH_MODE_SET_LABEL = 1 << 4,
Packit 2ba279
    BD_FS_TECH_MODE_QUERY     = 1 << 5,
Packit 2ba279
    BD_FS_TECH_MODE_RESIZE    = 1 << 6,
Packit 2ba279
} BDFSTechMode;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_is_tech_avail:
Packit 2ba279
 * @tech: the queried tech
Packit 2ba279
 * @mode: a bit mask of queried modes of operation (#BDFSTechMode) for @tech
Packit 2ba279
 * @error: (out): place to store error (details about why the @tech-@mode combination is not available)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the @tech-@mode combination is available -- supported by the
Packit 2ba279
 *          plugin implementation and having all the runtime dependencies available
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_is_tech_avail (BDFSTech tech, guint64 mode, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_wipe:
Packit 2ba279
 * @device: the device to wipe signatures from
Packit 2ba279
 * @all: whether to wipe all (%TRUE) signatures or just the first (%FALSE) one
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Note: This function will wipe signatures on a mounted @device without
Packit 2ba279
 *       asking. Use %bd_fs_wipe_force if you want to control this
Packit 2ba279
 *       behaviour manually.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether signatures were successfully wiped on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_wipe (const gchar *device, gboolean all, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_wipe_force:
Packit 2ba279
 * @device: the device to wipe signatures from
Packit 2ba279
 * @all: whether to wipe all (%TRUE) signatures or just the first (%FALSE) one
Packit 2ba279
 * @force: whether to force wipe even if the filesystem is mounted
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether signatures were successfully wiped on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_wipe_force (const gchar *device, gboolean all, gboolean force, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_clean:
Packit 2ba279
 * @device: the device to clean
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Clean all signatures from @device.
Packit 2ba279
 * Difference between this and bd_fs_wipe() is that this function doesn't
Packit 2ba279
 * return error if @device is already empty. This will also always remove
Packit 2ba279
 * all signatures from @device, not only the first one.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @device was successfully cleaned or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_clean (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_get_fstype:
Packit 2ba279
 * @device: the device to probe
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Get first signature on @device as a string.
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): type of filesystem found on @device, %NULL in case
Packit 2ba279
 *                           no signature has been detected or in case of error
Packit 2ba279
 *                           (@error is set in this case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
gchar* bd_fs_get_fstype (const gchar *device,  GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_freeze:
Packit 2ba279
 * @mountpoint: mountpoint of the device (filesystem) to freeze
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Freezes filesystem mounted on @mountpoint. The filesystem must
Packit 2ba279
 * support freezing.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @mountpoint was successfully freezed or not
Packit 2ba279
 *
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_freeze (const gchar *mountpoint, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_unfreeze:
Packit 2ba279
 * @mountpoint: mountpoint of the device (filesystem) to un-freeze
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Un-freezes filesystem mounted on @mountpoint. The filesystem must
Packit 2ba279
 * support freezing.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @mountpoint was successfully unfreezed or not
Packit 2ba279
 *
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_unfreeze (const gchar *mountpoint, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_unmount:
Packit 2ba279
 * @spec: mount point or device to unmount
Packit 2ba279
 * @lazy: enable/disable lazy unmount
Packit 2ba279
 * @force: enable/disable force unmount
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the unmount
Packit 2ba279
 *                                                 currently only 'run_as_uid'
Packit 2ba279
 *                                                 and 'run_as_gid' are supported
Packit 2ba279
 *                                                 value must be a valid non zero
Packit 2ba279
 *                                                 uid (gid)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @spec was successfully unmounted or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_MOUNT (no mode, ignored)
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_unmount (const gchar *spec, gboolean lazy, gboolean force, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_mount:
Packit 2ba279
 * @device: (allow-none): device to mount, if not specified @mountpoint entry
Packit 2ba279
 *                        from fstab will be used
Packit 2ba279
 * @mountpoint: (allow-none): mountpoint for @device, if not specified @device
Packit 2ba279
 *                            entry from fstab will be used
Packit 2ba279
 * @fstype: (allow-none): filesystem type
Packit 2ba279
 * @options: (allow-none): comma delimited options for mount
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the unmount
Packit 2ba279
 *                                                 currently only 'run_as_uid'
Packit 2ba279
 *                                                 and 'run_as_gid' are supported
Packit 2ba279
 *                                                 value must be a valid non zero
Packit 2ba279
 *                                                 uid (gid)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @device (or @mountpoint) was successfully mounted or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_MOUNT (no mode, ignored)
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_mount (const gchar *device, const gchar *mountpoint, const gchar *fstype, const gchar *options, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_get_mountpoint:
Packit 2ba279
 * @device: device to find mountpoint for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Get mountpoint for @device. If @device is mounted multiple times only
Packit 2ba279
 * one mountpoint will be returned.
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): mountpoint for @device, %NULL in case device is
Packit 2ba279
 *                           not mounted or in case of an error (@error is set
Packit 2ba279
 *                           in this case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_MOUNT (no mode, ignored)
Packit 2ba279
 */
Packit 2ba279
gchar* bd_fs_get_mountpoint (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_is_mountpoint:
Packit 2ba279
 * @path: path (folder) to check
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether @path is a mountpoint or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_MOUNT (no mode, ignored)
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_is_mountpoint (const gchar *path, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system (if 0, the file system is
Packit 2ba279
 *            adapted to the underlying block device)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_resize (const gchar *device, guint64 new_size, GError **error);
Packit 2ba279
Packit 2ba279
 /**
Packit 2ba279
 * bd_fs_repair:
Packit 2ba279
 * @device: the device the file system of which to repair
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Repair filesystem on @device. This calls other fs repair functions from this
Packit 2ba279
 * plugin based on detected filesystem (e.g. bd_fs_xfs_repair for XFS). This
Packit 2ba279
 * function will return an error for unknown/unsupported filesystems.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully repaired or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_repair (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_check:
Packit 2ba279
 * @device: the device the file system of which to check
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Check filesystem on @device. This calls other fs check functions from this
Packit 2ba279
 * plugin based on detected filesystem (e.g. bd_fs_xfs_check for XFS). This
Packit 2ba279
 * function will return an error for unknown/unsupported filesystems.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device passed the consistency check or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_check (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_set_label:
Packit 2ba279
 * @device: the device with file system to set the label for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Set label for filesystem on @device. This calls other fs label functions from this
Packit 2ba279
 * plugin based on detected filesystem (e.g. bd_fs_xfs_set_label for XFS). This
Packit 2ba279
 * function will return an error for unknown/unsupported filesystems.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully relabled or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * BDFsResizeFlags:
Packit 2ba279
 * Flags indicating whether a filesystem resize action supports growing and/or
Packit 2ba279
 * shrinking if mounted or unmounted.
Packit 2ba279
 */
Packit 2ba279
typedef enum {
Packit 2ba279
    BD_FS_OFFLINE_SHRINK = 1 << 1,
Packit 2ba279
    BD_FS_OFFLINE_GROW = 1 << 2,
Packit 2ba279
    BD_FS_ONLINE_SHRINK = 1 << 3,
Packit 2ba279
    BD_FS_ONLINE_GROW = 1 << 4
Packit 2ba279
} BDFsResizeFlags;
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_can_resize:
Packit 2ba279
 * @type: the filesystem type to be tested for installed resize support
Packit 2ba279
 * @mode: (out): flags for allowed resizing (i.e. growing/shrinking support for online/offline)
Packit 2ba279
 * @required_utility: (out) (transfer full): the utility binary which is required for resizing (if missing i.e. returns FALSE but no error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Searches for the required utility to resize the given filesystem and returns whether
Packit 2ba279
 * it is installed. The mode flags indicate if growing and/or shrinking resize is available if
Packit 2ba279
 * mounted/unmounted.
Packit 2ba279
 * Unknown filesystems or filesystems which do not support resizing result in errors.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether filesystem resize is available
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_can_resize (const gchar *type, BDFsResizeFlags *mode, gchar **required_utility, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_can_check:
Packit 2ba279
 * @type: the filesystem type to be tested for installed consistency check support
Packit 2ba279
 * @required_utility: (out) (transfer full): the utility binary which is required for checking (if missing i.e. returns FALSE but no error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Searches for the required utility to check the given filesystem and returns whether
Packit 2ba279
 * it is installed.
Packit 2ba279
 * Unknown filesystems or filesystems which do not support checking result in errors.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether filesystem check is available
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_can_check (const gchar *type, gchar **required_utility, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_can_repair:
Packit 2ba279
 * @type: the filesystem type to be tested for installed repair support
Packit 2ba279
 * @required_utility: (out) (transfer full): the utility binary which is required for repairing (if missing i.e. return FALSE but no error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Searches for the required utility to repair the given filesystem and returns whether
Packit 2ba279
 * it is installed.
Packit 2ba279
 * Unknown filesystems or filesystems which do not support reparing result in errors.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether filesystem repair is available
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_can_repair (const gchar *type, gchar **required_utility, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_can_set_label:
Packit 2ba279
 * @type: the filesystem type to be tested for installed label support
Packit 2ba279
 * @required_utility: (out) (transfer full): the utility binary which is required for relabeling (if missing i.e. return FALSE but no error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Searches for the required utility to set the label of the given filesystem and returns whether
Packit 2ba279
 * it is installed.
Packit 2ba279
 * Unknown filesystems or filesystems which do not support setting the label result in errors.
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether setting filesystem label is available
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_can_set_label (const gchar *type, gchar **required_utility, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_mkfs:
Packit 2ba279
 * @device: the device to create a new ext2 fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mke2fs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new ext2 fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_mkfs:
Packit 2ba279
 * @device: the device to create a new ext3 fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mke2fs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new ext3 fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_mkfs:
Packit 2ba279
 * @device: the device to create a new ext4 fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mkfs.ext4' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new ext4 fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_wipe:
Packit 2ba279
 * @device: the device to wipe an ext2 signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext2 signature was successfully wiped from the @device or
Packit 2ba279
 *          not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_wipe:
Packit 2ba279
 * @device: the device to wipe an ext3 signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext3 signature was successfully wiped from the @device or
Packit 2ba279
 *          not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_wipe:
Packit 2ba279
 * @device: the device to wipe an ext4 signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext4 signature was successfully wiped from the @device or
Packit 2ba279
 *          not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_check:
Packit 2ba279
 * @device: the device the file system on which to check
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the check (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext2 file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_check (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_check:
Packit 2ba279
 * @device: the device the file system on which to check
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the check (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext3 file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_check (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_check:
Packit 2ba279
 * @device: the device the file system on which to check
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the check (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext4 file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_check (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_repair:
Packit 2ba279
 * @device: the device the file system on which to repair
Packit 2ba279
 * @unsafe: whether to do unsafe operations too
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext2 file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_repair:
Packit 2ba279
 * @device: the device the file system on which to repair
Packit 2ba279
 * @unsafe: whether to do unsafe operations too
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext3 file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_repair:
Packit 2ba279
 * @device: the device the file system on which to repair
Packit 2ba279
 * @unsafe: whether to do unsafe operations too
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'e2fsck' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ext4 file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_set_label:
Packit 2ba279
 * @device: the device the file system on which to set label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of ext2 file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_set_label:
Packit 2ba279
 * @device: the device the file system on which to set label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of ext3 file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_set_label:
Packit 2ba279
 * @device: the device the file system on which to set label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of ext4 file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_get_info:
Packit 2ba279
 * @device: the device the file system of which to get info for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSExt2Info* bd_fs_ext2_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_get_info:
Packit 2ba279
 * @device: the device the file system of which to get info for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSExt3Info* bd_fs_ext3_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_get_info:
Packit 2ba279
 * @device: the device the file system of which to get info for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSExt4Info* bd_fs_ext4_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext2_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system (if 0, the file system is
Packit 2ba279
 *            adapted to the underlying block device)
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the resize (right now
Packit 2ba279
 *                                                 passed to the 'resize2fs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext2_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext3_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system (if 0, the file system is
Packit 2ba279
 *            adapted to the underlying block device)
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the resize (right now
Packit 2ba279
 *                                                 passed to the 'resize2fs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext3_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ext4_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system (if 0, the file system is
Packit 2ba279
 *            adapted to the underlying block device)
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the resize (right now
Packit 2ba279
 *                                                 passed to the 'resize2fs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ext4_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_mkfs:
Packit 2ba279
 * @device: the device to create a new xfs fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mkfs.xfs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new xfs fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_wipe:
Packit 2ba279
 * @device: the device to wipe an xfs signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an xfs signature was successfully wiped from the @device or
Packit 2ba279
 *          not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_check:
Packit 2ba279
 * @device: the device containing the file system to check
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an xfs file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Note: If the file system is mounted RW, it will always be reported as not
Packit 2ba279
 *       clean!
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_check (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_repair:
Packit 2ba279
 * @device: the device containing the file system to repair
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'xfs_repair' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an xfs file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_repair (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_set_label:
Packit 2ba279
 * @device: the device containing the file system to set label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of xfs file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_get_info:
Packit 2ba279
 * @device: the device containing the file system to get info for (device must
Packit 2ba279
            be mounted, trying to get info for an unmounted device will result
Packit 2ba279
            in an error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_xfs_resize:
Packit 2ba279
 * @mpoint: the mount point of the file system to resize
Packit 2ba279
 * @new_size: new requested size for the file system *in file system blocks* (see bd_fs_xfs_get_info())
Packit 2ba279
 *            (if 0, the file system is adapted to the underlying block device)
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the resize (right now
Packit 2ba279
 *                                                 passed to the 'xfs_growfs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system mounted on @mpoint was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_xfs_resize (const gchar *mpoint, guint64 new_size, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_mkfs:
Packit 2ba279
 * @device: the device to create a new vfat fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mkfs.vfat' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new vfat fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_wipe:
Packit 2ba279
 * @device: the device to wipe an vfat signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an vfat signature was successfully wiped from the @device or
Packit 2ba279
 *          not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_check:
Packit 2ba279
 * @device: the device containing the file system to check
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'fsck.vfat' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an vfat file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_check (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_repair:
Packit 2ba279
 * @device: the device containing the file system to repair
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the repair (right now
Packit 2ba279
 *                                                 passed to the 'fsck.vfat' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an vfat file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_repair (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_set_label:
Packit 2ba279
 * @device: the device containing the file system to set label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of vfat file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_get_info:
Packit 2ba279
 * @device: the device containing the file system to get info for
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSVfatInfo* bd_fs_vfat_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_vfat_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system (if 0, the file system is
Packit 2ba279
 *            adapted to the underlying block device)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_vfat_resize (const gchar *device, guint64 new_size, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_mkfs:
Packit 2ba279
 * @device: the device to create a new ntfs fs on
Packit 2ba279
 * @extra: (allow-none) (array zero-terminated=1): extra options for the creation (right now
Packit 2ba279
 *                                                 passed to the 'mkntfs' utility)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether a new NTFS fs was successfully created on @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_MKFS
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_wipe:
Packit 2ba279
 * @device: the device to wipe an ntfs signature from
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ntfs signature was successfully wiped from the @device or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_WIPE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_wipe (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_check:
Packit 2ba279
 * @device: the device containing the file system to check
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an ntfs file system on the @device is clean or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_CHECK
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_check (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_repair:
Packit 2ba279
 * @device: the device containing the file system to repair
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether an NTFS file system on the @device was successfully repaired
Packit 2ba279
 *          (if needed) or not (error is set in that case)
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_REPAIR
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_repair (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_set_label:
Packit 2ba279
 * @device: the device containing the file system to set the label for
Packit 2ba279
 * @label: label to set
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the label of the NTFS file system on the @device was
Packit 2ba279
 *          successfully set or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_SET_LABEL
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_set_label (const gchar *device, const gchar *label, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_resize:
Packit 2ba279
 * @device: the device the file system of which to resize
Packit 2ba279
 * @new_size: new requested size for the file system in bytes (if 0, the file system
Packit 2ba279
 *            is adapted to the underlying block device)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: whether the file system on @device was successfully resized or not
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_RESIZE
Packit 2ba279
 */
Packit 2ba279
gboolean bd_fs_ntfs_resize (const gchar *device, guint64 new_size, GError **error);
Packit 2ba279
Packit 2ba279
/**
Packit 2ba279
 * bd_fs_ntfs_get_info:
Packit 2ba279
 * @device: the device containing the file system to get info for (device must
Packit 2ba279
            not be mounted, trying to get info for a mounted device will result
Packit 2ba279
            in an error)
Packit 2ba279
 * @error: (out): place to store error (if any)
Packit 2ba279
 *
Packit 2ba279
 * Returns: (transfer full): information about the file system on @device or
Packit 2ba279
 *                           %NULL in case of error
Packit 2ba279
 *
Packit 2ba279
 * Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_QUERY
Packit 2ba279
 */
Packit 2ba279
BDFSNtfsInfo* bd_fs_ntfs_get_info (const gchar *device, GError **error);
Packit 2ba279
Packit 2ba279
#endif  /* BD_FS_API */