[master] c40060c3a polish the jail enums some more

Nils Goroll nils.goroll at uplex.de
Sat May 30 14:35:06 UTC 2020


commit c40060c3ae9f4fb9ef5181218e9c9ab7d0b4ed6e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat May 30 16:26:36 2020 +0200

    polish the jail enums some more
    
    We are also going to need JAIL_SUBPROC to determine the boundary between
    the MASTER and SUBPROC enum values.

diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 294b10a7f..25169384d 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -108,24 +108,24 @@ enum jail_master_e {
 	JAIL_MASTER_STORAGE,
 	JAIL_MASTER_PRIVPORT,
 	JAIL_MASTER_KILL,
+#define JAIL_SUBPROC (JAIL_MASTER_KILL + 1)
 };
 
-#define ASSERT_JAIL_MASTER(x) assert(x <= JAIL_MASTER_KILL)
-
 enum jail_subproc_e {
-	JAIL_SUBPROC_VCC = JAIL_MASTER_KILL + 1,
+	JAIL_SUBPROC_VCC = JAIL_SUBPROC,
 	JAIL_SUBPROC_CC,
 	JAIL_SUBPROC_VCLLOAD,
 	JAIL_SUBPROC_WORKER,
+#define JAIL_LIMIT (JAIL_SUBPROC_WORKER + 1)
 };
 
+#define ASSERT_JAIL_MASTER(x) assert((x) < JAIL_SUBPROC)
+
 #define ASSERT_JAIL_SUBPROC(x) do {		\
-	assert(x >= JAIL_SUBPROC_VCC);		\
-	assert(x <= JAIL_SUBPROC_WORKER);	\
+		assert((x) >= JAIL_SUBPROC);	\
+		assert((x) < JAIL_LIMIT);	\
 	} while (0)
 
-#define JAIL_LIMIT (JAIL_SUBPROC_WORKER + 1)
-
 enum jail_fixfd_e {
 	JAIL_FIXFD_FILE,
 	JAIL_FIXFD_VSMMGT,


More information about the varnish-commit mailing list