From: Arnd Bergmann <arnd@arndb.de>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Robert Love <rlove@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>, Mel Gorman <mel@csn.ul.ie>,
Dave Hansen <dave@linux.vnet.ibm.com>,
Rik van Riel <riel@redhat.com>, Eric Anholt <eric@anholt.net>,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [RFC][PATCH] Anonymous shared memory (ashmem) subsystem
Date: Tue, 19 Jul 2011 17:55:50 +0200 [thread overview]
Message-ID: <201107191755.50749.arnd@arndb.de> (raw)
In-Reply-To: <1311015274-28650-1-git-send-email-john.stultz@linaro.org>
On Monday 18 July 2011, John Stultz wrote:
> +
> +#define ASHMEM_NAME_DEF "dev/ashmem"
> +
> +/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
> +#define ASHMEM_NOT_PURGED 0
> +#define ASHMEM_WAS_PURGED 1
> +
> +/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
> +#define ASHMEM_IS_UNPINNED 0
> +#define ASHMEM_IS_PINNED 1
> +
> +struct ashmem_pin {
> + __u32 offset; /* offset into region, in bytes, page-aligned */
> + __u32 len; /* length forward from offset, in bytes, page-aligned */
> +};
> +
> +#define __ASHMEMIOC 0x77
> +
> +#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
> +#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
Having a name for an 'anonymous shared memory' segment is rather
counter-intuitive ;-)
> +#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
> +#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
> +#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
> +#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
size_t and unsigned long arguments in ioctl commands are harmful,
because they require a compat_ioctl function. It's often better to just
make these either __u32 or __u64.
> diff --git a/mm/Makefile b/mm/Makefile
> index 836e416..cd41f09 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -30,6 +30,7 @@ obj-$(CONFIG_HUGETLBFS) += hugetlb.o
> obj-$(CONFIG_NUMA) += mempolicy.o
> obj-$(CONFIG_SPARSEMEM) += sparse.o
> obj-$(CONFIG_SPARSEMEM_VMEMMAP) += sparse-vmemmap.o
> +obj-$(CONFIG_ASHMEM) += ashmem.o
> obj-$(CONFIG_SLOB) += slob.o
> obj-$(CONFIG_COMPACTION) += compaction.o
> obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
Wouldn't this better live in drivers/char, next to mem.c or even
merged into that file?
> +static const struct file_operations ashmem_fops = {
> + .owner = THIS_MODULE,
> + .open = ashmem_open,
> + .release = ashmem_release,
> + .read = ashmem_read,
> + .llseek = ashmem_llseek,
> + .mmap = ashmem_mmap,
> + .unlocked_ioctl = ashmem_ioctl,
> + .compat_ioctl = ashmem_ioctl,
> +};
The compat_ioctl is wrong here, as described above.
Arnd
prev parent reply other threads:[~2011-07-19 15:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 18:54 [RFC][PATCH] Anonymous shared memory (ashmem) subsystem John Stultz
2011-07-19 2:19 ` Christoph Hellwig
2011-07-19 3:32 ` Bryan Donlan
2011-07-19 3:36 ` Christoph Hellwig
2011-07-19 15:37 ` Dave Hansen
2011-07-19 15:41 ` Christoph Hellwig
2011-07-19 21:58 ` John Stultz
2011-07-19 14:33 ` Christoph Lameter
2011-07-19 15:55 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201107191755.50749.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=eric@anholt.net \
--cc=hughd@google.com \
--cc=jbarnes@virtuousgeek.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=riel@redhat.com \
--cc=rlove@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox