aaron6187 / compcache

Automatically exported from code.google.com/p/compcache
0 stars 0 forks source link

64-bit module does not work with 32-bit userspace #61

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run a 64-bit 2.6.33 kernel, with the module compiled externally from 
0.6.2
2. Have the userspace 32-bit
3. rzscontrol /dev/ramzswap0 --init

What version of the product are you using? On what operating system?
2.6.33, with the module and userspace from compcache 0.6.2.

Please provide any additional information below.

Here's the output:
$ sudo rzscontrol /dev/ramzswap0 --init
init: Invalid argument
$ dmesg | grep ramz
ramzswap: num_devices not specified. Using default: 1
ioctl32(rzscontrol:401): Unknown cmd fd(3) cmd(00007a04){t:'z';sz:0} arg
(00000000) on /dev/ramzswap0

AFAIK everything else in the kernel supports 32-bit userspace even with a 
64-bit kernel, for example iptables and loop.

Original issue reported on code.google.com by lauri.ka...@luukku.com on 3 Mar 2010 at 12:50

GoogleCodeExporter commented 8 years ago
Indeed, running 64-bit kernels with a 32-bit userspace is very common (Debian 
allows
this by providing an amd64-kernel-image variant in 32-bit installs).
For this to work, the driver needs to support the compat_ioctl interface.

in compcache-0.6.2 it would be a line added in ramzswap_drv.c:1346
   .compat_ioctl = ramzswap_compat_ioctl,

and adding above

long ramzswap_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long 
arg)
{
//  return ramzswap_unlocked_ioctl(filp, cmd, arg); /// watch locking!
  return ramzswap_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
}

Original comment by bmwiedem...@gmail.com on 10 Mar 2010 at 11:26

GoogleCodeExporter commented 8 years ago
Change committed to repository.

Thanks,
Nitin

Original comment by nitingupta910@gmail.com on 14 Mar 2010 at 8:24

GoogleCodeExporter commented 8 years ago
Please don't forget to make this change in the upstream version as well.

Original comment by lauri.ka...@luukku.com on 17 May 2010 at 10:48