From: Davide Libenzi <davidel@xmailserver.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Suparna Bhattacharya <suparna@in.ibm.com>,
Zach Brown <zach.brown@oracle.com>,
Benjamin LaHaise <bcrl@kvack.org>
Subject: Re: [patch 10/13] signal/timer/event fds v8 - eventfd core ...
Date: Fri, 30 Mar 2007 18:11:55 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0703301804110.3721@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <20070330124028.c6e54d2e.akpm@linux-foundation.org>
On Fri, 30 Mar 2007, Andrew Morton wrote:
> > +struct eventfd_ctx {
> > + spinlock_t lock;
> > + wait_queue_head_t wqh;
> > + __u64 count;
> > +};
>
> Again, can we borrow wqh.lock?
>
> `count' needs documentation - these things are key to understanding the
> code.
Added.
> > + */
>
> So it is the caller's responsibility to ensure that *file refers to an
> eventfd file?
In which function? I lost you ...
> > +int eventfd_signal(struct file *file, int n)
> > +{
> > + struct eventfd_ctx *ctx = file->private_data;
> > + unsigned long flags;
> > +
> > + if (n < 0)
> > + return -EINVAL;
> > + spin_lock_irqsave(&ctx->lock, flags);
> > + if (ULLONG_MAX - ctx->count < n)
> > + n = (int) (ULLONG_MAX - ctx->count);
> > + ctx->count += n;
> > + if (waitqueue_active(&ctx->wqh))
> > + wake_up_locked(&ctx->wqh);
> > + spin_unlock_irqrestore(&ctx->lock, flags);
> > +
> > + return n;
> > +}
>
> Neither the incoming arg (usefully named "n") nor the return value are
> documented.
Documented now.
> Needs interface documentation, please. Even the changelog doesn't tell us
> what an EAGAIN return from read() means.
I'll be adding the errno documentation to all of them.
> > +static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count,
> > + loff_t *ppos)
> > +{
> > + struct eventfd_ctx *ctx = file->private_data;
> > + ssize_t res;
> > + __u64 ucnt;
> > + DECLARE_WAITQUEUE(wait, current);
> > +
> > + if (count < sizeof(ucnt))
> > + return -EINVAL;
> > + if (get_user(ucnt, (const __u64 __user *) buf))
> > + return -EFAULT;
>
> Some architectures do not implement 64-bit get_user()
copy_from_user it is, then ...
- Davide
next prev parent reply other threads:[~2007-03-31 1:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 18:37 Davide Libenzi
2007-03-30 19:40 ` Andrew Morton
2007-03-31 1:11 ` Davide Libenzi [this message]
2007-03-31 1:14 ` Davide Libenzi
2007-03-31 1:26 ` Andrew Morton
2007-03-31 19:50 ` Davide Libenzi
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=Pine.LNX.4.64.0703301804110.3721@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=bcrl@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suparna@in.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=zach.brown@oracle.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
all inboxes | Powered by JetHome®