Rename node->str to node->name3

This commit is contained in:
Alexandre Ratchov 2020-01-23 07:38:14 +01:00
parent f51534ae26
commit 0ac817ab82
11 changed files with 42 additions and 42 deletions

View File

@ -126,16 +126,16 @@ struct amsg {
};
/*
* subset of channels of a stream
* network representation of sioctl_node structure
*/
struct amsg_ctl_node {
char str[AMSG_CTL_NAMEMAX]; /* stream name */
int16_t unit; /* stream number */
char name[AMSG_CTL_NAMEMAX];
int16_t unit;
uint8_t __pad[2];
};
/*
* description of a control (index, value) pair
* network representation of sioctl_desc structure
*/
struct amsg_ctl_desc {
struct amsg_ctl_node node0; /* affected channels */

View File

@ -83,9 +83,9 @@ sioctl_aucat_rdata(struct sioctl_aucat_hdl *hdl)
rpos = 0;
while (rpos < hdl->buf_wpos) {
strlcpy(desc.group, c->group, SIOCTL_NAMEMAX);
strlcpy(desc.node0.str, c->node0.str, SIOCTL_NAMEMAX);
strlcpy(desc.node0.name, c->node0.name, SIOCTL_NAMEMAX);
desc.node0.unit = (int16_t)ntohs(c->node0.unit);
strlcpy(desc.node1.str, c->node1.str, SIOCTL_NAMEMAX);
strlcpy(desc.node1.name, c->node1.name, SIOCTL_NAMEMAX);
desc.node1.unit = (int16_t)ntohs(c->node1.unit);
strlcpy(desc.func, c->func, SIOCTL_NAMEMAX);
desc.type = c->type;

View File

@ -116,7 +116,7 @@ Controls are described by the
stucture as follows:
.Bd -literal
struct sioctl_node {
char str[SIOCTL_NAMEMAX]; /* name, ex "spkr" */
char name[SIOCTL_NAMEMAX]; /* ex. "spkr" */
int unit; /* optional number or -1 */
};

View File

@ -234,10 +234,10 @@ scanvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol)
return 0;
}
desc.type = SIOCTL_NUM;
desc.node1.str[0] = 0;
desc.node1.name[0] = 0;
desc.node1.unit = -1;
strlcpy(desc.func, "level", SIOCTL_NAMEMAX);
strlcpy(desc.node0.str, vol->name, SIOCTL_NAMEMAX);
strlcpy(desc.node0.name, vol->name, SIOCTL_NAMEMAX);
for (i = 0; i < vol->nch; i++) {
desc.node0.unit = i;
desc.addr = vol->base_addr + i;
@ -254,10 +254,10 @@ scanvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol)
return 0;
}
desc.type = SIOCTL_SW;
desc.node1.str[0] = 0;
desc.node1.name[0] = 0;
desc.node1.unit = -1;
strlcpy(desc.func, "mute", SIOCTL_NAMEMAX);
strlcpy(desc.node0.str, vol->name, SIOCTL_NAMEMAX);
strlcpy(desc.node0.name, vol->name, SIOCTL_NAMEMAX);
val = ctrl.un.ord ? 1 : 0;
vol->mute_val = val;
for (i = 0; i < vol->nch; i++) {

View File

@ -96,7 +96,7 @@ struct sio_cap {
* controlled component of the device
*/
struct sioctl_node {
char str[SIOCTL_NAMEMAX]; /* name, ex "spkr" */
char name[SIOCTL_NAMEMAX]; /* ex. "spkr" */
int unit; /* optional number or -1 */
};

View File

@ -80,7 +80,7 @@ cmpdesc(struct sioctl_desc *d1, struct sioctl_desc *d2)
res = strcmp(d1->group, d2->group);
if (res != 0)
return res;
res = strcmp(d1->node0.str, d2->node0.str);
res = strcmp(d1->node0.name, d2->node0.name);
if (res != 0)
return res;
res = d1->type - d2->type;
@ -94,7 +94,7 @@ cmpdesc(struct sioctl_desc *d1, struct sioctl_desc *d2)
d1->type == SIOCTL_LIST) {
if (res != 0)
return res;
res = strcmp(d1->node1.str, d2->node1.str);
res = strcmp(d1->node1.name, d2->node1.name);
if (res != 0)
return res;
res = d1->node1.unit - d2->node1.unit;
@ -120,7 +120,7 @@ struct info *
vecent(struct info *i, char *vstr, int vunit)
{
while (i != NULL) {
if ((strcmp(i->desc.node1.str, vstr) == 0) &&
if ((strcmp(i->desc.node1.name, vstr) == 0) &&
(vunit < 0 || i->desc.node1.unit == vunit))
break;
i = i->next;
@ -138,10 +138,10 @@ nextfunc(struct info *i)
group = i->desc.group;
func = i->desc.func;
str = i->desc.node0.str;
str = i->desc.node0.name;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.group, group) != 0 ||
strcmp(i->desc.node0.str, str) != 0 ||
strcmp(i->desc.node0.name, str) != 0 ||
strcmp(i->desc.func, func) != 0)
return i;
}
@ -159,11 +159,11 @@ nextpar(struct info *i)
group = i->desc.group;
func = i->desc.func;
str = i->desc.node0.str;
str = i->desc.node0.name;
unit = i->desc.node0.unit;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.group, group) != 0 ||
strcmp(i->desc.node0.str, str) != 0 ||
strcmp(i->desc.node0.name, str) != 0 ||
strcmp(i->desc.func, func) != 0)
break;
/* XXX: need to check for -1 ? */
@ -183,16 +183,16 @@ firstent(struct info *g, char *vstr)
struct info *i;
group = g->desc.group;
astr = g->desc.node0.str;
astr = g->desc.node0.name;
func = g->desc.func;
for (i = g; i != NULL; i = i->next) {
if (strcmp(i->desc.group, group) != 0 ||
strcmp(i->desc.node0.str, astr) != 0 ||
strcmp(i->desc.node0.name, astr) != 0 ||
strcmp(i->desc.func, func) != 0)
break;
if (!isdiag(i))
continue;
if (strcmp(i->desc.node1.str, vstr) == 0)
if (strcmp(i->desc.node1.name, vstr) == 0)
return i;
}
return NULL;
@ -211,11 +211,11 @@ nextent(struct info *i, int mono)
group = i->desc.group;
func = i->desc.func;
str = i->desc.node0.str;
str = i->desc.node0.name;
unit = i->desc.node0.unit;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.group, group) != 0 ||
strcmp(i->desc.node0.str, str) != 0 ||
strcmp(i->desc.node0.name, str) != 0 ||
strcmp(i->desc.func, func) != 0)
return NULL;
if (mono)
@ -232,7 +232,7 @@ nextent(struct info *i, int mono)
int
matchpar(struct info *i, char *astr, int aunit)
{
if (strcmp(i->desc.node0.str, astr) != 0)
if (strcmp(i->desc.node0.name, astr) != 0)
return 0;
if (aunit < 0)
return 1;
@ -250,7 +250,7 @@ matchpar(struct info *i, char *astr, int aunit)
int
matchent(struct info *i, char *vstr, int vunit)
{
if (strcmp(i->desc.node1.str, vstr) != 0)
if (strcmp(i->desc.node1.name, vstr) != 0)
return 0;
if (vunit < 0)
return 1;
@ -289,7 +289,7 @@ ismono(struct info *g)
return 0;
} else {
e1 = vecent(p1,
e2->desc.node1.str,
e2->desc.node1.name,
p1->desc.node0.unit);
if (e1 == NULL)
continue;
@ -309,7 +309,7 @@ ismono(struct info *g)
void
print_node(struct sioctl_node *c, int mono)
{
printf("%s", c->str);
printf("%s", c->name);
if (!mono && c->unit >= 0)
printf("[%d]", c->unit);
}
@ -335,7 +335,7 @@ print_desc(struct info *p, int mono)
if (mono) {
if (!isdiag(e))
continue;
if (e != firstent(p, e->desc.node1.str))
if (e != firstent(p, e->desc.node1.name))
continue;
}
if (more)
@ -368,7 +368,7 @@ print_val(struct info *p, int mono)
if (mono) {
if (!isdiag(e))
continue;
if (e != firstent(p, e->desc.node1.str))
if (e != firstent(p, e->desc.node1.name))
continue;
}
if (more)
@ -588,7 +588,7 @@ cmd(char *line)
}
if (strcmp(g->desc.group, group) == 0 &&
strcmp(g->desc.func, func) == 0 &&
strcmp(g->desc.node0.str, astr) == 0)
strcmp(g->desc.node0.name, astr) == 0)
break;
}
g->mode = MODE_PRINT;

