Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /*
  2  *   32bit -> 64bit ioctl wrapper for hwdep 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 #include <sound/driver.h>
 22 #include <linux/time.h>
 23 #include <linux/fs.h>
 24 #include <sound/core.h>
 25 #include <sound/hwdep.h>
 26 #include <asm/uaccess.h>
 27 #include "ioctl32.h"
 28 
 29 struct sndrv_hwdep_dsp_image32 {
 30         u32 index;
 31         unsigned char name[64];
 32         u32 image;      /* pointer */
 33         u32 length;
 34         u32 driver_data;
 35 } /* don't set packed attribute here */;
 36 
 37 static inline int _snd_ioctl32_hwdep_dsp_image(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file, unsigned int native_ctl)
 38 {
 39         struct sndrv_hwdep_dsp_image __user *data, *dst;
 40         struct sndrv_hwdep_dsp_image32 __user *data32, *src;
 41         compat_caddr_t ptr;
 42 
 43         data32 = compat_ptr(arg);
 44         data = compat_alloc_user_space(sizeof(*data));
 45 
 46         /* index and name */
 47         if (copy_in_user(data, data32, 4 + 64))
 48                 return -EFAULT;
 49         if (__get_user(ptr, &data32->image) ||
 50             __put_user(compat_ptr(ptr), &data->image))
 51                 return -EFAULT;
 52         src = data32;
 53         dst = data;
 54         COPY_CVT(length);
 55         COPY_CVT(driver_data);
 56         return file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)data);
 57 }
 58 
 59 DEFINE_ALSA_IOCTL_ENTRY(hwdep_dsp_image, hwdep_dsp_image, SNDRV_HWDEP_IOCTL_DSP_LOAD);
 60 
 61 #define AP(x) snd_ioctl32_##x
 62 
 63 enum {
 64         SNDRV_HWDEP_IOCTL_DSP_LOAD32   = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image32)
 65 };
 66 
 67 struct ioctl32_mapper hwdep_mappers[] = {
 68         MAP_COMPAT(SNDRV_HWDEP_IOCTL_PVERSION),
 69         MAP_COMPAT(SNDRV_HWDEP_IOCTL_INFO),
 70         MAP_COMPAT(SNDRV_HWDEP_IOCTL_DSP_STATUS),
 71         { SNDRV_HWDEP_IOCTL_DSP_LOAD32, AP(hwdep_dsp_image) },
 72         { 0 },
 73 };
 74 
  This page was automatically generated by the LXR engine.