chiark / gitweb /
nspawn: support ephemeral boots from images
[elogind.git] / src / basic / fileio.h
index f45b0d54a64edf123178ab93512d27128de4dd0d..6a628086bce173d47a6f38e702e8431e1f1f6011 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 #pragma once
 
 /***
@@ -47,23 +45,26 @@ int read_full_stream(FILE *f, char **contents, size_t *size);
 int verify_file(const char *fn, const char *blob, bool accept_extra_nl);
 
 int parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
+#if 0 /// UNNEEDED by elogind
 int load_env_file(FILE *f, const char *fname, const char *separator, char ***l);
 int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l);
 
+int merge_env_file(char ***env, FILE *f, const char *fname);
+
 int write_env_file(const char *fname, char **l);
-/// UNNEEDED by elogind
-#if 0
+
 int executable_is_script(const char *path, char **interpreter);
 #endif // 0
+
 int get_proc_field(const char *filename, const char *pattern, const char *terminator, char **field);
 
 DIR *xopendirat(int dirfd, const char *name, int flags);
 
+#if 0 /// UNNEEDED by elogind
 int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f);
-/// UNNEEDED by elogind
-#if 0
 int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f);
 #endif // 0
+
 #define FOREACH_LINE(line, f, on_error)                         \
         for (;;)                                                \
                 if (!fgets(line, sizeof(line), f)) {            \
@@ -76,18 +77,22 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *root
 int fflush_and_check(FILE *f);
 
 int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
-int mkostemp_safe(char *pattern, int flags);
-/// UNNEEDED by elogind
-#if 0
-int open_tmpfile(const char *path, int flags);
-#endif // 0
+int mkostemp_safe(char *pattern);
 
 int tempfn_xxxxxx(const char *p, const char *extra, char **ret);
 int tempfn_random(const char *p, const char *extra, char **ret);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
 int tempfn_random_child(const char *p, const char *extra, char **ret);
 
 int write_timestamp_file_atomic(const char *fn, usec_t n);
 int read_timestamp_file(const char *fn, usec_t *ret);
+
+int fputs_with_space(FILE *f, const char *s, const char *separator, bool *space);
+
+int open_tmpfile_unlinkable(const char *directory, int flags);
+int open_tmpfile_linkable(const char *target, int flags, char **ret_path);
+
+int link_tmpfile(int fd, const char *path, const char *target);
 #endif // 0
+
+int read_nul_string(FILE *f, char **ret);