[ostree] repo: Add ostree_repo_get_dfd()
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Add ostree_repo_get_dfd()
- Date: Wed, 2 Mar 2016 14:20:06 +0000 (UTC)
commit 3efdcb54b79b288a208e5d41b4d16c2f445cc664
Author: Colin Walters <walters verbum org>
Date: Tue Mar 1 21:52:22 2016 -0500
repo: Add ostree_repo_get_dfd()
I plan to use this in rpm-ostree at least for two reasons:
- To find the mtime on the repo
- To use the tmp/ directory to stage content (but we should eventually
add a better API)
src/libostree/libostree.sym | 5 +++++
src/libostree/ostree-repo.c | 18 ++++++++++++++++++
src/libostree/ostree-repo.h | 3 +++
3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/libostree.sym b/src/libostree/libostree.sym
index ee6c2e7..ce8861f 100644
--- a/src/libostree/libostree.sym
+++ b/src/libostree/libostree.sym
@@ -311,3 +311,8 @@ global:
local:
*;
};
+
+LIBOSTREE_2016.4 {
+global:
+ ostree_repo_get_dfd;
+} LIBOSTREE_2016.3;
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 3b08d44..752e097 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2423,6 +2423,24 @@ ostree_repo_get_path (OstreeRepo *self)
return self->repodir;
}
+/**
+ * ostree_repo_get_dfd:
+ * @self: Repo
+ *
+ * In some cases it's useful for applications to access the repository
+ * directly; for example, writing content into `repo/tmp` ensures it's
+ * on the same filesystem. Another case is detecting the mtime on the
+ * repository (to see whether a ref was written).
+ *
+ * Returns: File descriptor for repository root - owned by @self
+ */
+int
+ostree_repo_get_dfd (OstreeRepo *self)
+{
+ g_return_val_if_fail (self->repo_dir_fd != -1, -1);
+ return self->repo_dir_fd;
+}
+
OstreeRepoMode
ostree_repo_get_mode (OstreeRepo *self)
{
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 288dca0..b8399b1 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -83,6 +83,9 @@ _OSTREE_PUBLIC
GFile * ostree_repo_get_path (OstreeRepo *self);
_OSTREE_PUBLIC
+int ostree_repo_get_dfd (OstreeRepo *self);
+
+_OSTREE_PUBLIC
OstreeRepoMode ostree_repo_get_mode (OstreeRepo *self);
_OSTREE_PUBLIC
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]