2 * 32bit -> 64bit ioctl wrapper for raw MIDI API
3 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
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.
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.
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
21 #include <sound/driver.h>
22 #include <linux/time.h>
24 #include <linux/compat.h>
25 #include <sound/core.h>
26 #include <sound/rawmidi.h>
27 #include <asm/uaccess.h>
30 struct sndrv_rawmidi_params32 {
34 unsigned int no_active_sensing; /* avoid bit-field */
35 unsigned char reserved[16];
36 } __attribute__((packed));
38 #define CVT_sndrv_rawmidi_params()\
41 COPY_CVT(buffer_size);\
43 if (copy_in_user(((size_t __user *)&dst->avail_min + 1),\
44 ((size_t __user *)&src->avail_min + 1), 4)) \
48 struct sndrv_rawmidi_status32 {
50 struct compat_timespec tstamp;
53 unsigned char reserved[16];
54 } __attribute__((packed));
56 #define CVT_sndrv_rawmidi_status()\
59 COPY_CVT(tstamp.tv_sec);\
60 COPY_CVT(tstamp.tv_nsec);\
65 DEFINE_ALSA_IOCTL(rawmidi_params);
66 DEFINE_ALSA_IOCTL(rawmidi_status);
68 DEFINE_ALSA_IOCTL_ENTRY(rawmidi_params, rawmidi_params, SNDRV_RAWMIDI_IOCTL_PARAMS);
69 DEFINE_ALSA_IOCTL_ENTRY(rawmidi_status, rawmidi_status, SNDRV_RAWMIDI_IOCTL_STATUS);
71 #define AP(x) snd_ioctl32_##x
74 SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct sndrv_rawmidi_params32),
75 SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct sndrv_rawmidi_status32),
78 struct ioctl32_mapper rawmidi_mappers[] = {
79 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_PVERSION),
80 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_INFO),
81 { SNDRV_RAWMIDI_IOCTL_PARAMS32, AP(rawmidi_params) },
82 { SNDRV_RAWMIDI_IOCTL_STATUS32, AP(rawmidi_status) },
83 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DROP),
84 MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DRAIN),
86 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE),
87 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_INFO),
88 MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE),