commit fc1248a5e65159c108214197dfb13a15a7988b9b
parent 6199e1478a15504748d72bb3d59ba59d24d3987a
Author: Christos Margiolis <christos@margiolis.net>
Date: Fri, 1 Oct 2021 18:28:45 +0300
fix symbol version and revert dunit name change
Diffstat:
6 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile
@@ -4,7 +4,8 @@ LIB= mixer
SRCS= ${LIB}.c
INCS= ${LIB}.h
MAN= ${LIB}.3
-SYMBOL_MAPS= Symbol.map
+VERSION_DEF= ${LIBCSRCDIR}/Versions.def
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
MLINKS+= mixer.3 mixer_open.3
MLINKS+= mixer.3 mixer_close.3
@@ -18,8 +19,8 @@ MLINKS+= mixer.3 mixer_get_ctl_byname.3
MLINKS+= mixer.3 mixer_set_vol.3
MLINKS+= mixer.3 mixer_set_mute.3
MLINKS+= mixer.3 mixer_mod_recsrc.3
-MLINKS+= mixer.3 mixer_get_default_unit.3
-MLINKS+= mixer.3 mixer_set_default_unit.3
+MLINKS+= mixer.3 mixer_get_dunit.3
+MLINKS+= mixer.3 mixer_set_dunit.3
MLINKS+= mixer.3 mixer_get_mode.3
MLINKS+= mixer.3 mixer_get_nmixers.3
MLINKS+= mixer.3 MIX_ISDEV.3
diff --git a/lib/libmixer/Symbol.map b/lib/libmixer/Symbol.map
@@ -2,7 +2,7 @@
* $FreeBSD$
*/
-LIBMIXER_1.0 {
+FBSD_1.7 {
mixer_open;
mixer_close;
mixer_get_dev;
@@ -15,14 +15,8 @@ LIBMIXER_1.0 {
mixer_set_vol;
mixer_set_mute;
mixer_mod_recsrc;
- mixer_get_default_unit;
- mixer_set_default_unit;
+ mixer_get_dunit;
+ mixer_set_dunit;
mixer_get_mode;
mixer_get_nmixers;
- MIX_ISDEV;
- MIX_ISMUTE;
- MIX_ISREC;
- MIX_ISRECSRC;
- MIX_VOLNORM;
- MIX_VOLDENORM;
};
diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3
@@ -38,8 +38,8 @@
.Nm mixer_set_vol ,
.Nm mixer_set_mute ,
.Nm mixer_mod_recsrc ,
-.Nm mixer_get_default_unit ,
-.Nm mixer_set_default_unit ,
+.Nm mixer_get_dunit ,
+.Nm mixer_set_dunit ,
.Nm mixer_get_mode,
.Nm mixer_get_nmixers ,
.Nm MIX_ISDEV ,
@@ -80,9 +80,9 @@ Mixer library (libmixer, -lmixer)
.Ft int
.Fn mixer_mod_recsrc "struct mixer *m" "int opt"
.Ft int
-.Fn mixer_get_default_unit "void"
+.Fn mixer_get_dunit "void"
.Ft int
-.Fn mixer_set_default_unit "struct mixer *m" "int unit"
+.Fn mixer_set_dunit "struct mixer *m" "int unit"
.Ft int
.Fn mixer_get_mode "int unit"
.Ft int
@@ -358,9 +358,9 @@ Toggle device from the recording sources.
.El
.Pp
The
-.Fn mixer_get_default_unit
+.Fn mixer_get_dunit
and
-.Fn mixer_set_default_unit
+.Fn mixer_set_dunit
functions get and set the default audio card in the system. Although this is
not really a mixer feature, it's useful to have instead of having to use
the
@@ -457,7 +457,7 @@ The
.Fn mixer_set_mute ,
.Fn mixer_mod_recsrc ,
.Fn mixer_get_dunut ,
-.Fn mixer_set_default_unit
+.Fn mixer_set_dunit
and
.Fn mixer_get_nmixers
functions return 0 or positive values on success and -1 on failure.
diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c
@@ -77,12 +77,12 @@ mixer_open(const char *name)
if (name != NULL) {
p = basename((char *)name);
if (strncmp(p, "mixer", 5) == 0 && p[5] == '\0')
- goto default_unit;
+ goto dunit;
(void)sscanf(p, "%*[^0123456789]%d", &m->unit);
(void)strlcpy(m->name, name, sizeof(m->name));
} else {
-default_unit:
- if ((m->unit = mixer_get_default_unit()) < 0)
+dunit:
+ if ((m->unit = mixer_get_dunit()) < 0)
goto fail;
(void)snprintf(m->name, sizeof(m->name), "/dev/mixer%d", m->unit);
}
@@ -91,7 +91,7 @@ default_unit:
goto fail;
m->devmask = m->recmask = m->recsrc = 0;
- m->f_default = m->unit == mixer_get_default_unit();
+ m->f_default = m->unit == mixer_get_dunit();
m->mode = mixer_get_mode(m->unit);
/* The unit number _must_ be set before the ioctl. */
m->mi.dev = m->unit;
@@ -414,7 +414,7 @@ mixer_mod_recsrc(struct mixer *m, int opt)
* and set the mixer structure's `f_default` flag.
*/
int
-mixer_get_default_unit(void)
+mixer_get_dunit(void)
{
size_t size;
int unit;
@@ -434,7 +434,7 @@ mixer_get_default_unit(void)
* @param unit the audio card number (e.g pcm0, pcm1, ...).
*/
int
-mixer_set_default_unit(struct mixer *m, int unit)
+mixer_set_dunit(struct mixer *m, int unit)
{
size_t size;
diff --git a/lib/libmixer/mixer.h b/lib/libmixer/mixer.h
@@ -113,8 +113,8 @@ mix_ctl_t *mixer_get_ctl_byname(struct mix_dev *, const char *);
int mixer_set_vol(struct mixer *, mix_volume_t);
int mixer_set_mute(struct mixer *, int);
int mixer_mod_recsrc(struct mixer *, int);
-int mixer_get_default_unit(void);
-int mixer_set_default_unit(struct mixer *, int);
+int mixer_get_dunit(void);
+int mixer_set_dunit(struct mixer *, int);
int mixer_get_mode(int);
int mixer_get_nmixers(void);
diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c
@@ -38,7 +38,7 @@ static void printminfo(struct mixer *, int);
static void printdev(struct mixer *, int);
static void printrecsrc(struct mixer *, int); /* XXX: change name */
/* Control handlers */
-static int mod_default_unit(struct mix_dev *, void *);
+static int mod_dunit(struct mix_dev *, void *);
static int mod_volume(struct mix_dev *, void *);
static int mod_mute(struct mix_dev *, void *);
static int mod_recsrc(struct mix_dev *, void *);
@@ -46,11 +46,11 @@ static int print_volume(struct mix_dev *, void *);
static int print_mute(struct mix_dev *, void *);
static int print_recsrc(struct mix_dev *, void *);
-static const mix_ctl_t ctl_default_unit = {
+static const mix_ctl_t ctl_dunit = {
.parent_dev = NULL,
.id = -1,
- .name = "default_unit",
- .mod = mod_default_unit,
+ .name = "dunit",
+ .mod = mod_dunit,
.print = NULL
};
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
initctls(m);
- if (dflag && ctl_default_unit.mod(m->dev, &du) < 0)
+ if (dflag && ctl_dunit.mod(m->dev, &du) < 0)
goto parse;
if (sflag) {
printrecsrc(m, oflag);
@@ -287,20 +287,20 @@ printrecsrc(struct mixer *m, int oflag)
}
static int
-mod_default_unit(struct mix_dev *d, void *p)
+mod_dunit(struct mix_dev *d, void *p)
{
int du = *((int *)p);
int n;
- if ((n = mixer_get_default_unit()) < 0) {
+ if ((n = mixer_get_dunit()) < 0) {
warn("cannot get default unit");
return (-1);
}
- if (mixer_set_default_unit(d->parent_mixer, du) < 0) {
+ if (mixer_set_dunit(d->parent_mixer, du) < 0) {
warn("cannot set default unit to: %d", du);
return (-1);
}
- printf("%s: %d -> %d\n", ctl_default_unit.name, n, du);
+ printf("%s: %d -> %d\n", ctl_dunit.name, n, du);
return (0);
}