util: introduce PTR_TO_MODE and MODE_TO_PTR macros
This commit is contained in:
parent
3f09629c22
commit
961189af2a
|
@ -14,6 +14,13 @@
|
|||
#include "errno-util.h"
|
||||
#include "time-util.h"
|
||||
|
||||
#define MODE_INVALID ((mode_t) -1)
|
||||
|
||||
/* The following macros add 1 when converting things, since 0 is a valid mode, while the pointer
|
||||
* NULL is special */
|
||||
#define PTR_TO_MODE(p) ((mode_t) ((uintptr_t) (p)-1))
|
||||
#define MODE_TO_PTR(u) ((void *) ((uintptr_t) (u)+1))
|
||||
|
||||
int unlink_noerrno(const char *path);
|
||||
|
||||
int rmdir_parents(const char *path, const char *stop);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "macro.h"
|
||||
|
||||
#define MODE_INVALID ((mode_t) -1)
|
||||
|
||||
int parse_boolean(const char *v) _pure_;
|
||||
int parse_dev(const char *s, dev_t *ret);
|
||||
int parse_pid(const char *s, pid_t* ret_pid);
|
||||
|
|
Loading…
Reference in a new issue