From: Peter Chubb <peter@chubb.wattle.id.au>
To: Lightweight Patch Manager <patch@luckynet.dynu.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Tomas Szepe <szepe@pinerecords.com>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH][2.5] Single linked lists for Linux
Date: Thu, 26 Sep 2002 10:14:19 +1000 [thread overview]
Message-ID: <15762.20827.271317.595537@wombat.chubb.wattle.id.au> (raw)
In-Reply-To: <83015759@toto.iv>
+
+/**
+ * slist_del - remove an entry from list
+ * @head: head to remove it from
+ * @entry: entry to be removed
+ */
+#define slist_del(_head, _entry) \
+do { \
+ (_head)->next = (_entry)->next; \
+ (_entry)->next = NULL; \
+}
+
This only works if head->next == entry otherwise you lose half your
list. Also, none of this is SMP-safe.
I think you need something like this (but with locking!)
/*
* remove entry from list starting at head
* Return 0 if successful, non-zero otherwise.
*/
static inline int slist_del(struct slist *head, struct slist *entry)
{
struct slist **p;
for (p = &head->next; *p; p = &(*p)->next)
if (*p == entry) {
*p = entry->next;
entry->next = NULL;
return 0;
}
return -1;
}
Peter C
next parent reply other threads:[~2002-09-26 0:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <83015759@toto.iv>
2002-09-26 0:14 ` Peter Chubb [this message]
2002-09-26 0:25 ` [PATCH][2.5] Single linked lists for Linux Zwane Mwaikambo
2002-09-26 0:35 ` Rik van Riel
2002-09-26 6:42 ` Thunder from the hill
2002-09-25 20:56 Lightweight Patch Manager
2002-09-25 21:11 ` Rik van Riel
2002-09-25 21:23 ` Thunder from the hill
2002-09-25 21:17 ` Mark Mielke
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=15762.20827.271317.595537@wombat.chubb.wattle.id.au \
--to=peter@chubb.wattle.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=patch@luckynet.dynu.com \
--cc=szepe@pinerecords.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;
as well as URLs for NNTP newsgroup(s).