summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod/dev.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-08-29 07:38:16 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-08-29 07:38:16 +0000
commit06727600679b779481a626d4231f94662e4cc3b2 (patch)
tree9a9f04fdfec3487bc7cb233ba1b2c0d623bdd888 /usr.bin/sndiod/dev.c
parent073868e2e3802e9a9a366de946abd6353fdcb4cf (diff)
Split dev_close() routine in two parts.
The first part disconnects clients, the other closes the device and frees audio buffers. No behavior change.
Diffstat (limited to 'usr.bin/sndiod/dev.c')
-rw-r--r--usr.bin/sndiod/dev.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index 5545e13b717..ffcbfdac1ce 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.57 2019/08/29 07:35:25 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.58 2019/08/29 07:38:15 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -60,6 +60,7 @@ void dev_adjpar(struct dev *, int, int, int);
int dev_open_do(struct dev *);
int dev_open(struct dev *);
void dev_exitall(struct dev *);
+void dev_close_do(struct dev *);
void dev_close(struct dev *);
int dev_ref(struct dev *);
void dev_unref(struct dev *);
@@ -1140,7 +1141,7 @@ dev_exitall(struct dev *d)
* ensure buffers are drained
*/
void
-dev_close(struct dev *d)
+dev_close_do(struct dev *d)
{
#ifdef DEBUG
if (log_level >= 3) {
@@ -1149,7 +1150,6 @@ dev_close(struct dev *d)
}
#endif
d->pstate = DEV_CFG;
- dev_exitall(d);
dev_sio_close(d);
if (d->mode & MODE_PLAY) {
if (d->encbuf != NULL)
@@ -1163,6 +1163,16 @@ dev_close(struct dev *d)
}
}
+/*
+ * Close the device and exit all slots
+ */
+void
+dev_close(struct dev *d)
+{
+ dev_exitall(d);
+ dev_close_do(d);
+}
+
int
dev_ref(struct dev *d)
{