Rename CHAN_DUPLICATES to CHAN_ALLOW_DUP

This commit is contained in:
Rodrigo Arias 2023-03-13 11:49:44 +01:00 committed by Rodrigo Arias Mallo
parent 7fba5cbdcc
commit ab3e823134
8 changed files with 13 additions and 13 deletions

View File

@ -67,7 +67,7 @@ static int
check_duplicates(struct chan *chan, struct value *v) check_duplicates(struct chan *chan, struct value *v)
{ {
/* If duplicates are allowed just skip the check */ /* If duplicates are allowed just skip the check */
if (chan->prop[CHAN_DUPLICATES]) if (chan->prop[CHAN_ALLOW_DUP])
return 0; return 0;
if (value_is_equal(&chan->last_value, v)) { if (value_is_equal(&chan->last_value, v)) {

View File

@ -18,7 +18,7 @@ enum chan_type {
enum chan_prop { enum chan_prop {
CHAN_DIRTY_WRITE = 0, CHAN_DIRTY_WRITE = 0,
CHAN_DUPLICATES, CHAN_ALLOW_DUP,
CHAN_MAXPROP, CHAN_MAXPROP,
}; };

View File

@ -116,11 +116,11 @@ cpu_init_end(struct cpu *cpu)
chan_fmt, cpu->gindex, chan_name[i]); chan_fmt, cpu->gindex, chan_name[i]);
} }
chan_prop_set(&cpu->chan[CPU_CHAN_NRUN], CHAN_DUPLICATES, 1); chan_prop_set(&cpu->chan[CPU_CHAN_NRUN], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_TID], CHAN_DUPLICATES, 1); chan_prop_set(&cpu->chan[CPU_CHAN_TID], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_PID], CHAN_DUPLICATES, 1); chan_prop_set(&cpu->chan[CPU_CHAN_PID], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THRUN], CHAN_DUPLICATES, 1); chan_prop_set(&cpu->chan[CPU_CHAN_THRUN], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THACT], CHAN_DUPLICATES, 1); chan_prop_set(&cpu->chan[CPU_CHAN_THACT], CHAN_ALLOW_DUP, 1);
cpu->is_init = 1; cpu->is_init = 1;

View File

@ -25,7 +25,7 @@ init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t g
if (spec->ch_dup != NULL) { if (spec->ch_dup != NULL) {
int dup = spec->ch_dup[i]; int dup = spec->ch_dup[i];
chan_prop_set(c, CHAN_DUPLICATES, dup); chan_prop_set(c, CHAN_ALLOW_DUP, dup);
} }
if (bay_register(th->bay, c) != 0) { if (bay_register(th->bay, c) != 0) {

View File

@ -171,7 +171,7 @@ mux_init(struct mux *mux,
/* Similarly, we may switch to an input channel that has the same value /* Similarly, we may switch to an input channel that has the same value
* as the last output value, so we allow duplicates too */ * as the last output value, so we allow duplicates too */
chan_prop_set(output, CHAN_DUPLICATES, 1); chan_prop_set(output, CHAN_ALLOW_DUP, 1);
memset(mux, 0, sizeof(struct mux)); memset(mux, 0, sizeof(struct mux));
mux->select = select; mux->select = select;

View File

@ -144,7 +144,7 @@ thread_init_end(struct thread *th)
chan_fmt, th->gindex, chan_name[i]); chan_fmt, th->gindex, chan_name[i]);
} }
chan_prop_set(&th->chan[TH_CHAN_TID], CHAN_DUPLICATES, 1); chan_prop_set(&th->chan[TH_CHAN_TID], CHAN_ALLOW_DUP, 1);
th->is_init = 1; th->is_init = 1;
return 0; return 0;

View File

@ -91,7 +91,7 @@ test_duplicate(void)
die("chan_set didn't fail\n"); die("chan_set didn't fail\n");
/* Now enable duplicates */ /* Now enable duplicates */
chan_prop_set(&chan, CHAN_DUPLICATES, 1); chan_prop_set(&chan, CHAN_ALLOW_DUP, 1);
/* Then it should allow writting the same value */ /* Then it should allow writting the same value */
if (chan_set(&chan, value_int64(1)) != 0) if (chan_set(&chan, value_int64(1)) != 0)

View File

@ -80,7 +80,7 @@ test_duplicate(const char *path)
chan_init(&chan, CHAN_SINGLE, "testchan"); chan_init(&chan, CHAN_SINGLE, "testchan");
/* Allow setting the same value in the channel */ /* Allow setting the same value in the channel */
chan_prop_set(&chan, CHAN_DUPLICATES, 1); chan_prop_set(&chan, CHAN_ALLOW_DUP, 1);
if (bay_register(&bay, &chan) != 0) if (bay_register(&bay, &chan) != 0)
die("bay_register failed\n"); die("bay_register failed\n");
@ -130,7 +130,7 @@ test_same_type(const char *path)
chan_init(&chan, CHAN_SINGLE, "testchan"); chan_init(&chan, CHAN_SINGLE, "testchan");
/* Allow setting the same value in the channel */ /* Allow setting the same value in the channel */
chan_prop_set(&chan, CHAN_DUPLICATES, 1); chan_prop_set(&chan, CHAN_ALLOW_DUP, 1);
OK(bay_register(&bay, &chan)); OK(bay_register(&bay, &chan));
OK(prv_register(&prv, row, type, &bay, &chan, 0)); OK(prv_register(&prv, row, type, &bay, &chan, 0));