lib/repo: Add an API to get min-free-space-* reserved bytes

https://phabricator.endlessm.com/T23694

Closes: #1715
Approved by: cgwalters
This commit is contained in:
Umang Jain 2018-08-31 19:50:29 +05:30 committed by Atomic Bot
parent 3814d075cb
commit 68420f70bb
4 changed files with 24 additions and 0 deletions

View File

@ -294,6 +294,7 @@ ostree_repo_create_at
ostree_repo_create
ostree_repo_get_path
ostree_repo_get_mode
ostree_repo_get_min_free_space_bytes
ostree_repo_get_config
ostree_repo_get_dfd
ostree_repo_hash

View File

@ -19,6 +19,7 @@
/* Add new symbols here. Release commits should copy this section into -released.sym. */
LIBOSTREE_2018.9 {
ostree_repo_get_min_free_space_bytes;
} LIBOSTREE_2018.7;
/* Stub section for the stable release *after* this development one; don't

View File

@ -3292,6 +3292,26 @@ ostree_repo_get_mode (OstreeRepo *self)
return self->mode;
}
/**
* ostree_repo_get_min_free_space:
* @self: Repo
*
* It should be noted that this function should be used only if there
* is a transaction active. It is a programmer error to request it
* otherwise.
*
* Returns: Value (in bytes) of min-free-space-* config option
* Since: 2018.9
*/
guint64
ostree_repo_get_min_free_space_bytes (OstreeRepo *self)
{
g_return_val_if_fail (OSTREE_IS_REPO (self), 0);
g_return_val_if_fail (self->in_transaction == TRUE, 0);
return self->reserved_blocks * self->txn.blocksize;
}
/**
* ostree_repo_get_parent:
* @self: Repo

View File

@ -127,6 +127,8 @@ gboolean ostree_repo_equal (OstreeRepo *a,
_OSTREE_PUBLIC
OstreeRepoMode ostree_repo_get_mode (OstreeRepo *self);
_OSTREE_PUBLIC
guint64 ostree_repo_get_min_free_space_bytes (OstreeRepo *self);
_OSTREE_PUBLIC
GKeyFile * ostree_repo_get_config (OstreeRepo *self);