DOC: fd: make it clear that some fields ordering must absolutely be respected
fd_set_running() and fd_takeover() may both use a double-word CAS on the
(running_mask, thread_mask) couple and as such they expect the fields to
be exactly arranged like this. It's critical not to reorder them, so add
a comment to avoid such a potential mistake later.
diff --git a/include/haproxy/fd-t.h b/include/haproxy/fd-t.h
index 1bffb26..5e17b6f 100644
--- a/include/haproxy/fd-t.h
+++ b/include/haproxy/fd-t.h
@@ -116,6 +116,10 @@
/* info about one given fd. Note: only align on cache lines when using threads;
* 32-bit small archs can put everything in 32-bytes when threads are disabled.
+ *
+ * NOTE: DO NOT REORDER THIS STRUCT AT ALL! Some code parts rely on exact field
+ * ordering, for example fd_takeover() and fd_set_running() want running_mask
+ * immediately followed by thread_mask to perform a double-word-CAS on them.
*/
struct fdtab {
unsigned long running_mask; /* mask of thread IDs currently using the fd */