~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/core/seq/seq_compat.c

Version: ~ [ linux-5.2-rc5 ] ~ [ linux-5.1.12 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.53 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.128 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.182 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.182 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.68 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *   32bit -> 64bit ioctl wrapper for sequencer API
  3  *   Copyright (c) by Takashi Iwai <tiwai@suse.de>
  4  *
  5  *   This program is free software; you can redistribute it and/or modify
  6  *   it under the terms of the GNU General Public License as published by
  7  *   the Free Software Foundation; either version 2 of the License, or
  8  *   (at your option) any later version.
  9  *
 10  *   This program is distributed in the hope that it will be useful,
 11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  *   GNU General Public License for more details.
 14  *
 15  *   You should have received a copy of the GNU General Public License
 16  *   along with this program; if not, write to the Free Software
 17  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 18  *
 19  */
 20 
 21 /* This file included from seq.c */
 22 
 23 #include <linux/compat.h>
 24 #include <linux/slab.h>
 25 
 26 struct snd_seq_port_info32 {
 27         struct snd_seq_addr addr;       /* client/port numbers */
 28         char name[64];                  /* port name */
 29 
 30         u32 capability; /* port capability bits */
 31         u32 type;               /* port type bits */
 32         s32 midi_channels;              /* channels per MIDI port */
 33         s32 midi_voices;                /* voices per MIDI port */
 34         s32 synth_voices;               /* voices per SYNTH port */
 35 
 36         s32 read_use;                   /* R/O: subscribers for output (from this port) */
 37         s32 write_use;                  /* R/O: subscribers for input (to this port) */
 38 
 39         u32 kernel;                     /* reserved for kernel use (must be NULL) */
 40         u32 flags;              /* misc. conditioning */
 41         unsigned char time_queue;       /* queue # for timestamping */
 42         char reserved[59];              /* for future use */
 43 };
 44 
 45 static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned int cmd,
 46                                         struct snd_seq_port_info32 __user *data32)
 47 {
 48         int err = -EFAULT;
 49         struct snd_seq_port_info *data;
 50         mm_segment_t fs;
 51 
 52         data = kmalloc(sizeof(*data), GFP_KERNEL);
 53         if (!data)
 54                 return -ENOMEM;
 55 
 56         if (copy_from_user(data, data32, sizeof(*data32)) ||
 57             get_user(data->flags, &data32->flags) ||
 58             get_user(data->time_queue, &data32->time_queue))
 59                 goto error;
 60         data->kernel = NULL;
 61 
 62         fs = snd_enter_user();
 63         err = snd_seq_do_ioctl(client, cmd, data);
 64         snd_leave_user(fs);
 65         if (err < 0)
 66                 goto error;
 67 
 68         if (copy_to_user(data32, data, sizeof(*data32)) ||
 69             put_user(data->flags, &data32->flags) ||
 70             put_user(data->time_queue, &data32->time_queue))
 71                 err = -EFAULT;
 72 
 73  error:
 74         kfree(data);
 75         return err;
 76 }
 77 
 78 
 79 
 80 /*
 81  */
 82 
 83 enum {
 84         SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct snd_seq_port_info32),
 85         SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct snd_seq_port_info32),
 86         SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct snd_seq_port_info32),
 87         SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct snd_seq_port_info32),
 88         SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct snd_seq_port_info32),
 89 };
 90 
 91 static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
 92 {
 93         struct snd_seq_client *client = file->private_data;
 94         void __user *argp = compat_ptr(arg);
 95 
 96         if (snd_BUG_ON(!client))
 97                 return -ENXIO;
 98 
 99         switch (cmd) {
100         case SNDRV_SEQ_IOCTL_PVERSION:
101         case SNDRV_SEQ_IOCTL_CLIENT_ID:
102         case SNDRV_SEQ_IOCTL_SYSTEM_INFO:
103         case SNDRV_SEQ_IOCTL_GET_CLIENT_INFO:
104         case SNDRV_SEQ_IOCTL_SET_CLIENT_INFO:
105         case SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT:
106         case SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT:
107         case SNDRV_SEQ_IOCTL_CREATE_QUEUE:
108         case SNDRV_SEQ_IOCTL_DELETE_QUEUE:
109         case SNDRV_SEQ_IOCTL_GET_QUEUE_INFO:
110         case SNDRV_SEQ_IOCTL_SET_QUEUE_INFO:
111         case SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE:
112         case SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS:
113         case SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO:
114         case SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO:
115         case SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER:
116         case SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER:
117         case SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT:
118         case SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT:
119         case SNDRV_SEQ_IOCTL_GET_CLIENT_POOL:
120         case SNDRV_SEQ_IOCTL_SET_CLIENT_POOL:
121         case SNDRV_SEQ_IOCTL_REMOVE_EVENTS:
122         case SNDRV_SEQ_IOCTL_QUERY_SUBS:
123         case SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION:
124         case SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT:
125         case SNDRV_SEQ_IOCTL_RUNNING_MODE:
126                 return snd_seq_do_ioctl(client, cmd, argp);
127         case SNDRV_SEQ_IOCTL_CREATE_PORT32:
128                 return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_CREATE_PORT, argp);
129         case SNDRV_SEQ_IOCTL_DELETE_PORT32:
130                 return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_DELETE_PORT, argp);
131         case SNDRV_SEQ_IOCTL_GET_PORT_INFO32:
132                 return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_GET_PORT_INFO, argp);
133         case SNDRV_SEQ_IOCTL_SET_PORT_INFO32:
134                 return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_SET_PORT_INFO, argp);
135         case SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32:
136                 return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT, argp);
137         }
138         return -ENOIOCTLCMD;
139 }
140 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp