diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-04-13 05:49:04 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-04-13 06:01:21 -0400 |
commit | 02f4865fa415a87de28cc8c2e4d798ff46be1cf8 (patch) | |
tree | 7d8e1087fd17e0390439ad4fe3cdd59477c3032c /sound/core | |
parent | 73029e0ff18dfac8a1aab1dc188e1e150bbe3adc (diff) |
ALSA: core - Define llseek fops
Set no_llseek to llseek file ops of each sound component (but for hwdep).
This avoids the implicit BKL invocation via generic_file_llseek() used
as default when fops.llseek is NULL.
Also call nonseekable_open() at each open ops to ensure the file flags
have no seek bit.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 5 | ||||
-rw-r--r-- | sound/core/oss/mixer_oss.c | 5 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 5 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 10 | ||||
-rw-r--r-- | sound/core/rawmidi.c | 5 | ||||
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 6 | ||||
-rw-r--r-- | sound/core/timer.c | 6 |
7 files changed, 40 insertions, 2 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 439ce64f9d82..070aab490191 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -50,6 +50,10 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
50 | struct snd_ctl_file *ctl; | 50 | struct snd_ctl_file *ctl; |
51 | int err; | 51 | int err; |
52 | 52 | ||
53 | err = nonseekable_open(inode, file); | ||
54 | if (err < 0) | ||
55 | return err; | ||
56 | |||
53 | card = snd_lookup_minor_data(iminor(inode), SNDRV_DEVICE_TYPE_CONTROL); | 57 | card = snd_lookup_minor_data(iminor(inode), SNDRV_DEVICE_TYPE_CONTROL); |
54 | if (!card) { | 58 | if (!card) { |
55 | err = -ENODEV; | 59 | err = -ENODEV; |
@@ -1388,6 +1392,7 @@ static const struct file_operations snd_ctl_f_ops = | |||
1388 | .read = snd_ctl_read, | 1392 | .read = snd_ctl_read, |
1389 | .open = snd_ctl_open, | 1393 | .open = snd_ctl_open, |
1390 | .release = snd_ctl_release, | 1394 | .release = snd_ctl_release, |
1395 | .llseek = no_llseek, | ||
1391 | .poll = snd_ctl_poll, | 1396 | .poll = snd_ctl_poll, |
1392 | .unlocked_ioctl = snd_ctl_ioctl, | 1397 | .unlocked_ioctl = snd_ctl_ioctl, |
1393 | .compat_ioctl = snd_ctl_ioctl_compat, | 1398 | .compat_ioctl = snd_ctl_ioctl_compat, |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 54e2eb56e4c2..f50ebf20df96 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -43,6 +43,10 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
43 | struct snd_mixer_oss_file *fmixer; | 43 | struct snd_mixer_oss_file *fmixer; |
44 | int err; | 44 | int err; |
45 | 45 | ||
46 | err = nonseekable_open(inode, file); | ||
47 | if (err < 0) | ||
48 | return err; | ||
49 | |||
46 | card = snd_lookup_oss_minor_data(iminor(inode), | 50 | card = snd_lookup_oss_minor_data(iminor(inode), |
47 | SNDRV_OSS_DEVICE_TYPE_MIXER); | 51 | SNDRV_OSS_DEVICE_TYPE_MIXER); |
48 | if (card == NULL) | 52 | if (card == NULL) |
@@ -397,6 +401,7 @@ static const struct file_operations snd_mixer_oss_f_ops = | |||
397 | .owner = THIS_MODULE, | 401 | .owner = THIS_MODULE, |
398 | .open = snd_mixer_oss_open, | 402 | .open = snd_mixer_oss_open, |
399 | .release = snd_mixer_oss_release, | 403 | .release = snd_mixer_oss_release, |
404 | .llseek = no_llseek, | ||
400 | .unlocked_ioctl = snd_mixer_oss_ioctl, | 405 | .unlocked_ioctl = snd_mixer_oss_ioctl, |
401 | .compat_ioctl = snd_mixer_oss_ioctl_compat, | 406 | .compat_ioctl = snd_mixer_oss_ioctl_compat, |
402 | }; | 407 | }; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 82d4e3329b3d..5c8c7dff8ede 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2379,6 +2379,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
2379 | int nonblock; | 2379 | int nonblock; |
2380 | wait_queue_t wait; | 2380 | wait_queue_t wait; |
2381 | 2381 | ||
2382 | err = nonseekable_open(inode, file); | ||
2383 | if (err < 0) | ||
2384 | return err; | ||
2385 | |||
2382 | pcm = snd_lookup_oss_minor_data(iminor(inode), | 2386 | pcm = snd_lookup_oss_minor_data(iminor(inode), |
2383 | SNDRV_OSS_DEVICE_TYPE_PCM); | 2387 | SNDRV_OSS_DEVICE_TYPE_PCM); |
2384 | if (pcm == NULL) { | 2388 | if (pcm == NULL) { |
@@ -2977,6 +2981,7 @@ static const struct file_operations snd_pcm_oss_f_reg = | |||
2977 | .write = snd_pcm_oss_write, | 2981 | .write = snd_pcm_oss_write, |
2978 | .open = snd_pcm_oss_open, | 2982 | .open = snd_pcm_oss_open, |
2979 | .release = snd_pcm_oss_release, | 2983 | .release = snd_pcm_oss_release, |
2984 | .llseek = no_llseek, | ||
2980 | .poll = snd_pcm_oss_poll, | 2985 | .poll = snd_pcm_oss_poll, |
2981 | .unlocked_ioctl = snd_pcm_oss_ioctl, | 2986 | .unlocked_ioctl = snd_pcm_oss_ioctl, |
2982 | .compat_ioctl = snd_pcm_oss_ioctl_compat, | 2987 | .compat_ioctl = snd_pcm_oss_ioctl_compat, |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index cadba3087768..5b22443ed607 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -2107,7 +2107,9 @@ static int snd_pcm_open_file(struct file *file, | |||
2107 | static int snd_pcm_playback_open(struct inode *inode, struct file *file) | 2107 | static int snd_pcm_playback_open(struct inode *inode, struct file *file) |
2108 | { | 2108 | { |
2109 | struct snd_pcm *pcm; | 2109 | struct snd_pcm *pcm; |
2110 | 2110 | int err = nonseekable_open(inode, file); | |
2111 | if (err < 0) | ||
2112 | return err; | ||
2111 | pcm = snd_lookup_minor_data(iminor(inode), | 2113 | pcm = snd_lookup_minor_data(iminor(inode), |
2112 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); | 2114 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
2113 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); | 2115 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); |
@@ -2116,7 +2118,9 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) | |||
2116 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) | 2118 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) |
2117 | { | 2119 | { |
2118 | struct snd_pcm *pcm; | 2120 | struct snd_pcm *pcm; |
2119 | 2121 | int err = nonseekable_open(inode, file); | |
2122 | if (err < 0) | ||
2123 | return err; | ||
2120 | pcm = snd_lookup_minor_data(iminor(inode), | 2124 | pcm = snd_lookup_minor_data(iminor(inode), |
2121 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); | 2125 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
2122 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); | 2126 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); |
@@ -3450,6 +3454,7 @@ const struct file_operations snd_pcm_f_ops[2] = { | |||
3450 | .aio_write = snd_pcm_aio_write, | 3454 | .aio_write = snd_pcm_aio_write, |
3451 | .open = snd_pcm_playback_open, | 3455 | .open = snd_pcm_playback_open, |
3452 | .release = snd_pcm_release, | 3456 | .release = snd_pcm_release, |
3457 | .llseek = no_llseek, | ||
3453 | .poll = snd_pcm_playback_poll, | 3458 | .poll = snd_pcm_playback_poll, |
3454 | .unlocked_ioctl = snd_pcm_playback_ioctl, | 3459 | .unlocked_ioctl = snd_pcm_playback_ioctl, |
3455 | .compat_ioctl = snd_pcm_ioctl_compat, | 3460 | .compat_ioctl = snd_pcm_ioctl_compat, |
@@ -3463,6 +3468,7 @@ const struct file_operations snd_pcm_f_ops[2] = { | |||
3463 | .aio_read = snd_pcm_aio_read, | 3468 | .aio_read = snd_pcm_aio_read, |
3464 | .open = snd_pcm_capture_open, | 3469 | .open = snd_pcm_capture_open, |
3465 | .release = snd_pcm_release, | 3470 | .release = snd_pcm_release, |
3471 | .llseek = no_llseek, | ||
3466 | .poll = snd_pcm_capture_poll, | 3472 | .poll = snd_pcm_capture_poll, |
3467 | .unlocked_ioctl = snd_pcm_capture_ioctl, | 3473 | .unlocked_ioctl = snd_pcm_capture_ioctl, |
3468 | .compat_ioctl = snd_pcm_ioctl_compat, | 3474 | .compat_ioctl = snd_pcm_ioctl_compat, |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 0f5a194695d9..eb68326c37d4 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -376,6 +376,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
376 | if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) | 376 | if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) |
377 | return -EINVAL; /* invalid combination */ | 377 | return -EINVAL; /* invalid combination */ |
378 | 378 | ||
379 | err = nonseekable_open(inode, file); | ||
380 | if (err < 0) | ||
381 | return err; | ||
382 | |||
379 | if (maj == snd_major) { | 383 | if (maj == snd_major) { |
380 | rmidi = snd_lookup_minor_data(iminor(inode), | 384 | rmidi = snd_lookup_minor_data(iminor(inode), |
381 | SNDRV_DEVICE_TYPE_RAWMIDI); | 385 | SNDRV_DEVICE_TYPE_RAWMIDI); |
@@ -1391,6 +1395,7 @@ static const struct file_operations snd_rawmidi_f_ops = | |||
1391 | .write = snd_rawmidi_write, | 1395 | .write = snd_rawmidi_write, |
1392 | .open = snd_rawmidi_open, | 1396 | .open = snd_rawmidi_open, |
1393 | .release = snd_rawmidi_release, | 1397 | .release = snd_rawmidi_release, |
1398 | .llseek = no_llseek, | ||
1394 | .poll = snd_rawmidi_poll, | 1399 | .poll = snd_rawmidi_poll, |
1395 | .unlocked_ioctl = snd_rawmidi_ioctl, | 1400 | .unlocked_ioctl = snd_rawmidi_ioctl, |
1396 | .compat_ioctl = snd_rawmidi_ioctl_compat, | 1401 | .compat_ioctl = snd_rawmidi_ioctl_compat, |
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 48eca9ff9ee7..99a485f13648 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c | |||
@@ -318,6 +318,11 @@ static int snd_seq_open(struct inode *inode, struct file *file) | |||
318 | int c, mode; /* client id */ | 318 | int c, mode; /* client id */ |
319 | struct snd_seq_client *client; | 319 | struct snd_seq_client *client; |
320 | struct snd_seq_user_client *user; | 320 | struct snd_seq_user_client *user; |
321 | int err; | ||
322 | |||
323 | err = nonseekable_open(inode, file); | ||
324 | if (err < 0) | ||
325 | return err; | ||
321 | 326 | ||
322 | if (mutex_lock_interruptible(®ister_mutex)) | 327 | if (mutex_lock_interruptible(®ister_mutex)) |
323 | return -ERESTARTSYS; | 328 | return -ERESTARTSYS; |
@@ -2550,6 +2555,7 @@ static const struct file_operations snd_seq_f_ops = | |||
2550 | .write = snd_seq_write, | 2555 | .write = snd_seq_write, |
2551 | .open = snd_seq_open, | 2556 | .open = snd_seq_open, |
2552 | .release = snd_seq_release, | 2557 | .release = snd_seq_release, |
2558 | .llseek = no_llseek, | ||
2553 | .poll = snd_seq_poll, | 2559 | .poll = snd_seq_poll, |
2554 | .unlocked_ioctl = snd_seq_ioctl, | 2560 | .unlocked_ioctl = snd_seq_ioctl, |
2555 | .compat_ioctl = snd_seq_ioctl_compat, | 2561 | .compat_ioctl = snd_seq_ioctl_compat, |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 73943651caed..8c9a661df05b 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -1237,6 +1237,11 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, | |||
1237 | static int snd_timer_user_open(struct inode *inode, struct file *file) | 1237 | static int snd_timer_user_open(struct inode *inode, struct file *file) |
1238 | { | 1238 | { |
1239 | struct snd_timer_user *tu; | 1239 | struct snd_timer_user *tu; |
1240 | int err; | ||
1241 | |||
1242 | err = nonseekable_open(inode, file); | ||
1243 | if (err < 0) | ||
1244 | return err; | ||
1240 | 1245 | ||
1241 | tu = kzalloc(sizeof(*tu), GFP_KERNEL); | 1246 | tu = kzalloc(sizeof(*tu), GFP_KERNEL); |
1242 | if (tu == NULL) | 1247 | if (tu == NULL) |
@@ -1921,6 +1926,7 @@ static const struct file_operations snd_timer_f_ops = | |||
1921 | .read = snd_timer_user_read, | 1926 | .read = snd_timer_user_read, |
1922 | .open = snd_timer_user_open, | 1927 | .open = snd_timer_user_open, |
1923 | .release = snd_timer_user_release, | 1928 | .release = snd_timer_user_release, |
1929 | .llseek = no_llseek, | ||
1924 | .poll = snd_timer_user_poll, | 1930 | .poll = snd_timer_user_poll, |
1925 | .unlocked_ioctl = snd_timer_user_ioctl, | 1931 | .unlocked_ioctl = snd_timer_user_ioctl, |
1926 | .compat_ioctl = snd_timer_user_ioctl_compat, | 1932 | .compat_ioctl = snd_timer_user_ioctl_compat, |