Messages in this thread |  | | | Subject | Re: [RFC][PATCH 1/1] support for user-space buffers in kfifo | | From | Stelian Pop <> | | Date | Wed, 13 Jun 2007 00:12:26 +0200 |
| |
Le mardi 12 juin 2007 à 11:24 -0500, Nelson Castillo a écrit : > On 6/12/07, Stelian Pop <stelian@popies.net> wrote: > (cut) > > accessing userspace memory with a spinlock taken (moreover an > > irqsave() > > one) is bad bad bad. > > Hi Stelian. > > I'm sending the new patch without kfifo_put_user and kfifo_get_user.
Ok, I have a few formatting/documentation comments:
> + * This function copies at most @len bytes from the @buffer into > + * the FIFO depending on the free space, and returns the number of > + * bytes copied.
... or -EFAULT if copy_from_user fails
> + * > + * Note that with only one concurrent reader and one concurrent > + * writer, you don't need extra locking to use these functions. > + */ > +int __kfifo_put_user(struct kfifo *fifo, const unsigned char __user *buffer, > + unsigned int len)
spacing ?
> + if(copy_from_user(fifo->buffer + (fifo->in & (fifo->size - 1)), > + buffer, l))
leave a space after the if please
> + * This function copies at most @len bytes from the FIFO into the > + * @buffer and returns the number of copied bytes.
or -EFAULT
> + * > + * Note that with only one concurrent reader and one concurrent > + * writer, you don't need extra locking to use these functions. > + */ > + > +int __kfifo_get_user(struct kfifo *fifo, > + unsigned char __user *buffer, unsigned int len)
spacing.
Other than that I'm ok with this patch.
Thanks,
Stelian. -- Stelian Pop <stelian@popies.net>
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |