Added patch to ioctl32 support to get it to work on sparc... still needs testing...
authorJeremy Huddleston <eradicator@gentoo.org>
Sun, 21 Nov 2004 23:07:53 +0000 (23:07 +0000)
committerJeremy Huddleston <eradicator@gentoo.org>
Sun, 21 Nov 2004 23:07:53 +0000 (23:07 +0000)
media-sound/alsa-driver/ChangeLog
media-sound/alsa-driver/Manifest
media-sound/alsa-driver/alsa-driver-1.0.7.ebuild
media-sound/alsa-driver/files/alsa-driver-1.0.7-ioctl32.patch [new file with mode: 0644]

index c3d9129b8dc83066ec32790cd1c251293793d836..57cbe22179f92be8776631fc697171f985d434ff 100644 (file)
@@ -1,6 +1,11 @@
 # ChangeLog for media-sound/alsa-driver
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-driver/ChangeLog,v 1.104 2004/11/19 23:29:02 eradicator Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-driver/ChangeLog,v 1.105 2004/11/21 23:07:52 eradicator Exp $
+
+  21 Nov 2004; Jeremy Huddleston <eradicator@gentoo.org>
+  +files/alsa-driver-1.0.7-ioctl32.patch, alsa-driver-1.0.7.ebuild:
+  Added patch to ioctl32 support to get it to work on sparc... still needs
+  testing... See bug #55465.
 
   19 Nov 2004; Jeremy Huddleston <eradicator@gentoo.org>
   alsa-driver-1.0.7.ebuild:
index 0b9492411f574fec37757f16d6c8b7371bc5a739..f2e0c37853eb6de03ea33f10219a91c0a45b61a4 100644 (file)
@@ -1,21 +1,32 @@
-MD5 3e1223a9d213887bf37773c129d753c1 ChangeLog 17613
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+MD5 e9b0128bb6bfb57ae0e30d9ed3fd3f7c alsa-driver-1.0.7.ebuild 4001
 MD5 d388a1b0706024ddccccc99045b976f9 alsa-driver-0.9.8.ebuild 2341
 MD5 e5de43659b629d1e9f0ee8d3f1864840 alsa-driver-1.0.3.ebuild 3363
+MD5 10ae804301e54cd0bd98ba0c95ab7c81 ChangeLog 17843
+MD5 a1eaeb2ae801daeb712c90c060e922dc metadata.xml 158
 MD5 9f0283e4e9611766ad3110532d4976d7 alsa-driver-1.0.5a.ebuild 3603
 MD5 45f95cf50aad5f544f0fa05dcf94d1ad alsa-driver-1.0.6a.ebuild 3501
-MD5 a1eaeb2ae801daeb712c90c060e922dc metadata.xml 158
-MD5 7837da85ce1dbf6fe0e3bb6f5c50457d alsa-driver-1.0.7.ebuild 3896
+MD5 479ee887025f4ce7944adee1e4a6fdf3 files/digest-alsa-driver-1.0.7 71
+MD5 2d66a81aa4bef486ad5a40b392cac999 files/alsa-driver-1.0.7-configure.patch 31374
 MD5 8c120f7730b91118d0a8148d2deb3a43 files/alsa-driver-0.9.8-au-fix.patch 1267
 MD5 1d70561326ef89e94179634d92782610 files/alsa-driver-1.0.4-devfix.patch 2756
 MD5 08af7cfec9cd33819c62880d6219f3a5 files/alsa-driver-1.0.5-devfix.patch 763
-MD5 a2ee6fa920bbac70835b4a58e5759e8c files/alsa-driver-1.0.5a-cs46xx-passthrough.patch 446
-MD5 8bb31a005a1db2e306c51d017fd44e70 files/alsa-driver-1.0.5a-xbox-ac97.patch 721
-MD5 f9d35aa6adca1137e05b1cb8852ff672 files/alsa-driver-1.0.6a-emu10k1-passthrough.patch 658
-MD5 27684bd356b1a43809d3f8c847a6abce files/alsa-driver-1.0.6a-kbuild.patch 575
+MD5 034733ce45d34c261a5c9bb74679f77a files/alsa-driver-1.0.7-ioctl32.patch 8684
 MD5 439dab13c036317c9b308b234ecf7290 files/digest-alsa-driver-0.9.8 71
