summaryrefslogtreecommitdiffstats
path: root/src/server/sendfile.h
diff options
context:
space:
mode:
authorSimon Rettberg2025-10-10 18:13:16 +0200
committerSimon Rettberg2025-12-09 15:33:20 +0100
commit531ba156de326210e4807b701183eaf2f506cf2a (patch)
tree0e732acacce0bde31e95bdf4e2bb272d39ecdd25 /src/server/sendfile.h
parent[SERVER] iscsi: Implement relaying requests to uplink servers (diff)
downloaddnbd3-531ba156de326210e4807b701183eaf2f506cf2a.tar.gz
dnbd3-531ba156de326210e4807b701183eaf2f506cf2a.tar.xz
dnbd3-531ba156de326210e4807b701183eaf2f506cf2a.zip
[SERVER] iscsi refactor: First working version
Work towards simplifying the iscsi implementation has begun. Goals are: - Simpler and easier to understand resource/lifecycle management of allocations - Single-threaded architecture, making locking unnecessary - Moving as many allocations as possible to the stack - Making the call-stack more shallow for easier tracking of code flow
Diffstat (limited to 'src/server/sendfile.h')
-rw-r--r--src/server/sendfile.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/sendfile.h b/src/server/sendfile.h
new file mode 100644
index 0000000..e4cc5b7
--- /dev/null
+++ b/src/server/sendfile.h
@@ -0,0 +1,18 @@
+#ifndef SENDFILE_H_
+#define SENDFILE_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <sys/types.h>
+
+/**
+ * Platform-agnostic wrapper around sendfile, with retry logic.
+ * @param fd file to read from
+ * @param sock socket to write to
+ * @param foffset offset in file to start reading from
+ * @param bytes number of bytes to read/send
+ * @return true on success
+ */
+bool sendfile_all(int fd, int sock, off_t foffset, size_t bytes);
+
+#endif \ No newline at end of file