View File

@ -2224,7 +2224,7 @@ ctlslot_del(struct ctlslot *s)
void
ctl_node_log(struct ctl_node *c)
{
log_puts(c->str);
log_puts(c->name);
if (c->unit >= 0)
log_putu(c->unit);
}
@ -2269,10 +2269,10 @@ dev_addctl(struct dev *d, char *gstr, int type, int addr,
c->type = type;
strlcpy(c->func, func, CTL_NAMEMAX);
strlcpy(c->group, gstr, CTL_NAMEMAX);
strlcpy(c->node0.str, str0, CTL_NAMEMAX);
strlcpy(c->node0.name, str0, CTL_NAMEMAX);
c->node0.unit = unit0;
if (c->type == CTL_VEC || c->type == CTL_LIST) {
strlcpy(c->node1.str, str1, CTL_NAMEMAX);
strlcpy(c->node1.name, str1, CTL_NAMEMAX);
c->node1.unit = unit1;
} else
memset(&c->node1, 0, sizeof(struct ctl_node));
@ -2419,9 +2419,9 @@ dev_label(struct dev *d, int i)
c = c->next;
}
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
if (strcmp(c->node0.str, name) == 0)
if (strcmp(c->node0.name, name) == 0)
return;
strlcpy(c->node0.str, name, CTL_NAMEMAX);
strlcpy(c->node0.name, name, CTL_NAMEMAX);
c->desc_mask = ~0;
}

