Re: [patch] eventfd - revised interface and cleanups (2nd rev)

From: Davide Libenzi
Date: Tue Jun 23 2009 - 17:09:39 EST


On Tue, 23 Jun 2009, Andrew Morton wrote:

> On Tue, 23 Jun 2009 12:25:36 -0700 (PDT)
> Davide Libenzi <davidel@xxxxxxxxxxxxxxx> wrote:
>
> > The following patch changes the eventfd interface to de-couple the eventfd
> > memory context, from the file pointer instance.
> > Without such change, there is no clean way to racely free handle the
> > POLLHUP event sent when the last instance of the file* goes away.
> > Also, now the internal eventfd APIs are using the eventfd context instead
> > of the file*.
> > Another cleanup this patch does, is making AIO select EVENTFD, instead of
> > adding a bunch of empty function stubs inside eventfd.h in order to
> > handle the (AIO && !EVENTFD) case.
> >
> > ...
> >
> > +/**
> > + * eventfd_ctx_get - Acquires a reference to the internal eventfd context.
> > + * @ctx: [in] Pointer to the eventfd context.
> > + *
> > + * Returns: In case of success, returns a pointer to the eventfd context,
> > + * otherwise a proper error code.
>
> The description of the return value

Should functions be describing all the returned error codes, ala man pages?



> > + */
> > +struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx)
> > +{
> > + kref_get(&ctx->kref);
> > + return ctx;
> > +}
> > +EXPORT_SYMBOL_GPL(eventfd_ctx_get);
>
> doesn't match the code.
>
> Also...
>
> > + * Returns: A pointer to the eventfd file structure in case of success, or a
> > + * proper error pointer in case of failure.
>
>
> > + * Returns: In case of success, it returns a pointer to the internal eventfd
> > + * context, otherwise a proper error code.
> > + */
>
> I'm unsure what the word "proper" means in this context.
>
> The term "proper error pointer" is understandable enough - something
> you run IS_ERR() against. "error pointer" would suffice.
>
> But the term "proper error code" is getting a bit remote from reality.
>
> Unfortunately the kernel doesn't have a simple and agreed-to term for
> an ERR_PTR() thingy. Perhaps we should invent one. "err_ptr"?

OK, but you tricked me once again :)
You posted your comments/changes while you merged the old version in -mm
already.



- Davide


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/