From: Willy Tarreau Date: Wed, 13 May 2026 08:48:18 +0000 (+0200) Subject: CLEANUP: tree-wide: fix more typos and outdated explanations in comments X-Git-Tag: v3.4-dev12~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31a3e16e1615e5f9afda86e6d3e7baba9b2246de;p=thirdparty%2Fhaproxy.git CLEANUP: tree-wide: fix more typos and outdated explanations in comments Some outdated comments, as well as typos were fixed in the following files: dgram.h protocol.h queue-t.h cpu_topo.c debug.c dict.c protocol.c queue.c raw_sock.c trace.c wdt.c --- diff --git a/include/haproxy/dgram.h b/include/haproxy/dgram.h index 92d00ab11..20816d019 100644 --- a/include/haproxy/dgram.h +++ b/include/haproxy/dgram.h @@ -1,5 +1,5 @@ /* - * include/haproxy/proto_dgram.h + * include/haproxy/dgram.h * This file provides functions related to DGRAM processing. * * Copyright (C) 2014 Baptiste Assmann diff --git a/include/haproxy/protocol.h b/include/haproxy/protocol.h index beb0632e3..45e96ee51 100644 --- a/include/haproxy/protocol.h +++ b/include/haproxy/protocol.h @@ -92,8 +92,8 @@ int protocol_resume_all(void); int protocol_enable_all(void); /* returns the protocol associated to family with proto_type among the - * supported protocol types, and ctrl_type of either SOCK_STREAM or SOCK_DGRAM - * depending on the requested values, or NULL if not found. + * supported protocol types, and index (0 or 1) selecting between the two + * possible entries per (family, proto_type), or NULL if not found. */ static inline struct protocol *protocol_lookup(int family, enum proto_type proto_type, int alt) { diff --git a/include/haproxy/queue-t.h b/include/haproxy/queue-t.h index 7d9c31cf8..bcb3ae398 100644 --- a/include/haproxy/queue-t.h +++ b/include/haproxy/queue-t.h @@ -42,7 +42,7 @@ struct pendconn { }; struct queue { - struct eb_root head; /* queued pendconnds */ + struct eb_root head; /* queued pendconns */ struct proxy *px; /* the proxy we're waiting for, never NULL in queue */ struct server *sv; /* the server we are waiting for, may be NULL if don't care */ __decl_thread(HA_SPINLOCK_T lock); /* for manipulations in the tree */ diff --git a/src/cpu_topo.c b/src/cpu_topo.c index 8cd7c73a4..bfb7177cd 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -983,7 +983,7 @@ void cpu_compose_clusters(void) /* renumber clusters and assign unassigned ones at the same * time. For this, we'll compare pkg/die/llc with the last * CPU's and verify if we need to create a new cluster ID. - * Note that some platforms don't report cache. The locao value + * Note that some platforms don't report cache. The local value * is local to the pkg+node combination so that we reset it * when changing, contrary to the global one which grows. */ @@ -2402,7 +2402,7 @@ static int cpu_topo_alloc(void) ha_cpu_clusters[cpu].idx = cpu; } - /* pre-inizialize the configured CPU sets */ + /* pre-initialize the configured CPU sets */ ha_cpuset_zero(&cpu_set_cfg.drop_cpus); ha_cpuset_zero(&cpu_set_cfg.only_cpus); ha_cpuset_zero(&cpu_set_cfg.drop_nodes); diff --git a/src/debug.c b/src/debug.c index 50a8856dc..cdb98584c 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1357,8 +1357,7 @@ static int debug_parse_cli_write(char **args, char *payload, struct appctx *appc /* * debug dev stream [strm=] [strm.f[{+-=}]] [txn.f[{+-=}]] \ * [req.f[{+-=}]] [res.f[{+-=}]] \ - * [sif.f[{+-=]] [sib.f[{+-=]] \ - * [sif.s[=]] [sib.s[=]] + * [scf.s[=]] [scb.s[=]] */ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private) { @@ -1628,7 +1627,7 @@ static struct task *debug_delay_inj_task(struct task *t, void *ctx, unsigned int */ static int debug_parse_delay_inj(char **args, char *payload, struct appctx *appctx, void *private) { - unsigned long *tctx; // [0] = inter, [2] = count + unsigned long *tctx; // [0] = inter, [1] = nbwakeups struct task *task; if (!cli_has_level(appctx, ACCESS_LVL_ADMIN)) diff --git a/src/dict.c b/src/dict.c index a22508148..61751eb1e 100644 --- a/src/dict.c +++ b/src/dict.c @@ -59,7 +59,7 @@ static void free_dict_entry(struct dict_entry *de) } /* - * Simple function to lookup dictionary entries with as value. + * Simple function to lookup dictionary entries with as key. */ static struct dict_entry *__dict_lookup(struct dict *d, const char *s) { @@ -75,7 +75,7 @@ static struct dict_entry *__dict_lookup(struct dict *d, const char *s) } /* - * Insert an entry in dictionary with as value. * + * Insert an entry in dictionary with as key. */ struct dict_entry *dict_insert(struct dict *d, char *s) { diff --git a/src/protocol.c b/src/protocol.c index b42346090..fe91656ba 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -106,7 +106,7 @@ int protocol_supports_flag(struct protocol *proto, uint flag) if (!(_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_SUPPORTED)) return 0; - /* at least nobody said it was not supported */ + /* TESTED is set, assume supported (live test already ran and passed) */ if (_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_TESTED) return 1; @@ -289,8 +289,7 @@ int protocol_resume_all(void) } /* enables all listeners of all registered protocols. This is intended to be - * used after a fork() to enable reading on all file descriptors. Returns - * composition of ERR_NONE. + * used after a fork() to enable reading on all file descriptors. Returns ERR_NONE. */ int protocol_enable_all(void) { diff --git a/src/queue.c b/src/queue.c index 59d52771e..acd7f6489 100644 --- a/src/queue.c +++ b/src/queue.c @@ -24,9 +24,9 @@ * - if p->node.node.leaf_p is NULL, the element is unlinked, * otherwise it necessarily belongs to one of the other lists ; this may * not be atomically checked under threads though ; - * - pendconn->px is never NULL if pendconn->list is not empty - * - pendconn->srv is never NULL if pendconn->list is in the server's queue, - * and is always NULL if pendconn->list is in the backend's queue or empty. + * - pendconn->queue->px is never NULL if pendconn->node.node.leaf_p is not NULL + * - pendconn->queue->sv is never NULL if pendconn is in the server's queue, + * and is always NULL if it is in the proxy's queue or unlinked. * - pendconn->target is NULL while the element is queued, and points to the * assigned server when the pendconn is picked. * @@ -44,7 +44,7 @@ * - a pendconn_add() is only performed by the stream which will own the * pendconn ; the pendconn is allocated at this moment and returned ; it is * added to either the server or the proxy's queue while holding this -s * queue's lock. + * queue's lock. * * - the pendconn is then met by a thread walking over the proxy or server's * queue with the respective lock held. This lock is exclusive and the @@ -59,7 +59,7 @@ s * queue's lock. * on the queue the pendconn is attached to. * * - no single operation except the pendconn initialisation prior to the - * insertion are performed without eithre a queue lock held or the element + * insertion are performed without either a queue lock held or the element * being unlinked and visible exclusively to its stream. * * - pendconn_process_next_strm() assign ->target so that the stream knows @@ -126,7 +126,8 @@ unsigned int srv_dynamic_maxconn(const struct server *s) * up to the caller to atomically decrement the pending counts. * * The caller must own the lock on the server queue. The pendconn must still be - * queued (p->node.leaf_p != NULL) and must be in a server (p->srv != NULL). + * queued (p->node.node.leaf_p != NULL) and must be in a server queue + * (p->queue->sv != NULL). */ static void __pendconn_unlink_srv(struct pendconn *p) { @@ -139,7 +140,8 @@ static void __pendconn_unlink_srv(struct pendconn *p) * up to the caller to atomically decrement the pending counts. * * The caller must own the lock on the proxy queue. The pendconn must still be - * queued (p->node.leaf_p != NULL) and must be in the proxy (p->srv == NULL). + * queued (p->node.node.leaf_p != NULL) and must be in the proxy queue + * (p->queue->sv == NULL). */ static void __pendconn_unlink_prx(struct pendconn *p) { @@ -147,18 +149,18 @@ static void __pendconn_unlink_prx(struct pendconn *p) eb32_delete(&p->node); } -/* Locks the queue the pendconn element belongs to. This relies on both p->px - * and p->srv to be properly initialized (which is always the case once the - * element has been added). +/* Locks the queue the pendconn element belongs to. This relies on p->queue + * being properly initialized (which is always the case once the element + * has been added). */ static inline void pendconn_queue_lock(struct pendconn *p) { HA_SPIN_LOCK(QUEUE_LOCK, &p->queue->lock); } -/* Unlocks the queue the pendconn element belongs to. This relies on both p->px - * and p->srv to be properly initialized (which is always the case once the - * element has been added). +/* Unlocks the queue the pendconn element belongs to. This relies on p->queue + * being properly initialized (which is always the case once the element + * has been added). */ static inline void pendconn_queue_unlock(struct pendconn *p) { diff --git a/src/raw_sock.c b/src/raw_sock.c index eebdf8be8..33fb8f5c3 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -365,7 +365,7 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu if (unlikely((flags & CO_RFL_TRY_HARDER) && !(conn->flags & CO_FL_SOCK_RD_SH) && !count)) { - /* we've read exactly what was being asked for, which is loewr + /* we've read exactly what was being asked for, which is lower * than a full buffer, and the caller wants us to really check * if there's something after. This happens in the context of * SSL where the lib reads in tiny chunks without offering the diff --git a/src/trace.c b/src/trace.c index 303b3e690..68e98bbc4 100644 --- a/src/trace.c +++ b/src/trace.c @@ -1188,7 +1188,7 @@ void trace_parse_cmds(void) } } -/* parse a "trace" statement in the "global" section, returns 1 if a message is returned, otherwise zero */ +/* parse a "trace" statement in the "global" section, returns -1 on error, zero otherwise */ static int cfg_parse_trace(char **args, int section_type, struct proxy *curpx, const struct proxy *defpx, const char *file, int line, char **err) diff --git a/src/wdt.c b/src/wdt.c index a18745f0f..0d411eb5d 100644 --- a/src/wdt.c +++ b/src/wdt.c @@ -258,6 +258,7 @@ int init_wdt_per_thread() fail1: per_thread_wd_ctx[tid].timer = TIMER_INVALID; ha_warning("Failed to setup watchdog timer for thread %u, disabling lockup detection.\n", tid); + /* don't fail to start just for this */ return 1; }