All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] sys_epoll 0.14 ...
Date: Tue, 29 Oct 2002 20:12:12 -0800	[thread overview]
Message-ID: <3DBF5C1C.5ACD296A@digeo.com> (raw)
In-Reply-To: Pine.LNX.4.44.0210292008370.1457-100000@blue1.dev.mcafeelabs.com

Davide Libenzi wrote:
> 
> On Tue, 29 Oct 2002, Andrew Morton wrote:
> 
> > I was referring to these guys:
> >
> > +#define list_first(head)     (((head)->next != (head)) ? (head)->next: (struct list_head *) 0)
> > +#define list_last(head)      (((head)->prev != (head)) ? (head)->prev: (struct list_head *) 0)
> > +#define list_next(pos, head) (((pos)->next != (head)) ? (pos)->next: (struct list_head *) 0)
> > +#define list_prev(pos, head) (((pos)->prev != (head)) ? (pos)->prev: (struct list_head *) 0)
> >
> > if we are to add such things to list.h then lots of people need
> > to hum and hah over them first and ask questions like "why doesn't
> > it use list_empty?"  ;)
> >
> > It would be better to recode epoll's list walks to use the existing
> > list accessors.
> 
> Andrew, don't they better describe what you're actually doing instead of
> the list_empty() trick ?
> 

They are a reasonable addition to the list library.  They
should be implemented as:

/*
 * kernel-doc description goes here
 */
static inline struct list_head *list_first(struct list_head *list)
{
	if (list_empty(list))
		return NULL;
	return list->next;
}

But it shouldn't be quietly snuck in as part of epoll.   Everyone in
the world uses list.h.

Given that they are used in just a handful of places in epoll and nowhere
else in the kernel it is a little hard to justify adding them.

Unless people leap out and say "I've always wanted one of them" it would
be best to redo epoll to use

	while (!list_empty(list)) {
		item = list_entry(list, ...);
		list_del(item->list);
		...
	}

or one of the other eighty-seven list helpers which we already have.

  reply	other threads:[~2002-10-30  4:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-30  0:49 [patch] sys_epoll 0.14 Davide Libenzi
2002-10-30  3:35 ` Andrew Morton
2002-10-30  3:50   ` Davide Libenzi
2002-10-30  3:55     ` Andrew Morton
2002-10-30  4:09       ` Davide Libenzi
2002-10-30  4:12         ` Andrew Morton [this message]
2002-10-30  4:29           ` Davide Libenzi
2002-10-30 17:15     ` Mark Hamblin
2002-10-30  3:51   ` Davide Libenzi
2002-10-30 20:14 ` Janet Morgan
2002-10-30 20:37   ` Davide Libenzi
2002-10-30 20:31     ` Linus Torvalds
2002-10-30 20:45       ` Davide Libenzi
2002-10-30 20:38         ` Linus Torvalds

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=3DBF5C1C.5ACD296A@digeo.com \
    --to=akpm@digeo.com \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.