summaryrefslogtreecommitdiff
path: root/src/libotutil/ot-fs-utils.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-05-17 11:02:56 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-05-23 14:06:24 +0000
commite99777e8d23eb59bc6f22cad023fa4d6ce56bbce (patch)
treedb336bd57e978db69f95d8a8f07eb90f9e582e65 /src/libotutil/ot-fs-utils.h
parentdb00c9591f7425c9098f06b818f6c3b4b7c2f352 (diff)
downloadostree-e99777e8d23eb59bc6f22cad023fa4d6ce56bbce.tar.gz
Add stub for new libglnx tmpfile API, port simpler callers to it
It's hard right now to do a full port to the new libglnx tmpfile API since there are complex cases in the commit path which deal with symlinks as well. Let's make things more gradual by introducing the important part (struct with autocleanup) here in libotutil, port what we can. This will make a future complete port easier. Closes: #871 Approved by: jlebon
Diffstat (limited to 'src/libotutil/ot-fs-utils.h')
-rw-r--r--src/libotutil/ot-fs-utils.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libotutil/ot-fs-utils.h b/src/libotutil/ot-fs-utils.h
index 14df8acb..26c5a499 100644
--- a/src/libotutil/ot-fs-utils.h
+++ b/src/libotutil/ot-fs-utils.h
@@ -25,6 +25,30 @@
G_BEGIN_DECLS
+/* This is a copy of https://github.com/GNOME/libglnx/pull/46 until we
+ * can do a full port; see https://github.com/ostreedev/ostree/pull/861 */
+typedef struct {
+ gboolean initialized;
+ int src_dfd;
+ int fd;
+ char *path;
+} OtTmpfile;
+void ot_tmpfile_clear (OtTmpfile *tmpf);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(OtTmpfile, ot_tmpfile_clear);
+
+gboolean
+ot_open_tmpfile_linkable_at (int dfd,
+ const char *subpath,
+ int flags,
+ OtTmpfile *out_tmpf,
+ GError **error);
+gboolean
+ot_link_tmpfile_at (OtTmpfile *tmpf,
+ GLnxLinkTmpfileReplaceMode flags,
+ int target_dfd,
+ const char *target,
+ GError **error);
+
GFile * ot_fdrel_to_gfile (int dfd, const char *path);
gboolean ot_readlinkat_gfile_info (int dfd,