X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=fdb9fb6ef5da16e0447f96c50f4dd2f0f51c10fc;hb=f4a53250acb3aea2eb5ebed059887b9417afbd9e;hp=850019ab9d46e45a61c771519078bd750bab7a2a;hpb=769d324c99aab129148bd25f5f663ef441287d86;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index 850019ab9..fdb9fb6ef 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -550,7 +550,6 @@ bool hostname_is_valid(const char *s) _pure_; char* hostname_cleanup(char *s, bool lowercase); bool machine_name_is_valid(const char *s) _pure_; -bool image_name_is_valid(const char *s) _pure_; char* strshorten(char *s, size_t l); @@ -1074,7 +1073,24 @@ int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); int same_fd(int a, int b); -int chattr_fd(int fd, bool b, int mask); -int chattr_path(const char *p, bool b, int mask); +int chattr_fd(int fd, bool b, unsigned mask); +int chattr_path(const char *p, bool b, unsigned mask); + +int read_attr_fd(int fd, unsigned *ret); +int read_attr_path(const char *p, unsigned *ret); + +typedef struct LockFile { + char *path; + int fd; + int operation; +} LockFile; + +int make_lock_file(const char *p, int operation, LockFile *ret); +int make_lock_file_for(const char *p, int operation, LockFile *ret); +void release_lock_file(LockFile *f); + +#define _cleanup_release_lock_file_ _cleanup_(release_lock_file) + +#define LOCK_FILE_INIT { .fd = -1, .path = NULL } #define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })