This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new caaf7fa484 Use static asserts to verify cache event constants. (#10524)
caaf7fa484 is described below
commit caaf7fa484256812bf775b55d0ff608236139703
Author: James Peach <[email protected]>
AuthorDate: Tue Sep 26 18:52:40 2023 +1000
Use static asserts to verify cache event constants. (#10524)
Signed-off-by: James Peach <[email protected]>
---
iocore/cache/Cache.cc | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 178663df71..508fe1415c 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -598,29 +598,29 @@ CacheProcessor::start(int, size_t)
static const int DEFAULT_CACHE_OPTIONS = (O_RDWR);
+static_assert(static_cast<int>(TS_EVENT_CACHE_OPEN_READ) ==
static_cast<int>(CACHE_EVENT_OPEN_READ));
+static_assert(static_cast<int>(TS_EVENT_CACHE_OPEN_READ_FAILED) ==
static_cast<int>(CACHE_EVENT_OPEN_READ_FAILED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_OPEN_WRITE) ==
static_cast<int>(CACHE_EVENT_OPEN_WRITE));
+static_assert(static_cast<int>(TS_EVENT_CACHE_OPEN_WRITE_FAILED) ==
static_cast<int>(CACHE_EVENT_OPEN_WRITE_FAILED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_REMOVE) ==
static_cast<int>(CACHE_EVENT_REMOVE));
+static_assert(static_cast<int>(TS_EVENT_CACHE_REMOVE_FAILED) ==
static_cast<int>(CACHE_EVENT_REMOVE_FAILED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN) ==
static_cast<int>(CACHE_EVENT_SCAN));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN_FAILED) ==
static_cast<int>(CACHE_EVENT_SCAN_FAILED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN_OBJECT) ==
static_cast<int>(CACHE_EVENT_SCAN_OBJECT));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED) ==
static_cast<int>(CACHE_EVENT_SCAN_OPERATION_BLOCKED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN_OPERATION_FAILED) ==
static_cast<int>(CACHE_EVENT_SCAN_OPERATION_FAILED));
+static_assert(static_cast<int>(TS_EVENT_CACHE_SCAN_DONE) ==
static_cast<int>(CACHE_EVENT_SCAN_DONE));
+
int
CacheProcessor::start_internal(int flags)
{
- ink_assert((int)TS_EVENT_CACHE_OPEN_READ == (int)CACHE_EVENT_OPEN_READ);
- ink_assert((int)TS_EVENT_CACHE_OPEN_READ_FAILED ==
(int)CACHE_EVENT_OPEN_READ_FAILED);
- ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE == (int)CACHE_EVENT_OPEN_WRITE);
- ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE_FAILED ==
(int)CACHE_EVENT_OPEN_WRITE_FAILED);
- ink_assert((int)TS_EVENT_CACHE_REMOVE == (int)CACHE_EVENT_REMOVE);
- ink_assert((int)TS_EVENT_CACHE_REMOVE_FAILED ==
(int)CACHE_EVENT_REMOVE_FAILED);
- ink_assert((int)TS_EVENT_CACHE_SCAN == (int)CACHE_EVENT_SCAN);
- ink_assert((int)TS_EVENT_CACHE_SCAN_FAILED == (int)CACHE_EVENT_SCAN_FAILED);
- ink_assert((int)TS_EVENT_CACHE_SCAN_OBJECT == (int)CACHE_EVENT_SCAN_OBJECT);
- ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED ==
(int)CACHE_EVENT_SCAN_OPERATION_BLOCKED);
- ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_FAILED ==
(int)CACHE_EVENT_SCAN_OPERATION_FAILED);
- ink_assert((int)TS_EVENT_CACHE_SCAN_DONE == (int)CACHE_EVENT_SCAN_DONE);
start_internal_flags = flags;
clear = !!(flags & PROCESSOR_RECONFIGURE) || auto_clear_flag;
fix = !!(flags & PROCESSOR_FIX);
check = (flags & PROCESSOR_CHECK) != 0;
start_done = 0;
- /* read the config file and create the data structures corresponding
- to the file */
+ /* Read the config file and create the data structures corresponding to the
file. */
gndisks = theCacheStore.n_disks;
gdisks = static_cast<CacheDisk **>(ats_malloc(gndisks * sizeof(CacheDisk
*)));