![]() |
![]() |
![]() |
libblockdev Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <btrfs.h> #define BD_BTRFS_MAIN_VOLUME_ID #define BD_BTRFS_MIN_MEMBER_SIZE GQuark bd_btrfs_error_quark (void
); #define BD_BTRFS_ERROR enum BDBtrfsError; BDBtrfsDeviceInfo; void bd_btrfs_device_info_free (BDBtrfsDeviceInfo *info
); BDBtrfsDeviceInfo * bd_btrfs_device_info_copy (BDBtrfsDeviceInfo *info
); BDBtrfsSubvolumeInfo; void bd_btrfs_subvolume_info_free (BDBtrfsSubvolumeInfo *info
); BDBtrfsSubvolumeInfo * bd_btrfs_subvolume_info_copy (BDBtrfsSubvolumeInfo *info
); BDBtrfsFilesystemInfo; void bd_btrfs_filesystem_info_free (BDBtrfsFilesystemInfo *info
); BDBtrfsFilesystemInfo * bd_btrfs_filesystem_info_copy (BDBtrfsFilesystemInfo *info
); gboolean bd_btrfs_create_volume (gchar **devices
,gchar *label
,gchar *data_level
,gchar *md_level
,GError **error
); gboolean bd_btrfs_add_device (gchar *mountpoint
,gchar *device
,GError **error
); gboolean bd_btrfs_remove_device (gchar *mountpoint
,gchar *device
,GError **error
); gboolean bd_btrfs_create_subvolume (gchar *mountpoint
,gchar *name
,GError **error
); gboolean bd_btrfs_delete_subvolume (gchar *mountpoint
,gchar *name
,GError **error
); guint64 bd_btrfs_get_default_subvolume_id (gchar *mountpoint
,GError **error
); gboolean bd_btrfs_set_default_subvolume (gchar *mountpoint
,guint64 subvol_id
,GError **error
); gboolean bd_btrfs_create_snapshot (gchar *source
,gchar *dest
,gboolean ro
,GError **error
); BDBtrfsDeviceInfo ** bd_btrfs_list_devices (gchar *device
,GError **error
); BDBtrfsSubvolumeInfo ** bd_btrfs_list_subvolumes (gchar *mountpoint
,gboolean snapshots_only
,GError **error
); BDBtrfsFilesystemInfo * bd_btrfs_filesystem_info (gchar *device
,GError **error
); gboolean bd_btrfs_mkfs (gchar **devices
,gchar *label
,gchar *data_level
,gchar *md_level
,GError **error
); gboolean bd_btrfs_resize (gchar *mountpoint
,guint64 size
,GError **error
); gboolean bd_btrfs_check (gchar *device
,GError **error
); gboolean bd_btrfs_repair (gchar *device
,GError **error
); gboolean bd_btrfs_change_label (gchar *mountpoint
,gchar *label
,GError **error
);
typedef struct { guint64 id; gchar *path; guint64 size; guint64 used; } BDBtrfsDeviceInfo;
BDBtrfsDeviceInfo * bd_btrfs_device_info_copy (BDBtrfsDeviceInfo *info
);
Creates a new copy of info
.
typedef struct { guint64 id; guint64 parent_id; gchar *path; } BDBtrfsSubvolumeInfo;
void bd_btrfs_subvolume_info_free (BDBtrfsSubvolumeInfo *info
);
Frees info
.
BDBtrfsSubvolumeInfo * bd_btrfs_subvolume_info_copy (BDBtrfsSubvolumeInfo *info
);
Creates a new copy of info
.
typedef struct { gchar *label; gchar *uuid; guint64 num_devices; guint64 used; } BDBtrfsFilesystemInfo;
void bd_btrfs_filesystem_info_free (BDBtrfsFilesystemInfo *info
);
Frees info
.
BDBtrfsFilesystemInfo * bd_btrfs_filesystem_info_copy (BDBtrfsFilesystemInfo *info
);
Creates a new copy of info
.
gboolean bd_btrfs_create_volume (gchar **devices
,gchar *label
,gchar *data_level
,gchar *md_level
,GError **error
);
|
list of devices to create btrfs volume from. [array zero-terminated=1] |
|
label for the volume. [allow-none] |
|
RAID level for the data or NULL to use the default. [allow-none]
|
|
RAID level for the metadata or NULL to use the default. [allow-none]
|
|
place to store error (if any). [out] |
Returns : |
whether the new btrfs volume was created from devices or not
See mkfs.btrfs(8) for details about data_level , md_level and btrfs in general. |
gboolean bd_btrfs_add_device (gchar *mountpoint
,gchar *device
,GError **error
);
|
mountpoint of the btrfs volume to add new device to |
|
a device to add to the btrfs volume |
|
place to store error (if any). [out] |
Returns : |
whether the device was successfully added to the mountpoint btrfs volume or not |
gboolean bd_btrfs_remove_device (gchar *mountpoint
,gchar *device
,GError **error
);
|
mountpoint of the btrfs volume to remove device from |
|
a device to remove from the btrfs volume |
|
place to store error (if any). [out] |
Returns : |
whether the device was successfully removed from the mountpoint btrfs volume or not |
gboolean bd_btrfs_create_subvolume (gchar *mountpoint
,gchar *name
,GError **error
);
|
mountpoint of the btrfs volume to create subvolume under |
|
name of the subvolume |
|
place to store error (if any). [out] |
Returns : |
whether the mountpoint /name subvolume was successfully created or not |
gboolean bd_btrfs_delete_subvolume (gchar *mountpoint
,gchar *name
,GError **error
);
|
mountpoint of the btrfs volume to delete subvolume from |
|
name of the subvolume |
|
place to store error (if any). [out] |
Returns : |
whether the mountpoint /name subvolume was successfully deleted or not |
guint64 bd_btrfs_get_default_subvolume_id (gchar *mountpoint
,GError **error
);
|
mountpoint of the volume to get the default subvolume ID of |
|
place to store error (if any). [out] |
Returns : |
ID of the mountpoint volume's default subvolume. If 0,
error ) may be set to indicate error |
gboolean bd_btrfs_set_default_subvolume (gchar *mountpoint
,guint64 subvol_id
,GError **error
);
|
mountpoint of the volume to set the default subvolume ID of |
|
ID of the subvolume to be set as the default subvolume |
|
place to store error (if any). [out] |
Returns : |
whether the mountpoint volume's default subvolume was correctly set
to subvol_id or not |
gboolean bd_btrfs_create_snapshot (gchar *source
,gchar *dest
,gboolean ro
,GError **error
);
|
path to source subvolume |
|
path to new snapshot volume |
|
whether the snapshot should be read-only |
|
place to store error (if any). [out] |
Returns : |
whether the dest snapshot of source was successfully created or not |
BDBtrfsDeviceInfo ** bd_btrfs_list_devices (gchar *device
,GError **error
);
|
a device that is part of the queried btrfs volume |
|
place to store error (if any). [out] |
Returns : |
information about the devices that are part of the btrfs volume
containing device or NULL in case of error. [array zero-terminated=1]
|
BDBtrfsSubvolumeInfo ** bd_btrfs_list_subvolumes (gchar *mountpoint
,gboolean snapshots_only
,GError **error
);
|
a mountpoint of the queried btrfs volume |
|
whether to list only snapshot subvolumes or not |
|
place to store error (if any). [out] |
Returns : |
information about the subvolumes that are part of the btrfs volume
mounted at mountpoint or NULL in case of error
The subvolumes are sorted in a way that no child subvolume appears in the
list before its parent (sub)volume. [array zero-terminated=1]
|
BDBtrfsFilesystemInfo * bd_btrfs_filesystem_info (gchar *device
,GError **error
);
|
a device that is part of the queried btrfs volume |
|
place to store error (if any). [out] |
Returns : |
information about the device 's volume's filesystem or NULL in case of error |
gboolean bd_btrfs_mkfs (gchar **devices
,gchar *label
,gchar *data_level
,gchar *md_level
,GError **error
);
|
list of devices to create btrfs volume from. [array zero-terminated=1] |
|
label for the volume. [allow-none] |
|
RAID level for the data or NULL to use the default. [allow-none]
|
|
RAID level for the metadata or NULL to use the default. [allow-none]
|
|
place to store error (if any). [out] |
Returns : |
whether the new btrfs volume was created from devices or not
See mkfs.btrfs(8) for details about data_level , md_level and btrfs in general. |
gboolean bd_btrfs_resize (gchar *mountpoint
,guint64 size
,GError **error
);
|
a mountpoint of the to be resized btrfs filesystem |
|
requested new size |
|
place to store error (if any). [out] |
Returns : |
whether the mountpoint filesystem was successfully resized to size
or not |
gboolean bd_btrfs_check (gchar *device
,GError **error
);
|
a device that is part of the checked btrfs volume |
|
place to store error (if any). [out] |
Returns : |
whether the filesystem was successfully checked or not |
gboolean bd_btrfs_repair (gchar *device
,GError **error
);
|
a device that is part of the to be repaired btrfs volume |
|
place to store error (if any). [out] |
Returns : |
whether the filesystem was successfully checked and repaired or not |
gboolean bd_btrfs_change_label (gchar *mountpoint
,gchar *label
,GError **error
);
|
a mountpoint of the btrfs filesystem to change label of |
|
new label for the filesystem |
|
place to store error (if any). [out] |
Returns : |
whether the label of the mountpoint filesystem was successfully set
to label or not |