]> git.kaiwu.me - nginx.git/commitdiff
Introduced the NGX_COMPAT macro.
authorRuslan Ermilov <ru@nginx.com>
Thu, 29 Sep 2016 12:28:24 +0000 (15:28 +0300)
committerRuslan Ermilov <ru@nginx.com>
Thu, 29 Sep 2016 12:28:24 +0000 (15:28 +0300)
When enabled, some structures are padded to be size compatible
with their NGINX Plus versions.

src/core/ngx_config.h
src/core/ngx_module.h
src/event/ngx_event_connect.h
src/http/ngx_http_upstream.h
src/http/ngx_http_upstream_round_robin.h
src/stream/ngx_stream_upstream.h
src/stream/ngx_stream_upstream_round_robin.h

index a0bfa63cd9d3d2cf28ad9462d1222798e3f320a3..1861be601397ef6296e0274c53e48b727c2fbc99 100644 (file)
@@ -129,4 +129,17 @@ typedef intptr_t        ngx_flag_t;
 #define NGX_MAX_INT32_VALUE   (uint32_t) 0x7fffffff
 
 
+#if (NGX_COMPAT)
+
+#define NGX_COMPAT_BEGIN(slots)  uint64_t spare[slots];
+#define NGX_COMPAT_END
+
+#else
+
+#define NGX_COMPAT_BEGIN(slots)
+#define NGX_COMPAT_END
+
+#endif
+
+
 #endif /* _NGX_CONFIG_H_INCLUDED_ */
index a1a0d6c27e9ab093bf5208625523db44b99490bd..c944746938dcd4c9d6b350f61ec7527e14806ac5 100644 (file)
 #define NGX_MODULE_SIGNATURE_33  "0"
 #endif
 
+#if (NGX_COMPAT)
+#define NGX_MODULE_SIGNATURE_34  "1"
+#else
+#define NGX_MODULE_SIGNATURE_34  "0"
+#endif
+
 #define NGX_MODULE_SIGNATURE                                                  \
     NGX_MODULE_SIGNATURE_0 NGX_MODULE_SIGNATURE_1 NGX_MODULE_SIGNATURE_2      \
     NGX_MODULE_SIGNATURE_3 NGX_MODULE_SIGNATURE_4 NGX_MODULE_SIGNATURE_5      \
     NGX_MODULE_SIGNATURE_24 NGX_MODULE_SIGNATURE_25 NGX_MODULE_SIGNATURE_26   \
     NGX_MODULE_SIGNATURE_27 NGX_MODULE_SIGNATURE_28 NGX_MODULE_SIGNATURE_29   \
     NGX_MODULE_SIGNATURE_30 NGX_MODULE_SIGNATURE_31 NGX_MODULE_SIGNATURE_32   \
-    NGX_MODULE_SIGNATURE_33
+    NGX_MODULE_SIGNATURE_33 NGX_MODULE_SIGNATURE_34
 
 
 #define NGX_MODULE_V1                                                         \
index f410d35a4b380874ee1074efb1d9886a87b24bf0..6b97a24dcd875d21f5c6816dba3b5c2ca7962c18 100644 (file)
@@ -68,6 +68,9 @@ struct ngx_peer_connection_s {
 
                                      /* ngx_connection_log_error_e */
     unsigned                         log_error:2;
+
+    NGX_COMPAT_BEGIN(2)
+    NGX_COMPAT_END
 };
 
 
index e079eaed3b09c2ee8c67572a3339aea2cf5c23aa..e6bf3c983c167d61276c8b1b4159de3faf0b8210 100644 (file)
@@ -102,6 +102,9 @@ typedef struct {
 
     unsigned                         down:1;
     unsigned                         backup:1;
+
+    NGX_COMPAT_BEGIN(6)
+    NGX_COMPAT_END
 } ngx_http_upstream_server_t;
 
 
@@ -229,6 +232,9 @@ typedef struct {
 #endif
 
     ngx_str_t                        module;
+
+    NGX_COMPAT_BEGIN(2)
+    NGX_COMPAT_END
 } ngx_http_upstream_conf_t;
 
 
@@ -382,6 +388,9 @@ struct ngx_http_upstream_s {
     unsigned                         request_sent:1;
     unsigned                         request_body_sent:1;
     unsigned                         header_sent:1;
+
+    NGX_COMPAT_BEGIN(1)
+    NGX_COMPAT_END
 };
 
 
index 326e84904db7e8a0a2e59d190cd2c8d45e16c42d..92aa1a60cceacad50a3876e8632271b5d634bc68 100644 (file)
@@ -50,6 +50,9 @@ struct ngx_http_upstream_rr_peer_s {
 #endif
 
     ngx_http_upstream_rr_peer_t    *next;
+
+    NGX_COMPAT_BEGIN(32)
+    NGX_COMPAT_END
 };
 
 
index db219841738f3bada46fb9392c371e901523f03f..5c99078a6f0037a67163134bc200f371037f782d 100644 (file)
@@ -58,6 +58,9 @@ typedef struct {
 
     unsigned                           down:1;
     unsigned                           backup:1;
+
+    NGX_COMPAT_BEGIN(4)
+    NGX_COMPAT_END
 } ngx_stream_upstream_server_t;
 
 
index 75ffadd6f43025b5e0c30dfb260a6a619f7bad56..9e1afc5455ff36a5cf663f882a90cbcd54cda33b 100644 (file)
@@ -50,6 +50,9 @@ struct ngx_stream_upstream_rr_peer_s {
 #endif
 
     ngx_stream_upstream_rr_peer_t   *next;
+
+    NGX_COMPAT_BEGIN(25)
+    NGX_COMPAT_END
 };