Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363303
b: refs/heads/master
c: e9f5b81
h: refs/heads/master
i:
  363301: dc2294e
  363299: 7d4da03
  363295: 64359e3
v: v3
  • Loading branch information
Serban Constantinescu authored and Greg Kroah-Hartman committed Mar 6, 2013
1 parent 718afeb commit c6fb8aa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5db5a20a50cfd078c78b13a988f237cca81aedc5
refs/heads/master: e9f5b8145af9a0ee34e98cf01dcd3afb87225538
21 changes: 20 additions & 1 deletion trunk/drivers/staging/android/ashmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,23 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return ret;
}

/* support of 32bit userspace on 64bit platforms */
#ifdef CONFIG_COMPAT
static long compat_ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{

switch (cmd) {
case COMPAT_ASHMEM_SET_SIZE:
cmd = ASHMEM_SET_SIZE;
break;
case COMPAT_ASHMEM_SET_PROT_MASK:
cmd = ASHMEM_SET_PROT_MASK;
break;
}
return ashmem_ioctl(file, cmd, arg);
}
#endif

static const struct file_operations ashmem_fops = {
.owner = THIS_MODULE,
.open = ashmem_open,
Expand All @@ -710,7 +727,9 @@ static const struct file_operations ashmem_fops = {
.llseek = ashmem_llseek,
.mmap = ashmem_mmap,
.unlocked_ioctl = ashmem_ioctl,
.compat_ioctl = ashmem_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_ashmem_ioctl,
#endif
};

static struct miscdevice ashmem_misc = {
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/staging/android/ashmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <linux/limits.h>
#include <linux/ioctl.h>
#include <linux/compat.h>

#define ASHMEM_NAME_LEN 256

Expand Down Expand Up @@ -45,4 +46,10 @@ struct ashmem_pin {
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)

/* support of 32bit userspace on 64bit platforms */
#ifdef CONFIG_COMPAT
#define COMPAT_ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, compat_size_t)
#define COMPAT_ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned int)
#endif

#endif /* _LINUX_ASHMEM_H */

0 comments on commit c6fb8aa

Please sign in to comment.