[ostree] deployment: Add an API to get relative origin path



commit 6ac880c9597ba5bf9a5d90bd8e8186d443483af2
Author: Colin Walters <walters verbum org>
Date:   Tue Mar 10 09:07:12 2015 -0400

    deployment: Add an API to get relative origin path
    
    This will be used for fd-relative cleanups.

 src/libostree/ostree-deployment.c |   19 +++++++++++++++++++
 src/libostree/ostree-deployment.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/ostree-deployment.c b/src/libostree/ostree-deployment.c
index 4533715..0f98c59 100644
--- a/src/libostree/ostree-deployment.c
+++ b/src/libostree/ostree-deployment.c
@@ -252,3 +252,22 @@ ostree_deployment_new (int    index,
   self->bootserial = bootserial;
   return self;
 }
+
+/**
+ * ostree_deployment_get_origin_relpath:
+ * @self: A deployment
+ *
+ * Note this function only returns a *relative* path - if you want to
+ * access, it, you must either use fd-relative api such as openat(),
+ * or concatenate it with the full ostree_sysroot_get_path().
+ *
+ * Returns: (transfer full): Path to deployment root directory, relative to sysroot
+ */
+char *
+ostree_deployment_get_origin_relpath (OstreeDeployment *self)
+{
+  return g_strdup_printf ("ostree/deploy/%s/deploy/%s.%d.origin",
+                          ostree_deployment_get_osname (self),
+                          ostree_deployment_get_csum (self),
+                          ostree_deployment_get_deployserial (self));
+}
diff --git a/src/libostree/ostree-deployment.h b/src/libostree/ostree-deployment.h
index 0dbe6f1..dc28d63 100644
--- a/src/libostree/ostree-deployment.h
+++ b/src/libostree/ostree-deployment.h
@@ -58,5 +58,6 @@ void ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin);
 
 OstreeDeployment *ostree_deployment_clone (OstreeDeployment *self);
 
+char *ostree_deployment_get_origin_relpath (OstreeDeployment *self);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]