[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Declare relay/dirauth subsystem levels in a header.



commit 13df7449217cec5d4a9baf73adec850614b43633
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Dec 18 11:49:26 2019 -0500

    Declare relay/dirauth subsystem levels in a header.
    
    This way, we can't get out of sync between the two declarations.
---
 src/feature/dirauth/dirauth_stub.c | 2 +-
 src/feature/dirauth/dirauth_sys.c  | 2 +-
 src/feature/dirauth/dirauth_sys.h  | 8 ++++++++
 src/feature/relay/relay_stub.c     | 2 +-
 src/feature/relay/relay_sys.c      | 2 +-
 src/feature/relay/relay_sys.h      | 8 ++++++++
 6 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/feature/dirauth/dirauth_stub.c b/src/feature/dirauth/dirauth_stub.c
index b0b4f987f..d902d56d2 100644
--- a/src/feature/dirauth/dirauth_stub.c
+++ b/src/feature/dirauth/dirauth_stub.c
@@ -27,7 +27,7 @@ static const config_format_t dirauth_options_stub_fmt = {
 const struct subsys_fns_t sys_dirauth = {
   .name = "dirauth",
   .supported = false,
-  .level = 70,
+  .level = DIRAUTH_SUBSYS_LEVEL,
 
   .options_format = &dirauth_options_stub_fmt
 };
diff --git a/src/feature/dirauth/dirauth_sys.c b/src/feature/dirauth/dirauth_sys.c
index 8a4b1abaa..6ec25681e 100644
--- a/src/feature/dirauth/dirauth_sys.c
+++ b/src/feature/dirauth/dirauth_sys.c
@@ -60,7 +60,7 @@ dirauth_set_options(void *arg)
 const struct subsys_fns_t sys_dirauth = {
   .name = "dirauth",
   .supported = true,
-  .level = 70,
+  .level = DIRAUTH_SUBSYS_LEVEL,
   .initialize = subsys_dirauth_initialize,
   .shutdown = subsys_dirauth_shutdown,
 
diff --git a/src/feature/dirauth/dirauth_sys.h b/src/feature/dirauth/dirauth_sys.h
index 4c09ff64f..6f116855d 100644
--- a/src/feature/dirauth/dirauth_sys.h
+++ b/src/feature/dirauth/dirauth_sys.h
@@ -17,4 +17,12 @@ const struct dirauth_options_t *dirauth_get_options(void);
 
 extern const struct subsys_fns_t sys_dirauth;
 
+/**
+ * Subsystem level for the directory-authority system.
+ *
+ * Defined here so that it can be shared between the real and stub
+ * definitions.
+ **/
+#define DIRAUTH_SUBSYS_LEVEL 70
+
 #endif /* !defined(DIRAUTH_SYS_H) */
diff --git a/src/feature/relay/relay_stub.c b/src/feature/relay/relay_stub.c
index a23b99186..36daaa7bd 100644
--- a/src/feature/relay/relay_stub.c
+++ b/src/feature/relay/relay_stub.c
@@ -16,5 +16,5 @@
 const struct subsys_fns_t sys_relay = {
   .name = "relay",
   .supported = false,
-  .level = 50,
+  .level = RELAY_SUBSYS_LEVEL,
 };
diff --git a/src/feature/relay/relay_sys.c b/src/feature/relay/relay_sys.c
index 106e88b2a..dfddff27f 100644
--- a/src/feature/relay/relay_sys.c
+++ b/src/feature/relay/relay_sys.c
@@ -42,7 +42,7 @@ subsys_relay_shutdown(void)
 const struct subsys_fns_t sys_relay = {
   .name = "relay",
   .supported = true,
-  .level = 50,
+  .level = RELAY_SUBSYS_LEVEL,
   .initialize = subsys_relay_initialize,
   .shutdown = subsys_relay_shutdown,
 };
diff --git a/src/feature/relay/relay_sys.h b/src/feature/relay/relay_sys.h
index 32e21d90d..ba3b5ccf4 100644
--- a/src/feature/relay/relay_sys.h
+++ b/src/feature/relay/relay_sys.h
@@ -14,4 +14,12 @@
 
 extern const struct subsys_fns_t sys_relay;
 
+/**
+ * Subsystem level for the relay system.
+ *
+ * Defined here so that it can be shared between the real and stub
+ * definitions.
+ **/
+#define RELAY_SUBSYS_LEVEL 50
+
 #endif /* !defined(TOR_FEATURE_RELAY_RELAY_SYS_H) */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits