repo: Add _ostree_repo_allocate_tmpdir helper

This creates a subdirectory of the tmp dir with a selected prefix,
and takes a lockfile to ensure that nobody else is using the same directory.
However, if a directory with the same prefix already exists and is
not locked that is used instead.

The later is useful if you want to support some kind of resumed operation
on the tmpdir.

touch reused dirs

https://bugzilla.gnome.org/show_bug.cgi?id=757611
This commit is contained in:
Alexander Larsson committed 2015-12-14 08:37:55 +01:00
1 parent 211ca6795c
commit be19c88861
2 files changed
+141

No files matched your search

+10
View File
@@ -90,6 +90,16 @@ struct OstreeRepo {
OstreeRepo *parent_repo;
};
gboolean
_ostree_repo_allocate_tmpdir (int tmpdir_dfd,
const char *tmpdir_prefix,
char **tmpdir_name_out,
int *tmpdir_fd_out,
GLnxLockFile *file_lock_out,
gboolean * reusing_dir_out,
GCancellable *cancellable,
GError **error);
gboolean
_ostree_repo_ensure_loose_objdir_at (int dfd,
const char *loose_path,