Commit 3808881e authored by Reza Naghibi's avatar Reza Naghibi

Style(9) and whitespace OCD

dd28fc73Co-authored-by: 's avatarDridi Boukelmoune <dridi.boukelmoune@gmail.com>
parent 1e3cfe58
...@@ -97,7 +97,7 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv, ...@@ -97,7 +97,7 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv,
shard_err0(ctx, shardd, shard_err0(ctx, shardd,
"cannot change more than one shard director " "cannot change more than one shard director "
"at a time"); "at a time");
return NULL; return (NULL);
} }
return (change); return (change);
} }
...@@ -105,7 +105,7 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv, ...@@ -105,7 +105,7 @@ shard_change_get(VRT_CTX, struct vmod_priv *priv,
change = WS_Alloc(ctx->ws, sizeof(*change)); change = WS_Alloc(ctx->ws, sizeof(*change));
if (change == NULL) { if (change == NULL) {
shard_err0(ctx, shardd, "could not get workspace"); shard_err0(ctx, shardd, "could not get workspace");
return NULL; return (NULL);
} }
INIT_OBJ(change, SHARD_CHANGE_MAGIC); INIT_OBJ(change, SHARD_CHANGE_MAGIC);
...@@ -160,13 +160,13 @@ shard_change_task_backend(VRT_CTX, ...@@ -160,13 +160,13 @@ shard_change_task_backend(VRT_CTX,
change = shard_change_get(ctx, priv, shardd); change = shard_change_get(ctx, priv, shardd);
if (change == NULL) if (change == NULL)
return 0; return (0);
b = WS_Alloc(ctx->ws, sizeof(*b)); b = WS_Alloc(ctx->ws, sizeof(*b));
if (b == NULL) { if (b == NULL) {
shard_err(ctx, shardd, ".%s_backend() WS_Alloc() failed", shard_err(ctx, shardd, ".%s_backend() WS_Alloc() failed",
task_e == ADD_BE ? "add" : "remove"); task_e == ADD_BE ? "add" : "remove");
return 0; return (0);
} }
b->backend = be; b->backend = be;
...@@ -175,7 +175,7 @@ shard_change_task_backend(VRT_CTX, ...@@ -175,7 +175,7 @@ shard_change_task_backend(VRT_CTX,
shard_change_task_add(ctx, change, task_e, b); shard_change_task_add(ctx, change, task_e, b);
return 1; return (1);
} }
/* /*
...@@ -188,16 +188,16 @@ shardcfg_add_backend(VRT_CTX, struct vmod_priv *priv, ...@@ -188,16 +188,16 @@ shardcfg_add_backend(VRT_CTX, struct vmod_priv *priv,
VCL_DURATION rampup) VCL_DURATION rampup)
{ {
AN(be); AN(be);
return shard_change_task_backend(ctx, priv, shardd, ADD_BE, return (shard_change_task_backend(ctx, priv, shardd, ADD_BE,
be, ident, rampup); be, ident, rampup));
} }
VCL_BOOL VCL_BOOL
shardcfg_remove_backend(VRT_CTX, struct vmod_priv *priv, shardcfg_remove_backend(VRT_CTX, struct vmod_priv *priv,
const struct sharddir *shardd, VCL_BACKEND be, VCL_STRING ident) const struct sharddir *shardd, VCL_BACKEND be, VCL_STRING ident)
{ {
return shard_change_task_backend(ctx, priv, shardd, REMOVE_BE, return (shard_change_task_backend(ctx, priv, shardd, REMOVE_BE,
be, ident, 0); be, ident, 0));
} }
VCL_BOOL VCL_BOOL
...@@ -209,11 +209,11 @@ shardcfg_clear(VRT_CTX, struct vmod_priv *priv, const struct sharddir *shardd) ...@@ -209,11 +209,11 @@ shardcfg_clear(VRT_CTX, struct vmod_priv *priv, const struct sharddir *shardd)
change = shard_change_get(ctx, priv, shardd); change = shard_change_get(ctx, priv, shardd);
if (change == NULL) if (change == NULL)
return 0; return (0);
shard_change_task_add(ctx, change, CLEAR, NULL); shard_change_task_add(ctx, change, CLEAR, NULL);
return 1; return (1);
} }
/* /*
...@@ -227,7 +227,7 @@ static int ...@@ -227,7 +227,7 @@ static int
circlepoint_compare(const struct shard_circlepoint *a, circlepoint_compare(const struct shard_circlepoint *a,
const struct shard_circlepoint *b) const struct shard_circlepoint *b)
{ {
return (a->point == b->point) ? 0 : ((a->point > b->point) ? 1 : -1); return ((a->point == b->point) ? 0 : ((a->point > b->point) ? 1 : -1));
} }
static void static void
...@@ -322,7 +322,7 @@ shardcfg_backend_cmp(const struct shard_backend *a, ...@@ -322,7 +322,7 @@ shardcfg_backend_cmp(const struct shard_backend *a,
/* vcl_names are unique, so we can compare the backend pointers */ /* vcl_names are unique, so we can compare the backend pointers */
if (ai == NULL && bi == NULL) if (ai == NULL && bi == NULL)
return a->backend != b->backend; return (a->backend != b->backend);
if (ai == NULL) if (ai == NULL)
ai = a->backend->vcl_name; ai = a->backend->vcl_name;
...@@ -330,7 +330,7 @@ shardcfg_backend_cmp(const struct shard_backend *a, ...@@ -330,7 +330,7 @@ shardcfg_backend_cmp(const struct shard_backend *a,
if (bi == NULL) if (bi == NULL)
bi = b->backend->vcl_name; bi = b->backend->vcl_name;
return strcmp(ai, bi); return (strcmp(ai, bi));
} }
/* for removal, we delete all instances if the backend matches */ /* for removal, we delete all instances if the backend matches */
...@@ -341,9 +341,9 @@ shardcfg_backend_del_cmp(const struct shard_backend *task, ...@@ -341,9 +341,9 @@ shardcfg_backend_del_cmp(const struct shard_backend *task,
assert(task->backend || task->ident); assert(task->backend || task->ident);
if (task->ident == NULL) if (task->ident == NULL)
return task->backend != b->backend; return (task->backend != b->backend);
return shardcfg_backend_cmp(task, b); return (shardcfg_backend_cmp(task, b));
} }
static const struct shard_backend * static const struct shard_backend *
...@@ -360,9 +360,9 @@ shardcfg_backend_lookup(const struct backend_reconfig *re, ...@@ -360,9 +360,9 @@ shardcfg_backend_lookup(const struct backend_reconfig *re,
if (bb[i].backend == NULL) if (bb[i].backend == NULL)
continue; // hole continue; // hole
if (!shardcfg_backend_cmp(b, &bb[i])) if (!shardcfg_backend_cmp(b, &bb[i]))
return &bb[i]; return (&bb[i]);
} }
return NULL; return (NULL);
} }
static void static void
...@@ -585,15 +585,15 @@ shardcfg_reconfigure(VRT_CTX, struct vmod_priv *priv, ...@@ -585,15 +585,15 @@ shardcfg_reconfigure(VRT_CTX, struct vmod_priv *priv,
if (replicas <= 0) { if (replicas <= 0) {
shard_err(ctx, shardd, shard_err(ctx, shardd,
".reconfigure() invalid replicas argument %ld", replicas); ".reconfigure() invalid replicas argument %ld", replicas);
return 0; return (0);
} }
change = shard_change_get(ctx, priv, shardd); change = shard_change_get(ctx, priv, shardd);
if (change == NULL) if (change == NULL)
return 0; return (0);
if (VSTAILQ_FIRST(&change->tasks) == NULL) if (VSTAILQ_FIRST(&change->tasks) == NULL)
return 1; return (1);
sharddir_wrlock(shardd); sharddir_wrlock(shardd);
...@@ -607,7 +607,7 @@ shardcfg_reconfigure(VRT_CTX, struct vmod_priv *priv, ...@@ -607,7 +607,7 @@ shardcfg_reconfigure(VRT_CTX, struct vmod_priv *priv,
if (shardd->n_backend == 0) { if (shardd->n_backend == 0) {
shard_err0(ctx, shardd, ".reconfigure() no backends"); shard_err0(ctx, shardd, ".reconfigure() no backends");
sharddir_unlock(shardd); sharddir_unlock(shardd);
return 0; return (0);
} }
shardcfg_hashcircle(shardd, replicas); shardcfg_hashcircle(shardd, replicas);
......
...@@ -156,7 +156,7 @@ shard_lookup(const struct sharddir *shardd, const uint32_t key) ...@@ -156,7 +156,7 @@ shard_lookup(const struct sharddir *shardd, const uint32_t key)
low = i; low = i;
} while (idx == -1); } while (idx == -1);
return idx; return (idx);
} }
static int static int
...@@ -173,7 +173,7 @@ shard_next(struct shard_state *state, VCL_INT skip, VCL_BOOL healthy) ...@@ -173,7 +173,7 @@ shard_next(struct shard_state *state, VCL_INT skip, VCL_BOOL healthy)
CHECK_OBJ_NOTNULL(state->shardd, SHARDDIR_MAGIC); CHECK_OBJ_NOTNULL(state->shardd, SHARDDIR_MAGIC);
if (state->pickcount >= state->shardd->n_backend) if (state->pickcount >= state->shardd->n_backend)
return -1; return (-1);
ringsz = state->shardd->n_backend * state->shardd->replicas; ringsz = state->shardd->n_backend * state->shardd->replicas;
...@@ -218,7 +218,7 @@ shard_next(struct shard_state *state, VCL_INT skip, VCL_BOOL healthy) ...@@ -218,7 +218,7 @@ shard_next(struct shard_state *state, VCL_INT skip, VCL_BOOL healthy)
if (++(state->idx) == ringsz) if (++(state->idx) == ringsz)
state->idx = 0; state->idx = 0;
} }
return chosen; return (chosen);
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment