summaryrefslogtreecommitdiff
path: root/sound/core/seq/seq_compat.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2016-08-13 10:13:34 +0900
committerTakashi Iwai <tiwai@suse.de>2016-08-22 11:11:03 +0200
commit8ce8eb601c71d4eec4c83ac2398a2cb847f4ef4d (patch)
tree2d7897ca14af7eb173f7af9656166a30cfef2485 /sound/core/seq/seq_compat.c
parent77dfa8d3196a0cd219dfd6c65e4ff5a3e696fd8c (diff)
ALSA: seq: add an alternative way to handle ioctl requests
ALSA sequencer is designed with two types of clients; application and kernel. Operations for each ioctl command should handle data in both of user space and kernel space, while current implementation just allows them to handle data in user space. Data in kernel space is handled with change of address limit of running tasks. This commit adds a new table to map ioctl commands to corresponding functions. The functions get data in kernel space. Helper functions to operate kernel and application clients seek entries from the table. Especially, the helper function for application is responsible for coping from user space to kernel space or vise versa. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_compat.c')
-rw-r--r--sound/core/seq/seq_compat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c
index 65175902a68a..4cfc50584218 100644
--- a/sound/core/seq/seq_compat.c
+++ b/sound/core/seq/seq_compat.c
@@ -59,6 +59,9 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned
goto error;
data->kernel = NULL;
+ if (snd_seq_kernel_client_ctl(client->number, cmd, &data) >= 0)
+ return 0;
+
fs = snd_enter_user();
err = snd_seq_do_ioctl(client, cmd, data);
snd_leave_user(fs);
@@ -123,6 +126,8 @@ static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
case SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION:
case SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT:
case SNDRV_SEQ_IOCTL_RUNNING_MODE:
+ if (seq_ioctl(file, cmd, arg) >= 0)
+ return 0;
return snd_seq_do_ioctl(client, cmd, argp);
case SNDRV_SEQ_IOCTL_CREATE_PORT32:
return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_CREATE_PORT, argp);