From d2057194b148f53b9802bb6c11764ab494a4e62d Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Fri, 3 Jan 2020 15:30:06 +0100 Subject: [PATCH] Rename _setctl -> _setval and _onctl -> _onval --- libsndio/Makefile.in | 6 +++--- libsndio/sioctl.c | 8 ++++---- libsndio/sioctl_aucat.c | 8 ++++---- libsndio/sioctl_open.3 | 16 ++++++++-------- libsndio/sioctl_priv.h | 2 +- libsndio/sioctl_sun.c | 10 +++++----- libsndio/sndio.h | 4 ++-- sndioctl/sndioctl.c | 6 +++--- sndiod/dev.c | 6 +++--- sndiod/dev.h | 2 +- sndiod/dev_sioctl.c | 10 +++++----- sndiod/sock.c | 2 +- xvolkeys/xvolkeys.c | 6 +++--- 13 files changed, 43 insertions(+), 43 deletions(-) diff --git a/libsndio/Makefile.in b/libsndio/Makefile.in index cc1e5f5..bf572bb 100644 --- a/libsndio/Makefile.in +++ b/libsndio/Makefile.in @@ -35,7 +35,7 @@ MAN3 = \ sio_nfds.3 sio_pollfd.3 sio_revents.3 sio_eof.3 \ sio_setvol.3 sio_onvol.3 sio_initpar.3 \ sioctl_open.3 \ - sioctl_close.3 sioctl_setctl.3 sioctl_ondesc.3 sioctl_onctl.3 \ + sioctl_close.3 sioctl_setval.3 sioctl_ondesc.3 sioctl_onval.3 \ sioctl_nfds.3 sioctl_pollfd.3 sioctl_revents.3 sioctl_eof.3 \ mio_open.3 \ mio_close.3 mio_read.3 mio_write.3 mio_nfds.3 mio_pollfd.3 \ @@ -79,9 +79,9 @@ install: ln -sf sio_open.3 ${DESTDIR}${MAN3_DIR}/sio_initpar.3 cp sioctl_open.3 ${DESTDIR}${MAN3_DIR} ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_close.3 - ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_setctl.3 + ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_setval.3 ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_ondesc.3 - ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_onctl.3 + ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_onval.3 ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_nfds.3 ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_pollfd.3 ln -sf sioctl_open.3 ${DESTDIR}${MAN3_DIR}/sioctl_revents.3 diff --git a/libsndio/sioctl.c b/libsndio/sioctl.c index 1de7dff..8bff8de 100644 --- a/libsndio/sioctl.c +++ b/libsndio/sioctl.c @@ -149,7 +149,7 @@ sioctl_ondesc(struct sioctl_hdl *hdl, } int -sioctl_onctl(struct sioctl_hdl *hdl, +sioctl_onval(struct sioctl_hdl *hdl, void (*cb)(void *, unsigned int, unsigned int), void *arg) { hdl->ctl_cb = cb; @@ -174,15 +174,15 @@ _sioctl_ondesc_cb(struct sioctl_hdl *hdl, } void -_sioctl_onctl_cb(struct sioctl_hdl *hdl, unsigned int addr, unsigned int val) +_sioctl_onval_cb(struct sioctl_hdl *hdl, unsigned int addr, unsigned int val) { - DPRINTF("_sioctl_onctl_cb: %u -> %u\n", addr, val); + DPRINTF("_sioctl_onval_cb: %u -> %u\n", addr, val); if (hdl->ctl_cb) hdl->ctl_cb(hdl->ctl_arg, addr, val); } int -sioctl_setctl(struct sioctl_hdl *hdl, unsigned int addr, unsigned int val) +sioctl_setval(struct sioctl_hdl *hdl, unsigned int addr, unsigned int val) { if (!(hdl->mode & SIOCTL_WRITE)) return 0; diff --git a/libsndio/sioctl_aucat.c b/libsndio/sioctl_aucat.c index 8412cb2..e9b8b74 100644 --- a/libsndio/sioctl_aucat.c +++ b/libsndio/sioctl_aucat.c @@ -40,7 +40,7 @@ static int sioctl_aucat_nfds(struct sioctl_hdl *); static int sioctl_aucat_pollfd(struct sioctl_hdl *, struct pollfd *, int); static int sioctl_aucat_revents(struct sioctl_hdl *, struct pollfd *); static int sioctl_aucat_setctl(struct sioctl_hdl *, unsigned int, unsigned int); -static int sioctl_aucat_onctl(struct sioctl_hdl *); +static int sioctl_aucat_onval(struct sioctl_hdl *); static int sioctl_aucat_ondesc(struct sioctl_hdl *); /* @@ -52,7 +52,7 @@ struct sioctl_ops sioctl_aucat_ops = { sioctl_aucat_pollfd, sioctl_aucat_revents, sioctl_aucat_setctl, - sioctl_aucat_onctl, + sioctl_aucat_onval, sioctl_aucat_ondesc }; @@ -117,7 +117,7 @@ sioctl_aucat_runmsg(struct sioctl_aucat_hdl *hdl) break; case AMSG_CTLSET: DPRINTF("sioctl_aucat_runmsg: got CTLSET\n"); - _sioctl_onctl_cb(&hdl->sioctl, + _sioctl_onval_cb(&hdl->sioctl, ntohs(hdl->aucat.rmsg.u.ctlset.addr), ntohs(hdl->aucat.rmsg.u.ctlset.val)); break; @@ -191,7 +191,7 @@ sioctl_aucat_ondesc(struct sioctl_hdl *addr) } static int -sioctl_aucat_onctl(struct sioctl_hdl *addr) +sioctl_aucat_onval(struct sioctl_hdl *addr) { struct sioctl_aucat_hdl *hdl = (struct sioctl_aucat_hdl *)addr; diff --git a/libsndio/sioctl_open.3 b/libsndio/sioctl_open.3 index ebc80bf..0c5d72b 100644 --- a/libsndio/sioctl_open.3 +++ b/libsndio/sioctl_open.3 @@ -21,8 +21,8 @@ .Nm sioctl_open , .Nm sioctl_close , .Nm sioctl_ondesc , -.Nm sioctl_onctl , -.Nm sioctl_setctl , +.Nm sioctl_onval , +.Nm sioctl_setval , .Nm sioctl_nfds , .Nm sioctl_pollfd , .Nm sioctl_eof @@ -36,9 +36,9 @@ .Ft "int" .Fn "sioctl_ondesc" "struct sioctl_hdl *hdl" "void (*cb)(void *arg, struct sioctl_desc *desc, int val)" "void *arg" .Ft "void" -.Fn "sioctl_onctl" "struct sioctl_hdl *hdl" "void (*cb)(void *arg, unsigned int addr, unsigned int val)" "void *arg" +.Fn "sioctl_onval" "struct sioctl_hdl *hdl" "void (*cb)(void *arg, unsigned int addr, unsigned int val)" "void *arg" .Ft "int" -.Fn "sioctl_setctl" "struct sioctl_hdl *hdl" "unsigned int addr" "unsigned int val" +.Fn "sioctl_setval" "struct sioctl_hdl *hdl" "unsigned int addr" "unsigned int val" .Ft "int" .Fn "sioctl_nfds" "struct sioctl_hdl *hdl" .Ft "int" @@ -86,7 +86,7 @@ modified respectively. If the .Ar nbio_flag argument is 1, then the -.Fn sioctl_setctl +.Fn sioctl_setval function (see below) may fail instead of blocking and the .Fn sioctl_ondesc @@ -192,10 +192,10 @@ are strings usable as unique identifiers within the the given .Va namespace . .Sh Changing and reading control values Controls are changed with the -.Fn sioctl_setctl +.Fn sioctl_setval function, by giving the index of the control and the new value. The -.Fn sioctl_onctl +.Fn sioctl_onval function can be used to register a call-back which will be invoked whenever a control changes. Continuous values are in the 0..127 range. @@ -231,7 +231,7 @@ structures. If .Va POLLOUT is set, -.Fn sioctl_setctl +.Fn sioctl_setval can be called without blocking. POLLHUP may be set if an error occurs, even if it is not selected with diff --git a/libsndio/sioctl_priv.h b/libsndio/sioctl_priv.h index 491e31b..eec92af 100644 --- a/libsndio/sioctl_priv.h +++ b/libsndio/sioctl_priv.h @@ -61,7 +61,7 @@ void _sioctl_create(struct sioctl_hdl *, struct sioctl_ops *, unsigned int, int); void _sioctl_ondesc_cb(struct sioctl_hdl *, struct sioctl_desc *, unsigned int); -void _sioctl_onctl_cb(struct sioctl_hdl *, unsigned int, unsigned int); +void _sioctl_onval_cb(struct sioctl_hdl *, unsigned int, unsigned int); int _sioctl_psleep(struct sioctl_hdl *, int); #endif /* !defined(SIOCTL_PRIV_H) */ diff --git a/libsndio/sioctl_sun.c b/libsndio/sioctl_sun.c index 6c74c98..f7ec7ce 100644 --- a/libsndio/sioctl_sun.c +++ b/libsndio/sioctl_sun.c @@ -67,7 +67,7 @@ static int sioctl_sun_nfds(struct sioctl_hdl *); static int sioctl_sun_pollfd(struct sioctl_hdl *, struct pollfd *, int); static int sioctl_sun_revents(struct sioctl_hdl *, struct pollfd *); static int sioctl_sun_setctl(struct sioctl_hdl *, unsigned int, unsigned int); -static int sioctl_sun_onctl(struct sioctl_hdl *); +static int sioctl_sun_onval(struct sioctl_hdl *); static int sioctl_sun_ondesc(struct sioctl_hdl *); /* @@ -79,7 +79,7 @@ struct sioctl_ops sioctl_sun_ops = { sioctl_sun_pollfd, sioctl_sun_revents, sioctl_sun_setctl, - sioctl_sun_onctl, + sioctl_sun_onval, sioctl_sun_ondesc }; @@ -187,7 +187,7 @@ setvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol, int addr, int val) DPRINTF("level write failed\n"); return 0; } - _sioctl_onctl_cb(&hdl->sioctl, vol->base_addr + addr, val); + _sioctl_onval_cb(&hdl->sioctl, vol->base_addr + addr, val); return 1; } @@ -208,7 +208,7 @@ setvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol, int addr, int val) return 0; } for (i = 0; i < vol->nch; i++) { - _sioctl_onctl_cb(&hdl->sioctl, + _sioctl_onval_cb(&hdl->sioctl, vol->base_addr + 32 + i, val); } return 1; @@ -371,7 +371,7 @@ sioctl_sun_ondesc(struct sioctl_hdl *addr) } static int -sioctl_sun_onctl(struct sioctl_hdl *addr) +sioctl_sun_onval(struct sioctl_hdl *addr) { return 1; } diff --git a/libsndio/sndio.h b/libsndio/sndio.h index fc1c5e9..96434f0 100644 --- a/libsndio/sndio.h +++ b/libsndio/sndio.h @@ -184,9 +184,9 @@ struct sioctl_hdl *sioctl_open(const char *, unsigned int, int); void sioctl_close(struct sioctl_hdl *); int sioctl_ondesc(struct sioctl_hdl *, void (*)(void *, struct sioctl_desc *, int), void *); -int sioctl_onctl(struct sioctl_hdl *, +int sioctl_onval(struct sioctl_hdl *, void (*)(void *, unsigned int, unsigned int), void *); -int sioctl_setctl(struct sioctl_hdl *, unsigned int, unsigned int); +int sioctl_setval(struct sioctl_hdl *, unsigned int, unsigned int); int sioctl_nfds(struct sioctl_hdl *); int sioctl_pollfd(struct sioctl_hdl *, struct pollfd *, int); int sioctl_revents(struct sioctl_hdl *, struct pollfd *); diff --git a/sndioctl/sndioctl.c b/sndioctl/sndioctl.c index 2043893..6c2e7a7 100644 --- a/sndioctl/sndioctl.c +++ b/sndioctl/sndioctl.c @@ -710,11 +710,11 @@ commit(void) switch (i->desc.type) { case SIOCTL_NUM: case SIOCTL_SW: - sioctl_setctl(hdl, i->ctladdr, val); + sioctl_setval(hdl, i->ctladdr, val); break; case SIOCTL_VEC: case SIOCTL_LIST: - sioctl_setctl(hdl, i->ctladdr, val); + sioctl_setval(hdl, i->ctladdr, val); } i->curval = val; } @@ -866,7 +866,7 @@ main(int argc, char **argv) fprintf(stderr, "%s: can't get device description\n", devname); exit(1); } - sioctl_onctl(hdl, onctl, NULL); + sioctl_onval(hdl, onctl, NULL); if (d_flag) { if (argc > 0) { diff --git a/sndiod/dev.c b/sndiod/dev.c index 0430bbe..0bf57bc 100644 --- a/sndiod/dev.c +++ b/sndiod/dev.c @@ -423,7 +423,7 @@ dev_midi_omsg(void *arg, unsigned char *msg, int len) if (chan >= DEV_NSLOT) return; slot_setvol(d->slot + chan, msg[2]); - dev_onctl(d, CTLADDR_SLOT_LEVEL(chan), msg[2]); + dev_onval(d, CTLADDR_SLOT_LEVEL(chan), msg[2]); return; } x = (struct sysex *)msg; @@ -436,7 +436,7 @@ dev_midi_omsg(void *arg, unsigned char *msg, int len) if (x->id0 == SYSEX_CONTROL && x->id1 == SYSEX_MASTER) { if (len == SYSEX_SIZE(master)) { dev_master(d, x->u.master.coarse); - dev_onctl(d, CTLADDR_MASTER, + dev_onval(d, CTLADDR_MASTER, x->u.master.coarse); } return; @@ -2386,7 +2386,7 @@ dev_setctl(struct dev *d, int addr, int val) } int -dev_onctl(struct dev *d, int addr, int val) +dev_onval(struct dev *d, int addr, int val) { struct ctl *c; diff --git a/sndiod/dev.h b/sndiod/dev.h index e21ef26..2f61bef 100644 --- a/sndiod/dev.h +++ b/sndiod/dev.h @@ -302,7 +302,7 @@ void ctl_log(struct ctl *); struct ctlslot *ctlslot_new(struct dev *, struct ctlops *, void *); void ctlslot_del(struct ctlslot *); int dev_setctl(struct dev *, int, int); -int dev_onctl(struct dev *, int, int); +int dev_onval(struct dev *, int, int); int dev_nctl(struct dev *); void dev_label(struct dev *, int); struct ctl *dev_addctl(struct dev *, char *, int, int, int, diff --git a/sndiod/dev_sioctl.c b/sndiod/dev_sioctl.c index cbd89f6..5122d15 100644 --- a/sndiod/dev_sioctl.c +++ b/sndiod/dev_sioctl.c @@ -32,7 +32,7 @@ #include "bsd-compat.h" void dev_sioctl_ondesc(void *, struct sioctl_desc *, int); -void dev_sioctl_onctl(void *, unsigned int, unsigned int); +void dev_sioctl_onval(void *, unsigned int, unsigned int); int dev_sioctl_pollfd(void *, struct pollfd *); int dev_sioctl_revents(void *, struct pollfd *); void dev_sioctl_in(void *); @@ -65,7 +65,7 @@ dev_sioctl_ondesc(void *arg, struct sioctl_desc *desc, int val) } void -dev_sioctl_onctl(void *arg, unsigned int addr, unsigned int val) +dev_sioctl_onval(void *arg, unsigned int addr, unsigned int val) { struct dev *d = arg; struct ctl *c; @@ -100,7 +100,7 @@ dev_sioctl_open(struct dev *d) if (d->sioctl.hdl == NULL) return; sioctl_ondesc(d->sioctl.hdl, dev_sioctl_ondesc, d); - sioctl_onctl(d->sioctl.hdl, dev_sioctl_onctl, d); + sioctl_onval(d->sioctl.hdl, dev_sioctl_onval, d); d->sioctl.file = file_new(&dev_sioctl_ops, d, "mix", sioctl_nfds(d->sioctl.hdl)); } @@ -151,7 +151,7 @@ dev_sioctl_out(void *arg) int cnt; /* - * for each dirty ctl, call sioctl_setctl() and dev_unref(). As + * for each dirty ctl, call sioctl_setval() and dev_unref(). As * dev_unref() may destroy the ctl_list, we must call it after * we've finished iterating on it. */ @@ -159,7 +159,7 @@ dev_sioctl_out(void *arg) for (c = d->ctl_list; c != NULL; c = c->next) { if (!c->dirty) continue; - if (!sioctl_setctl(d->sioctl.hdl, + if (!sioctl_setval(d->sioctl.hdl, c->addr - CTLADDR_END, c->curval)) { ctl_log(c); log_puts(": set failed\n"); diff --git a/sndiod/sock.c b/sndiod/sock.c index 88b3274..faacdc0 100644 --- a/sndiod/sock.c +++ b/sndiod/sock.c @@ -1205,7 +1205,7 @@ sock_execmsg(struct sock *f) f->lastvol = ctl; /* dont trigger feedback message */ slot_setvol(s, ctl); dev_midi_vol(s->dev, s); - dev_onctl(s->dev, + dev_onval(s->dev, CTLADDR_SLOT_LEVEL(f->slot - s->dev->slot), ctl); break; case AMSG_CTLSUB: diff --git a/xvolkeys/xvolkeys.c b/xvolkeys/xvolkeys.c index 479339f..b89d4ee 100644 --- a/xvolkeys/xvolkeys.c +++ b/xvolkeys/xvolkeys.c @@ -80,7 +80,7 @@ dev_ondesc(void *unused, struct sioctl_desc *desc, int val) * control value changed */ static void -dev_onctl(void *unused, unsigned int addr, unsigned int val) +dev_onval(void *unused, unsigned int addr, unsigned int val) { if (addr == master_addr) { if (verbose) @@ -120,7 +120,7 @@ dev_connect(void) } master_found = 0; sioctl_ondesc(hdl, dev_ondesc, NULL); - sioctl_onctl(hdl, dev_onctl, NULL); + sioctl_onval(hdl, dev_onval, NULL); if (!master_found) fprintf(stderr, "%s: warning, couldn't find master control\n", dev_name); @@ -149,7 +149,7 @@ dev_incrvol(int incr) fprintf(stderr, "%s: setting volume to %d\n", dev_name, vol); } - sioctl_setctl(hdl, master_addr, master_val); + sioctl_setval(hdl, master_addr, master_val); dev_disconnect(); } }