sysroot: Add ostree_sysroot_get_fd()

This way external programs like rpm-ostree can do fd-relative
operations on the deployment directories, like inspecting the RPM
database.

Closes: https://github.com/GNOME/ostree/pull/91
This commit is contained in:
Colin Walters 2015-04-17 09:13:31 -04:00
parent 60ebec770e
commit 24087d477c
3 changed files with 20 additions and 0 deletions

View File

@ -365,6 +365,7 @@ ostree_sysroot_new
ostree_sysroot_new_default
ostree_sysroot_get_path
ostree_sysroot_load
ostree_sysroot_get_fd
ostree_sysroot_ensure_initialized
ostree_sysroot_get_bootversion
ostree_sysroot_get_subbootversion

View File

@ -196,6 +196,23 @@ ensure_sysroot_fd (OstreeSysroot *self,
return TRUE;
}
/**
* ostree_sysroot_get_fd:
* @self: Sysroot
*
* Access a file descriptor that refers to the root directory of this
* sysroot. ostree_sysroot_load() must have been invoked prior to
* calling this function.
*
* Returns: A file descriptor valid for the lifetime of @self
*/
int
ostree_sysroot_get_fd (OstreeSysroot *self)
{
g_return_val_if_fail (self->sysroot_fd != -1, -1);
return self->sysroot_fd;
}
/**
* ostree_sysroot_ensure_initialized:
* @self: Sysroot

View File

@ -39,6 +39,8 @@ OstreeSysroot* ostree_sysroot_new_default (void);
GFile *ostree_sysroot_get_path (OstreeSysroot *self);
int ostree_sysroot_get_fd (OstreeSysroot *self);
gboolean ostree_sysroot_load (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);