patch-2.1.120 linux/drivers/sound/audio.c
Next file: linux/drivers/sound/dev_table.h
Previous file: linux/drivers/sound/README.FIRST
Back to the patch index
Back to the overall index
- Lines: 55
- Date:
Fri Sep 4 15:32:26 1998
- Orig file:
v2.1.119/linux/drivers/sound/audio.c
- Orig date:
Thu May 14 19:47:42 1998
diff -u --recursive --new-file v2.1.119/linux/drivers/sound/audio.c linux/drivers/sound/audio.c
@@ -17,6 +17,7 @@
* (which is grossly misnamed btw.) because they have the same
* lifetime as the rest in there and dynamic allocation saves
* 12k or so
+ * Thomas Sailer : use more logical O_NONBLOCK semantics
*/
#include <linux/config.h>
@@ -99,7 +100,6 @@
set_format(dev, bits);
audio_devs[dev]->audio_mode = AM_NONE;
- audio_devs[dev]->dev_nblock = 0;
return ret;
@@ -203,10 +203,10 @@
while (c)
{
- if ((err = DMAbuf_getwrbuffer(dev, &dma_buf, &buf_size, audio_devs[dev]->dev_nblock)) < 0)
+ if ((err = DMAbuf_getwrbuffer(dev, &dma_buf, &buf_size, !!(file->f_flags & O_NONBLOCK))) < 0)
{
/* Handle nonblocking mode */
- if (audio_devs[dev]->dev_nblock && err == -EAGAIN)
+ if ((file->f_flags & O_NONBLOCK) && err == -EAGAIN)
return p; /* No more space. Return # of accepted bytes */
return err;
}
@@ -273,14 +273,13 @@
while(c)
{
- if ((buf_no = DMAbuf_getrdbuffer(dev, &dmabuf, &l,
- audio_devs[dev]->dev_nblock)) < 0)
+ if ((buf_no = DMAbuf_getrdbuffer(dev, &dmabuf, &l, !!(file->f_flags & O_NONBLOCK))) < 0)
{
/*
* Nonblocking mode handling. Return current # of bytes
*/
- if (audio_devs[dev]->dev_nblock && buf_no == -EAGAIN)
+ if (file->f_flags & O_NONBLOCK && buf_no == -EAGAIN)
return p;
if (p > 0) /* Avoid throwing away data */
@@ -388,7 +387,7 @@
return dma_ioctl(dev, cmd, arg);
case SNDCTL_DSP_NONBLOCK:
- audio_devs[dev]->dev_nblock = 1;
+ file->f_flags |= O_NONBLOCK;
return 0;
case SNDCTL_DSP_GETCAPS:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov