X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=2e662c9d2d6b1fd18a8f645a6c709322a01e8b6e;hb=c4a5ddc9f29cf910fac9d814cd898b4cc2bd79b1;hp=84453713caebd2f164a498aa12a5f251eb1ab6d0;hpb=0193ad26ba121f3df259cc8b3bab54a99b8e5252;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index 84453713c..2e662c9d2 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -664,13 +664,6 @@ static inline void freep(void *p) { free(*(void**) p); } -#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ - static inline void func##p(type *p) { \ - if (*p) \ - func(*p); \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ - static inline void closep(int *fd) { safe_close(*fd); } @@ -993,6 +986,7 @@ union file_handle_union { struct file_handle handle; char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; }; +#define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ } int update_reboot_param_file(const char *param); @@ -1068,3 +1062,5 @@ void release_lock_file(LockFile *f); #define LOCK_FILE_INIT { .fd = -1, .path = NULL } #define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim }) + +ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);