View File

@ -131,7 +131,7 @@ struct ctl {
char func[CTL_NAMEMAX]; /* parameter function name */
char group[CTL_NAMEMAX]; /* group aka namespace */
struct ctl_node {
char str[CTL_NAMEMAX]; /* stream name */
char name[CTL_NAMEMAX]; /* stream name */
int unit;
} node0, node1; /* affected channels */
#define CTL_DEVMASK (1 << 31)

View File

@ -80,8 +80,8 @@ dev_sioctl_ondesc(void *arg, struct sioctl_desc *desc, int val)
group = desc->group;
dev_addctl(d, group, desc->type, addr,
desc->node0.str, desc->node0.unit, desc->func,
desc->node1.str, desc->node1.unit, val);
desc->node0.name, desc->node0.unit, desc->func,
desc->node1.name, desc->node1.unit, val);
}
void

View File

@ -1534,10 +1534,10 @@ sock_buildmsg(struct sock *f)
c->val_mask &= ~mask;
strlcpy(desc->group, c->group,
AMSG_CTL_NAMEMAX);
strlcpy(desc->node0.str, c->node0.str,
strlcpy(desc->node0.name, c->node0.name,
AMSG_CTL_NAMEMAX);
desc->node0.unit = ntohs(c->node0.unit);
strlcpy(desc->node1.str, c->node1.str,
strlcpy(desc->node1.name, c->node1.name,
AMSG_CTL_NAMEMAX);
desc->node1.unit = ntohs(c->node1.unit);
desc->type = c->type;

View File

@ -66,7 +66,7 @@ dev_ondesc(void *unused, struct sioctl_desc *desc, int val)
if (output_found)
return;
if (desc->group[0] == 0 &&
strcmp(desc->node0.str, "output") == 0 &&
strcmp(desc->node0.name, "output") == 0 &&
strcmp(desc->func, "level") == 0) {
output_found = 1;
output_addr = desc->addr;