-MD5 938a2ee36c54416322d1acd47b249c99 files/digest-alsa-driver-1.0.3 71
-MD5 deb0bfd8e2cfe0ba434fb5a820294502 files/digest-alsa-driver-1.0.5a 72
 MD5 e1b13905eac70fe728dcb85fcaac27a9 files/digest-alsa-driver-1.0.6a 72
+MD5 938a2ee36c54416322d1acd47b249c99 files/digest-alsa-driver-1.0.3 71
+MD5 27684bd356b1a43809d3f8c847a6abce files/alsa-driver-1.0.6a-kbuild.patch 575
+MD5 f9d35aa6adca1137e05b1cb8852ff672 files/alsa-driver-1.0.6a-emu10k1-passthrough.patch 658
 MD5 27ccbe36406f145c1d63725a53517233 files/makefile.patch 1122
-MD5 479ee887025f4ce7944adee1e4a6fdf3 files/digest-alsa-driver-1.0.7 71
-MD5 2d66a81aa4bef486ad5a40b392cac999 files/alsa-driver-1.0.7-configure.patch 31374
+MD5 deb0bfd8e2cfe0ba434fb5a820294502 files/digest-alsa-driver-1.0.5a 72
+MD5 a2ee6fa920bbac70835b4a58e5759e8c files/alsa-driver-1.0.5a-cs46xx-passthrough.patch 446
+MD5 8bb31a005a1db2e306c51d017fd44e70 files/alsa-driver-1.0.5a-xbox-ac97.patch 721
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.6 (GNU/Linux)
+
+iD8DBQFBoR/TArHZZzCEUG0RAlObAJ4+Gkj50MTsOWgplCl8JLa/3rpBIgCfVMar
+FhTvri+dls0nXkUhDM+HXm8=
+=+8wh
+-----END PGP SIGNATURE-----
index 52f3760945e0ad18e236e2f16f4f600a0d6fdde1..5315fa9b5435236eaa422e329ceafa0357d7015a 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-driver/alsa-driver-1.0.7.ebuild,v 1.8 2004/11/21 07:02:27 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-driver/alsa-driver-1.0.7.ebuild,v 1.9 2004/11/21 23:07:53 eradicator Exp $
 
 IUSE="oss doc"
 
@@ -15,7 +15,7 @@ SRC_URI="mirror://alsaproject/driver/${P}.tar.bz2"
 
 LICENSE="GPL-2 LGPL-2.1"
 SLOT="${KV}"
-KEYWORDS="~alpha ~amd64 ~ia64 ~mips ~ppc -sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~ia64 ~mips ~ppc ~sparc ~x86"
 
 RDEPEND="virtual/modutils
         ~media-sound/alsa-headers-${PV}"
