aboutsummaryrefslogtreecommitdiff
path: root/reftable/system.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-04-08 10:19:17 -0700
committerJunio C Hamano <gitster@pobox.com>2026-04-08 10:19:17 -0700
commit4fee6ff3b23321b55073ca2d13c4e2aa6adaea65 (patch)
tree097114e50b0fea8c224986e29d070b99a7904370 /reftable/system.h
parent0c0cbd8ab7c8e1884d6f0bdf1f36f5f9d4732553 (diff)
parent87e4eee3f94ec261a92a76d06261b227b00de461 (diff)
downloadgit-4fee6ff3b23321b55073ca2d13c4e2aa6adaea65.tar.xz
Merge branch 'ps/reftable-portability'
Update reftable library part with what is used in libgit2 to improve portability to different target codebases and platforms. * ps/reftable-portability: reftable/system: add abstraction to mmap files reftable/system: add abstraction to retrieve time in milliseconds reftable/fsck: use REFTABLE_UNUSED instead of UNUSED reftable/stack: provide fsync(3p) via system header reftable: introduce "reftable-system.h" header
Diffstat (limited to 'reftable/system.h')
-rw-r--r--reftable/system.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/reftable/system.h b/reftable/system.h
index c54ed4cad6..c0e2cbe0ff 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -9,11 +9,14 @@
#ifndef SYSTEM_H
#define SYSTEM_H
-/* This header glues the reftable library to the rest of Git */
+/*
+ * This header defines the platform-agnostic interface that is to be
+ * implemented by the project to make it work on their respective supported
+ * systems, and to integrate it into the project itself. This header is not
+ * expected to be changed by the individual project.
+ */
-#define MINGW_DONT_HANDLE_IN_USE_ERROR
-#include "compat/posix.h"
-#include "compat/zlib-compat.h"
+#include "reftable-system.h"
/*
* Return a random 32 bit integer. This function is expected to return
@@ -108,4 +111,25 @@ int flock_release(struct reftable_flock *l);
*/
int flock_commit(struct reftable_flock *l);
+/* Report the time in milliseconds. */
+uint64_t reftable_time_ms(void);
+
+struct reftable_mmap {
+ void *data;
+ size_t size;
+ void *priv;
+};
+
+/*
+ * Map the file into memory. Returns 0 on success, a reftable error code on
+ * error.
+ */
+int reftable_mmap(struct reftable_mmap *out, int fd, size_t len);
+
+/*
+ * Unmap the file from memory. Returns 0 on success, a reftable error code on
+ * error.
+ */
+int reftable_munmap(struct reftable_mmap *mmap);
+
#endif