diff options
Diffstat (limited to 'src/libotutil/ot-fs-utils.h')
-rw-r--r-- | src/libotutil/ot-fs-utils.h | 78 |
1 files changed, 27 insertions, 51 deletions
diff --git a/src/libotutil/ot-fs-utils.h b/src/libotutil/ot-fs-utils.h index f719381d..b64adce2 100644 --- a/src/libotutil/ot-fs-utils.h +++ b/src/libotutil/ot-fs-utils.h @@ -19,8 +19,8 @@ #pragma once -#include "ot-unix-utils.h" #include "libglnx.h" +#include "ot-unix-utils.h" G_BEGIN_DECLS @@ -28,7 +28,8 @@ G_BEGIN_DECLS * function. Mostly only necessary to handle * deletion of temporary symlinks. */ -typedef struct { +typedef struct +{ int dfd; char *path; } OtCleanupUnlinkat; @@ -44,62 +45,37 @@ ot_cleanup_unlinkat (OtCleanupUnlinkat *cleanup) { if (cleanup->path) { - (void) unlinkat (cleanup->dfd, cleanup->path, 0); + (void)unlinkat (cleanup->dfd, cleanup->path, 0); ot_cleanup_unlinkat_clear (cleanup); } } -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(OtCleanupUnlinkat, ot_cleanup_unlinkat) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (OtCleanupUnlinkat, ot_cleanup_unlinkat) -GFile * ot_fdrel_to_gfile (int dfd, const char *path); +GFile *ot_fdrel_to_gfile (int dfd, const char *path); -gboolean ot_readlinkat_gfile_info (int dfd, - const char *path, - GFileInfo *target_info, - GCancellable *cancellable, - GError **error); +gboolean ot_readlinkat_gfile_info (int dfd, const char *path, GFileInfo *target_info, + GCancellable *cancellable, GError **error); -gboolean ot_openat_read_stream (int dfd, - const char *path, - gboolean follow, - GInputStream **out_istream, - GCancellable *cancellable, - GError **error); - -gboolean ot_ensure_unlinked_at (int dfd, - const char *path, +gboolean ot_openat_read_stream (int dfd, const char *path, gboolean follow, + GInputStream **out_istream, GCancellable *cancellable, GError **error); -gboolean ot_openat_ignore_enoent (int dfd, - const char *path, - int *out_fd, - GError **error); - -gboolean ot_dfd_iter_init_allow_noent (int dfd, - const char *path, - GLnxDirFdIterator *dfd_iter, - gboolean *out_exists, - GError **error); - -GBytes * -ot_map_anonymous_tmpfile_from_content (GInputStream *instream, - GCancellable *cancellable, - GError **error); - -GBytes *ot_fd_readall_or_mmap (int fd, goffset offset, - GError **error); - -gboolean -ot_parse_file_by_line (const char *path, - gboolean (*cb)(const char*, void*, GError**), - void *cbdata, - GCancellable *cancellable, - GError **error); - -gboolean -ot_get_dir_size (int dfd, - const char *path, - guint64 *out_size, - GCancellable *cancellable, - GError **error); +gboolean ot_ensure_unlinked_at (int dfd, const char *path, GError **error); + +gboolean ot_openat_ignore_enoent (int dfd, const char *path, int *out_fd, GError **error); + +gboolean ot_dfd_iter_init_allow_noent (int dfd, const char *path, GLnxDirFdIterator *dfd_iter, + gboolean *out_exists, GError **error); + +GBytes *ot_map_anonymous_tmpfile_from_content (GInputStream *instream, GCancellable *cancellable, + GError **error); + +GBytes *ot_fd_readall_or_mmap (int fd, goffset offset, GError **error); + +gboolean ot_parse_file_by_line (const char *path, gboolean (*cb) (const char *, void *, GError **), + void *cbdata, GCancellable *cancellable, GError **error); + +gboolean ot_get_dir_size (int dfd, const char *path, guint64 *out_size, GCancellable *cancellable, + GError **error); G_END_DECLS |