sq lib/util/samba_io_uring.*
authorStefan Metzmacher <metze@samba.org>
Wed, 30 Sep 2020 11:59:52 +0000 (13:59 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 30 Sep 2020 12:00:05 +0000 (14:00 +0200)
lib/util/samba_io_uring.c
lib/util/samba_io_uring.h
lib/util/wscript_configure

index 7aa4dbed4c5e07d73af8bd0e18e1e99fd5ede92e..aa6022917dc076f56f5a450e2179fa467866acf5 100644 (file)
 #include "lib/util/dlinklist.h"
 #include "lib/util/debug.h"
 #include "lib/util/fault.h"
+#include <liburing.h>
 #include "lib/util/samba_io_uring.h"
 
 #ifdef HAVE_IO_URING_GET_PROBE_RING
 #ifndef HAVE_IO_URING_FREE_PROBE
+struct io_uring_probe;
 static void io_uring_free_probe(struct io_uring_probe *probe)
 {
        free(probe);
index 6ea0d936edff60b7849adf0fa473f4d815b8e3fa..ecfd88fea70adba711833cfcf793c7cdb7e5f2eb 100644 (file)
 
 #ifndef __SAMBA_IO_URING_H__
 #define __SAMBA_IO_URING_H__ 1
-#ifdef HAVE_LIBURING
-#include <liburing.h>
+
+#define HAVE_IO_URING_GET_PROBE_RING 1
+
+/*
+ * If IORING_SETUP_IOPOLL is defined
+ * we have already included <liburing.h>
+ */
+#ifdef IORING_SETUP_IOPOLL
+#define __SAMBA_IO_URING_INTERNALS 1
+#endif
 
 struct samba_io_uring;
 struct samba_io_uring_request;
@@ -32,8 +40,20 @@ struct samba_io_uring_qe {
        void (*completion_fn)(struct samba_io_uring_qe *qe,
                              const char *location);
        bool force_async;
-       struct io_uring_sqe sqe;
-       struct io_uring_cqe cqe;
+       union {
+               uint64_t __sqe_align8;
+               uint8_t __sqe_space[SIZEOF_STRUCT_IO_URING_SQE];
+#ifdef __SAMBA_IO_URING_INTERNALS
+               struct io_uring_sqe sqe;
+#endif /* __SAMBA_IO_URING_INTERNALS */
+       };
+       union {
+               uint64_t __cqe_align8;
+               uint8_t __cqe_space[SIZEOF_STRUCT_IO_URING_SQE];
+#ifdef __SAMBA_IO_URING_INTERNALS
+               struct io_uring_cqe cqe;
+#endif /* __SAMBA_IO_URING_INTERNALS */
+       };
        uint8_t idx;
 };
 
@@ -55,5 +75,4 @@ int samba_io_uring_create(TALLOC_CTX *mem_ctx,
 void samba_io_uring_request_submit(struct samba_io_uring *ring,
                                   struct samba_io_uring_request *r);
 
-#endif /* HAVE_LIBURING */
 #endif /* __SAMBA_IO_URING_H__ */
index 3747cc561f43d2d1c6531d735a7d7aa23ef91e58..788ed1476f73430b7c098c9bf568a6cc3eddeafb 100644 (file)
@@ -174,4 +174,6 @@ if conf.CHECK_CFG(package='liburing', args='--cflags --libs',
                             headers='liburing.h')
         conf.CHECK_FUNCS_IN('io_uring_free_probe', 'uring',
                             headers='liburing.h')
+        conf.CHECK_SIZEOF('"struct io_uring_sqe" "struct io_uring_cqe"',
+                          lib='uring', headers='liburing.h')
         conf.DEFINE('HAVE_LIBURING', '1')