| 1 |
#include <glib.h> |
| 2 |
#include <glib-object.h> |
| 3 |
#include <blockdev/utils.h> |
| 4 |
|
| 5 |
#ifndef BD_FS_API |
| 6 |
#define BD_FS_API |
| 7 |
|
| 8 |
GQuark bd_fs_error_quark (void) { |
| 9 |
return g_quark_from_static_string ("g-bd-fs-error-quark"); |
| 10 |
} |
| 11 |
|
| 12 |
#define BD_FS_ERROR bd_fs_error_quark () |
| 13 |
typedef enum { |
| 14 |
BD_FS_ERROR_TECH_UNAVAIL, |
| 15 |
BD_FS_ERROR_INVAL, |
| 16 |
BD_FS_ERROR_PARSE, |
| 17 |
BD_FS_ERROR_FAIL, |
| 18 |
BD_FS_ERROR_NOFS, |
| 19 |
BD_FS_ERROR_PIPE, |
| 20 |
BD_FS_ERROR_UNMOUNT_FAIL, |
| 21 |
BD_FS_ERROR_NOT_SUPPORTED, |
| 22 |
BD_FS_ERROR_NOT_MOUNTED, |
| 23 |
BD_FS_ERROR_AUTH, |
| 24 |
BD_FS_ERROR_LABEL_INVALID, |
| 25 |
BD_FS_ERROR_UUID_INVALID, |
| 26 |
BD_FS_ERROR_UNKNOWN_FS, |
| 27 |
} BDFSError; |
| 28 |
|
| 29 |
/** |
| 30 |
* BDFSMkfsOptions: |
| 31 |
* @label: label of the filesystem |
| 32 |
* @uuid: uuid of the filesystem |
| 33 |
* @dry_run: whether to run mkfs in dry run mode (no changes written to the device) |
| 34 |
* @no_discard: whether to avoid discarding blocks at mkfs time |
| 35 |
* @force: whether to run mkfs with the `--force` (or similar) option, the behaviour of this |
| 36 |
* option depends on the filesystem, but in general it allows overwriting other |
| 37 |
* preexisting formats detected on the device |
| 38 |
* @no_pt: whether to disable (protective) partition table creation during mkfs |
| 39 |
* @reserve: reserve for future expansion |
| 40 |
*/ |
| 41 |
typedef struct BDFSMkfsOptions { |
| 42 |
const gchar *label; |
| 43 |
const gchar *uuid; |
| 44 |
gboolean dry_run; |
| 45 |
gboolean no_discard; |
| 46 |
gboolean force; |
| 47 |
gboolean no_pt; |
| 48 |
guint8 reserve[32]; |
| 49 |
} BDFSMkfsOptions; |
| 50 |
|
| 51 |
/** |
| 52 |
* bd_fs_mkfs_options_copy: (skip) |
| 53 |
* @data: (nullable): %BDFSMkfsOptions to copy |
| 54 |
* |
| 55 |
* Creates a new copy of @data. |
| 56 |
*/ |
| 57 |
BDFSMkfsOptions* bd_fs_mkfs_options_copy (BDFSMkfsOptions *data) { |
| 58 |
if (data == NULL) |
| 59 |
return NULL; |
| 60 |
|
| 61 |
BDFSMkfsOptions *ret = g_new0 (BDFSMkfsOptions, 1); |
| 62 |
|
| 63 |
ret->label = data->label; |
| 64 |
ret->uuid = data->uuid; |
| 65 |
ret->dry_run = data->dry_run; |
| 66 |
ret->no_discard = data->no_discard; |
| 67 |
ret->force = data->force; |
| 68 |
ret->no_pt = data->no_pt; |
| 69 |
|
| 70 |
return ret; |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* bd_fs_mkfs_options_free: (skip) |
| 75 |
* @data: (nullable): %BDFSMkfsOptions to free |
| 76 |
* |
| 77 |
* Frees @data. |
| 78 |
*/ |
| 79 |
void bd_fs_mkfs_options_free (BDFSMkfsOptions *data) { |
| 80 |
if (data == NULL) |
| 81 |
return; |
| 82 |
|
| 83 |
g_free (data); |
| 84 |
} |
| 85 |
|
| 86 |
#define BD_FS_TYPE_MKFS_OPTIONS (bd_fs_mkfs_options_get_type ()) |
| 87 |
|
| 88 |
GType bd_fs_mkfs_options_get_type () { |
| 89 |
static GType type = 0; |
| 90 |
|
| 91 |
if (G_UNLIKELY(type == 0)) { |
| 92 |
type = g_boxed_type_register_static("BDFSMkfsOptions", |
| 93 |
(GBoxedCopyFunc) bd_fs_mkfs_options_copy, |
| 94 |
(GBoxedFreeFunc) bd_fs_mkfs_options_free); |
| 95 |
} |
| 96 |
|
| 97 |
return type; |
| 98 |
} |
| 99 |
|
| 100 |
#define BD_FS_TYPE_EXT2_INFO (bd_fs_ext2_info_get_type ()) |
| 101 |
GType bd_fs_ext2_info_get_type(); |
| 102 |
#define BD_FS_TYPE_EXT3_INFO (bd_fs_ext3_info_get_type ()) |
| 103 |
GType bd_fs_ext3_info_get_type(); |
| 104 |
#define BD_FS_TYPE_EXT4_INFO (bd_fs_ext4_info_get_type ()) |
| 105 |
GType bd_fs_ext4_info_get_type(); |
| 106 |
|
| 107 |
/** |
| 108 |
* BDFSExtInfo: |
| 109 |
* @label: label of the filesystem |
| 110 |
* @uuid: uuid of the filesystem |
| 111 |
* @state: state of the filesystem (e.g. "clean") |
| 112 |
* @block_size: block size used by the filesystem |
| 113 |
* @block_count: number of blocks in the filesystem |
| 114 |
* @free_blocks: number of free blocks in the filesystem |
| 115 |
*/ |
| 116 |
typedef struct BDFSExtInfo { |
| 117 |
gchar *label; |
| 118 |
gchar *uuid; |
| 119 |
gchar *state; |
| 120 |
guint64 block_size; |
| 121 |
guint64 block_count; |
| 122 |
guint64 free_blocks; |
| 123 |
} BDFSExtInfo; |
| 124 |
|
| 125 |
typedef struct BDFSExtInfo BDFSExt4Info; |
| 126 |
typedef struct BDFSExtInfo BDFSExt3Info; |
| 127 |
typedef struct BDFSExtInfo BDFSExt2Info; |
| 128 |
|
| 129 |
/** |
| 130 |
* bd_fs_ext2_info_copy: (skip) |
| 131 |
* @data: (nullable): %BDFSExt2Info to copy |
| 132 |
* |
| 133 |
* Creates a new copy of @data. |
| 134 |
*/ |
| 135 |
BDFSExt2Info* bd_fs_ext2_info_copy (BDFSExt2Info *data) { |
| 136 |
if (data == NULL) |
| 137 |
return NULL; |
| 138 |
|
| 139 |
BDFSExt2Info *ret = g_new0 (BDFSExt2Info, 1); |
| 140 |
|
| 141 |
ret->label = g_strdup (data->label); |
| 142 |
ret->uuid = g_strdup (data->uuid); |
| 143 |
ret->state = g_strdup (data->state); |
| 144 |
ret->block_size = data->block_size; |
| 145 |
ret->block_count = data->block_count; |
| 146 |
ret->free_blocks = data->free_blocks; |
| 147 |
|
| 148 |
return ret; |
| 149 |
} |
| 150 |
|
| 151 |
/** |
| 152 |
* bd_fs_ext3_info_copy: (skip) |
| 153 |
* @data: (nullable): %BDFSExt3Info to copy |
| 154 |
* |
| 155 |
* Creates a new copy of @data. |
| 156 |
*/ |
| 157 |
BDFSExt3Info* bd_fs_ext3_info_copy (BDFSExt3Info *data) { |
| 158 |
return (BDFSExt3Info*) bd_fs_ext2_info_copy (data); |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* bd_fs_ext4_info_copy: (skip) |
| 163 |
* @data: (nullable): %BDFSExt4Info to copy |
| 164 |
* |
| 165 |
* Creates a new copy of @data. |
| 166 |
*/ |
| 167 |
BDFSExt4Info* bd_fs_ext4_info_copy (BDFSExt4Info *data) { |
| 168 |
return (BDFSExt4Info*) bd_fs_ext2_info_copy (data); |
| 169 |
}; |
| 170 |
|
| 171 |
/** |
| 172 |
* bd_fs_ext2_info_free: (skip) |
| 173 |
* @data: (nullable): %BDFSExt2Info to free |
| 174 |
* |
| 175 |
* Frees @data. |
| 176 |
*/ |
| 177 |
void bd_fs_ext2_info_free (BDFSExt2Info *data) { |
| 178 |
if (data == NULL) |
| 179 |
return; |
| 180 |
|
| 181 |
g_free (data->label); |
| 182 |
g_free (data->uuid); |
| 183 |
g_free (data->state); |
| 184 |
g_free (data); |
| 185 |
} |
| 186 |
|
| 187 |
/** |
| 188 |
* bd_fs_ext3_info_free: (skip) |
| 189 |
* @data: (nullable): %BDFSExt3Info to free |
| 190 |
* |
| 191 |
* Frees @data. |
| 192 |
*/ |
| 193 |
void bd_fs_ext3_info_free (BDFSExt3Info *data) { |
| 194 |
bd_fs_ext2_info_free ((BDFSExt2Info*) data); |
| 195 |
} |
| 196 |
|
| 197 |
/** |
| 198 |
* bd_fs_ext4_info_free: (skip) |
| 199 |
* @data: (nullable): %BDFSExt4Info to free |
| 200 |
* |
| 201 |
* Frees @data. |
| 202 |
*/ |
| 203 |
void bd_fs_ext4_info_free (BDFSExt4Info *data) { |
| 204 |
bd_fs_ext2_info_free ((BDFSExt2Info*) data); |
| 205 |
} |
| 206 |
|
| 207 |
GType bd_fs_ext2_info_get_type () { |
| 208 |
static GType type = 0; |
| 209 |
|
| 210 |
if (G_UNLIKELY(type == 0)) { |
| 211 |
type = g_boxed_type_register_static("BDFSExt2Info", |
| 212 |
(GBoxedCopyFunc) bd_fs_ext2_info_copy, |
| 213 |
(GBoxedFreeFunc) bd_fs_ext2_info_free); |
| 214 |
} |
| 215 |
|
| 216 |
return type; |
| 217 |
} |
| 218 |
|
| 219 |
GType bd_fs_ext3_info_get_type () { |
| 220 |
static GType type = 0; |
| 221 |
|
| 222 |
if (G_UNLIKELY(type == 0)) { |
| 223 |
type = g_boxed_type_register_static("BDFSExt3Info", |
| 224 |
(GBoxedCopyFunc) bd_fs_ext3_info_copy, |
| 225 |
(GBoxedFreeFunc) bd_fs_ext3_info_free); |
| 226 |
} |
| 227 |
|
| 228 |
return type; |
| 229 |
} |
| 230 |
|
| 231 |
GType bd_fs_ext4_info_get_type () { |
| 232 |
static GType type = 0; |
| 233 |
|
| 234 |
if (G_UNLIKELY(type == 0)) { |
| 235 |
type = g_boxed_type_register_static("BDFSExt4Info", |
| 236 |
(GBoxedCopyFunc) bd_fs_ext4_info_copy, |
| 237 |
(GBoxedFreeFunc) bd_fs_ext4_info_free); |
| 238 |
} |
| 239 |
|
| 240 |
return type; |
| 241 |
} |
| 242 |
|
| 243 |
#define BD_FS_TYPE_XFS_INFO (bd_fs_xfs_info_get_type ()) |
| 244 |
GType bd_fs_xfs_info_get_type(); |
| 245 |
|
| 246 |
/** |
| 247 |
* BDFSXfsInfo: |
| 248 |
* @label: label of the filesystem |
| 249 |
* @uuid: uuid of the filesystem |
| 250 |
* @block_size: block size used by the filesystem |
| 251 |
* @block_count: number of blocks in the filesystem |
| 252 |
*/ |
| 253 |
typedef struct BDFSXfsInfo { |
| 254 |
gchar *label; |
| 255 |
gchar *uuid; |
| 256 |
guint64 block_size; |
| 257 |
guint64 block_count; |
| 258 |
} BDFSXfsInfo; |
| 259 |
|
| 260 |
/** |
| 261 |
* bd_fs_xfs_info_copy: (skip) |
| 262 |
* @data: (nullable): %BDFSXfsInfo to copy |
| 263 |
* |
| 264 |
* Creates a new copy of @data. |
| 265 |
*/ |
| 266 |
BDFSXfsInfo* bd_fs_xfs_info_copy (BDFSXfsInfo *data) { |
| 267 |
if (data == NULL) |
| 268 |
return NULL; |
| 269 |
|
| 270 |
BDFSXfsInfo *ret = g_new0 (BDFSXfsInfo, 1); |
| 271 |
|
| 272 |
ret->label = g_strdup (data->label); |
| 273 |
ret->uuid = g_strdup (data->uuid); |
| 274 |
ret->block_size = data->block_size; |
| 275 |
ret->block_count = data->block_count; |
| 276 |
|
| 277 |
return ret; |
| 278 |
} |
| 279 |
|
| 280 |
/** |
| 281 |
* bd_fs_xfs_info_free: (skip) |
| 282 |
* @data: (nullable): %BDFSXfsInfo to free |
| 283 |
* |
| 284 |
* Frees @data. |
| 285 |
*/ |
| 286 |
void bd_fs_xfs_info_free (BDFSXfsInfo *data) { |
| 287 |
if (data == NULL) |
| 288 |
return; |
| 289 |
|
| 290 |
g_free (data->label); |
| 291 |
g_free (data->uuid); |
| 292 |
g_free (data); |
| 293 |
} |
| 294 |
|
| 295 |
GType bd_fs_xfs_info_get_type () { |
| 296 |
static GType type = 0; |
| 297 |
|
| 298 |
if (G_UNLIKELY(type == 0)) { |
| 299 |
type = g_boxed_type_register_static("BDFSXfsInfo", |
| 300 |
(GBoxedCopyFunc) bd_fs_xfs_info_copy, |
| 301 |
(GBoxedFreeFunc) bd_fs_xfs_info_free); |
| 302 |
} |
| 303 |
|
| 304 |
return type; |
| 305 |
} |
| 306 |
|
| 307 |
#define BD_FS_TYPE_VFAT_INFO (bd_fs_vfat_info_get_type ()) |
| 308 |
GType bd_fs_vfat_info_get_type(); |
| 309 |
|
| 310 |
/** |
| 311 |
* BDFSVfatInfo: |
| 312 |
* @label: label of the filesystem |
| 313 |
* @uuid: uuid of the filesystem |
| 314 |
* @cluster_size: cluster size used by the filesystem |
| 315 |
* @cluster_count: number of clusters in the filesystem |
| 316 |
* @free_cluster_count: number of free clusters in the filesystem |
| 317 |
*/ |
| 318 |
typedef struct BDFSVfatInfo { |
| 319 |
gchar *label; |
| 320 |
gchar *uuid; |
| 321 |
guint64 cluster_size; |
| 322 |
guint64 cluster_count; |
| 323 |
guint64 free_cluster_count; |
| 324 |
} BDFSVfatInfo; |
| 325 |
|
| 326 |
/** |
| 327 |
* bd_fs_vfat_info_copy: (skip) |
| 328 |
* @data: (nullable): %BDFSVfatInfo to copy |
| 329 |
* |
| 330 |
* Creates a new copy of @data. |
| 331 |
*/ |
| 332 |
BDFSVfatInfo* bd_fs_vfat_info_copy (BDFSVfatInfo *data) { |
| 333 |
if (data == NULL) |
| 334 |
return NULL; |
| 335 |
|
| 336 |
BDFSVfatInfo *ret = g_new0 (BDFSVfatInfo, 1); |
| 337 |
|
| 338 |
ret->label = g_strdup (data->label); |
| 339 |
ret->uuid = g_strdup (data->uuid); |
| 340 |
ret->cluster_size = data->cluster_size; |
| 341 |
ret->cluster_count = data->cluster_count; |
| 342 |
ret->free_cluster_count = data->free_cluster_count; |
| 343 |
|
| 344 |
return ret; |
| 345 |
} |
| 346 |
|
| 347 |
/** |
| 348 |
* bd_fs_vfat_info_free: (skip) |
| 349 |
* @data: (nullable): %BDFSVfatInfo to free |
| 350 |
* |
| 351 |
* Frees @data. |
| 352 |
*/ |
| 353 |
void bd_fs_vfat_info_free (BDFSVfatInfo *data) { |
| 354 |
if (data == NULL) |
| 355 |
return; |
| 356 |
|
| 357 |
g_free (data->label); |
| 358 |
g_free (data->uuid); |
| 359 |
g_free (data); |
| 360 |
} |
| 361 |
|
| 362 |
GType bd_fs_vfat_info_get_type () { |
| 363 |
static GType type = 0; |
| 364 |
|
| 365 |
if (G_UNLIKELY(type == 0)) { |
| 366 |
type = g_boxed_type_register_static("BDFSVfatInfo", |
| 367 |
(GBoxedCopyFunc) bd_fs_vfat_info_copy, |
| 368 |
(GBoxedFreeFunc) bd_fs_vfat_info_free); |
| 369 |
} |
| 370 |
|
| 371 |
return type; |
| 372 |
} |
| 373 |
|
| 374 |
/** |
| 375 |
* BDFSNtfsInfo: |
| 376 |
* @label: label of the filesystem |
| 377 |
* @uuid: uuid of the filesystem |
| 378 |
* @size: size of the filesystem in bytes |
| 379 |
* @free_space: number of free space in the filesystem in bytes |
| 380 |
*/ |
| 381 |
typedef struct BDFSNtfsInfo { |
| 382 |
gchar *label; |
| 383 |
gchar *uuid; |
| 384 |
guint64 size; |
| 385 |
guint64 free_space; |
| 386 |
} BDFSNtfsInfo; |
| 387 |
|
| 388 |
/** |
| 389 |
* bd_fs_ntfs_info_copy: (skip) |
| 390 |
* @data: (nullable): %BDFSNtfsInfo to copy |
| 391 |
* |
| 392 |
* Creates a new copy of @data. |
| 393 |
*/ |
| 394 |
BDFSNtfsInfo* bd_fs_ntfs_info_copy (BDFSNtfsInfo *data) { |
| 395 |
if (data == NULL) |
| 396 |
return NULL; |
| 397 |
|
| 398 |
BDFSNtfsInfo *ret = g_new0 (BDFSNtfsInfo, 1); |
| 399 |
|
| 400 |
ret->label = g_strdup (data->label); |
| 401 |
ret->uuid = g_strdup (data->uuid); |
| 402 |
ret->size = data->size; |
| 403 |
ret->free_space = data->free_space; |
| 404 |
|
| 405 |
return ret; |
| 406 |
} |
| 407 |
|
| 408 |
/** |
| 409 |
* bd_fs_ntfs_info_free: (skip) |
| 410 |
* @data: (nullable): %BDFSNtfsInfo to free |
| 411 |
* |
| 412 |
* Frees @data. |
| 413 |
*/ |
| 414 |
void bd_fs_ntfs_info_free (BDFSNtfsInfo *data) { |
| 415 |
if (data == NULL) |
| 416 |
return; |
| 417 |
|
| 418 |
g_free (data->label); |
| 419 |
g_free (data->uuid); |
| 420 |
g_free (data); |
| 421 |
} |
| 422 |
|
| 423 |
GType bd_fs_ntfs_info_get_type () { |
| 424 |
static GType type = 0; |
| 425 |
|
| 426 |
if (G_UNLIKELY(type == 0)) { |
| 427 |
type = g_boxed_type_register_static("BDFSNtfsInfo", |
| 428 |
(GBoxedCopyFunc) bd_fs_ntfs_info_copy, |
| 429 |
(GBoxedFreeFunc) bd_fs_ntfs_info_free); |
| 430 |
} |
| 431 |
|
| 432 |
return type; |
| 433 |
} |
| 434 |
|
| 435 |
#define BD_FS_TYPE_F2FS_INFO (bd_fs_f2fs_info_get_type ()) |
| 436 |
GType bd_fs_f2fs_info_get_type(); |
| 437 |
|
| 438 |
/** |
| 439 |
* BDFSF2FSInfo: |
| 440 |
* @label: label of the filesystem |
| 441 |
* @uuid: uuid of the filesystem |
| 442 |
* @sector_size: sector size used by the filesystem |
| 443 |
* @sector_count: number of sectors in the filesystem |
| 444 |
* @features: features enabled for this filesystem, see #BDFSF2FSFeature |
| 445 |
*/ |
| 446 |
typedef struct BDFSF2FSInfo { |
| 447 |
gchar *label; |
| 448 |
gchar *uuid; |
| 449 |
guint64 sector_size; |
| 450 |
guint64 sector_count; |
| 451 |
guint64 features; |
| 452 |
} BDFSF2FSInfo; |
| 453 |
|
| 454 |
/** |
| 455 |
* bd_fs_f2fs_info_copy: (skip) |
| 456 |
* @data: (nullable): %BDFSF2FSInfo to copy |
| 457 |
* |
| 458 |
* Creates a new copy of @data. |
| 459 |
*/ |
| 460 |
BDFSF2FSInfo* bd_fs_f2fs_info_copy (BDFSF2FSInfo *data) { |
| 461 |
if (data == NULL) |
| 462 |
return NULL; |
| 463 |
|
| 464 |
BDFSF2FSInfo *ret = g_new0 (BDFSF2FSInfo, 1); |
| 465 |
|
| 466 |
ret->label = g_strdup (data->label); |
| 467 |
ret->uuid = g_strdup (data->uuid); |
| 468 |
ret->sector_size = data->sector_size; |
| 469 |
ret->sector_count = data->sector_count; |
| 470 |
ret->features = data->features; |
| 471 |
|
| 472 |
return ret; |
| 473 |
} |
| 474 |
|
| 475 |
/** |
| 476 |
* bd_fs_f2fs_info_free: (skip) |
| 477 |
* @data: (nullable): %BDFSF2FSInfo to free |
| 478 |
* |
| 479 |
* Frees @data. |
| 480 |
*/ |
| 481 |
void bd_fs_f2fs_info_free (BDFSF2FSInfo *data) { |
| 482 |
if (data == NULL) |
| 483 |
return; |
| 484 |
|
| 485 |
g_free (data->label); |
| 486 |
g_free (data->uuid); |
| 487 |
g_free (data); |
| 488 |
} |
| 489 |
|
| 490 |
GType bd_fs_f2fs_info_get_type () { |
| 491 |
static GType type = 0; |
| 492 |
|
| 493 |
if (G_UNLIKELY(type == 0)) { |
| 494 |
type = g_boxed_type_register_static("BDFSF2FSInfo", |
| 495 |
(GBoxedCopyFunc) bd_fs_f2fs_info_copy, |
| 496 |
(GBoxedFreeFunc) bd_fs_f2fs_info_free); |
| 497 |
} |
| 498 |
|
| 499 |
return type; |
| 500 |
} |
| 501 |
|
| 502 |
typedef enum { |
| 503 |
BD_FS_F2FS_FEATURE_ENCRYPT = 1 << 0, |
| 504 |
BD_FS_F2FS_FEATURE_BLKZONED = 1 << 1, |
| 505 |
BD_FS_F2FS_FEATURE_ATOMIC_WRITE = 1 << 2, |
| 506 |
BD_FS_F2FS_FEATURE_EXTRA_ATTR = 1 << 3, |
| 507 |
BD_FS_F2FS_FEATURE_PRJQUOTA = 1 << 4, |
| 508 |
BD_FS_F2FS_FEATURE_INODE_CHKSUM = 1 << 5, |
| 509 |
BD_FS_F2FS_FEATURE_FLEXIBLE_INLINE_XATTR = 1 << 6, |
| 510 |
BD_FS_F2FS_FEATURE_QUOTA_INO = 1 << 7, |
| 511 |
BD_FS_F2FS_FEATURE_INODE_CRTIME = 1 << 8, |
| 512 |
BD_FS_F2FS_FEATURE_LOST_FOUND = 1 << 9, |
| 513 |
BD_FS_F2FS_FEATURE_VERITY = 1 << 10, |
| 514 |
BD_FS_F2FS_FEATURE_SB_CHKSUM = 1 << 11, |
| 515 |
} BDFSF2FSFeature; |
| 516 |
|
| 517 |
typedef enum { |
| 518 |
BD_FS_TECH_GENERIC = 0, |
| 519 |
BD_FS_TECH_MOUNT, |
| 520 |
BD_FS_TECH_EXT2, |
| 521 |
BD_FS_TECH_EXT3, |
| 522 |
BD_FS_TECH_EXT4, |
| 523 |
BD_FS_TECH_XFS, |
| 524 |
BD_FS_TECH_VFAT, |
| 525 |
BD_FS_TECH_NTFS, |
| 526 |
BD_FS_TECH_F2FS, |
| 527 |
BD_FS_TECH_NILFS2, |
| 528 |
BD_FS_TECH_EXFAT, |
| 529 |
BD_FS_TECH_BTRFS, |
| 530 |
BD_FS_TECH_UDF, |
| 531 |
} BDFSTech; |
| 532 |
|
| 533 |
typedef enum { |
| 534 |
BD_FS_TECH_MODE_MKFS = 1 << 0, |
| 535 |
BD_FS_TECH_MODE_WIPE = 1 << 1, |
| 536 |
BD_FS_TECH_MODE_CHECK = 1 << 2, |
| 537 |
BD_FS_TECH_MODE_REPAIR = 1 << 3, |
| 538 |
BD_FS_TECH_MODE_SET_LABEL = 1 << 4, |
| 539 |
BD_FS_TECH_MODE_QUERY = 1 << 5, |
| 540 |
BD_FS_TECH_MODE_RESIZE = 1 << 6, |
| 541 |
BD_FS_TECH_MODE_SET_UUID = 1 << 7, |
| 542 |
} BDFSTechMode; |
| 543 |
|
| 544 |
#define BD_FS_TYPE_NILFS_INFO (bd_fs_nilfs2_info_get_type ()) |
| 545 |
GType bd_fs_nilfs2_info_get_type(); |
| 546 |
|
| 547 |
/** |
| 548 |
* BDFSNILFS2Info: |
| 549 |
* @label: label of the filesystem |
| 550 |
* @uuid: uuid of the filesystem |
| 551 |
* @block_size: block size used by the filesystem |
| 552 |
* @size: size of the filesystem |
| 553 |
* @free_blocks: number of free blocks in the filesystem |
| 554 |
*/ |
| 555 |
typedef struct BDFSNILFS2Info { |
| 556 |
gchar *label; |
| 557 |
gchar *uuid; |
| 558 |
guint64 size; |
| 559 |
guint64 block_size; |
| 560 |
guint64 free_blocks; |
| 561 |
} BDFSNILFS2Info; |
| 562 |
|
| 563 |
/** |
| 564 |
* bd_fs_nilfs2_info_copy: (skip) |
| 565 |
* @data: (nullable): %BDFSNILFS2Info to copy |
| 566 |
* |
| 567 |
* Creates a new copy of @data. |
| 568 |
*/ |
| 569 |
BDFSNILFS2Info* bd_fs_nilfs2_info_copy (BDFSNILFS2Info *data) { |
| 570 |
if (data == NULL) |
| 571 |
return NULL; |
| 572 |
|
| 573 |
BDFSNILFS2Info *ret = g_new0 (BDFSNILFS2Info, 1); |
| 574 |
|
| 575 |
ret->label = g_strdup (data->label); |
| 576 |
ret->uuid = g_strdup (data->uuid); |
| 577 |
ret->size = data->size; |
| 578 |
ret->block_size = data->block_size; |
| 579 |
ret->free_blocks = data->free_blocks; |
| 580 |
|
| 581 |
return ret; |
| 582 |
} |
| 583 |
|
| 584 |
/** |
| 585 |
* bd_fs_nilfs2_info_free: (skip) |
| 586 |
* @data: (nullable): %BDFSNILFS2Info to free |
| 587 |
* |
| 588 |
* Frees @data. |
| 589 |
*/ |
| 590 |
void bd_fs_nilfs2_info_free (BDFSNILFS2Info *data) { |
| 591 |
if (data == NULL) |
| 592 |
return; |
| 593 |
|
| 594 |
g_free (data->label); |
| 595 |
g_free (data->uuid); |
| 596 |
g_free (data); |
| 597 |
} |
| 598 |
|
| 599 |
GType bd_fs_nilfs2_info_get_type () { |
| 600 |
static GType type = 0; |
| 601 |
|
| 602 |
if (G_UNLIKELY(type == 0)) { |
| 603 |
type = g_boxed_type_register_static("BDFSNILFS2Info", |
| 604 |
(GBoxedCopyFunc) bd_fs_nilfs2_info_copy, |
| 605 |
(GBoxedFreeFunc) bd_fs_nilfs2_info_free); |
| 606 |
} |
| 607 |
|
| 608 |
return type; |
| 609 |
} |
| 610 |
|
| 611 |
#define BD_FS_TYPE_EXFAT_INFO (bd_fs_exfat_info_get_type ()) |
| 612 |
GType bd_fs_exfat_info_get_type(); |
| 613 |
|
| 614 |
/** |
| 615 |
* BDFSExfatInfo: |
| 616 |
* @label: label of the filesystem |
| 617 |
* @uuid: uuid of the filesystem |
| 618 |
* @sector_size: sector size used by the filesystem |
| 619 |
* @sector_count: number of sectors in the filesystem |
| 620 |
* @cluster_count: number of clusters in the filesystem |
| 621 |
*/ |
| 622 |
typedef struct BDFSExfatInfo { |
| 623 |
gchar *label; |
| 624 |
gchar *uuid; |
| 625 |
guint64 sector_size; |
| 626 |
guint64 sector_count; |
| 627 |
guint64 cluster_count; |
| 628 |
} BDFSExfatInfo; |
| 629 |
|
| 630 |
/** |
| 631 |
* bd_fs_exfat_info_free: (skip) |
| 632 |
* @data: (nullable): %BDFSExfatInfo to free |
| 633 |
* |
| 634 |
* Frees @data. |
| 635 |
*/ |
| 636 |
void bd_fs_exfat_info_free (BDFSExfatInfo *data) { |
| 637 |
if (data == NULL) |
| 638 |
return; |
| 639 |
|
| 640 |
g_free (data->label); |
| 641 |
g_free (data->uuid); |
| 642 |
g_free (data); |
| 643 |
} |
| 644 |
|
| 645 |
/** |
| 646 |
* bd_fs_exfat_info_copy: (skip) |
| 647 |
* @data: (nullable): %BDFSExfatInfo to copy |
| 648 |
* |
| 649 |
* Creates a new copy of @data. |
| 650 |
*/ |
| 651 |
BDFSExfatInfo* bd_fs_exfat_info_copy (BDFSExfatInfo *data) { |
| 652 |
if (data == NULL) |
| 653 |
return NULL; |
| 654 |
|
| 655 |
BDFSExfatInfo *ret = g_new0 (BDFSExfatInfo, 1); |
| 656 |
|
| 657 |
ret->label = g_strdup (data->label); |
| 658 |
ret->uuid = g_strdup (data->uuid); |
| 659 |
ret->sector_size = data->sector_size; |
| 660 |
ret->sector_count = data->sector_count; |
| 661 |
ret->cluster_count = data->cluster_count; |
| 662 |
|
| 663 |
return ret; |
| 664 |
} |
| 665 |
|
| 666 |
GType bd_fs_exfat_info_get_type () { |
| 667 |
static GType type = 0; |
| 668 |
|
| 669 |
if (G_UNLIKELY(type == 0)) { |
| 670 |
type = g_boxed_type_register_static("BDFSExfatInfo", |
| 671 |
(GBoxedCopyFunc) bd_fs_exfat_info_copy, |
| 672 |
(GBoxedFreeFunc) bd_fs_exfat_info_free); |
| 673 |
} |
| 674 |
|
| 675 |
return type; |
| 676 |
} |
| 677 |
|
| 678 |
/** |
| 679 |
* BDFSBtrfsInfo: |
| 680 |
* @label: label of the filesystem |
| 681 |
* @uuid: uuid of the filesystem |
| 682 |
* @size: size of the filesystem in bytes |
| 683 |
* @free_space: free space on the filesystem in bytes |
| 684 |
*/ |
| 685 |
typedef struct BDFSBtrfsInfo { |
| 686 |
gchar *label; |
| 687 |
gchar *uuid; |
| 688 |
guint64 size; |
| 689 |
guint64 free_space; |
| 690 |
} BDFSBtrfsInfo; |
| 691 |
|
| 692 |
/** |
| 693 |
* bd_fs_btrfs_info_copy: (skip) |
| 694 |
* @data: (nullable): %BDFSBtrfsInfo to copy |
| 695 |
* |
| 696 |
* Creates a new copy of @data. |
| 697 |
*/ |
| 698 |
BDFSBtrfsInfo* bd_fs_btrfs_info_copy (BDFSBtrfsInfo *data) { |
| 699 |
if (data == NULL) |
| 700 |
return NULL; |
| 701 |
|
| 702 |
BDFSBtrfsInfo *ret = g_new0 (BDFSBtrfsInfo, 1); |
| 703 |
|
| 704 |
ret->label = g_strdup (data->label); |
| 705 |
ret->uuid = g_strdup (data->uuid); |
| 706 |
ret->size = data->size; |
| 707 |
ret->free_space = data->free_space; |
| 708 |
|
| 709 |
return ret; |
| 710 |
} |
| 711 |
|
| 712 |
/** |
| 713 |
* bd_fs_btrfs_info_free: (skip) |
| 714 |
* @data: (nullable): %BDFSBtrfsInfo to free |
| 715 |
* |
| 716 |
* Frees @data. |
| 717 |
*/ |
| 718 |
void bd_fs_btrfs_info_free (BDFSBtrfsInfo *data) { |
| 719 |
if (data == NULL) |
| 720 |
return; |
| 721 |
|
| 722 |
g_free (data->label); |
| 723 |
g_free (data->uuid); |
| 724 |
g_free (data); |
| 725 |
} |
| 726 |
|
| 727 |
GType bd_fs_btrfs_info_get_type () { |
| 728 |
static GType type = 0; |
| 729 |
|
| 730 |
if (G_UNLIKELY(type == 0)) { |
| 731 |
type = g_boxed_type_register_static("BDFSBtrfsInfo", |
| 732 |
(GBoxedCopyFunc) bd_fs_btrfs_info_copy, |
| 733 |
(GBoxedFreeFunc) bd_fs_btrfs_info_free); |
| 734 |
} |
| 735 |
|
| 736 |
return type; |
| 737 |
} |
| 738 |
|
| 739 |
/** |
| 740 |
* BDFSUdfInfo: |
| 741 |
* @label: label of the filesystem |
| 742 |
* @uuid: uuid of the filesystem |
| 743 |
* @revision: UDF revision |
| 744 |
* @lvid: Logical Volume Identifier (most UDF implementations use this identifier as a disk label) |
| 745 |
* @vid: Volume Identifier |
| 746 |
* @block_size: block size used by the filesystem |
| 747 |
* @block_count: number of blocks in the filesystem |
| 748 |
* @free_blocks: number of free blocks in the filesystem |
| 749 |
*/ |
| 750 |
typedef struct BDFSUdfInfo { |
| 751 |
gchar *label; |
| 752 |
gchar *uuid; |
| 753 |
gchar *revision; |
| 754 |
gchar *lvid; |
| 755 |
gchar *vid; |
| 756 |
guint64 block_size; |
| 757 |
guint64 block_count; |
| 758 |
guint64 free_blocks; |
| 759 |
} BDFSUdfInfo; |
| 760 |
|
| 761 |
/** |
| 762 |
* bd_fs_udf_info_free: (skip) |
| 763 |
* @data: (nullable): %BDFSUdfInfo to free |
| 764 |
* |
| 765 |
* Frees @data. |
| 766 |
*/ |
| 767 |
void bd_fs_udf_info_free (BDFSUdfInfo *data) { |
| 768 |
if (data == NULL) |
| 769 |
return; |
| 770 |
|
| 771 |
g_free (data->label); |
| 772 |
g_free (data->uuid); |
| 773 |
g_free (data->revision); |
| 774 |
g_free (data->lvid); |
| 775 |
g_free (data->vid); |
| 776 |
g_free (data); |
| 777 |
} |
| 778 |
|
| 779 |
/** |
| 780 |
* bd_fs_udf_info_copy: (skip) |
| 781 |
* @data: (nullable): %BDFSUdfInfo to copy |
| 782 |
* |
| 783 |
* Creates a new copy of @data. |
| 784 |
*/ |
| 785 |
BDFSUdfInfo* bd_fs_udf_info_copy (BDFSUdfInfo *data) { |
| 786 |
if (data == NULL) |
| 787 |
return NULL; |
| 788 |
|
| 789 |
BDFSUdfInfo *ret = g_new0 (BDFSUdfInfo, 1); |
| 790 |
|
| 791 |
ret->label = g_strdup (data->label); |
| 792 |
ret->uuid = g_strdup (data->uuid); |
| 793 |
ret->revision = g_strdup (data->revision); |
| 794 |
ret->lvid = g_strdup (data->lvid); |
| 795 |
ret->vid = g_strdup (data->vid); |
| 796 |
ret->block_size = data->block_size; |
| 797 |
ret->block_count = data->block_count; |
| 798 |
ret->free_blocks = data->free_blocks; |
| 799 |
|
| 800 |
return ret; |
| 801 |
} |
| 802 |
|
| 803 |
GType bd_fs_udf_info_get_type () { |
| 804 |
static GType type = 0; |
| 805 |
|
| 806 |
if (G_UNLIKELY(type == 0)) { |
| 807 |
type = g_boxed_type_register_static("BDFSUdfInfo", |
| 808 |
(GBoxedCopyFunc) bd_fs_udf_info_copy, |
| 809 |
(GBoxedFreeFunc) bd_fs_udf_info_free); |
| 810 |
} |
| 811 |
|
| 812 |
return type; |
| 813 |
} |
| 814 |
|
| 815 |
/** |
| 816 |
* bd_fs_is_tech_avail: |
| 817 |
* @tech: the queried tech |
| 818 |
* @mode: a bit mask of queried modes of operation (#BDFSTechMode) for @tech |
| 819 |
* @error: (out) (optional): place to store error (details about why the @tech-@mode combination is not available) |
| 820 |
* |
| 821 |
* Returns: whether the @tech-@mode combination is available -- supported by the |
| 822 |
* plugin implementation and having all the runtime dependencies available |
| 823 |
*/ |
| 824 |
gboolean bd_fs_is_tech_avail (BDFSTech tech, guint64 mode, GError **error); |
| 825 |
|
| 826 |
/** |
| 827 |
* bd_fs_supported_filesystems: |
| 828 |
* @error: (out) (optional): currently unused |
| 829 |
* |
| 830 |
* Returns: (transfer container) (array zero-terminated=1): list of filesystems supported by this plugin |
| 831 |
* |
| 832 |
* Note: This returns filesystems supported by libblockdev, but not necessarily |
| 833 |
* by the systems this is running on, for this information you need to |
| 834 |
* run one of the `bd_fs_can_` functions. |
| 835 |
* |
| 836 |
* Tech category: always available |
| 837 |
*/ |
| 838 |
const gchar** bd_fs_supported_filesystems (GError **error); |
| 839 |
|
| 840 |
/** |
| 841 |
* bd_fs_wipe: |
| 842 |
* @device: the device to wipe signatures from |
| 843 |
* @all: whether to wipe all (%TRUE) signatures or just the first (%FALSE) one |
| 844 |
* @force: whether to wipe signatures on a mounted @device |
| 845 |
* @error: (out) (optional): place to store error (if any) |
| 846 |
* |
| 847 |
* Returns: whether signatures were successfully wiped on @device or not |
| 848 |
* |
| 849 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_WIPE |
| 850 |
*/ |
| 851 |
gboolean bd_fs_wipe (const gchar *device, gboolean all, gboolean force, GError **error); |
| 852 |
|
| 853 |
/** |
| 854 |
* bd_fs_clean: |
| 855 |
* @device: the device to clean |
| 856 |
* @force: whether to wipe signatures on a mounted @device |
| 857 |
* @error: (out) (optional): place to store error (if any) |
| 858 |
* |
| 859 |
* Clean all signatures from @device. |
| 860 |
* Difference between this and bd_fs_wipe() is that this function doesn't |
| 861 |
* return error if @device is already empty. This will also always remove |
| 862 |
* all signatures from @device, not only the first one. |
| 863 |
* |
| 864 |
* Returns: whether @device was successfully cleaned or not |
| 865 |
* |
| 866 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_WIPE |
| 867 |
*/ |
| 868 |
gboolean bd_fs_clean (const gchar *device, gboolean force, GError **error); |
| 869 |
|
| 870 |
/** |
| 871 |
* bd_fs_get_fstype: |
| 872 |
* @device: the device to probe |
| 873 |
* @error: (out) (optional): place to store error (if any) |
| 874 |
* |
| 875 |
* Get first signature on @device as a string. |
| 876 |
* |
| 877 |
* Returns: (transfer full): type of filesystem found on @device, %NULL in case |
| 878 |
* no signature has been detected or in case of error |
| 879 |
* (@error is set in this case) |
| 880 |
* |
| 881 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 882 |
*/ |
| 883 |
gchar* bd_fs_get_fstype (const gchar *device, GError **error); |
| 884 |
|
| 885 |
/** |
| 886 |
* bd_fs_freeze: |
| 887 |
* @mountpoint: mountpoint of the device (filesystem) to freeze |
| 888 |
* @error: (out) (optional): place to store error (if any) |
| 889 |
* |
| 890 |
* Freezes filesystem mounted on @mountpoint. The filesystem must |
| 891 |
* support freezing. |
| 892 |
* |
| 893 |
* Returns: whether @mountpoint was successfully freezed or not |
| 894 |
* |
| 895 |
*/ |
| 896 |
gboolean bd_fs_freeze (const gchar *mountpoint, GError **error); |
| 897 |
|
| 898 |
/** |
| 899 |
* bd_fs_unfreeze: |
| 900 |
* @mountpoint: mountpoint of the device (filesystem) to un-freeze |
| 901 |
* @error: (out) (optional): place to store error (if any) |
| 902 |
* |
| 903 |
* Un-freezes filesystem mounted on @mountpoint. The filesystem must |
| 904 |
* support freezing. |
| 905 |
* |
| 906 |
* Returns: whether @mountpoint was successfully unfreezed or not |
| 907 |
* |
| 908 |
*/ |
| 909 |
gboolean bd_fs_unfreeze (const gchar *mountpoint, GError **error); |
| 910 |
|
| 911 |
/** |
| 912 |
* bd_fs_unmount: |
| 913 |
* @spec: mount point or device to unmount |
| 914 |
* @lazy: enable/disable lazy unmount |
| 915 |
* @force: enable/disable force unmount |
| 916 |
* @extra: (nullable) (array zero-terminated=1): extra options for the unmount; |
| 917 |
* currently only 'run_as_uid' |
| 918 |
* and 'run_as_gid' are supported; |
| 919 |
* value must be a valid non zero |
| 920 |
* uid (gid), if you specify one of |
| 921 |
* these, the function will run in |
| 922 |
* a child process with real user |
| 923 |
* and/or group ID set to these values. |
| 924 |
* @error: (out) (optional): place to store error (if any) |
| 925 |
* |
| 926 |
* Returns: whether @spec was successfully unmounted or not |
| 927 |
* |
| 928 |
* Tech category: %BD_FS_TECH_MOUNT (no mode, ignored) |
| 929 |
*/ |
| 930 |
gboolean bd_fs_unmount (const gchar *spec, gboolean lazy, gboolean force, const BDExtraArg **extra, GError **error); |
| 931 |
|
| 932 |
/** |
| 933 |
* bd_fs_mount: |
| 934 |
* @device: (nullable): device to mount, if not specified @mountpoint entry |
| 935 |
* from fstab will be used |
| 936 |
* @mountpoint: (nullable): mountpoint for @device, if not specified @device |
| 937 |
* entry from fstab will be used |
| 938 |
* @fstype: (nullable): filesystem type |
| 939 |
* @options: (nullable): comma delimited options for mount |
| 940 |
* @extra: (nullable) (array zero-terminated=1): extra options for the mount; |
| 941 |
* currently only 'run_as_uid' |
| 942 |
* and 'run_as_gid' are supported; |
| 943 |
* value must be a valid non zero |
| 944 |
* uid (gid), if you specify one of |
| 945 |
* these, the function will run in |
| 946 |
* a child process with real user |
| 947 |
* and/or group ID set to these values. |
| 948 |
* @error: (out) (optional): place to store error (if any) |
| 949 |
* |
| 950 |
* Returns: whether @device (or @mountpoint) was successfully mounted or not |
| 951 |
* |
| 952 |
* Tech category: %BD_FS_TECH_MOUNT (no mode, ignored) |
| 953 |
*/ |
| 954 |
gboolean bd_fs_mount (const gchar *device, const gchar *mountpoint, const gchar *fstype, const gchar *options, const BDExtraArg **extra, GError **error); |
| 955 |
|
| 956 |
/** |
| 957 |
* bd_fs_get_mountpoint: |
| 958 |
* @device: device to find mountpoint for |
| 959 |
* @error: (out) (optional): place to store error (if any) |
| 960 |
* |
| 961 |
* Get mountpoint for @device. If @device is mounted multiple times only |
| 962 |
* one mountpoint will be returned. |
| 963 |
* |
| 964 |
* Returns: (transfer full): mountpoint for @device, %NULL in case device is |
| 965 |
* not mounted or in case of an error (@error is set |
| 966 |
* in this case) |
| 967 |
* |
| 968 |
* Tech category: %BD_FS_TECH_MOUNT (no mode, ignored) |
| 969 |
*/ |
| 970 |
gchar* bd_fs_get_mountpoint (const gchar *device, GError **error); |
| 971 |
|
| 972 |
/** |
| 973 |
* bd_fs_is_mountpoint: |
| 974 |
* @path: path (folder) to check |
| 975 |
* @error: (out) (optional): place to store error (if any) |
| 976 |
* |
| 977 |
* Returns: whether @path is a mountpoint or not |
| 978 |
* |
| 979 |
* Tech category: %BD_FS_TECH_MOUNT (no mode, ignored) |
| 980 |
*/ |
| 981 |
gboolean bd_fs_is_mountpoint (const gchar *path, GError **error); |
| 982 |
|
| 983 |
/** |
| 984 |
* bd_fs_resize: |
| 985 |
* @device: the device the file system of which to resize |
| 986 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 987 |
* adapted to the underlying block device) |
| 988 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 989 |
* @error: (out) (optional): place to store error (if any) |
| 990 |
* |
| 991 |
* Resize filesystem on @device. This calls other fs resize functions from this |
| 992 |
* plugin based on provides or detected filesystem (e.g. bd_fs_xfs_resize for XFS). |
| 993 |
* This function will return an error for unknown/unsupported filesystems. |
| 994 |
* |
| 995 |
* Note: This function will mount @device for filesystems that can be resized only |
| 996 |
* when mounted (like XFS or Btrfs). |
| 997 |
* |
| 998 |
* Returns: whether the file system on @device was successfully resized or not |
| 999 |
* |
| 1000 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_RESIZE |
| 1001 |
*/ |
| 1002 |
gboolean bd_fs_resize (const gchar *device, guint64 new_size, const gchar *fstype, GError **error); |
| 1003 |
|
| 1004 |
/** |
| 1005 |
* bd_fs_repair: |
| 1006 |
* @device: the device the file system of which to repair |
| 1007 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1008 |
* @error: (out) (optional): place to store error (if any) |
| 1009 |
* |
| 1010 |
* Repair filesystem on @device. This calls other fs repair functions from this |
| 1011 |
* plugin based on detected filesystem (e.g. bd_fs_xfs_repair for XFS). This |
| 1012 |
* function will return an error for unknown/unsupported filesystems. |
| 1013 |
* |
| 1014 |
* Most filesystem tools typically require the filesystem not to be mounted. |
| 1015 |
* |
| 1016 |
* Returns: whether the file system on @device was successfully repaired or not |
| 1017 |
* |
| 1018 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_REPAIR |
| 1019 |
*/ |
| 1020 |
gboolean bd_fs_repair (const gchar *device, const gchar *fstype, GError **error); |
| 1021 |
|
| 1022 |
/** |
| 1023 |
* bd_fs_check: |
| 1024 |
* @device: the device the file system of which to check |
| 1025 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1026 |
* @error: (out) (optional): place to store error (if any) |
| 1027 |
* |
| 1028 |
* Check filesystem on @device avoiding any modifications or repairs. |
| 1029 |
* This calls other fs check functions from this plugin based on detected |
| 1030 |
* filesystem (e.g. bd_fs_xfs_check for XFS). This function will return |
| 1031 |
* an error for unknown/unsupported filesystems. |
| 1032 |
* |
| 1033 |
* Note that depending on a corresponding filesystem type and configured |
| 1034 |
* features running this function on a mounted filesystem may result |
| 1035 |
* in false errors reported. |
| 1036 |
* |
| 1037 |
* Returns: whether the file system on @device passed the consistency check or not |
| 1038 |
* |
| 1039 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_CHECK |
| 1040 |
*/ |
| 1041 |
gboolean bd_fs_check (const gchar *device, const gchar *fstype, GError **error); |
| 1042 |
|
| 1043 |
/** |
| 1044 |
* bd_fs_check_label: |
| 1045 |
* @fstype: the filesystem type to check @label for |
| 1046 |
* @label: label to check |
| 1047 |
* @error: (out) (optional): place to store error (if any) |
| 1048 |
* |
| 1049 |
* This calls other fs check label functions from this plugin based on the provided |
| 1050 |
* filesystem (e.g. bd_fs_xfs_check_label for XFS). This function will return |
| 1051 |
* an error for unknown/unsupported filesystems. |
| 1052 |
* |
| 1053 |
* Returns: whether @label is a valid label for the @fstype file system or not |
| 1054 |
* (reason is provided in @error) |
| 1055 |
* |
| 1056 |
* Tech category: always available |
| 1057 |
*/ |
| 1058 |
gboolean bd_fs_check_label (const gchar *fstype, const gchar *label, GError **error); |
| 1059 |
|
| 1060 |
/** |
| 1061 |
* bd_fs_set_label: |
| 1062 |
* @device: the device with file system to set the label for |
| 1063 |
* @label: label to set |
| 1064 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1065 |
* @error: (out) (optional): place to store error (if any) |
| 1066 |
* |
| 1067 |
* Set label for filesystem on @device. This calls other fs label functions from this |
| 1068 |
* plugin based on detected filesystem (e.g. bd_fs_xfs_set_label for XFS). This |
| 1069 |
* function will return an error for unknown/unsupported filesystems. |
| 1070 |
* |
| 1071 |
* Note: This function will mount @device for filesystems that need to be mounted |
| 1072 |
* to set label (like btrfs). |
| 1073 |
* |
| 1074 |
* Returns: whether the file system on @device was successfully relabeled or not |
| 1075 |
* |
| 1076 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_SET_LABEL |
| 1077 |
*/ |
| 1078 |
gboolean bd_fs_set_label (const gchar *device, const gchar *label, const gchar *fstype, GError **error); |
| 1079 |
|
| 1080 |
/** |
| 1081 |
* bd_fs_check_uuid: |
| 1082 |
* @fstype: the filesystem type to check @uuid for |
| 1083 |
* @uuid: uuid to check |
| 1084 |
* @error: (out) (optional): place to store error (if any) |
| 1085 |
* |
| 1086 |
* This calls other fs check uuid functions from this plugin based on the provided |
| 1087 |
* filesystem (e.g. bd_fs_xfs_check_uuid for XFS). This function will return |
| 1088 |
* an error for unknown/unsupported filesystems. |
| 1089 |
* |
| 1090 |
* Returns: whether @uuid is a valid UUID for the @fstype file system or not |
| 1091 |
* (reason is provided in @error) |
| 1092 |
* |
| 1093 |
* Tech category: always available |
| 1094 |
*/ |
| 1095 |
gboolean bd_fs_check_uuid (const gchar *fstype, const gchar *uuid, GError **error); |
| 1096 |
|
| 1097 |
/** |
| 1098 |
* bd_fs_set_uuid: |
| 1099 |
* @device: the device with file system to set the UUID for |
| 1100 |
* @uuid: (nullable): UUID to set or %NULL to generate a new one |
| 1101 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1102 |
* @error: (out) (optional): place to store error (if any) |
| 1103 |
* |
| 1104 |
* Set UUID for filesystem on @device. This calls other fs UUID functions from this |
| 1105 |
* plugin based on detected filesystem (e.g. bd_fs_xfs_set_uuid for XFS). This |
| 1106 |
* function will return an error for unknown/unsupported filesystems. |
| 1107 |
* |
| 1108 |
* Returns: whether the UUID on the file system on @device was successfully changed or not |
| 1109 |
* |
| 1110 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_SET_UUID |
| 1111 |
*/ |
| 1112 |
gboolean bd_fs_set_uuid (const gchar *device, const gchar *uuid, const gchar *fstype, GError **error); |
| 1113 |
|
| 1114 |
/** |
| 1115 |
* bd_fs_xfs_check_uuid: |
| 1116 |
* @uuid: UUID to check |
| 1117 |
* @error: (out) (optional): place to store error |
| 1118 |
* |
| 1119 |
* Returns: whether @uuid is a valid UUID for the xfs file system or not |
| 1120 |
* (reason is provided in @error) |
| 1121 |
* |
| 1122 |
* Tech category: always available |
| 1123 |
*/ |
| 1124 |
gboolean bd_fs_xfs_check_uuid (const gchar *uuid, GError **error); |
| 1125 |
|
| 1126 |
/** |
| 1127 |
* bd_fs_get_size: |
| 1128 |
* @device: the device with file system to get size for |
| 1129 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1130 |
* @error: (out) (optional): place to store error (if any) |
| 1131 |
* |
| 1132 |
* Get size for filesystem on @device. This calls other fs info functions from this |
| 1133 |
* plugin based on detected filesystem (e.g. bd_fs_xfs_get_info for XFS). This |
| 1134 |
* function will return an error for unknown/unsupported filesystems. |
| 1135 |
* |
| 1136 |
* Note: This function will mount @device for filesystems that need to be mounted |
| 1137 |
* to gather information (like btrfs). |
| 1138 |
* |
| 1139 |
* Returns: size of filesystem on @device, 0 in case of error. |
| 1140 |
* |
| 1141 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1142 |
*/ |
| 1143 |
guint64 bd_fs_get_size (const gchar *device, const gchar *fstype, GError **error); |
| 1144 |
|
| 1145 |
/** |
| 1146 |
* bd_fs_get_free_space: |
| 1147 |
* @device: the device with file system to get free space for |
| 1148 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1149 |
* @error: (out) (optional): place to store error (if any) |
| 1150 |
* |
| 1151 |
* Get free space for filesystem on @device. This calls other fs info functions from this |
| 1152 |
* plugin based on detected filesystem (e.g. bd_fs_ext4_get_info for ext4). This |
| 1153 |
* function will return an error for unknown/unsupported filesystems. |
| 1154 |
* |
| 1155 |
* Returns: free space of filesystem on @device, 0 in case of error. |
| 1156 |
* |
| 1157 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1158 |
*/ |
| 1159 |
guint64 bd_fs_get_free_space (const gchar *device, const gchar *fstype, GError **error); |
| 1160 |
|
| 1161 |
/** |
| 1162 |
* bd_fs_get_min_size: |
| 1163 |
* @device: the device with file system to get minimum size for |
| 1164 |
* @fstype: (nullable): the filesystem type on @device or %NULL to detect |
| 1165 |
* @error: (out) (optional): place to store error (if any) |
| 1166 |
* |
| 1167 |
* Get minimum size for filesystem on @device. This calls other fs info functions from this |
| 1168 |
* plugin based on detected filesystem (e.g. bd_fs_ext4_get_min_size for ext4). This |
| 1169 |
* function will return an error for unknown/unsupported filesystems. |
| 1170 |
* |
| 1171 |
* Returns: minimum size of filesystem on @device, 0 in case of error. |
| 1172 |
* |
| 1173 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_RESIZE |
| 1174 |
*/ |
| 1175 |
guint64 bd_fs_get_min_size (const gchar *device, const gchar *fstype, GError **error); |
| 1176 |
|
| 1177 |
/** |
| 1178 |
* bd_fs_can_get_info: |
| 1179 |
* @type: the filesystem type to be tested for info querying support |
| 1180 |
* @required_utility: (out) (transfer full): the utility binary which is required |
| 1181 |
* for info querying (if missing i.e. return FALSE but no error) |
| 1182 |
* @error: (out) (optional): place to store error (if any) |
| 1183 |
* |
| 1184 |
* Searches for the required utility to get info of the given filesystem and |
| 1185 |
* returns whether it is installed. |
| 1186 |
* Unknown filesystems or filesystems which do not support info querying result in errors. |
| 1187 |
* |
| 1188 |
* Returns: whether getting filesystem info is available |
| 1189 |
* |
| 1190 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1191 |
*/ |
| 1192 |
gboolean bd_fs_can_get_info (const gchar *type, gchar **required_utility, GError **error); |
| 1193 |
|
| 1194 |
/** |
| 1195 |
* BDFSMkfsOptionsFlags: |
| 1196 |
* Flags indicating mkfs options are available for given filesystem type. |
| 1197 |
*/ |
| 1198 |
typedef enum { |
| 1199 |
BD_FS_MKFS_LABEL = 1 << 0, |
| 1200 |
BD_FS_MKFS_UUID = 1 << 1, |
| 1201 |
BD_FS_MKFS_DRY_RUN = 1 << 2, |
| 1202 |
BD_FS_MKFS_NODISCARD = 1 << 3, |
| 1203 |
BD_FS_MKFS_FORCE = 1 << 4, |
| 1204 |
BD_FS_MKFS_NOPT = 1 << 5, |
| 1205 |
} BDFSMkfsOptionsFlags; |
| 1206 |
|
| 1207 |
/** |
| 1208 |
* bd_fs_can_mkfs: |
| 1209 |
* @type: the filesystem type to be tested for installed mkfs support |
| 1210 |
* @options: (out): flags for allowed mkfs options (i.e. support for setting label or UUID when creating the filesystem) |
| 1211 |
* @required_utility: (out) (transfer full): the utility binary which is required for creating (if missing returns %FALSE but no @error) |
| 1212 |
* @error: (out) (optional): place to store error (if any) |
| 1213 |
* |
| 1214 |
* Searches for the required utility to create the given filesystem and returns whether |
| 1215 |
* it is installed. The options flags indicate what additional options can be specified for @type. |
| 1216 |
* Unknown filesystems result in errors. |
| 1217 |
* |
| 1218 |
* Returns: whether filesystem mkfs tool is available |
| 1219 |
* |
| 1220 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1221 |
*/ |
| 1222 |
gboolean bd_fs_can_mkfs (const gchar *type, BDFSMkfsOptionsFlags *options, gchar **required_utility, GError **error); |
| 1223 |
|
| 1224 |
/** |
| 1225 |
* BDFSResizeFlags: |
| 1226 |
* Flags indicating whether a filesystem resize action supports growing and/or |
| 1227 |
* shrinking if mounted or unmounted. |
| 1228 |
*/ |
| 1229 |
typedef enum { |
| 1230 |
BD_FS_OFFLINE_SHRINK = 1 << 1, |
| 1231 |
BD_FS_OFFLINE_GROW = 1 << 2, |
| 1232 |
BD_FS_ONLINE_SHRINK = 1 << 3, |
| 1233 |
BD_FS_ONLINE_GROW = 1 << 4 |
| 1234 |
} BDFSResizeFlags; |
| 1235 |
|
| 1236 |
/** |
| 1237 |
* bd_fs_can_resize: |
| 1238 |
* @type: the filesystem type to be tested for installed resize support |
| 1239 |
* @mode: (out): flags for allowed resizing (i.e. growing/shrinking support for online/offline) |
| 1240 |
* @required_utility: (out) (transfer full): the utility binary which is required for resizing (if missing i.e. returns FALSE but no error) |
| 1241 |
* @error: (out) (optional): place to store error (if any) |
| 1242 |
* |
| 1243 |
* Searches for the required utility to resize the given filesystem and returns whether |
| 1244 |
* it is installed. The mode flags indicate if growing and/or shrinking resize is available if |
| 1245 |
* mounted/unmounted. |
| 1246 |
* Unknown filesystems or filesystems which do not support resizing result in errors. |
| 1247 |
* |
| 1248 |
* Returns: whether filesystem resize is available |
| 1249 |
* |
| 1250 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1251 |
*/ |
| 1252 |
gboolean bd_fs_can_resize (const gchar *type, BDFSResizeFlags *mode, gchar **required_utility, GError **error); |
| 1253 |
|
| 1254 |
/** |
| 1255 |
* bd_fs_can_check: |
| 1256 |
* @type: the filesystem type to be tested for installed consistency check support |
| 1257 |
* @required_utility: (out) (transfer full): the utility binary which is required for checking (if missing i.e. returns FALSE but no error) |
| 1258 |
* @error: (out) (optional): place to store error (if any) |
| 1259 |
* |
| 1260 |
* Searches for the required utility to check the given filesystem and returns whether |
| 1261 |
* it is installed. |
| 1262 |
* Unknown filesystems or filesystems which do not support checking result in errors. |
| 1263 |
* |
| 1264 |
* Returns: whether filesystem check is available |
| 1265 |
* |
| 1266 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1267 |
*/ |
| 1268 |
gboolean bd_fs_can_check (const gchar *type, gchar **required_utility, GError **error); |
| 1269 |
|
| 1270 |
/** |
| 1271 |
* bd_fs_can_repair: |
| 1272 |
* @type: the filesystem type to be tested for installed repair support |
| 1273 |
* @required_utility: (out) (transfer full): the utility binary which is required for repairing (if missing i.e. return FALSE but no error) |
| 1274 |
* @error: (out) (optional): place to store error (if any) |
| 1275 |
* |
| 1276 |
* Searches for the required utility to repair the given filesystem and returns whether |
| 1277 |
* it is installed. |
| 1278 |
* Unknown filesystems or filesystems which do not support reparing result in errors. |
| 1279 |
* |
| 1280 |
* Returns: whether filesystem repair is available |
| 1281 |
* |
| 1282 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1283 |
*/ |
| 1284 |
gboolean bd_fs_can_repair (const gchar *type, gchar **required_utility, GError **error); |
| 1285 |
|
| 1286 |
/** |
| 1287 |
* bd_fs_can_set_label: |
| 1288 |
* @type: the filesystem type to be tested for installed label support |
| 1289 |
* @required_utility: (out) (transfer full): the utility binary which is required for relabeling (if missing i.e. return FALSE but no error) |
| 1290 |
* @error: (out) (optional): place to store error (if any) |
| 1291 |
* |
| 1292 |
* Searches for the required utility to set the label of the given filesystem and returns whether |
| 1293 |
* it is installed. |
| 1294 |
* Unknown filesystems or filesystems which do not support setting the label result in errors. |
| 1295 |
* |
| 1296 |
* Returns: whether setting filesystem label is available |
| 1297 |
* |
| 1298 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1299 |
*/ |
| 1300 |
gboolean bd_fs_can_set_label (const gchar *type, gchar **required_utility, GError **error); |
| 1301 |
|
| 1302 |
/** |
| 1303 |
* bd_fs_can_set_uuid: |
| 1304 |
* @type: the filesystem type to be tested for installed UUID support |
| 1305 |
* @required_utility: (out) (transfer full): the utility binary which is required for setting UUID (if missing i.e. return FALSE but no error) |
| 1306 |
* @error: (out) (optional): place to store error (if any) |
| 1307 |
* |
| 1308 |
* Searches for the required utility to set the UUID of the given filesystem and returns whether |
| 1309 |
* it is installed. |
| 1310 |
* Unknown filesystems or filesystems which do not support setting the UUID result in errors. |
| 1311 |
* |
| 1312 |
* Returns: whether setting filesystem UUID is available |
| 1313 |
* |
| 1314 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1315 |
*/ |
| 1316 |
gboolean bd_fs_can_set_uuid (const gchar *type, gchar **required_utility, GError **error); |
| 1317 |
|
| 1318 |
/** |
| 1319 |
* bd_fs_can_get_size: |
| 1320 |
* @type: the filesystem type to be tested for installed size querying support |
| 1321 |
* @required_utility: (out) (transfer full): the utility binary which is required |
| 1322 |
* for size querying (if missing i.e. return FALSE but no error) |
| 1323 |
* @error: (out) (optional): place to store error (if any) |
| 1324 |
* |
| 1325 |
* Searches for the required utility to get size of the given filesystem and |
| 1326 |
* returns whether it is installed. |
| 1327 |
* Unknown filesystems or filesystems which do not support size querying result in errors. |
| 1328 |
* |
| 1329 |
* Returns: whether getting filesystem size is available |
| 1330 |
* |
| 1331 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1332 |
*/ |
| 1333 |
gboolean bd_fs_can_get_size (const gchar *type, gchar **required_utility, GError **error); |
| 1334 |
|
| 1335 |
/** |
| 1336 |
* bd_fs_can_get_free_space: |
| 1337 |
* @type: the filesystem type to be tested for installed free space querying support |
| 1338 |
* @required_utility: (out) (transfer full): the utility binary which is required |
| 1339 |
* for free space querying (if missing i.e. return FALSE but no error) |
| 1340 |
* @error: (out) (optional): place to store error (if any) |
| 1341 |
* |
| 1342 |
* Searches for the required utility to get free space of the given filesystem and |
| 1343 |
* returns whether it is installed. |
| 1344 |
* Unknown filesystems or filesystems which do not support free space querying result in errors. |
| 1345 |
* |
| 1346 |
* Returns: whether getting filesystem free space is available |
| 1347 |
* |
| 1348 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1349 |
*/ |
| 1350 |
gboolean bd_fs_can_get_free_space (const gchar *type, gchar **required_utility, GError **error); |
| 1351 |
|
| 1352 |
/** |
| 1353 |
* bd_fs_can_get_min_size: |
| 1354 |
* @type: the filesystem type to be tested for installed minimum size querying support |
| 1355 |
* @required_utility: (out) (transfer full): the utility binary which is required |
| 1356 |
* for size querying (if missing i.e. return FALSE but no error) |
| 1357 |
* @error: (out) (optional): place to store error (if any) |
| 1358 |
* |
| 1359 |
* Searches for the required utility to get minimum size of the given filesystem and |
| 1360 |
* returns whether it is installed. |
| 1361 |
* Unknown filesystems or filesystems which do not support minimum size querying result in errors. |
| 1362 |
* |
| 1363 |
* Returns: whether getting filesystem size is available |
| 1364 |
* |
| 1365 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_QUERY |
| 1366 |
*/ |
| 1367 |
gboolean bd_fs_can_get_min_size (const gchar *type, gchar **required_utility, GError **error); |
| 1368 |
|
| 1369 |
/** |
| 1370 |
* bd_fs_mkfs: |
| 1371 |
* @device: the device to create the new filesystem on |
| 1372 |
* @fstype: name of the filesystem to create (e.g. "ext4") |
| 1373 |
* @options: additional options like label or UUID for the filesystem |
| 1374 |
* @extra: (nullable) (array zero-terminated=1): extra mkfs options not provided in @options |
| 1375 |
* @error: (out) (optional): place to store error (if any) |
| 1376 |
* |
| 1377 |
* This is a helper function for creating filesystems with extra options. |
| 1378 |
* This is the same as running a filesystem-specific function like %bd_fs_ext4_mkfs |
| 1379 |
* and manually specifying the extra command line options. %BDFSMkfsOptions |
| 1380 |
* removes the need to specify supported options for selected filesystems, |
| 1381 |
* make sure to check whether @fstype supports these options (see %bd_fs_can_mkfs) |
| 1382 |
* for details. |
| 1383 |
* |
| 1384 |
* When specifying additional mkfs options using @extra, it's caller's |
| 1385 |
* responsibility to make sure these options do not conflict with options |
| 1386 |
* specified using @options. Extra options are added after the @options and |
| 1387 |
* there are no additional checks for duplicate and/or conflicting options. |
| 1388 |
* |
| 1389 |
* Returns: whether @fstype was successfully created on @device or not. |
| 1390 |
* |
| 1391 |
* Tech category: %BD_FS_TECH_GENERIC-%BD_FS_TECH_MODE_MKFS |
| 1392 |
* |
| 1393 |
*/ |
| 1394 |
gboolean bd_fs_mkfs (const gchar *device, const gchar *fstype, BDFSMkfsOptions *options, const BDExtraArg **extra, GError **error); |
| 1395 |
|
| 1396 |
/** |
| 1397 |
* bd_fs_ext2_mkfs: |
| 1398 |
* @device: the device to create a new ext2 fs on |
| 1399 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 1400 |
* passed to the 'mke2fs' utility) |
| 1401 |
* @error: (out) (optional): place to store error (if any) |
| 1402 |
* |
| 1403 |
* Returns: whether a new ext2 fs was successfully created on @device or not |
| 1404 |
* |
| 1405 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_MKFS |
| 1406 |
*/ |
| 1407 |
gboolean bd_fs_ext2_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1408 |
|
| 1409 |
/** |
| 1410 |
* bd_fs_ext3_mkfs: |
| 1411 |
* @device: the device to create a new ext3 fs on |
| 1412 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 1413 |
* passed to the 'mke2fs' utility) |
| 1414 |
* @error: (out) (optional): place to store error (if any) |
| 1415 |
* |
| 1416 |
* Returns: whether a new ext3 fs was successfully created on @device or not |
| 1417 |
* |
| 1418 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_MKFS |
| 1419 |
*/ |
| 1420 |
gboolean bd_fs_ext3_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1421 |
|
| 1422 |
/** |
| 1423 |
* bd_fs_ext4_mkfs: |
| 1424 |
* @device: the device to create a new ext4 fs on |
| 1425 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 1426 |
* passed to the 'mkfs.ext4' utility) |
| 1427 |
* @error: (out) (optional): place to store error (if any) |
| 1428 |
* |
| 1429 |
* Returns: whether a new ext4 fs was successfully created on @device or not |
| 1430 |
* |
| 1431 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_MKFS |
| 1432 |
*/ |
| 1433 |
gboolean bd_fs_ext4_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1434 |
|
| 1435 |
/** |
| 1436 |
* bd_fs_ext2_check: |
| 1437 |
* @device: the device the file system on which to check |
| 1438 |
* @extra: (nullable) (array zero-terminated=1): extra options for the check (right now |
| 1439 |
* passed to the 'e2fsck' utility) |
| 1440 |
* @error: (out) (optional): place to store error (if any) |
| 1441 |
* |
| 1442 |
* Returns: whether an ext2 file system on the @device is clean or not |
| 1443 |
* |
| 1444 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_CHECK |
| 1445 |
*/ |
| 1446 |
gboolean bd_fs_ext2_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1447 |
|
| 1448 |
/** |
| 1449 |
* bd_fs_ext3_check: |
| 1450 |
* @device: the device the file system on which to check |
| 1451 |
* @extra: (nullable) (array zero-terminated=1): extra options for the check (right now |
| 1452 |
* passed to the 'e2fsck' utility) |
| 1453 |
* @error: (out) (optional): place to store error (if any) |
| 1454 |
* |
| 1455 |
* Returns: whether an ext3 file system on the @device is clean or not |
| 1456 |
* |
| 1457 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_CHECK |
| 1458 |
*/ |
| 1459 |
gboolean bd_fs_ext3_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1460 |
|
| 1461 |
/** |
| 1462 |
* bd_fs_ext4_check: |
| 1463 |
* @device: the device the file system on which to check |
| 1464 |
* @extra: (nullable) (array zero-terminated=1): extra options for the check (right now |
| 1465 |
* passed to the 'e2fsck' utility) |
| 1466 |
* @error: (out) (optional): place to store error (if any) |
| 1467 |
* |
| 1468 |
* Returns: whether an ext4 file system on the @device is clean or not |
| 1469 |
* |
| 1470 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_CHECK |
| 1471 |
*/ |
| 1472 |
gboolean bd_fs_ext4_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1473 |
|
| 1474 |
/** |
| 1475 |
* bd_fs_ext2_repair: |
| 1476 |
* @device: the device the file system on which to repair |
| 1477 |
* @unsafe: whether to do unsafe operations too |
| 1478 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1479 |
* passed to the 'e2fsck' utility) |
| 1480 |
* @error: (out) (optional): place to store error (if any) |
| 1481 |
* |
| 1482 |
* Returns: whether an ext2 file system on the @device was successfully repaired |
| 1483 |
* (if needed) or not (error is set in that case) |
| 1484 |
* |
| 1485 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_REPAIR |
| 1486 |
*/ |
| 1487 |
gboolean bd_fs_ext2_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error); |
| 1488 |
|
| 1489 |
/** |
| 1490 |
* bd_fs_ext3_repair: |
| 1491 |
* @device: the device the file system on which to repair |
| 1492 |
* @unsafe: whether to do unsafe operations too |
| 1493 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1494 |
* passed to the 'e2fsck' utility) |
| 1495 |
* @error: (out) (optional): place to store error (if any) |
| 1496 |
* |
| 1497 |
* Returns: whether an ext3 file system on the @device was successfully repaired |
| 1498 |
* (if needed) or not (error is set in that case) |
| 1499 |
* |
| 1500 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_REPAIR |
| 1501 |
*/ |
| 1502 |
gboolean bd_fs_ext3_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error); |
| 1503 |
|
| 1504 |
/** |
| 1505 |
* bd_fs_ext4_repair: |
| 1506 |
* @device: the device the file system on which to repair |
| 1507 |
* @unsafe: whether to do unsafe operations too |
| 1508 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1509 |
* passed to the 'e2fsck' utility) |
| 1510 |
* @error: (out) (optional): place to store error (if any) |
| 1511 |
* |
| 1512 |
* Returns: whether an ext4 file system on the @device was successfully repaired |
| 1513 |
* (if needed) or not (error is set in that case) |
| 1514 |
* |
| 1515 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_REPAIR |
| 1516 |
*/ |
| 1517 |
gboolean bd_fs_ext4_repair (const gchar *device, gboolean unsafe, const BDExtraArg **extra, GError **error); |
| 1518 |
|
| 1519 |
/** |
| 1520 |
* bd_fs_ext2_set_label: |
| 1521 |
* @device: the device the file system on which to set label for |
| 1522 |
* @label: label to set |
| 1523 |
* @error: (out) (optional): place to store error (if any) |
| 1524 |
* |
| 1525 |
* Returns: whether the label of ext2 file system on the @device was |
| 1526 |
* successfully set or not |
| 1527 |
* |
| 1528 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_SET_LABEL |
| 1529 |
*/ |
| 1530 |
gboolean bd_fs_ext2_set_label (const gchar *device, const gchar *label, GError **error); |
| 1531 |
|
| 1532 |
/** |
| 1533 |
* bd_fs_ext3_set_label: |
| 1534 |
* @device: the device the file system on which to set label for |
| 1535 |
* @label: label to set |
| 1536 |
* @error: (out) (optional): place to store error (if any) |
| 1537 |
* |
| 1538 |
* Returns: whether the label of ext3 file system on the @device was |
| 1539 |
* successfully set or not |
| 1540 |
* |
| 1541 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_SET_LABEL |
| 1542 |
*/ |
| 1543 |
gboolean bd_fs_ext3_set_label (const gchar *device, const gchar *label, GError **error); |
| 1544 |
|
| 1545 |
/** |
| 1546 |
* bd_fs_ext4_set_label: |
| 1547 |
* @device: the device the file system on which to set label for |
| 1548 |
* @label: label to set |
| 1549 |
* @error: (out) (optional): place to store error (if any) |
| 1550 |
* |
| 1551 |
* Returns: whether the label of ext4 file system on the @device was |
| 1552 |
* successfully set or not |
| 1553 |
* |
| 1554 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_SET_LABEL |
| 1555 |
*/ |
| 1556 |
gboolean bd_fs_ext4_set_label (const gchar *device, const gchar *label, GError **error); |
| 1557 |
|
| 1558 |
/** |
| 1559 |
* bd_fs_ext2_check_label: |
| 1560 |
* @label: label to check |
| 1561 |
* @error: (out) (optional): place to store error |
| 1562 |
* |
| 1563 |
* Returns: whether @label is a valid label for the ext2 file system or not |
| 1564 |
* (reason is provided in @error) |
| 1565 |
* |
| 1566 |
* Tech category: always available |
| 1567 |
*/ |
| 1568 |
gboolean bd_fs_ext2_check_label (const gchar *label, GError **error); |
| 1569 |
|
| 1570 |
/** |
| 1571 |
* bd_fs_ext3_check_label: |
| 1572 |
* @label: label to check |
| 1573 |
* @error: (out) (optional): place to store error (if any) |
| 1574 |
* |
| 1575 |
* Returns: whether @label is a valid label for the ext3 file system or not |
| 1576 |
* (reason is provided in @error) |
| 1577 |
* |
| 1578 |
* Tech category: always available |
| 1579 |
*/ |
| 1580 |
gboolean bd_fs_ext3_check_label (const gchar *label, GError **error); |
| 1581 |
|
| 1582 |
/** |
| 1583 |
* bd_fs_ext4_check_label: |
| 1584 |
* @label: label to check |
| 1585 |
* @error: (out) (optional): place to store error (if any) |
| 1586 |
* |
| 1587 |
* Returns: whether @label is a valid label for the ext4 file system or not |
| 1588 |
* (reason is provided in @error) |
| 1589 |
* |
| 1590 |
* Tech category: always available |
| 1591 |
*/ |
| 1592 |
gboolean bd_fs_ext4_check_label (const gchar *label, GError **error); |
| 1593 |
|
| 1594 |
/** |
| 1595 |
* bd_fs_ext2_set_uuid: |
| 1596 |
* @device: the device the file system on which to set UUID for |
| 1597 |
* @uuid: (nullable): UUID to set %NULL to generate a new one |
| 1598 |
* UUID can also be one of "clear", "random" and "time" to clear, |
| 1599 |
* generate a new random/time-based UUID |
| 1600 |
* @error: (out) (optional): place to store error (if any) |
| 1601 |
* |
| 1602 |
* Returns: whether the UUID of ext2 file system on the @device was |
| 1603 |
* successfully set or not |
| 1604 |
* |
| 1605 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_SET_UUID |
| 1606 |
*/ |
| 1607 |
gboolean bd_fs_ext2_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 1608 |
|
| 1609 |
/** |
| 1610 |
* bd_fs_ext3_set_uuid: |
| 1611 |
* @device: the device the file system on which to set UUID for |
| 1612 |
* @uuid: (nullable): UUID to set %NULL to generate a new one |
| 1613 |
* UUID can also be one of "clear", "random" and "time" to clear, |
| 1614 |
* generate a new random/time-based UUID |
| 1615 |
* @error: (out) (optional): place to store error (if any) |
| 1616 |
* |
| 1617 |
* Returns: whether the UUID of ext3 file system on the @device was |
| 1618 |
* successfully set or not |
| 1619 |
* |
| 1620 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_SET_UUID |
| 1621 |
*/ |
| 1622 |
gboolean bd_fs_ext3_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 1623 |
|
| 1624 |
/** |
| 1625 |
* bd_fs_ext4_set_uuid: |
| 1626 |
* @device: the device the file system on which to set UUID for |
| 1627 |
* @uuid: (nullable): UUID to set %NULL to generate a new one |
| 1628 |
* UUID can also be one of "clear", "random" and "time" to clear, |
| 1629 |
* generate a new random/time-based UUID |
| 1630 |
* @error: (out) (optional): place to store error (if any) |
| 1631 |
* |
| 1632 |
* Returns: whether the UUID of ext4 file system on the @device was |
| 1633 |
* successfully set or not |
| 1634 |
* |
| 1635 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_SET_UUID |
| 1636 |
*/ |
| 1637 |
gboolean bd_fs_ext4_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 1638 |
|
| 1639 |
/** |
| 1640 |
* bd_fs_ext2_check_uuid: |
| 1641 |
* @uuid: UUID to check |
| 1642 |
* @error: (out) (optional): place to store error |
| 1643 |
* |
| 1644 |
* Returns: whether @uuid is a valid UUID for the ext2 file system or not |
| 1645 |
* (reason is provided in @error) |
| 1646 |
* |
| 1647 |
* Tech category: always available |
| 1648 |
*/ |
| 1649 |
gboolean bd_fs_ext2_check_uuid (const gchar *uuid, GError **error); |
| 1650 |
|
| 1651 |
/** |
| 1652 |
* bd_fs_ext3_check_uuid: |
| 1653 |
* @uuid: UUID to check |
| 1654 |
* @error: (out) (optional): place to store error |
| 1655 |
* |
| 1656 |
* Returns: whether @uuid is a valid UUID for the ext3 file system or not |
| 1657 |
* (reason is provided in @error) |
| 1658 |
* |
| 1659 |
* Tech category: always available |
| 1660 |
*/ |
| 1661 |
gboolean bd_fs_ext3_check_uuid (const gchar *uuid, GError **error); |
| 1662 |
|
| 1663 |
/** |
| 1664 |
* bd_fs_ext4_check_uuid: |
| 1665 |
* @uuid: UUID to check |
| 1666 |
* @error: (out) (optional): place to store error |
| 1667 |
* |
| 1668 |
* Returns: whether @uuid is a valid UUID for the ext4 file system or not |
| 1669 |
* (reason is provided in @error) |
| 1670 |
* |
| 1671 |
* Tech category: always available |
| 1672 |
*/ |
| 1673 |
gboolean bd_fs_ext4_check_uuid (const gchar *uuid, GError **error); |
| 1674 |
|
| 1675 |
/** |
| 1676 |
* bd_fs_ext2_get_info: |
| 1677 |
* @device: the device the file system of which to get info for |
| 1678 |
* @error: (out) (optional): place to store error (if any) |
| 1679 |
* |
| 1680 |
* Returns: (transfer full): information about the file system on @device or |
| 1681 |
* %NULL in case of error |
| 1682 |
* |
| 1683 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_QUERY |
| 1684 |
*/ |
| 1685 |
BDFSExt2Info* bd_fs_ext2_get_info (const gchar *device, GError **error); |
| 1686 |
|
| 1687 |
/** |
| 1688 |
* bd_fs_ext3_get_info: |
| 1689 |
* @device: the device the file system of which to get info for |
| 1690 |
* @error: (out) (optional): place to store error (if any) |
| 1691 |
* |
| 1692 |
* Returns: (transfer full): information about the file system on @device or |
| 1693 |
* %NULL in case of error |
| 1694 |
* |
| 1695 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_QUERY |
| 1696 |
*/ |
| 1697 |
BDFSExt3Info* bd_fs_ext3_get_info (const gchar *device, GError **error); |
| 1698 |
|
| 1699 |
/** |
| 1700 |
* bd_fs_ext4_get_info: |
| 1701 |
* @device: the device the file system of which to get info for |
| 1702 |
* @error: (out) (optional): place to store error (if any) |
| 1703 |
* |
| 1704 |
* Returns: (transfer full): information about the file system on @device or |
| 1705 |
* %NULL in case of error |
| 1706 |
* |
| 1707 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_QUERY |
| 1708 |
*/ |
| 1709 |
BDFSExt4Info* bd_fs_ext4_get_info (const gchar *device, GError **error); |
| 1710 |
|
| 1711 |
/** |
| 1712 |
* bd_fs_ext2_resize: |
| 1713 |
* @device: the device the file system of which to resize |
| 1714 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 1715 |
* adapted to the underlying block device) |
| 1716 |
* @extra: (nullable) (array zero-terminated=1): extra options for the resize (right now |
| 1717 |
* passed to the 'resize2fs' utility) |
| 1718 |
* @error: (out) (optional): place to store error (if any) |
| 1719 |
* |
| 1720 |
* Returns: whether the file system on @device was successfully resized or not |
| 1721 |
* |
| 1722 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_RESIZE |
| 1723 |
*/ |
| 1724 |
gboolean bd_fs_ext2_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error); |
| 1725 |
|
| 1726 |
/** |
| 1727 |
* bd_fs_ext3_resize: |
| 1728 |
* @device: the device the file system of which to resize |
| 1729 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 1730 |
* adapted to the underlying block device) |
| 1731 |
* @extra: (nullable) (array zero-terminated=1): extra options for the resize (right now |
| 1732 |
* passed to the 'resize2fs' utility) |
| 1733 |
* @error: (out) (optional): place to store error (if any) |
| 1734 |
* |
| 1735 |
* Returns: whether the file system on @device was successfully resized or not |
| 1736 |
* |
| 1737 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_RESIZE |
| 1738 |
*/ |
| 1739 |
gboolean bd_fs_ext3_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error); |
| 1740 |
|
| 1741 |
/** |
| 1742 |
* bd_fs_ext4_resize: |
| 1743 |
* @device: the device the file system of which to resize |
| 1744 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 1745 |
* adapted to the underlying block device) |
| 1746 |
* @extra: (nullable) (array zero-terminated=1): extra options for the resize (right now |
| 1747 |
* passed to the 'resize2fs' utility) |
| 1748 |
* @error: (out) (optional): place to store error (if any) |
| 1749 |
* |
| 1750 |
* Returns: whether the file system on @device was successfully resized or not |
| 1751 |
* |
| 1752 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_RESIZE |
| 1753 |
*/ |
| 1754 |
gboolean bd_fs_ext4_resize (const gchar *device, guint64 new_size, const BDExtraArg **extra, GError **error); |
| 1755 |
|
| 1756 |
/** |
| 1757 |
* bd_fs_ext2_get_min_size: |
| 1758 |
* @device: the device containing the file system to get min size for |
| 1759 |
* @error: (out) (optional): place to store error (if any) |
| 1760 |
* |
| 1761 |
* Returns: smallest shrunken filesystem size as reported by resize2fs |
| 1762 |
* in case of error 0 is returned and @error is set |
| 1763 |
* |
| 1764 |
* Tech category: %BD_FS_TECH_EXT2-%BD_FS_TECH_MODE_RESIZE |
| 1765 |
*/ |
| 1766 |
guint64 bd_fs_ext2_get_min_size (const gchar *device, GError **error); |
| 1767 |
|
| 1768 |
/** |
| 1769 |
* bd_fs_ext3_get_min_size: |
| 1770 |
* @device: the device containing the file system to get min size for |
| 1771 |
* @error: (out) (optional): place to store error (if any) |
| 1772 |
* |
| 1773 |
* Returns: smallest shrunken filesystem size as reported by resize2fs |
| 1774 |
* in case of error 0 is returned and @error is set |
| 1775 |
* |
| 1776 |
* Tech category: %BD_FS_TECH_EXT3-%BD_FS_TECH_MODE_RESIZE |
| 1777 |
*/ |
| 1778 |
guint64 bd_fs_ext3_get_min_size (const gchar *device, GError **error); |
| 1779 |
|
| 1780 |
/** |
| 1781 |
* bd_fs_ext4_get_min_size: |
| 1782 |
* @device: the device containing the file system to get min size for |
| 1783 |
* @error: (out) (optional): place to store error (if any) |
| 1784 |
* |
| 1785 |
* Returns: smallest shrunken filesystem size as reported by resize2fs |
| 1786 |
* in case of error 0 is returned and @error is set |
| 1787 |
* |
| 1788 |
* Tech category: %BD_FS_TECH_EXT4-%BD_FS_TECH_MODE_RESIZE |
| 1789 |
*/ |
| 1790 |
guint64 bd_fs_ext4_get_min_size (const gchar *device, GError **error); |
| 1791 |
|
| 1792 |
/** |
| 1793 |
* bd_fs_xfs_mkfs: |
| 1794 |
* @device: the device to create a new xfs fs on |
| 1795 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 1796 |
* passed to the 'mkfs.xfs' utility) |
| 1797 |
* @error: (out) (optional): place to store error (if any) |
| 1798 |
* |
| 1799 |
* Returns: whether a new xfs fs was successfully created on @device or not |
| 1800 |
* |
| 1801 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_MKFS |
| 1802 |
*/ |
| 1803 |
gboolean bd_fs_xfs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1804 |
|
| 1805 |
/** |
| 1806 |
* bd_fs_xfs_check: |
| 1807 |
* @device: the device containing the file system to check |
| 1808 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1809 |
* passed to the 'xfs_repair' utility) |
| 1810 |
* @error: (out) (optional): place to store error (if any) |
| 1811 |
* |
| 1812 |
* Returns: whether an xfs file system on the @device is clean or not |
| 1813 |
* |
| 1814 |
* Note: If the file system is mounted RW, it will always be reported as not |
| 1815 |
* clean! |
| 1816 |
* |
| 1817 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_CHECK |
| 1818 |
*/ |
| 1819 |
gboolean bd_fs_xfs_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1820 |
|
| 1821 |
/** |
| 1822 |
* bd_fs_xfs_repair: |
| 1823 |
* @device: the device containing the file system to repair |
| 1824 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1825 |
* passed to the 'xfs_repair' utility) |
| 1826 |
* @error: (out) (optional): place to store error (if any) |
| 1827 |
* |
| 1828 |
* Returns: whether an xfs file system on the @device was successfully repaired |
| 1829 |
* (if needed) or not (error is set in that case) |
| 1830 |
* |
| 1831 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_REPAIR |
| 1832 |
*/ |
| 1833 |
gboolean bd_fs_xfs_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1834 |
|
| 1835 |
/** |
| 1836 |
* bd_fs_xfs_set_label: |
| 1837 |
* @device: the device containing the file system to set label for |
| 1838 |
* @label: label to set |
| 1839 |
* @error: (out) (optional): place to store error (if any) |
| 1840 |
* |
| 1841 |
* Returns: whether the label of xfs file system on the @device was |
| 1842 |
* successfully set or not |
| 1843 |
* |
| 1844 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_SET_LABEL |
| 1845 |
*/ |
| 1846 |
gboolean bd_fs_xfs_set_label (const gchar *device, const gchar *label, GError **error); |
| 1847 |
|
| 1848 |
/** |
| 1849 |
* bd_fs_xfs_check_label: |
| 1850 |
* @label: label to check |
| 1851 |
* @error: (out) (optional): place to store error |
| 1852 |
* |
| 1853 |
* Returns: whether @label is a valid label for the xfs file system or not |
| 1854 |
* (reason is provided in @error) |
| 1855 |
* |
| 1856 |
* Tech category: always available |
| 1857 |
*/ |
| 1858 |
gboolean bd_fs_xfs_check_label (const gchar *label, GError **error); |
| 1859 |
|
| 1860 |
/** |
| 1861 |
* bd_fs_xfs_set_uuid: |
| 1862 |
* @device: the device containing the file system to set uuid for |
| 1863 |
* @uuid: (nullable): UUID to set %NULL to generate a new one |
| 1864 |
* UUID can also be one of "nil" and "generate" to clear or |
| 1865 |
* generate a new UUID |
| 1866 |
* @error: (out) (optional): place to store error (if any) |
| 1867 |
* |
| 1868 |
* Returns: whether the UUID of xfs file system on the @device was |
| 1869 |
* successfully set or not |
| 1870 |
* |
| 1871 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_SET_UUID |
| 1872 |
*/ |
| 1873 |
gboolean bd_fs_xfs_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 1874 |
|
| 1875 |
/** |
| 1876 |
* bd_fs_xfs_get_info: |
| 1877 |
* @device: the device containing the file system to get info for (device must |
| 1878 |
be mounted, trying to get info for an unmounted device will result |
| 1879 |
in an error) |
| 1880 |
* @error: (out) (optional): place to store error (if any) |
| 1881 |
* |
| 1882 |
* Returns: (transfer full): information about the file system on @device or |
| 1883 |
* %NULL in case of error |
| 1884 |
* |
| 1885 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_QUERY |
| 1886 |
*/ |
| 1887 |
BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error); |
| 1888 |
|
| 1889 |
/** |
| 1890 |
* bd_fs_xfs_resize: |
| 1891 |
* @mpoint: the mount point of the file system to resize |
| 1892 |
* @new_size: new requested size for the file system *in file system blocks* (see bd_fs_xfs_get_info()) |
| 1893 |
* (if 0, the file system is adapted to the underlying block device) |
| 1894 |
* @extra: (nullable) (array zero-terminated=1): extra options for the resize (right now |
| 1895 |
* passed to the 'xfs_growfs' utility) |
| 1896 |
* @error: (out) (optional): place to store error (if any) |
| 1897 |
* |
| 1898 |
* Returns: whether the file system mounted on @mpoint was successfully resized or not |
| 1899 |
* |
| 1900 |
* Tech category: %BD_FS_TECH_XFS-%BD_FS_TECH_MODE_RESIZE |
| 1901 |
*/ |
| 1902 |
gboolean bd_fs_xfs_resize (const gchar *mpoint, guint64 new_size, const BDExtraArg **extra, GError **error); |
| 1903 |
|
| 1904 |
/** |
| 1905 |
* bd_fs_vfat_mkfs: |
| 1906 |
* @device: the device to create a new vfat fs on |
| 1907 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 1908 |
* passed to the 'mkfs.vfat' utility) |
| 1909 |
* @error: (out) (optional): place to store error (if any) |
| 1910 |
* |
| 1911 |
* Please remember that FAT labels should always be uppercase. |
| 1912 |
* |
| 1913 |
* Returns: whether a new vfat fs was successfully created on @device or not |
| 1914 |
* |
| 1915 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_MKFS |
| 1916 |
*/ |
| 1917 |
gboolean bd_fs_vfat_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1918 |
|
| 1919 |
/** |
| 1920 |
* bd_fs_vfat_check: |
| 1921 |
* @device: the device containing the file system to check |
| 1922 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1923 |
* passed to the 'fsck.vfat' utility) |
| 1924 |
* @error: (out) (optional): place to store error (if any) |
| 1925 |
* |
| 1926 |
* Returns: whether an vfat file system on the @device is clean or not |
| 1927 |
* |
| 1928 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_CHECK |
| 1929 |
*/ |
| 1930 |
gboolean bd_fs_vfat_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1931 |
|
| 1932 |
/** |
| 1933 |
* bd_fs_vfat_repair: |
| 1934 |
* @device: the device containing the file system to repair |
| 1935 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 1936 |
* passed to the 'fsck.vfat' utility) |
| 1937 |
* @error: (out) (optional): place to store error (if any) |
| 1938 |
* |
| 1939 |
* Returns: whether an vfat file system on the @device was successfully repaired |
| 1940 |
* (if needed) or not (error is set in that case) |
| 1941 |
* |
| 1942 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_REPAIR |
| 1943 |
*/ |
| 1944 |
gboolean bd_fs_vfat_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 1945 |
|
| 1946 |
/** |
| 1947 |
* bd_fs_vfat_set_label: |
| 1948 |
* @device: the device containing the file system to set label for |
| 1949 |
* @label: label to set |
| 1950 |
* @error: (out) (optional): place to store error (if any) |
| 1951 |
* |
| 1952 |
* Returns: whether the label of vfat file system on the @device was |
| 1953 |
* successfully set or not |
| 1954 |
* |
| 1955 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_SET_LABEL |
| 1956 |
*/ |
| 1957 |
gboolean bd_fs_vfat_set_label (const gchar *device, const gchar *label, GError **error); |
| 1958 |
|
| 1959 |
/** |
| 1960 |
* bd_fs_vfat_check_label: |
| 1961 |
* @label: label to check |
| 1962 |
* @error: (out) (optional): place to store error |
| 1963 |
* |
| 1964 |
* Returns: whether @label is a valid label for the vfat file system or not |
| 1965 |
* (reason is provided in @error) |
| 1966 |
* |
| 1967 |
* Tech category: always available |
| 1968 |
*/ |
| 1969 |
gboolean bd_fs_vfat_check_label (const gchar *label, GError **error); |
| 1970 |
|
| 1971 |
|
| 1972 |
/** |
| 1973 |
* bd_fs_vfat_set_uuid: |
| 1974 |
* @device: the device containing the file system to set uuid for |
| 1975 |
* @uuid: (nullable): volume ID to set or %NULL to generate a new one |
| 1976 |
* @error: (out) (optional): place to store error (if any) |
| 1977 |
* |
| 1978 |
* Returns: whether the volume ID of vfat file system on the @device was |
| 1979 |
* successfully set or not |
| 1980 |
* |
| 1981 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_SET_UUID |
| 1982 |
*/ |
| 1983 |
gboolean bd_fs_vfat_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 1984 |
|
| 1985 |
/** |
| 1986 |
* bd_fs_vfat_check_uuid: |
| 1987 |
* @uuid: UUID to check |
| 1988 |
* @error: (out) (optional): place to store error |
| 1989 |
* |
| 1990 |
* Returns: whether @uuid is a valid UUID for the vfat file system or not |
| 1991 |
* (reason is provided in @error) |
| 1992 |
* |
| 1993 |
* Tech category: always available |
| 1994 |
*/ |
| 1995 |
gboolean bd_fs_vfat_check_uuid (const gchar *uuid, GError **error); |
| 1996 |
|
| 1997 |
/** |
| 1998 |
* bd_fs_vfat_get_info: |
| 1999 |
* @device: the device containing the file system to get info for |
| 2000 |
* @error: (out) (optional): place to store error (if any) |
| 2001 |
* |
| 2002 |
* Returns: (transfer full): information about the file system on @device or |
| 2003 |
* %NULL in case of error |
| 2004 |
* |
| 2005 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_QUERY |
| 2006 |
*/ |
| 2007 |
BDFSVfatInfo* bd_fs_vfat_get_info (const gchar *device, GError **error); |
| 2008 |
|
| 2009 |
/** |
| 2010 |
* bd_fs_vfat_resize: |
| 2011 |
* @device: the device the file system of which to resize |
| 2012 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 2013 |
* adapted to the underlying block device) |
| 2014 |
* @error: (out) (optional): place to store error (if any) |
| 2015 |
* |
| 2016 |
* Returns: whether the file system on @device was successfully resized or not |
| 2017 |
* |
| 2018 |
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_RESIZE |
| 2019 |
*/ |
| 2020 |
gboolean bd_fs_vfat_resize (const gchar *device, guint64 new_size, GError **error); |
| 2021 |
|
| 2022 |
/** |
| 2023 |
* bd_fs_ntfs_mkfs: |
| 2024 |
* @device: the device to create a new ntfs fs on |
| 2025 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2026 |
* passed to the 'mkntfs' utility) |
| 2027 |
* @error: (out) (optional): place to store error (if any) |
| 2028 |
* |
| 2029 |
* Returns: whether a new NTFS fs was successfully created on @device or not |
| 2030 |
* |
| 2031 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_MKFS |
| 2032 |
*/ |
| 2033 |
gboolean bd_fs_ntfs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2034 |
|
| 2035 |
/** |
| 2036 |
* bd_fs_ntfs_check: |
| 2037 |
* @device: the device containing the file system to check |
| 2038 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2039 |
* passed to the 'ntfsfix' utility) |
| 2040 |
* @error: (out) (optional): place to store error (if any) |
| 2041 |
* |
| 2042 |
* Returns: whether an ntfs file system on the @device is clean or not |
| 2043 |
* |
| 2044 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_CHECK |
| 2045 |
*/ |
| 2046 |
gboolean bd_fs_ntfs_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2047 |
|
| 2048 |
/** |
| 2049 |
* bd_fs_ntfs_repair: |
| 2050 |
* @device: the device containing the file system to repair |
| 2051 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2052 |
* passed to the 'ntfsfix' utility) |
| 2053 |
* @error: (out) (optional): place to store error (if any) |
| 2054 |
* |
| 2055 |
* Returns: whether an NTFS file system on the @device was successfully repaired |
| 2056 |
* (if needed) or not (error is set in that case) |
| 2057 |
* |
| 2058 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_REPAIR |
| 2059 |
*/ |
| 2060 |
gboolean bd_fs_ntfs_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2061 |
|
| 2062 |
/** |
| 2063 |
* bd_fs_ntfs_set_label: |
| 2064 |
* @device: the device containing the file system to set the label for |
| 2065 |
* @label: label to set |
| 2066 |
* @error: (out) (optional): place to store error (if any) |
| 2067 |
* |
| 2068 |
* Returns: whether the label of the NTFS file system on the @device was |
| 2069 |
* successfully set or not |
| 2070 |
* |
| 2071 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_SET_LABEL |
| 2072 |
*/ |
| 2073 |
gboolean bd_fs_ntfs_set_label (const gchar *device, const gchar *label, GError **error); |
| 2074 |
|
| 2075 |
/** |
| 2076 |
* bd_fs_ntfs_check_label: |
| 2077 |
* @label: label to check |
| 2078 |
* @error: (out) (optional): place to store error |
| 2079 |
* |
| 2080 |
* Returns: whether @label is a valid label for the ntfs file system or not |
| 2081 |
* (reason is provided in @error) |
| 2082 |
* |
| 2083 |
* Tech category: always available |
| 2084 |
*/ |
| 2085 |
gboolean bd_fs_ntfs_check_label (const gchar *label, GError **error); |
| 2086 |
|
| 2087 |
/** |
| 2088 |
* bd_fs_ntfs_set_uuid: |
| 2089 |
* @device: the device containing the file system to set the UUID (serial number) for |
| 2090 |
* @uuid: (nullable): UUID to set or %NULL to generate a new one |
| 2091 |
* @error: (out) (optional): place to store error (if any) |
| 2092 |
* |
| 2093 |
* Returns: whether the UUID of the NTFS file system on the @device was |
| 2094 |
* successfully set or not |
| 2095 |
* |
| 2096 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_SET_UUID |
| 2097 |
*/ |
| 2098 |
gboolean bd_fs_ntfs_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 2099 |
|
| 2100 |
/** |
| 2101 |
* bd_fs_ntfs_check_uuid: |
| 2102 |
* @uuid: UUID to check |
| 2103 |
* @error: (out) (optional): place to store error |
| 2104 |
* |
| 2105 |
* Returns: whether @uuid is a valid UUID for the ntfs file system or not |
| 2106 |
* (reason is provided in @error) |
| 2107 |
* |
| 2108 |
* Tech category: always available |
| 2109 |
*/ |
| 2110 |
gboolean bd_fs_ntfs_check_uuid (const gchar *uuid, GError **error); |
| 2111 |
|
| 2112 |
/** |
| 2113 |
* bd_fs_ntfs_resize: |
| 2114 |
* @device: the device the file system of which to resize |
| 2115 |
* @new_size: new requested size for the file system in bytes (if 0, the file system |
| 2116 |
* is adapted to the underlying block device) |
| 2117 |
* @error: (out) (optional): place to store error (if any) |
| 2118 |
* |
| 2119 |
* Returns: whether the file system on @device was successfully resized or not |
| 2120 |
* |
| 2121 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_RESIZE |
| 2122 |
*/ |
| 2123 |
gboolean bd_fs_ntfs_resize (const gchar *device, guint64 new_size, GError **error); |
| 2124 |
|
| 2125 |
/** |
| 2126 |
* bd_fs_ntfs_get_info: |
| 2127 |
* @device: the device containing the file system to get info for (device must |
| 2128 |
not be mounted, trying to get info for a mounted device will result |
| 2129 |
in an error) |
| 2130 |
* @error: (out) (optional): place to store error (if any) |
| 2131 |
* |
| 2132 |
* Returns: (transfer full): information about the file system on @device or |
| 2133 |
* %NULL in case of error |
| 2134 |
* |
| 2135 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_QUERY |
| 2136 |
*/ |
| 2137 |
BDFSNtfsInfo* bd_fs_ntfs_get_info (const gchar *device, GError **error); |
| 2138 |
|
| 2139 |
/** |
| 2140 |
* bd_fs_ntfs_get_min_size: |
| 2141 |
* @device: the device containing the file system to get min size for |
| 2142 |
* @error: (out) (optional): place to store error (if any) |
| 2143 |
* |
| 2144 |
* Returns: smallest shrunken filesystem size as reported by ntfsresize |
| 2145 |
* in case of error 0 is returned and @error is set |
| 2146 |
* |
| 2147 |
* Tech category: %BD_FS_TECH_NTFS-%BD_FS_TECH_MODE_RESIZE |
| 2148 |
*/ |
| 2149 |
guint64 bd_fs_ntfs_get_min_size (const gchar *device, GError **error); |
| 2150 |
|
| 2151 |
/** |
| 2152 |
* bd_fs_f2fs_mkfs: |
| 2153 |
* @device: the device to create a new f2fs fs on |
| 2154 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2155 |
* passed to the 'mkfs.f2fs' utility) |
| 2156 |
* @error: (out) (optional): place to store error (if any) |
| 2157 |
* |
| 2158 |
* Returns: whether a new f2fs fs was successfully created on @device or not |
| 2159 |
* |
| 2160 |
* Tech category: %BD_FS_TECH_F2FS-%BD_FS_TECH_MODE_MKFS |
| 2161 |
*/ |
| 2162 |
gboolean bd_fs_f2fs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2163 |
|
| 2164 |
/** |
| 2165 |
* bd_fs_f2fs_check: |
| 2166 |
* @device: the device containing the file system to check |
| 2167 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2168 |
* passed to the 'fsck.f2fs' utility) |
| 2169 |
* @error: (out) (optional): place to store error (if any) |
| 2170 |
* |
| 2171 |
* Returns: whether an f2fs file system on the @device is clean or not |
| 2172 |
* |
| 2173 |
* Tech category: %BD_FS_TECH_F2FS-%BD_FS_TECH_MODE_CHECK |
| 2174 |
*/ |
| 2175 |
gboolean bd_fs_f2fs_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2176 |
|
| 2177 |
/** |
| 2178 |
* bd_fs_f2fs_repair: |
| 2179 |
* @device: the device containing the file system to repair |
| 2180 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2181 |
* passed to the 'fsck.f2fs' utility) |
| 2182 |
* @error: (out) (optional): place to store error (if any) |
| 2183 |
* |
| 2184 |
* Returns: whether an f2fs file system on the @device was successfully repaired |
| 2185 |
* (if needed) or not (error is set in that case) |
| 2186 |
* |
| 2187 |
* Tech category: %BD_FS_TECH_F2FS-%BD_FS_TECH_MODE_REPAIR |
| 2188 |
*/ |
| 2189 |
gboolean bd_fs_f2fs_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2190 |
|
| 2191 |
/** |
| 2192 |
* bd_fs_f2fs_get_info: |
| 2193 |
* @device: the device containing the file system to get info for |
| 2194 |
* @error: (out) (optional): place to store error (if any) |
| 2195 |
* |
| 2196 |
* Returns: (transfer full): information about the file system on @device or |
| 2197 |
* %NULL in case of error |
| 2198 |
* |
| 2199 |
* Tech category: %BD_FS_TECH_F2FS-%BD_FS_TECH_MODE_QUERY |
| 2200 |
*/ |
| 2201 |
BDFSF2FSInfo* bd_fs_f2fs_get_info (const gchar *device, GError **error); |
| 2202 |
|
| 2203 |
/** |
| 2204 |
* bd_fs_f2fs_resize: |
| 2205 |
* @device: the device containing the file system to resize |
| 2206 |
* @new_size: new requested size for the file system *in file system sectors* (see bd_fs_f2fs_get_info()) |
| 2207 |
* (if 0, the file system is adapted to the underlying block device) |
| 2208 |
* @safe: whether to perform safe resize or not (does not resize metadata) |
| 2209 |
* @extra: (nullable) (array zero-terminated=1): extra options for the resize (right now |
| 2210 |
* passed to the 'resize.f2fs' utility) |
| 2211 |
* @error: (out) (optional): place to store error (if any) |
| 2212 |
* |
| 2213 |
* Returns: whether the file system on @device was successfully resized or not |
| 2214 |
* |
| 2215 |
* Tech category: %BD_FS_TECH_F2FS-%BD_FS_TECH_MODE_RESIZE |
| 2216 |
*/ |
| 2217 |
gboolean bd_fs_f2fs_resize (const gchar *device, guint64 new_size, gboolean safe, const BDExtraArg **extra, GError **error); |
| 2218 |
|
| 2219 |
/** |
| 2220 |
* bd_fs_f2fs_check_label: |
| 2221 |
* @label: label to check |
| 2222 |
* @error: (out) (optional): place to store error |
| 2223 |
* |
| 2224 |
* Returns: whether @label is a valid label for the f2fs file system or not |
| 2225 |
* (reason is provided in @error) |
| 2226 |
* |
| 2227 |
* Tech category: always available |
| 2228 |
*/ |
| 2229 |
gboolean bd_fs_f2fs_check_label (const gchar *label, GError **error); |
| 2230 |
|
| 2231 |
/** |
| 2232 |
* bd_fs_nilfs2_mkfs: |
| 2233 |
* @device: the device to create a new nilfs fs on |
| 2234 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2235 |
* passed to the 'mkfs.nilfs2' utility) |
| 2236 |
* @error: (out) (optional): place to store error (if any) |
| 2237 |
* |
| 2238 |
* Returns: whether a new nilfs fs was successfully created on @device or not |
| 2239 |
* |
| 2240 |
* Tech category: %BD_FS_TECH_NILFS2-%BD_FS_TECH_MODE_MKFS |
| 2241 |
*/ |
| 2242 |
gboolean bd_fs_nilfs2_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2243 |
|
| 2244 |
/** |
| 2245 |
* bd_fs_nilfs2_set_label: |
| 2246 |
* @device: the device containing the file system to set label for |
| 2247 |
* @label: label to set |
| 2248 |
* @error: (out) (optional): place to store error (if any) |
| 2249 |
* |
| 2250 |
* Returns: whether the label of nilfs file system on the @device was |
| 2251 |
* successfully set or not |
| 2252 |
* |
| 2253 |
* Tech category: %BD_FS_TECH_NILFS2-%BD_FS_TECH_MODE_SET_LABEL |
| 2254 |
*/ |
| 2255 |
gboolean bd_fs_nilfs2_set_label (const gchar *device, const gchar *label, GError **error); |
| 2256 |
|
| 2257 |
/** |
| 2258 |
* bd_fs_nilfs2_check_label: |
| 2259 |
* @label: label to check |
| 2260 |
* @error: (out) (optional): place to store error |
| 2261 |
* |
| 2262 |
* Returns: whether @label is a valid label for the nilfs2 file system or not |
| 2263 |
* (reason is provided in @error) |
| 2264 |
* |
| 2265 |
* Tech category: always available |
| 2266 |
*/ |
| 2267 |
gboolean bd_fs_nilfs2_check_label (const gchar *label, GError **error); |
| 2268 |
|
| 2269 |
/** |
| 2270 |
* bd_fs_nilfs2_set_uuid: |
| 2271 |
* @device: the device containing the file system to set UUID for |
| 2272 |
* @uuid: (nullable): UUID to set or %NULL to generate a new one |
| 2273 |
* @error: (out) (optional): place to store error (if any) |
| 2274 |
* |
| 2275 |
* Returns: whether the uuid of nilfs file system on the @device was |
| 2276 |
* successfully set or not |
| 2277 |
* |
| 2278 |
* Tech category: %BD_FS_TECH_NILFS2-%BD_FS_TECH_MODE_SET_UUID |
| 2279 |
*/ |
| 2280 |
gboolean bd_fs_nilfs2_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 2281 |
|
| 2282 |
/** |
| 2283 |
* bd_fs_nilfs2_check_uuid: |
| 2284 |
* @uuid: UUID to check |
| 2285 |
* @error: (out) (optional): place to store error |
| 2286 |
* |
| 2287 |
* Returns: whether @uuid is a valid UUID for the nilfs file system or not |
| 2288 |
* (reason is provided in @error) |
| 2289 |
* |
| 2290 |
* Tech category: always available |
| 2291 |
*/ |
| 2292 |
gboolean bd_fs_nilfs2_check_uuid (const gchar *uuid, GError **error); |
| 2293 |
|
| 2294 |
/** |
| 2295 |
* bd_fs_nilfs2_get_info: |
| 2296 |
* @device: the device containing the file system to get info for |
| 2297 |
* @error: (out) (optional): place to store error (if any) |
| 2298 |
* |
| 2299 |
* Returns: (transfer full): information about the file system on @device or |
| 2300 |
* %NULL in case of error |
| 2301 |
* |
| 2302 |
* Tech category: %BD_FS_TECH_NILFS2-%BD_FS_TECH_MODE_QUERY |
| 2303 |
*/ |
| 2304 |
BDFSNILFS2Info* bd_fs_nilfs2_get_info (const gchar *device, GError **error); |
| 2305 |
|
| 2306 |
/** |
| 2307 |
* bd_fs_nilfs2_resize: |
| 2308 |
* @device: the device the file system of which to resize |
| 2309 |
* @new_size: new requested size for the file system (if 0, the file system is |
| 2310 |
* adapted to the underlying block device) |
| 2311 |
* @error: (out) (optional): place to store error (if any) |
| 2312 |
* |
| 2313 |
* Returns: whether the file system on @device was successfully resized or not |
| 2314 |
* |
| 2315 |
* Tech category: %BD_FS_TECH_NILFS2-%BD_FS_TECH_MODE_RESIZE |
| 2316 |
*/ |
| 2317 |
gboolean bd_fs_nilfs2_resize (const gchar *device, guint64 new_size, GError **error); |
| 2318 |
|
| 2319 |
/** |
| 2320 |
* bd_fs_exfat_mkfs: |
| 2321 |
* @device: the device to create a new exfat fs on |
| 2322 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2323 |
* passed to the 'mkexfatfs' utility) |
| 2324 |
* @error: (out) (optional): place to store error (if any) |
| 2325 |
* |
| 2326 |
* Returns: whether a new exfat fs was successfully created on @device or not |
| 2327 |
* |
| 2328 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_MKFS |
| 2329 |
*/ |
| 2330 |
gboolean bd_fs_exfat_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2331 |
|
| 2332 |
/** |
| 2333 |
* bd_fs_exfat_check: |
| 2334 |
* @device: the device containing the file system to check |
| 2335 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2336 |
* passed to the 'exfatfsck' utility) |
| 2337 |
* @error: (out) (optional): place to store error (if any) |
| 2338 |
* |
| 2339 |
* Returns: whether the exfat file system on the @device is clean or not |
| 2340 |
* |
| 2341 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_CHECK |
| 2342 |
*/ |
| 2343 |
gboolean bd_fs_exfat_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2344 |
|
| 2345 |
/** |
| 2346 |
* bd_fs_exfat_repair: |
| 2347 |
* @device: the device containing the file system to repair |
| 2348 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2349 |
* passed to the 'exfatfsck' utility) |
| 2350 |
* @error: (out) (optional): place to store error (if any) |
| 2351 |
* |
| 2352 |
* Returns: whether the exfat file system on the @device was successfully repaired |
| 2353 |
* (if needed) or not (error is set in that case) |
| 2354 |
* |
| 2355 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_REPAIR |
| 2356 |
*/ |
| 2357 |
gboolean bd_fs_exfat_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2358 |
|
| 2359 |
/** |
| 2360 |
* bd_fs_exfat_set_label: |
| 2361 |
* @device: the device containing the file system to set label for |
| 2362 |
* @label: label to set |
| 2363 |
* @error: (out) (optional): place to store error (if any) |
| 2364 |
* |
| 2365 |
* Returns: whether the label of exfat file system on the @device was |
| 2366 |
* successfully set or not |
| 2367 |
* |
| 2368 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_SET_LABEL |
| 2369 |
*/ |
| 2370 |
gboolean bd_fs_exfat_set_label (const gchar *device, const gchar *label, GError **error); |
| 2371 |
|
| 2372 |
/** |
| 2373 |
* bd_fs_exfat_check_label: |
| 2374 |
* @label: label to check |
| 2375 |
* @error: (out) (optional): place to store error |
| 2376 |
* |
| 2377 |
* Returns: whether @label is a valid label for the exfat file system or not |
| 2378 |
* (reason is provided in @error) |
| 2379 |
* |
| 2380 |
* Tech category: always available |
| 2381 |
*/ |
| 2382 |
gboolean bd_fs_exfat_check_label (const gchar *label, GError **error); |
| 2383 |
|
| 2384 |
/** |
| 2385 |
* bd_fs_exfat_set_uuid: |
| 2386 |
* @device: the device containing the file system to set uuid for |
| 2387 |
* @uuid: (nullable): volume ID to set or %NULL to generate a new one |
| 2388 |
* @error: (out) (optional): place to store error (if any) |
| 2389 |
* |
| 2390 |
* Returns: whether the volume ID of exFAT file system on the @device was |
| 2391 |
* successfully set or not |
| 2392 |
* |
| 2393 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_SET_UUID |
| 2394 |
*/ |
| 2395 |
gboolean bd_fs_exfat_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 2396 |
|
| 2397 |
/** |
| 2398 |
* bd_fs_exfat_check_uuid: |
| 2399 |
* @uuid: UUID to check |
| 2400 |
* @error: (out) (optional): place to store error |
| 2401 |
* |
| 2402 |
* Returns: whether @uuid is a valid UUID for the exFAT file system or not |
| 2403 |
* (reason is provided in @error) |
| 2404 |
* |
| 2405 |
* Tech category: always available |
| 2406 |
*/ |
| 2407 |
gboolean bd_fs_exfat_check_uuid (const gchar *uuid, GError **error); |
| 2408 |
|
| 2409 |
/** |
| 2410 |
* bd_fs_exfat_get_info: |
| 2411 |
* @device: the device containing the file system to get info for |
| 2412 |
* @error: (out) (optional): place to store error (if any) |
| 2413 |
* |
| 2414 |
* Returns: (transfer full): information about the file system on @device or |
| 2415 |
* %NULL in case of error |
| 2416 |
* Tech category: %BD_FS_TECH_EXFAT-%BD_FS_TECH_MODE_QUERY |
| 2417 |
*/ |
| 2418 |
BDFSExfatInfo* bd_fs_exfat_get_info (const gchar *device, GError **error); |
| 2419 |
|
| 2420 |
/** |
| 2421 |
* bd_fs_btrfs_mkfs: |
| 2422 |
* @device: the device to create a new btrfs fs on |
| 2423 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2424 |
* passed to the 'mkfs.btrfs' utility) |
| 2425 |
* @error: (out) (optional): place to store error (if any) |
| 2426 |
* |
| 2427 |
* Returns: whether a new btrfs fs was successfully created on @device or not |
| 2428 |
* |
| 2429 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_MKFS |
| 2430 |
* |
| 2431 |
*/ |
| 2432 |
gboolean bd_fs_btrfs_mkfs (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2433 |
|
| 2434 |
/** |
| 2435 |
* bd_fs_btrfs_check: |
| 2436 |
* @device: the device containing the file system to check |
| 2437 |
* @extra: (nullable) (array zero-terminated=1): extra options for the check (right now |
| 2438 |
* passed to the 'btrfsck' utility) |
| 2439 |
* @error: (out) (optional): place to store error (if any) |
| 2440 |
* |
| 2441 |
* Returns: whether the filesystem was successfully checked or not |
| 2442 |
* |
| 2443 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_CHECK |
| 2444 |
*/ |
| 2445 |
gboolean bd_fs_btrfs_check (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2446 |
|
| 2447 |
/** |
| 2448 |
* bd_fs_btrfs_repair: |
| 2449 |
* @device: the device containing the file system to repair |
| 2450 |
* @extra: (nullable) (array zero-terminated=1): extra options for the repair (right now |
| 2451 |
* passed to the 'btrfs' utility) |
| 2452 |
* @error: (out) (optional): place to store error (if any) |
| 2453 |
* |
| 2454 |
* Returns: whether the filesystem was successfully checked and repaired or not |
| 2455 |
* |
| 2456 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_REPAIR |
| 2457 |
*/ |
| 2458 |
gboolean bd_fs_btrfs_repair (const gchar *device, const BDExtraArg **extra, GError **error); |
| 2459 |
|
| 2460 |
/** |
| 2461 |
* bd_fs_btrfs_set_label: |
| 2462 |
* @mpoint: the mount point of the file system to set label for |
| 2463 |
* @label: label to set |
| 2464 |
* @error: (out) (optional): place to store error (if any) |
| 2465 |
* |
| 2466 |
* Returns: whether the label of Btrfs file system on the @mpoint was |
| 2467 |
* successfully set or not |
| 2468 |
* |
| 2469 |
* Note: This function is intended to be used for btrfs filesystem on a single device, |
| 2470 |
* for more complicated setups use the btrfs plugin instead. |
| 2471 |
* |
| 2472 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_SET_LABEL |
| 2473 |
*/ |
| 2474 |
gboolean bd_fs_btrfs_set_label (const gchar *mpoint, const gchar *label, GError **error); |
| 2475 |
|
| 2476 |
/** |
| 2477 |
* bd_fs_btrfs_check_label: |
| 2478 |
* @label: label to check |
| 2479 |
* @error: (out) (optional): place to store error |
| 2480 |
* |
| 2481 |
* Returns: whether @label is a valid label for the Btrfs file system or not |
| 2482 |
* (reason is provided in @error) |
| 2483 |
* |
| 2484 |
* Note: This function is intended to be used for btrfs filesystem on a single device, |
| 2485 |
* for more complicated setups use the btrfs plugin instead. |
| 2486 |
* |
| 2487 |
* Tech category: always available |
| 2488 |
*/ |
| 2489 |
gboolean bd_fs_btrfs_check_label (const gchar *label, GError **error); |
| 2490 |
|
| 2491 |
/** |
| 2492 |
* bd_fs_btrfs_set_uuid: |
| 2493 |
* @device: the device containing the file system to set the UUID (serial number) for |
| 2494 |
* @uuid: (nullable): UUID to set or %NULL to generate a new one |
| 2495 |
* @error: (out) (optional): place to store error (if any) |
| 2496 |
* |
| 2497 |
* Returns: whether the UUID of the Btrfs file system on the @device was |
| 2498 |
* successfully set or not |
| 2499 |
* |
| 2500 |
* Note: This function is intended to be used for btrfs filesystem on a single device, |
| 2501 |
* for more complicated setups use the btrfs plugin instead. |
| 2502 |
* |
| 2503 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_SET_UUID |
| 2504 |
*/ |
| 2505 |
gboolean bd_fs_btrfs_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 2506 |
|
| 2507 |
/** |
| 2508 |
* bd_fs_btrfs_check_uuid: |
| 2509 |
* @uuid: UUID to check |
| 2510 |
* @error: (out) (optional): place to store error |
| 2511 |
* |
| 2512 |
* Returns: whether @uuid is a valid UUID for the Btrfs file system or not |
| 2513 |
* (reason is provided in @error) |
| 2514 |
* |
| 2515 |
* Note: This function is intended to be used for btrfs filesystem on a single device, |
| 2516 |
* for more complicated setups use the btrfs plugin instead. |
| 2517 |
* |
| 2518 |
* Tech category: always available |
| 2519 |
*/ |
| 2520 |
gboolean bd_fs_btrfs_check_uuid (const gchar *uuid, GError **error); |
| 2521 |
|
| 2522 |
/** |
| 2523 |
* bd_fs_btrfs_get_info: |
| 2524 |
* @mpoint: a mountpoint of the btrfs filesystem to get information about |
| 2525 |
* @error: (out) (optional): place to store error (if any) |
| 2526 |
* |
| 2527 |
* Returns: (transfer full): information about the file system on @device or |
| 2528 |
* %NULL in case of error |
| 2529 |
* |
| 2530 |
* Note: This function WON'T WORK for multi device btrfs filesystems, |
| 2531 |
* for more complicated setups use the btrfs plugin instead. |
| 2532 |
* |
| 2533 |
* Tech category: %BD_FS_TECH_BTRFS-%BD_FS_TECH_MODE_QUERY |
| 2534 |
*/ |
| 2535 |
BDFSBtrfsInfo* bd_fs_btrfs_get_info (const gchar *mpoint, GError **error); |
| 2536 |
|
| 2537 |
/** |
| 2538 |
* bd_fs_btrfs_resize: |
| 2539 |
* @mpoint: a mountpoint of the to be resized btrfs filesystem |
| 2540 |
* @new_size: requested new size |
| 2541 |
* @extra: (nullable) (array zero-terminated=1): extra options for the volume resize (right now |
| 2542 |
* passed to the 'btrfs' utility) |
| 2543 |
* @error: (out) (optional): place to store error (if any) |
| 2544 |
* |
| 2545 |
* Returns: whether the @mpoint filesystem was successfully resized to @new_size |
| 2546 |
* or not |
| 2547 |
* |
| 2548 |
* Note: This function WON'T WORK for multi device btrfs filesystems, |
| 2549 |
* for more complicated setups use the btrfs plugin instead. |
| 2550 |
* |
| 2551 |
* Tech category: %BD_BTRFS_TECH_FS-%BD_BTRFS_TECH_MODE_MODIFY |
| 2552 |
*/ |
| 2553 |
gboolean bd_fs_btrfs_resize (const gchar *mpoint, guint64 new_size, const BDExtraArg **extra, GError **error); |
| 2554 |
|
| 2555 |
/** |
| 2556 |
* bd_fs_udf_mkfs: |
| 2557 |
* @device: the device to create a new UDF fs on |
| 2558 |
* @media_type: (nullable): specify the media type or %NULL for default ('hd') |
| 2559 |
* @revision: (nullable): UDF revision to use or %NULL for default ('2.01') |
| 2560 |
* @block_size: block size in bytes or 0 for auto detection (device logical block size) |
| 2561 |
* @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now |
| 2562 |
* passed to the 'mkudffs' utility) |
| 2563 |
* @error: (out) (optional): place to store error (if any) |
| 2564 |
* |
| 2565 |
* Returns: whether a new UDF fs was successfully created on @device or not |
| 2566 |
* |
| 2567 |
* Tech category: %BD_FS_TECH_UDF-%BD_FS_TECH_MODE_MKFS |
| 2568 |
*/ |
| 2569 |
gboolean bd_fs_udf_mkfs (const gchar *device, const gchar *media_type, gchar *revision, guint64 block_size, const BDExtraArg **extra, GError **error); |
| 2570 |
|
| 2571 |
/** |
| 2572 |
* bd_fs_udf_set_label: |
| 2573 |
* @device: the device containing the file system to set label for |
| 2574 |
* @label: label to set |
| 2575 |
* @error: (out) (optional): place to store error (if any) |
| 2576 |
* |
| 2577 |
* Note: This sets both Volume Identifier and Logical Volume Identifier. Volume Identifier |
| 2578 |
* is truncated to 30 or 15 characters to accommodate to the different length limits |
| 2579 |
* of these labels. |
| 2580 |
* |
| 2581 |
* Returns: whether the label of UDF file system on the @device was |
| 2582 |
* successfully set or not |
| 2583 |
* |
| 2584 |
* Tech category: %BD_FS_TECH_UDF-%BD_FS_TECH_MODE_SET_LABEL |
| 2585 |
*/ |
| 2586 |
gboolean bd_fs_udf_set_label (const gchar *device, const gchar *label, GError **error); |
| 2587 |
|
| 2588 |
/** |
| 2589 |
* bd_fs_udf_check_label: |
| 2590 |
* @label: label to check |
| 2591 |
* @error: (out) (optional): place to store error |
| 2592 |
* |
| 2593 |
* Note: This checks only whether @label adheres the length limits for Logical Volume Identifier, |
| 2594 |
* not the stricter limits for Volume Identifier. |
| 2595 |
* |
| 2596 |
* Returns: whether @label is a valid label for the UDF file system or not |
| 2597 |
* (reason is provided in @error) |
| 2598 |
* |
| 2599 |
* Tech category: always available |
| 2600 |
*/ |
| 2601 |
gboolean bd_fs_udf_check_label (const gchar *label, GError **error); |
| 2602 |
|
| 2603 |
/** |
| 2604 |
* bd_fs_udf_set_uuid: |
| 2605 |
* @device: the device containing the file system to set the UUID (serial number) for |
| 2606 |
* @uuid: (nullable): UUID to set or %NULL to generate a new one |
| 2607 |
* @error: (out) (optional): place to store error (if any) |
| 2608 |
* |
| 2609 |
* Returns: whether the UUID of the UDF file system on the @device was |
| 2610 |
* successfully set or not |
| 2611 |
* |
| 2612 |
* Tech category: %BD_FS_TECH_UDF-%BD_FS_TECH_MODE_SET_UUID |
| 2613 |
*/ |
| 2614 |
gboolean bd_fs_udf_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 2615 |
|
| 2616 |
/** |
| 2617 |
* bd_fs_udf_check_uuid: |
| 2618 |
* @uuid: UUID to check |
| 2619 |
* @error: (out) (optional): place to store error |
| 2620 |
* |
| 2621 |
* Returns: whether @uuid is a valid UUID for the UDF file system or not |
| 2622 |
* (reason is provided in @error) |
| 2623 |
* |
| 2624 |
* Tech category: always available |
| 2625 |
*/ |
| 2626 |
gboolean bd_fs_udf_check_uuid (const gchar *uuid, GError **error); |
| 2627 |
|
| 2628 |
/** |
| 2629 |
* bd_fs_udf_get_info: |
| 2630 |
* @device: the device containing the file system to get info for |
| 2631 |
* @error: (out) (optional): place to store error (if any) |
| 2632 |
* |
| 2633 |
* Returns: (transfer full): information about the file system on @device or |
| 2634 |
* %NULL in case of error |
| 2635 |
* |
| 2636 |
* Tech category: %BD_FS_TECH_UDF-%BD_FS_TECH_MODE_QUERY |
| 2637 |
*/ |
| 2638 |
BDFSUdfInfo* bd_fs_udf_get_info (const gchar *device, GError **error); |
| 2639 |
|
| 2640 |
typedef enum { |
| 2641 |
BD_FS_SUPPORT_SET_LABEL = 1 << 1, |
| 2642 |
BD_FS_SUPPORT_SET_UUID = 1 << 2 |
| 2643 |
} BDFSConfigureFlags; |
| 2644 |
|
| 2645 |
typedef enum { |
| 2646 |
BD_FS_FSCK_CHECK = 1 << 1, |
| 2647 |
BD_FS_FSCK_REPAIR = 1 << 2 |
| 2648 |
} BDFSFsckFlags; |
| 2649 |
|
| 2650 |
typedef enum { |
| 2651 |
BD_FS_FEATURE_OWNERS = 1 << 1, |
| 2652 |
BD_FS_FEATURE_PARTITION_TABLE = 1 << 2 |
| 2653 |
} BDFSFeatureFlags; |
| 2654 |
|
| 2655 |
/** |
| 2656 |
* BDFSFeatures: |
| 2657 |
* @resize: supported resizes modes |
| 2658 |
* @mkfs: supported options for mkfs |
| 2659 |
* @fsck: support for fsck operations (check and repair) |
| 2660 |
* @configure: support for changing properties of an existing filesystem |
| 2661 |
* @features: other supported features |
| 2662 |
* @partition_id: partition ID used for this filesystem on MSDOS partitions |
| 2663 |
* @partition_type: partition type/GUID used for this filesystem GPT partitions |
| 2664 |
* @min_size: minimum size when creating this filesystem |
| 2665 |
* @max_size: maximum size when creating this filesystem |
| 2666 |
*/ |
| 2667 |
typedef struct BDFSFeatures { |
| 2668 |
BDFSResizeFlags resize; |
| 2669 |
BDFSMkfsOptionsFlags mkfs; |
| 2670 |
BDFSFsckFlags fsck; |
| 2671 |
BDFSConfigureFlags configure; |
| 2672 |
BDFSFeatureFlags features; |
| 2673 |
const gchar *partition_id; |
| 2674 |
const gchar *partition_type; |
| 2675 |
guint64 min_size; |
| 2676 |
guint64 max_size; |
| 2677 |
} BDFSFeatures; |
| 2678 |
|
| 2679 |
/** |
| 2680 |
* bd_fs_features_copy: (skip) |
| 2681 |
* @data: (allow-none): %BDFSFeatures to copy |
| 2682 |
* |
| 2683 |
* Creates a new copy of @data. |
| 2684 |
*/ |
| 2685 |
BDFSFeatures* bd_fs_features_copy (BDFSFeatures *data) { |
| 2686 |
if (data == NULL) |
| 2687 |
return NULL; |
| 2688 |
|
| 2689 |
BDFSFeatures *ret = g_new0 (BDFSFeatures, 1); |
| 2690 |
|
| 2691 |
ret->resize = data->resize; |
| 2692 |
ret->mkfs = data->mkfs; |
| 2693 |
ret->fsck = data->fsck; |
| 2694 |
ret->configure = data->configure; |
| 2695 |
ret->features = data->features; |
| 2696 |
ret->partition_id = data->partition_id; |
| 2697 |
ret->partition_type = data->partition_type; |
| 2698 |
ret->min_size = data->min_size; |
| 2699 |
ret->max_size = data->max_size; |
| 2700 |
|
| 2701 |
return ret; |
| 2702 |
} |
| 2703 |
|
| 2704 |
/** |
| 2705 |
* bd_fs_features_free: (skip) |
| 2706 |
* @data: (allow-none): %BDFSFeatures to free |
| 2707 |
* |
| 2708 |
* Frees @data. |
| 2709 |
*/ |
| 2710 |
void bd_fs_features_free (BDFSFeatures *data) { |
| 2711 |
if (data == NULL) |
| 2712 |
return; |
| 2713 |
|
| 2714 |
g_free (data); |
| 2715 |
} |
| 2716 |
|
| 2717 |
GType bd_fs_features_get_type () { |
| 2718 |
static GType type = 0; |
| 2719 |
|
| 2720 |
if (G_UNLIKELY(type == 0)) { |
| 2721 |
type = g_boxed_type_register_static("BDFSFeatures", |
| 2722 |
(GBoxedCopyFunc) bd_fs_features_copy, |
| 2723 |
(GBoxedFreeFunc) bd_fs_features_free); |
| 2724 |
} |
| 2725 |
|
| 2726 |
return type; |
| 2727 |
} |
| 2728 |
|
| 2729 |
/** |
| 2730 |
* bd_fs_features: |
| 2731 |
* @fstype: name of the filesystem to get features for (e.g. "ext4") |
| 2732 |
* @error: (allow-none): (out): place to store error (if any) |
| 2733 |
* |
| 2734 |
* Returns (transfer-none): features supported by @fstype, see %BDFSFeatures for more information. |
| 2735 |
* |
| 2736 |
* Tech category: always available |
| 2737 |
* |
| 2738 |
*/ |
| 2739 |
const BDFSFeatures* bd_fs_features (const gchar *fstype, GError **error); |
| 2740 |
|
| 2741 |
#endif /* BD_FS_API */ |