summaryrefslogtreecommitdiff
path: root/src/basic/missing.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-20 12:48:33 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:00 +0200
commitdfa4d304232d841d119f9f5a2a6f9ff8399f16ef (patch)
tree22db6faaa33fdca901d872a30b0bb7d275e3a37b /src/basic/missing.h
parent4c5943104751a678b7ad886131806dd964618d2f (diff)
xattr-util: use crtime/btime if statx() is available for implementation of fd_setcrtime() and friends
The Linux kernel exposes the birth time now for files through statx() hence make use of it where available. We keep the xattr logic in place for this however, since only a subset of file systems on Linux currently expose the birth time. NFS and tmpfs for example do not support it. OTOH there are other file systems that do support the birth time but might not support xattrs (smb…), hence make the best of the two, in particular in order to deal with journal files copied between file system types and to maintain compatibility with older file systems that are updated to newer version of the file system.
Diffstat (limited to 'src/basic/missing.h')
-rw-r--r--src/basic/missing.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/basic/missing.h b/src/basic/missing.h
index bbddfe6fb..3708742c2 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -27,16 +27,19 @@
#include <inttypes.h>
#include <linux/audit.h>
#include <linux/capability.h>
+//#include <linux/falloc.h>
#include <linux/if_link.h>
#include <linux/input.h>
#include <linux/loop.h>
#include <linux/neighbour.h>
#include <linux/oom.h>
#include <linux/rtnetlink.h>
+//#include <linux/stat.h>
#include <net/ethernet.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/socket.h>
+//#include <sys/stat.h>
#include <sys/syscall.h>
#include <uchar.h>
#include <unistd.h>
@@ -522,6 +525,10 @@ struct btrfs_ioctl_quota_ctl_args {
#define BPF_FS_MAGIC 0xcafe4a11
#endif
+#ifndef OCFS2_SUPER_MAGIC
+#define OCFS2_SUPER_MAGIC 0x7461636f
+#endif
+
#ifndef MS_MOVE
#define MS_MOVE 8192
#endif
@@ -1364,8 +1371,55 @@ struct fib_rule_uid_range {
#define NS_GET_NSTYPE _IO(0xb7, 0x3)
#endif
+#ifndef FALLOC_FL_KEEP_SIZE
+#define FALLOC_FL_KEEP_SIZE 0x01
+#endif
+
+#ifndef FALLOC_FL_PUNCH_HOLE
+#define FALLOC_FL_PUNCH_HOLE 0x02
+#endif
+
#ifndef PF_KTHREAD
#define PF_KTHREAD 0x00200000
#endif
+#if ! HAVE_STRUCT_STATX
+struct statx_timestamp {
+ int64_t tv_sec;
+ uint32_t tv_nsec;
+ uint32_t __reserved;
+};
+struct statx {
+ uint32_t stx_mask;
+ uint32_t stx_blksize;
+ uint64_t stx_attributes;
+ uint32_t stx_nlink;
+ uint32_t stx_uid;
+ uint32_t stx_gid;
+ uint16_t stx_mode;
+ uint16_t __spare0[1];
+ uint64_t stx_ino;
+ uint64_t stx_size;
+ uint64_t stx_blocks;
+ uint64_t stx_attributes_mask;
+ struct statx_timestamp stx_atime;
+ struct statx_timestamp stx_btime;
+ struct statx_timestamp stx_ctime;
+ struct statx_timestamp stx_mtime;
+ uint32_t stx_rdev_major;
+ uint32_t stx_rdev_minor;
+ uint32_t stx_dev_major;
+ uint32_t stx_dev_minor;
+ uint64_t __spare2[14];
+};
+#endif
+
+#ifndef STATX_BTIME
+#define STATX_BTIME 0x00000800U
+#endif
+
+#ifndef AT_STATX_DONT_SYNC
+#define AT_STATX_DONT_SYNC 0x4000
+#endif
+
#include "missing_syscall.h"