diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2013-11-13 22:38:23 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2013-11-13 22:38:23 +0000 |
commit | a98eb49e6c4f34cf3f67faaef783568c21a90e7f (patch) | |
tree | ed6941a554a91e8164889e9bb4bce4e8f5006c19 /lib | |
parent | c2dc08c014af76a47af336c84b6d64e7babe7985 (diff) |
Prefix by '_' symbols that are not part of the API.
ok deraadt, guenther
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libsndio/aucat.c | 61 | ||||
-rw-r--r-- | lib/libsndio/aucat.h | 18 | ||||
-rw-r--r-- | lib/libsndio/debug.c | 14 | ||||
-rw-r--r-- | lib/libsndio/debug.h | 14 | ||||
-rw-r--r-- | lib/libsndio/mio.c | 28 | ||||
-rw-r--r-- | lib/libsndio/mio_aucat.c | 22 | ||||
-rw-r--r-- | lib/libsndio/mio_priv.h | 10 | ||||
-rw-r--r-- | lib/libsndio/mio_rmidi.c | 8 | ||||
-rw-r--r-- | lib/libsndio/shlib_version | 2 | ||||
-rw-r--r-- | lib/libsndio/sio.c | 36 | ||||
-rw-r--r-- | lib/libsndio/sio_aucat.c | 42 | ||||
-rw-r--r-- | lib/libsndio/sio_priv.h | 16 | ||||
-rw-r--r-- | lib/libsndio/sio_sun.c | 14 |
13 files changed, 142 insertions, 143 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index 21889ac1911..3c67342c6e4 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.58 2013/11/12 06:56:00 deraadt Exp $ */ +/* $OpenBSD: aucat.c,v 1.59 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -36,18 +36,17 @@ #include "aucat.h" #include "debug.h" - /* * read a message, return 0 if not completed */ int -aucat_rmsg(struct aucat *hdl, int *eof) +_aucat_rmsg(struct aucat *hdl, int *eof) { ssize_t n; unsigned char *data; if (hdl->rstate != RSTATE_MSG) { - DPRINTF("aucat_rmsg: bad state\n"); + DPRINTF("_aucat_rmsg: bad state\n"); abort(); } while (hdl->rtodo > 0) { @@ -58,12 +57,12 @@ aucat_rmsg(struct aucat *hdl, int *eof) continue; if (errno != EAGAIN) { *eof = 1; - DPERROR("aucat_rmsg: read"); + DPERROR("_aucat_rmsg: read"); } return 0; } if (n == 0) { - DPRINTF("aucat_rmsg: eof\n"); + DPRINTF("_aucat_rmsg: eof\n"); *eof = 1; return 0; } @@ -83,7 +82,7 @@ aucat_rmsg(struct aucat *hdl, int *eof) * write a message, return 0 if not completed */ int -aucat_wmsg(struct aucat *hdl, int *eof) +_aucat_wmsg(struct aucat *hdl, int *eof) { ssize_t n; unsigned char *data; @@ -92,7 +91,7 @@ aucat_wmsg(struct aucat *hdl, int *eof) hdl->wstate = WSTATE_MSG; hdl->wtodo = sizeof(struct amsg); if (hdl->wstate != WSTATE_MSG) { - DPRINTF("aucat_wmsg: bad state\n"); + DPRINTF("_aucat_wmsg: bad state\n"); abort(); } while (hdl->wtodo > 0) { @@ -103,7 +102,7 @@ aucat_wmsg(struct aucat *hdl, int *eof) continue; if (errno != EAGAIN) { *eof = 1; - DPERROR("aucat_wmsg: write"); + DPERROR("_aucat_wmsg: write"); } return 0; } @@ -120,12 +119,12 @@ aucat_wmsg(struct aucat *hdl, int *eof) } size_t -aucat_rdata(struct aucat *hdl, void *buf, size_t len, int *eof) +_aucat_rdata(struct aucat *hdl, void *buf, size_t len, int *eof) { ssize_t n; if (hdl->rstate != RSTATE_DATA) { - DPRINTF("aucat_rdata: bad state\n"); + DPRINTF("_aucat_rdata: bad state\n"); abort(); } if (len > hdl->rtodo) @@ -135,12 +134,12 @@ aucat_rdata(struct aucat *hdl, void *buf, size_t len, int *eof) continue; if (errno != EAGAIN) { *eof = 1; - DPERROR("aucat_rdata: read"); + DPERROR("_aucat_rdata: read"); } return 0; } if (n == 0) { - DPRINTF("aucat_rdata: eof\n"); + DPRINTF("_aucat_rdata: eof\n"); *eof = 1; return 0; } @@ -149,12 +148,12 @@ aucat_rdata(struct aucat *hdl, void *buf, size_t len, int *eof) hdl->rstate = RSTATE_MSG; hdl->rtodo = sizeof(struct amsg); } - DPRINTFN(2, "aucat_rdata: read: n = %zd\n", n); + DPRINTFN(2, "_aucat_rdata: read: n = %zd\n", n); return n; } size_t -aucat_wdata(struct aucat *hdl, const void *buf, size_t len, +_aucat_wdata(struct aucat *hdl, const void *buf, size_t len, unsigned int wbpf, int *eof) { ssize_t n; @@ -174,13 +173,13 @@ aucat_wdata(struct aucat *hdl, const void *buf, size_t len, hdl->wstate = WSTATE_MSG; /* FALLTHROUGH */ case WSTATE_MSG: - if (!aucat_wmsg(hdl, eof)) + if (!_aucat_wmsg(hdl, eof)) return 0; } if (len > hdl->wtodo) len = hdl->wtodo; if (len == 0) { - DPRINTF("aucat_wdata: len == 0\n"); + DPRINTF("_aucat_wdata: len == 0\n"); abort(); } while ((n = write(hdl->fd, buf, len)) < 0) { @@ -188,11 +187,11 @@ aucat_wdata(struct aucat *hdl, const void *buf, size_t len, continue; if (errno != EAGAIN) { *eof = 1; - DPERROR("aucat_wdata: write"); + DPERROR("_aucat_wdata: write"); } return 0; } - DPRINTFN(2, "aucat_wdata: write: n = %zd\n", n); + DPRINTFN(2, "_aucat_wdata: write: n = %zd\n", n); hdl->wtodo -= n; if (hdl->wtodo == 0) { hdl->wstate = WSTATE_IDLE; @@ -407,7 +406,7 @@ parsestr(const char *str, char *rstr, unsigned int max) } int -aucat_open(struct aucat *hdl, const char *str, unsigned int mode, +_aucat_open(struct aucat *hdl, const char *str, unsigned int mode, unsigned int type) { extern char *__progname; @@ -446,7 +445,7 @@ aucat_open(struct aucat *hdl, const char *str, unsigned int mode, return 0; } devnum += type * 16; /* XXX */ - DPRINTF("aucat_open: host=%s unit=%u devnum=%u opt=%s\n", + DPRINTF("_aucat_open: host=%s unit=%u devnum=%u opt=%s\n", host, unit, devnum, opt); if (host[0] != '\0') { if (!aucat_connect_tcp(hdl, host, unit)) @@ -473,7 +472,7 @@ aucat_open(struct aucat *hdl, const char *str, unsigned int mode, if (!aucat_mkcookie(hdl->wmsg.u.auth.cookie)) goto bad_connect; hdl->wtodo = sizeof(struct amsg); - if (!aucat_wmsg(hdl, &eof)) + if (!_aucat_wmsg(hdl, &eof)) goto bad_connect; AMSG_INIT(&hdl->wmsg); hdl->wmsg.cmd = htonl(AMSG_HELLO); @@ -485,10 +484,10 @@ aucat_open(struct aucat *hdl, const char *str, unsigned int mode, strlcpy(hdl->wmsg.u.hello.opt, opt, sizeof(hdl->wmsg.u.hello.opt)); hdl->wtodo = sizeof(struct amsg); - if (!aucat_wmsg(hdl, &eof)) + if (!_aucat_wmsg(hdl, &eof)) goto bad_connect; hdl->rtodo = sizeof(struct amsg); - if (!aucat_rmsg(hdl, &eof)) { + if (!_aucat_rmsg(hdl, &eof)) { DPRINTF("aucat_init: mode refused\n"); goto bad_connect; } @@ -504,7 +503,7 @@ aucat_open(struct aucat *hdl, const char *str, unsigned int mode, } void -aucat_close(struct aucat *hdl, int eof) +_aucat_close(struct aucat *hdl, int eof) { char dummy[1]; @@ -512,7 +511,7 @@ aucat_close(struct aucat *hdl, int eof) AMSG_INIT(&hdl->wmsg); hdl->wmsg.cmd = htonl(AMSG_BYE); hdl->wtodo = sizeof(struct amsg); - if (!aucat_wmsg(hdl, &eof)) + if (!_aucat_wmsg(hdl, &eof)) goto bad_close; while (read(hdl->fd, dummy, 1) < 0 && errno == EINTR) ; /* nothing */ @@ -523,10 +522,10 @@ aucat_close(struct aucat *hdl, int eof) } int -aucat_setfl(struct aucat *hdl, int nbio, int *eof) +_aucat_setfl(struct aucat *hdl, int nbio, int *eof) { if (fcntl(hdl->fd, F_SETFL, nbio ? O_NONBLOCK : 0) < 0) { - DPERROR("aucat_setfl: fcntl"); + DPERROR("_aucat_setfl: fcntl"); *eof = 1; return 0; } @@ -534,7 +533,7 @@ aucat_setfl(struct aucat *hdl, int nbio, int *eof) } int -aucat_pollfd(struct aucat *hdl, struct pollfd *pfd, int events) +_aucat_pollfd(struct aucat *hdl, struct pollfd *pfd, int events) { if (hdl->rstate == RSTATE_MSG) events |= POLLIN; @@ -544,10 +543,10 @@ aucat_pollfd(struct aucat *hdl, struct pollfd *pfd, int events) } int -aucat_revents(struct aucat *hdl, struct pollfd *pfd) +_aucat_revents(struct aucat *hdl, struct pollfd *pfd) { int revents = pfd->revents; - DPRINTFN(2, "aucat_revents: revents: %x\n", revents); + DPRINTFN(2, "_aucat_revents: revents: %x\n", revents); return revents; } diff --git a/lib/libsndio/aucat.h b/lib/libsndio/aucat.h index d7dd4d9cbf2..8c3966cadde 100644 --- a/lib/libsndio/aucat.h +++ b/lib/libsndio/aucat.h @@ -17,14 +17,14 @@ struct aucat { unsigned maxwrite; /* bytes we're allowed to write */ }; -int aucat_rmsg(struct aucat *, int *); -int aucat_wmsg(struct aucat *, int *); -size_t aucat_rdata(struct aucat *, void *, size_t, int *); -size_t aucat_wdata(struct aucat *, const void *, size_t, unsigned, int *); -int aucat_open(struct aucat *, const char *, unsigned, unsigned); -void aucat_close(struct aucat *, int); -int aucat_pollfd(struct aucat *, struct pollfd *, int); -int aucat_revents(struct aucat *, struct pollfd *); -int aucat_setfl(struct aucat *, int, int *); +int _aucat_rmsg(struct aucat *, int *); +int _aucat_wmsg(struct aucat *, int *); +size_t _aucat_rdata(struct aucat *, void *, size_t, int *); +size_t _aucat_wdata(struct aucat *, const void *, size_t, unsigned, int *); +int _aucat_open(struct aucat *, const char *, unsigned, unsigned); +void _aucat_close(struct aucat *, int); +int _aucat_pollfd(struct aucat *, struct pollfd *, int); +int _aucat_revents(struct aucat *, struct pollfd *); +int _aucat_setfl(struct aucat *, int, int *); #endif /* !defined(AUCAT_H) */ diff --git a/lib/libsndio/debug.c b/lib/libsndio/debug.c index b592506494d..e1542bc47cf 100644 --- a/lib/libsndio/debug.c +++ b/lib/libsndio/debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.c,v 1.2 2011/11/15 08:05:22 ratchov Exp $ */ +/* $OpenBSD: debug.c,v 1.3 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2011 Alexandre Ratchov <alex@caoua.org> * @@ -25,23 +25,23 @@ /* * debug level, -1 means uninitialized */ -int sndio_debug = -1; +int _sndio_debug = -1; void -sndio_debug_init(void) +_sndio_debug_init(void) { char *dbg; - if (sndio_debug < 0) { + if (_sndio_debug < 0) { dbg = issetugid() ? NULL : getenv("SNDIO_DEBUG"); - if (!dbg || sscanf(dbg, "%u", &sndio_debug) != 1) - sndio_debug = 0; + if (!dbg || sscanf(dbg, "%u", &_sndio_debug) != 1) + _sndio_debug = 0; } } #endif const char * -sndio_parsetype(const char *str, char *type) +_sndio_parsetype(const char *str, char *type) { while (*type) { if (*type != *str) diff --git a/lib/libsndio/debug.h b/lib/libsndio/debug.h index 4d3baf40eef..8cad09f11b6 100644 --- a/lib/libsndio/debug.h +++ b/lib/libsndio/debug.h @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.h,v 1.2 2011/11/15 08:05:22 ratchov Exp $ */ +/* $OpenBSD: debug.h,v 1.3 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -22,30 +22,30 @@ #define DPRINTFN(n, ...) \ do { \ - if (sndio_debug >= (n)) \ + if (_sndio_debug >= (n)) \ fprintf(stderr, __VA_ARGS__); \ } while(0) #define DPRINTF(...) \ do { \ - if (sndio_debug > 0) \ + if (_sndio_debug > 0) \ fprintf(stderr, __VA_ARGS__); \ } while(0) #define DPERROR(s) \ do { \ - if (sndio_debug > 0) \ + if (_sndio_debug > 0) \ perror(s); \ } while(0) -void sndio_debug_init(void); -extern int sndio_debug; +void _sndio_debug_init(void); +extern int _sndio_debug; #else #define DPRINTF(...) do {} while(0) #define DPRINTFN(...) do {} while(0) #define DPERROR(s) do {} while(0) #endif -const char *sndio_parsetype(const char *, char *); +const char *_sndio_parsetype(const char *, char *); #endif diff --git a/lib/libsndio/mio.c b/lib/libsndio/mio.c index f965a148fb5..0501dd1b522 100644 --- a/lib/libsndio/mio.c +++ b/lib/libsndio/mio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio.c,v 1.17 2012/11/23 07:03:28 ratchov Exp $ */ +/* $OpenBSD: mio.c,v 1.18 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -39,7 +39,7 @@ mio_open(const char *str, unsigned int mode, int nbio) const char *p; #ifdef DEBUG - sndio_debug_init(); + _sndio_debug_init(); #endif if ((mode & (MIO_OUT | MIO_IN)) == 0) return NULL; @@ -51,27 +51,27 @@ mio_open(const char *str, unsigned int mode, int nbio) str = portany; } if (strcmp(str, portany) == 0) { - hdl = mio_aucat_open("/0", mode, nbio, 1); + hdl = _mio_aucat_open("/0", mode, nbio, 1); if (hdl != NULL) return hdl; - return mio_rmidi_open("/0", mode, nbio); + return _mio_rmidi_open("/0", mode, nbio); } - if ((p = sndio_parsetype(str, "snd")) != NULL || - (p = sndio_parsetype(str, "aucat")) != NULL) - return mio_aucat_open(p, mode, nbio, 0); - if ((p = sndio_parsetype(str, "midithru")) != NULL) - return mio_aucat_open(p, mode, nbio, 1); - if ((p = sndio_parsetype(str, "midi")) != NULL) - return mio_aucat_open(p, mode, nbio, 2); - if ((p = sndio_parsetype(str, "rmidi")) != NULL) { - return mio_rmidi_open(p, mode, nbio); + if ((p = _sndio_parsetype(str, "snd")) != NULL || + (p = _sndio_parsetype(str, "aucat")) != NULL) + return _mio_aucat_open(p, mode, nbio, 0); + if ((p = _sndio_parsetype(str, "midithru")) != NULL) + return _mio_aucat_open(p, mode, nbio, 1); + if ((p = _sndio_parsetype(str, "midi")) != NULL) + return _mio_aucat_open(p, mode, nbio, 2); + if ((p = _sndio_parsetype(str, "rmidi")) != NULL) { + return _mio_rmidi_open(p, mode, nbio); } DPRINTF("mio_open: %s: unknown device type\n", str); return NULL; } void -mio_create(struct mio_hdl *hdl, struct mio_ops *ops, +_mio_create(struct mio_hdl *hdl, struct mio_ops *ops, unsigned int mode, int nbio) { hdl->ops = ops; diff --git a/lib/libsndio/mio_aucat.c b/lib/libsndio/mio_aucat.c index 28fbd1c8154..59a20b31535 100644 --- a/lib/libsndio/mio_aucat.c +++ b/lib/libsndio/mio_aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_aucat.c,v 1.9 2012/11/02 10:24:58 ratchov Exp $ */ +/* $OpenBSD: mio_aucat.c,v 1.10 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -62,7 +62,7 @@ mio_aucat_runmsg(struct mio_aucat_hdl *hdl) { int delta; - if (!aucat_rmsg(&hdl->aucat, &hdl->mio.eof)) + if (!_aucat_rmsg(&hdl->aucat, &hdl->mio.eof)) return 0; switch (ntohl(hdl->aucat.rmsg.cmd)) { case AMSG_DATA: @@ -84,7 +84,7 @@ mio_aucat_runmsg(struct mio_aucat_hdl *hdl) } struct mio_hdl * -mio_aucat_open(const char *str, unsigned int mode, +_mio_aucat_open(const char *str, unsigned int mode, int nbio, unsigned int type) { struct mio_aucat_hdl *hdl; @@ -92,10 +92,10 @@ mio_aucat_open(const char *str, unsigned int mode, hdl = malloc(sizeof(struct mio_aucat_hdl)); if (hdl == NULL) return NULL; - if (!aucat_open(&hdl->aucat, str, mode, type)) + if (!_aucat_open(&hdl->aucat, str, mode, type)) goto bad; - mio_create(&hdl->mio, &mio_aucat_ops, mode, nbio); - if (!aucat_setfl(&hdl->aucat, 1, &hdl->mio.eof)) + _mio_create(&hdl->mio, &mio_aucat_ops, mode, nbio); + if (!_aucat_setfl(&hdl->aucat, 1, &hdl->mio.eof)) goto bad; return (struct mio_hdl *)hdl; bad: @@ -109,8 +109,8 @@ mio_aucat_close(struct mio_hdl *sh) struct mio_aucat_hdl *hdl = (struct mio_aucat_hdl *)sh; if (!hdl->mio.eof) - aucat_setfl(&hdl->aucat, 0, &hdl->mio.eof); - aucat_close(&hdl->aucat, hdl->mio.eof); + _aucat_setfl(&hdl->aucat, 0, &hdl->mio.eof); + _aucat_close(&hdl->aucat, hdl->mio.eof); free(hdl); } @@ -123,7 +123,7 @@ mio_aucat_read(struct mio_hdl *sh, void *buf, size_t len) if (!mio_aucat_runmsg(hdl)) return 0; } - return aucat_rdata(&hdl->aucat, buf, len, &hdl->mio.eof); + return _aucat_rdata(&hdl->aucat, buf, len, &hdl->mio.eof); } static size_t @@ -136,7 +136,7 @@ mio_aucat_write(struct mio_hdl *sh, const void *buf, size_t len) return 0; if (len > hdl->aucat.maxwrite) len = hdl->aucat.maxwrite; - n = aucat_wdata(&hdl->aucat, buf, len, 1, &hdl->mio.eof); + n = _aucat_wdata(&hdl->aucat, buf, len, 1, &hdl->mio.eof); hdl->aucat.maxwrite -= n; return n; } @@ -155,7 +155,7 @@ mio_aucat_pollfd(struct mio_hdl *sh, struct pollfd *pfd, int events) hdl->events = events; if (hdl->aucat.maxwrite <= 0) events &= ~POLLOUT; - return aucat_pollfd(&hdl->aucat, pfd, events); + return _aucat_pollfd(&hdl->aucat, pfd, events); } static int diff --git a/lib/libsndio/mio_priv.h b/lib/libsndio/mio_priv.h index 0e1b6ba530c..4b58affb342 100644 --- a/lib/libsndio/mio_priv.h +++ b/lib/libsndio/mio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_priv.h,v 1.9 2012/10/27 12:08:25 ratchov Exp $ */ +/* $OpenBSD: mio_priv.h,v 1.10 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -44,9 +44,9 @@ struct mio_ops { int (*revents)(struct mio_hdl *, struct pollfd *); }; -struct mio_hdl *mio_rmidi_open(const char *, unsigned, int); -struct mio_hdl *mio_aucat_open(const char *, unsigned, int, unsigned); -void mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); -void mio_destroy(struct mio_hdl *); +struct mio_hdl *_mio_rmidi_open(const char *, unsigned, int); +struct mio_hdl *_mio_aucat_open(const char *, unsigned, int, unsigned); +void _mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); +void _mio_destroy(struct mio_hdl *); #endif /* !defined(MIO_PRIV_H) */ diff --git a/lib/libsndio/mio_rmidi.c b/lib/libsndio/mio_rmidi.c index c82425201b7..79f78933f05 100644 --- a/lib/libsndio/mio_rmidi.c +++ b/lib/libsndio/mio_rmidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_rmidi.c,v 1.12 2012/10/27 12:08:25 ratchov Exp $ */ +/* $OpenBSD: mio_rmidi.c,v 1.13 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -52,7 +52,7 @@ static struct mio_ops mio_rmidi_ops = { }; struct mio_hdl * -mio_rmidi_open(const char *str, unsigned int mode, int nbio) +_mio_rmidi_open(const char *str, unsigned int mode, int nbio) { int fd, flags; struct mio_rmidi_hdl *hdl; @@ -64,13 +64,13 @@ mio_rmidi_open(const char *str, unsigned int mode, int nbio) str++; break; default: - DPRINTF("sio_sun_open: %s: '/<devnum>' expected\n", str); + DPRINTF("_sio_sun_open: %s: '/<devnum>' expected\n", str); return NULL; } hdl = malloc(sizeof(struct mio_rmidi_hdl)); if (hdl == NULL) return NULL; - mio_create(&hdl->mio, &mio_rmidi_ops, mode, nbio); + _mio_create(&hdl->mio, &mio_rmidi_ops, mode, nbio); snprintf(path, sizeof(path), "/dev/rmidi%s", str); if (mode == (MIO_OUT | MIO_IN)) diff --git a/lib/libsndio/shlib_version b/lib/libsndio/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libsndio/shlib_version +++ b/lib/libsndio/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libsndio/sio.c b/lib/libsndio/sio.c index d8ccf0c666c..fd5b5bf2008 100644 --- a/lib/libsndio/sio.c +++ b/lib/libsndio/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.14 2013/08/24 12:32:34 ratchov Exp $ */ +/* $OpenBSD: sio.c,v 1.15 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -48,7 +48,7 @@ sio_open(const char *str, unsigned int mode, int nbio) const char *p; #ifdef DEBUG - sndio_debug_init(); + _sndio_debug_init(); #endif if ((mode & (SIO_PLAY | SIO_REC)) == 0) return NULL; @@ -60,24 +60,24 @@ sio_open(const char *str, unsigned int mode, int nbio) str = devany; } if (strcmp(str, devany) == 0) { - hdl = sio_aucat_open("/0", mode, nbio); + hdl = _sio_aucat_open("/0", mode, nbio); if (hdl != NULL) return hdl; - return sio_sun_open("/0", mode, nbio); + return _sio_sun_open("/0", mode, nbio); } - if ((p = sndio_parsetype(str, "snd")) != NULL || - (p = sndio_parsetype(str, "aucat")) != NULL) - return sio_aucat_open(p, mode, nbio); - if ((p = sndio_parsetype(str, "rsnd")) != NULL || - (p = sndio_parsetype(str, "sun")) != NULL) { - return sio_sun_open(p, mode, nbio); + if ((p = _sndio_parsetype(str, "snd")) != NULL || + (p = _sndio_parsetype(str, "aucat")) != NULL) + return _sio_aucat_open(p, mode, nbio); + if ((p = _sndio_parsetype(str, "rsnd")) != NULL || + (p = _sndio_parsetype(str, "sun")) != NULL) { + return _sio_sun_open(p, mode, nbio); } DPRINTF("sio_open: %s: unknown device type\n", str); return NULL; } void -sio_create(struct sio_hdl *hdl, struct sio_ops *ops, +_sio_create(struct sio_hdl *hdl, struct sio_ops *ops, unsigned int mode, int nbio) { hdl->ops = ops; @@ -385,7 +385,7 @@ sio_revents(struct sio_hdl *hdl, struct pollfd *pfd) #ifdef DEBUG struct timespec ts0, ts1; - if (sndio_debug >= 2) + if (_sndio_debug >= 2) clock_gettime(CLOCK_MONOTONIC, &ts0); #endif if (hdl->eof) @@ -397,7 +397,7 @@ sio_revents(struct sio_hdl *hdl, struct pollfd *pfd) if (!hdl->started) return revents & POLLHUP; #ifdef DEBUG - if (sndio_debug >= 3) { + if (_sndio_debug >= 3) { clock_gettime(CLOCK_MONOTONIC, &ts1); DPRINTF("%09lld: sio_revents: revents = 0x%x, took %lldns\n", 1000000000LL * ts0.tv_sec + @@ -434,7 +434,7 @@ sio_onmove(struct sio_hdl *hdl, void (*cb)(void *, int), void *addr) #ifdef DEBUG void -sio_printpos(struct sio_hdl *hdl) +_sio_printpos(struct sio_hdl *hdl) { struct timespec ts; long long rpos, rdiff; @@ -474,12 +474,12 @@ sio_printpos(struct sio_hdl *hdl) #endif void -sio_onmove_cb(struct sio_hdl *hdl, int delta) +_sio_onmove_cb(struct sio_hdl *hdl, int delta) { #ifdef DEBUG hdl->cpos += delta; - if (sndio_debug >= 2) - sio_printpos(hdl); + if (_sndio_debug >= 2) + _sio_printpos(hdl); #endif if (hdl->move_cb) hdl->move_cb(hdl->move_addr, delta); @@ -515,7 +515,7 @@ sio_onvol(struct sio_hdl *hdl, void (*cb)(void *, unsigned int), void *addr) } void -sio_onvol_cb(struct sio_hdl *hdl, unsigned int ctl) +_sio_onvol_cb(struct sio_hdl *hdl, unsigned int ctl) { if (hdl->vol_cb) hdl->vol_cb(hdl->vol_addr, ctl); diff --git a/lib/libsndio/sio_aucat.c b/lib/libsndio/sio_aucat.c index a8ce5190732..05cfe8fdd68 100644 --- a/lib/libsndio/sio_aucat.c +++ b/lib/libsndio/sio_aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_aucat.c,v 1.14 2012/11/23 06:40:26 ratchov Exp $ */ +/* $OpenBSD: sio_aucat.c,v 1.15 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -85,7 +85,7 @@ sio_aucat_runmsg(struct sio_aucat_hdl *hdl) int delta; unsigned int size, ctl; - if (!aucat_rmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_rmsg(&hdl->aucat, &hdl->sio.eof)) return 0; switch (ntohl(hdl->aucat.rmsg.cmd)) { case AMSG_DATA: @@ -108,14 +108,14 @@ sio_aucat_runmsg(struct sio_aucat_hdl *hdl) DPRINTFN(2, "aucat: move = %d, delta = %d, maxwrite = %d\n", delta, hdl->delta, hdl->aucat.maxwrite); if (hdl->delta >= 0) { - sio_onmove_cb(&hdl->sio, hdl->delta); + _sio_onmove_cb(&hdl->sio, hdl->delta); hdl->delta = 0; } break; case AMSG_SETVOL: ctl = ntohl(hdl->aucat.rmsg.u.vol.ctl); hdl->curvol = hdl->reqvol = ctl; - sio_onvol_cb(&hdl->sio, ctl); + _sio_onvol_cb(&hdl->sio, ctl); break; case AMSG_STOP: hdl->pstate = PSTATE_INIT; @@ -139,24 +139,24 @@ sio_aucat_buildmsg(struct sio_aucat_hdl *hdl) hdl->aucat.wmsg.cmd = htonl(AMSG_SETVOL); hdl->aucat.wmsg.u.vol.ctl = htonl(hdl->reqvol); hdl->curvol = hdl->reqvol; - return aucat_wmsg(&hdl->aucat, &hdl->sio.eof); + return _aucat_wmsg(&hdl->aucat, &hdl->sio.eof); } return 0; } struct sio_hdl * -sio_aucat_open(const char *str, unsigned int mode, int nbio) +_sio_aucat_open(const char *str, unsigned int mode, int nbio) { struct sio_aucat_hdl *hdl; hdl = malloc(sizeof(struct sio_aucat_hdl)); if (hdl == NULL) return NULL; - if (!aucat_open(&hdl->aucat, str, mode, 0)) { + if (!_aucat_open(&hdl->aucat, str, mode, 0)) { free(hdl); return NULL; } - sio_create(&hdl->sio, &sio_aucat_ops, mode, nbio); + _sio_create(&hdl->sio, &sio_aucat_ops, mode, nbio); hdl->curvol = SIO_MAXVOL; hdl->reqvol = SIO_MAXVOL; hdl->pstate = PSTATE_INIT; @@ -172,7 +172,7 @@ sio_aucat_close(struct sio_hdl *sh) if (!hdl->sio.eof && hdl->sio.started) (void)sio_aucat_stop(&hdl->sio); - aucat_close(&hdl->aucat, hdl->sio.eof); + _aucat_close(&hdl->aucat, hdl->sio.eof); free(hdl); } @@ -197,11 +197,11 @@ sio_aucat_start(struct sio_hdl *sh) AMSG_INIT(&hdl->aucat.wmsg); hdl->aucat.wmsg.cmd = htonl(AMSG_START); hdl->aucat.wtodo = sizeof(struct amsg); - if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) return 0; hdl->aucat.rstate = RSTATE_MSG; hdl->aucat.rtodo = sizeof(struct amsg); - if (!aucat_setfl(&hdl->aucat, 1, &hdl->sio.eof)) + if (!_aucat_setfl(&hdl->aucat, 1, &hdl->sio.eof)) return 0; hdl->walign = hdl->round * hdl->wbpf; hdl->pstate = PSTATE_RUN; @@ -216,13 +216,13 @@ sio_aucat_stop(struct sio_hdl *sh) struct sio_aucat_hdl *hdl = (struct sio_aucat_hdl *)sh; unsigned int n, count; - if (!aucat_setfl(&hdl->aucat, 0, &hdl->sio.eof)) + if (!_aucat_setfl(&hdl->aucat, 0, &hdl->sio.eof)) return 0; /* * complete message or data block in progress */ if (hdl->aucat.wstate == WSTATE_MSG) { - if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) return 0; } if (hdl->aucat.wstate == WSTATE_DATA) { @@ -243,7 +243,7 @@ sio_aucat_stop(struct sio_hdl *sh) AMSG_INIT(&hdl->aucat.wmsg); hdl->aucat.wmsg.cmd = htonl(AMSG_STOP); hdl->aucat.wtodo = sizeof(struct amsg); - if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) return 0; /* @@ -284,7 +284,7 @@ sio_aucat_setpar(struct sio_hdl *sh, struct sio_par *par) if (hdl->sio.mode & SIO_PLAY) hdl->aucat.wmsg.u.par.pchan = htons(par->pchan); hdl->aucat.wtodo = sizeof(struct amsg); - if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) return 0; return 1; } @@ -297,10 +297,10 @@ sio_aucat_getpar(struct sio_hdl *sh, struct sio_par *par) AMSG_INIT(&hdl->aucat.wmsg); hdl->aucat.wmsg.cmd = htonl(AMSG_GETPAR); hdl->aucat.wtodo = sizeof(struct amsg); - if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_wmsg(&hdl->aucat, &hdl->sio.eof)) return 0; hdl->aucat.rtodo = sizeof(struct amsg); - if (!aucat_rmsg(&hdl->aucat, &hdl->sio.eof)) + if (!_aucat_rmsg(&hdl->aucat, &hdl->sio.eof)) return 0; if (ntohl(hdl->aucat.rmsg.cmd) != AMSG_GETPAR) { DPRINTF("sio_aucat_getpar: protocol err\n"); @@ -407,7 +407,7 @@ sio_aucat_read(struct sio_hdl *sh, void *buf, size_t len) if (!sio_aucat_runmsg(hdl)) return 0; } - return aucat_rdata(&hdl->aucat, buf, len, &hdl->sio.eof); + return _aucat_rdata(&hdl->aucat, buf, len, &hdl->sio.eof); } static size_t @@ -426,7 +426,7 @@ sio_aucat_write(struct sio_hdl *sh, const void *buf, size_t len) len = hdl->aucat.maxwrite; if (len > hdl->walign) len = hdl->walign; - n = aucat_wdata(&hdl->aucat, buf, len, hdl->wbpf, &hdl->sio.eof); + n = _aucat_wdata(&hdl->aucat, buf, len, hdl->wbpf, &hdl->sio.eof); hdl->aucat.maxwrite -= n; hdl->walign -= n; if (hdl->walign == 0) @@ -448,7 +448,7 @@ sio_aucat_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events) hdl->events = events; if (hdl->aucat.maxwrite <= 0) events &= ~POLLOUT; - return aucat_pollfd(&hdl->aucat, pfd, events); + return _aucat_pollfd(&hdl->aucat, pfd, events); } static int @@ -489,6 +489,6 @@ sio_aucat_getvol(struct sio_hdl *sh) { struct sio_aucat_hdl *hdl = (struct sio_aucat_hdl *)sh; - sio_onvol_cb(&hdl->sio, hdl->reqvol); + _sio_onvol_cb(&hdl->sio, hdl->reqvol); return; } diff --git a/lib/libsndio/sio_priv.h b/lib/libsndio/sio_priv.h index b8792ffcc46..40ff7089780 100644 --- a/lib/libsndio/sio_priv.h +++ b/lib/libsndio/sio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_priv.h,v 1.6 2013/08/24 12:32:35 ratchov Exp $ */ +/* $OpenBSD: sio_priv.h,v 1.7 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -66,14 +66,14 @@ struct sio_ops { void (*getvol)(struct sio_hdl *); }; -struct sio_hdl *sio_aucat_open(const char *, unsigned, int); -struct sio_hdl *sio_sun_open(const char *, unsigned, int); -void sio_create(struct sio_hdl *, struct sio_ops *, unsigned, int); -void sio_destroy(struct sio_hdl *); -void sio_onmove_cb(struct sio_hdl *, int); -void sio_onvol_cb(struct sio_hdl *, unsigned); +struct sio_hdl *_sio_aucat_open(const char *, unsigned, int); +struct sio_hdl *_sio_sun_open(const char *, unsigned, int); +void _sio_create(struct sio_hdl *, struct sio_ops *, unsigned, int); +void _sio_destroy(struct sio_hdl *); +void _sio_onmove_cb(struct sio_hdl *, int); +void _sio_onvol_cb(struct sio_hdl *, unsigned); #ifdef DEBUG -void sio_printpos(struct sio_hdl *); +void _sio_printpos(struct sio_hdl *); #endif #endif /* !defined(SNDIO_PRIV_H) */ diff --git a/lib/libsndio/sio_sun.c b/lib/libsndio/sio_sun.c index 779e864f9ce..d51750ce7e4 100644 --- a/lib/libsndio/sio_sun.c +++ b/lib/libsndio/sio_sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_sun.c,v 1.8 2013/08/24 12:32:35 ratchov Exp $ */ +/* $OpenBSD: sio_sun.c,v 1.9 2013/11/13 22:38:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -335,7 +335,7 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap) } struct sio_hdl * -sio_sun_open(const char *str, unsigned int mode, int nbio) +_sio_sun_open(const char *str, unsigned int mode, int nbio) { int fd, flags, fullduplex; struct audio_info aui; @@ -349,13 +349,13 @@ sio_sun_open(const char *str, unsigned int mode, int nbio) str++; break; default: - DPRINTF("sio_sun_open: %s: '/<devnum>' expected\n", str); + DPRINTF("_sio_sun_open: %s: '/<devnum>' expected\n", str); return NULL; } hdl = malloc(sizeof(struct sio_sun_hdl)); if (hdl == NULL) return NULL; - sio_create(&hdl->sio, &sio_sun_ops, mode, nbio); + _sio_create(&hdl->sio, &sio_sun_ops, mode, nbio); snprintf(path, sizeof(path), "/dev/audio%s", str); if (mode == (SIO_PLAY | SIO_REC)) @@ -470,7 +470,7 @@ sio_sun_start(struct sio_hdl *sh) return 0; } hdl->filling = 0; - sio_onmove_cb(&hdl->sio, 0); + _sio_onmove_cb(&hdl->sio, 0); } return 1; } @@ -773,7 +773,7 @@ sio_sun_autostart(struct sio_sun_hdl *hdl) hdl->sio.eof = 1; return 0; } - sio_onmove_cb(&hdl->sio, 0); + _sio_onmove_cb(&hdl->sio, 0); } return 1; } @@ -893,7 +893,7 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd) delta = (hdl->idelta > hdl->odelta) ? hdl->idelta : hdl->odelta; if (delta > 0) { - sio_onmove_cb(&hdl->sio, delta); + _sio_onmove_cb(&hdl->sio, delta); hdl->idelta -= delta; hdl->odelta -= delta; } |