Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2017 Cavium, Inc 3 : : */ 4 : : 5 : : #include <stdio.h> 6 : : #include <unistd.h> 7 : : #include <sys/queue.h> 8 : : 9 : : #include "evt_test.h" 10 : : 11 : : static STAILQ_HEAD(, evt_test_entry) head = STAILQ_HEAD_INITIALIZER(head); 12 : : 13 : : void 14 : 0 : evt_test_register(struct evt_test_entry *entry) 15 : : { 16 : 0 : STAILQ_INSERT_TAIL(&head, entry, next); 17 : 0 : } 18 : : 19 : : struct evt_test* 20 : 0 : evt_test_get(const char *name) 21 : : { 22 : : struct evt_test_entry *entry; 23 : : 24 : 0 : if (!name) 25 : : return NULL; 26 : : 27 : 0 : STAILQ_FOREACH(entry, &head, next) 28 : 0 : if (!strncmp(entry->test.name, name, strlen(name))) 29 : 0 : return &entry->test; 30 : : 31 : : return NULL; 32 : : } 33 : : 34 : : void 35 : 0 : evt_test_dump_names(void) 36 : : { 37 : : struct evt_test_entry *entry; 38 : : 39 : 0 : STAILQ_FOREACH(entry, &head, next) 40 : 0 : if (entry->test.name) 41 : : printf("\t %s\n", entry->test.name); 42 : 0 : }