@@ -67,6 +67,9 @@ src_unpack() {
                epatch ${FILESDIR}/${PN}-1.0.6a-kbuild.patch
        fi
 
+       # Fix ioctl32 support
+       epatch ${FILESDIR}/${P}-ioctl32.patch
+
        # Fix order of configure operations so the kernel compiler isn't used
        # for tests.
        epatch ${FILESDIR}/${PN}-1.0.7-configure.patch
@@ -123,6 +126,9 @@ src_install() {
                docinto doc
                dodoc doc/*
 
+               docinto DocBook
+               dodoc doc/DocBook/*
+
                docinto Documentation
                dodoc sound/Documentation/*
        fi
diff --git a/media-sound/alsa-driver/files/alsa-driver-1.0.7-ioctl32.patch b/media-sound/alsa-driver/files/alsa-driver-1.0.7-ioctl32.patch
new file mode 100644 (file)
index 0000000..e5ddc81
--- /dev/null
@@ -0,0 +1,329 @@
+diff -Naur alsa-driver-1.0.7.orig/sound/core/ioctl32/hwdep32.c alsa-driver-1.0.7/sound/core/ioctl32/hwdep32.c
+--- alsa-driver-1.0.7.orig/sound/core/ioctl32/hwdep32.c        2004-10-18 07:55:51.000000000 -0700
++++ alsa-driver-1.0.7/sound/core/ioctl32/hwdep32.c     2004-11-21 15:03:41.306477719 -0800
+@@ -39,20 +39,26 @@
+       struct sndrv_hwdep_dsp_image data;
+       struct sndrv_hwdep_dsp_image32 data32;
+       mm_segment_t oldseg;
+-      int err;
++      int err = 0;
+ 
+-      if (copy_from_user(&data32, (void __user *)arg, sizeof(data32)))
++      if (copy_from_user(&data32, (void __user *)arg, sizeof(data32))) {
+               return -EFAULT;
++      }
+       memset(&data, 0, sizeof(data));
+       data.index = data32.index;
+       memcpy(data.name, data32.name, sizeof(data.name));
+-      data.image = compat_ptr(data32.image);
++      data.image = kmalloc(data32.length, GFP_KERNEL);
++      if (data.image == NULL) {
++              return -ENOMEM;
++      }
+       data.length = data32.length;
+       data.driver_data = data32.driver_data;
+       oldseg = get_fs();
+       set_fs(KERNEL_DS);
+       err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)&data);
+       set_fs(oldseg);
++
++      kfree(data.image);
+       return err;
+ }
+ 
+diff -Naur alsa-driver-1.0.7.orig/sound/core/ioctl32/ioctl32.c alsa-driver-1.0.7/sound/core/ioctl32/ioctl32.c
+--- alsa-driver-1.0.7.orig/sound/core/ioctl32/ioctl32.c        2004-10-18 07:55:51.000000000 -0700
++++ alsa-driver-1.0.7/sound/core/ioctl32/ioctl32.c     2004-11-21 15:03:41.299478783 -0800
+@@ -93,45 +93,54 @@
+       unsigned char reserved[50];
+ } /* don't set packed attribute here */;
+ 
+-#define CVT_sndrv_ctl_elem_list()\
+-{\
+-      COPY(offset);\
+-      COPY(space);\
+-      COPY(used);\
+-      COPY(count);\
+-      CPTR(pids);\
+-}
+-
+ static inline int _snd_ioctl32_ctl_elem_list(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file, unsigned int native_ctl)
+ {
+       struct sndrv_ctl_elem_list32 data32;
+       struct sndrv_ctl_elem_list data;
+       mm_segment_t oldseg;
+-      int err;
++      int err = 0;
+ 
+       if (copy_from_user(&data32, (void __user *)arg, sizeof(data32)))
+               return -EFAULT;
+       memset(&data, 0, sizeof(data));
++
++      /* Copy over W data */
+       data.offset = data32.offset;
+       data.space = data32.space;
+-      data.used = data32.used;
+-      data.count = data32.count;
+-      data.pids = compat_ptr(data32.pids);
++
++      data.pids = kmalloc(sizeof(*data.pids) * data.space, GFP_KERNEL);
++      if (data.pids == NULL) {
++              err = -ENOMEM;
++              goto __list_end;
++      }
++
++      /* ioctl call */
+       oldseg = get_fs();
+       set_fs(KERNEL_DS);
+       err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)&data);
+       set_fs(oldseg);
++
+       if (err < 0)
+-              return err;
++              goto __list_end;
++
+       /* copy the result */
+-      data32.offset = data.offset;
+-      data32.space = data.space;
+       data32.used = data.used;
+       data32.count = data.count;
+-      //data.pids = data.pids;
++
++      if (data.used > 0 && 
++          copy_to_user((void __user *)compat_ptr(data32.pids), data.pids, sizeof(*data.pids) * data.used)) {
++              err = -EFAULT;
++              goto __list_end;
++      }
++
+       if (copy_to_user((void __user *)arg, &data32, sizeof(data32)))
+-              return -EFAULT;
+-      return 0;
++              err = -EFAULT;
++
++__list_end:
++      if (data.pids) {
++              kfree(data.pids);
++      }
++      return err;
+ }
+ 
+ DEFINE_ALSA_IOCTL_ENTRY(ctl_elem_list, ctl_elem_list, SNDRV_CTL_IOCTL_ELEM_LIST);
+@@ -298,8 +307,21 @@
+       memset(data, 0, sizeof(*data));
+       data->id = data32->id;
+       data->indirect = data32->indirect;
+-      if (data->indirect) /* FIXME: this is not correct for long arrays */
++      if (data->indirect) { /* FIXME: this is not correct for long arrays */
++#if defined(__sparc__)
++              err = -EINVAL;
++              goto __end;
++
++      /* Is this the correct way to handle indirect? */
++              data->value.integer.value_ptr = kmalloc(sizeof(u32), GFP_KERNEL);
++              if (data->value.integer.value_ptr == NULL) {
++                      err = -ENOMEM;
++                      goto __end;
++              }
++#else
+               data->value.integer.value_ptr = compat_ptr(data32->value.integer.value_ptr);
++#endif
++      }
+       type = get_ctl_type(file, &data->id);
+       if (type < 0) {
+               err = type;
+@@ -370,10 +392,16 @@
+       if (copy_to_user((void __user *)arg, data32, sizeof(*data32)))
+               err = -EFAULT;
+       __end:
++#if defined(__sparc__)
++      if (data->indirect) {
++              kfree(data->value.integer.value_ptr);
++      }
++#endif
+               if (data32)
+                       kfree(data32);
+       if (data)
+               kfree(data);
++
+       return err;
+ }
+ 
+diff -Naur alsa-driver-1.0.7.orig/sound/core/ioctl32/pcm32.c alsa-driver-1.0.7/sound/core/ioctl32/pcm32.c
+--- alsa-driver-1.0.7.orig/sound/core/ioctl32/pcm32.c  2004-10-18 07:55:51.000000000 -0700
++++ alsa-driver-1.0.7/sound/core/ioctl32/pcm32.c       2004-11-21 15:03:41.305477871 -0800
+@@ -169,6 +169,7 @@
+ 
+ DEFINE_ALSA_IOCTL(pcm_uframes_str);
+ DEFINE_ALSA_IOCTL(pcm_sframes_str);
++DEFINE_ALSA_IOCTL_BIG(pcm_hw_params);
+ DEFINE_ALSA_IOCTL(pcm_sw_params);
+ DEFINE_ALSA_IOCTL(pcm_channel_info);
+ DEFINE_ALSA_IOCTL(pcm_status);
+@@ -192,46 +193,6 @@
+               runtime->boundary *= 2;
+ }
+ 
+-static inline int _snd_ioctl32_pcm_hw_params(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file, unsigned int native_ctl)
+-{
+-      struct sndrv_pcm_hw_params32 *data32;
+-      struct sndrv_pcm_hw_params *data;
+-      mm_segment_t oldseg;
+-      int err;
+-
+-      data32 = kmalloc(sizeof(*data32), GFP_KERNEL);
+-      data = kmalloc(sizeof(*data), GFP_KERNEL);
+-      if (data32 == NULL || data == NULL) {
+-              err = -ENOMEM;
+-              goto __end;
+-      }
+-      if (copy_from_user(data32, (void __user *)arg, sizeof(*data32))) {
+-              err = -EFAULT;
+-              goto __end;
+-      }
+-      memset(data, 0, sizeof(*data));
+-      convert_from_32(pcm_hw_params, data, data32);
+-      oldseg = get_fs();
+-      set_fs(KERNEL_DS);
+-      err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)data);
+-      set_fs(oldseg);
+-      if (err < 0)
+-              goto __end;
+-      err = 0;
+-      convert_to_32(pcm_hw_params, data32, data);
+-      if (copy_to_user((void __user *)arg, data32, sizeof(*data32)))
+-              err = -EFAULT;
+-      else
+-              recalculate_boundary(file);
+-      __end:
+-              if (data)
+-                      kfree(data);
+-              if (data32)
+-                      kfree(data32);
+-      return err;
+-}
+-
+-
+ /*
+  */
+ struct sndrv_xferi32 {
+@@ -245,25 +206,54 @@
+       struct sndrv_xferi32 data32;
+       struct sndrv_xferi data;
+       mm_segment_t oldseg;
+-      int err;
++      int err = 0;
++      size_t size;
++
++      snd_pcm_substream_t *substream;
++      snd_pcm_runtime_t *runtime;
++
++      substream = ((snd_pcm_file_t *)file->private_data)->substream;
++      snd_assert(substream != NULL, return -ENXIO);
++      runtime = substream->runtime;
+ 
+       if (copy_from_user(&data32, (void __user *)arg, sizeof(data32)))
+               return -EFAULT;
+       memset(&data, 0, sizeof(data));
++
++      size = frames_to_bytes(runtime, data32.frames);
++      data.buf = kmalloc(size, GFP_KERNEL);
++      if (data.buf == NULL) {
++              return -ENOMEM;
++      }
++
++      if (copy_from_user(data.buf, (void __user *)compat_ptr(data32.buf), size)) {
++              err = -EFAULT;
++              goto __xferi_end;
++      }
+       data.result = data32.result;
+-      data.buf = compat_ptr(data32.buf);
+       data.frames = data32.frames;
++
+       oldseg = get_fs();
+       set_fs(KERNEL_DS);
+       err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)&data);
+       set_fs(oldseg);
+       if (err < 0)
+-              return err;
++              goto __xferi_end;
++
+       /* copy the result */
+       data32.result = data.result;
++      data32.frames = data.frames;
++      if (copy_to_user((void __user *)compat_ptr(data32.buf), data.buf, size)) {
++              err = -EFAULT;
++              goto __xferi_end;
++      }
+       if (copy_to_user((void __user *)arg, &data32, sizeof(data32)))
+-              return -EFAULT;
+-      return 0;
++              err = -EFAULT;
++
++__xferi_end:
++      if(data.buf)
++              kfree(data.buf);
++      return err;
+ }
+ 
+ 
+@@ -287,12 +277,12 @@
+       struct sndrv_xfern32 data32;
+       struct sndrv_xfern32 __user *srcptr = (void __user *)arg;
+       void __user **bufs = NULL;
+-      int err = 0, ch, i;
++      int err = 0, ch, i, cp = 0;
+       u32 __user *bufptr;
+       mm_segment_t oldseg;
++      size_t size;
+ 
+       /* FIXME: need to check whether fop->ioctl is sane */
+-
+       pcm_file = file->private_data;
+       substream = pcm_file->substream;
+       snd_assert(substream != NULL && substream->runtime, return -ENXIO);
+@@ -319,11 +309,27 @@
+       bufs = kmalloc(sizeof(void *) * 128, GFP_KERNEL);
+       if (bufs == NULL)
+               return -ENOMEM;
++      size = frames_to_bytes(substream->runtime , data32.frames);
+       for (i = 0; i < ch; i++) {
+               u32 ptr;
+-              if (get_user(ptr, bufptr))
+-                      return -EFAULT;
+-              bufs[ch] = compat_ptr(ptr);
++              if (get_user(ptr, bufptr)) {
++                      err = -EFAULT;
++                      goto __xfern_out;
++              }
++
++              bufs[i] = kmalloc(size, GFP_KERNEL);
++              if (bufs[i] == NULL) {
++                      err = -ENOMEM;
++                      goto __xfern_out;
++              }
++
++              cp++;
++
++              if (copy_from_user(bufs[i], (void __user *)compat_ptr(ptr), size)) {
++                      err = -EFAULT;
++                      goto __xfern_out;
++              }
++
+               bufptr++;
+       }
+       oldseg = get_fs();
+@@ -341,8 +347,13 @@
+               if (put_user(err, &srcptr->result))
+                       err = -EFAULT;
+       }
++
++__xfern_out:
++      for (i = 0; i < cp; i++) {
++              kfree(bufs[i]);
++      }
+       kfree(bufs);
+-      return 0;
++      return err;
+ }
+ 
+