* [PATCH] more const in skbuff
@ 2003-09-18 17:27 Stephen Hemminger
2003-09-18 20:42 ` Mitchell Blank Jr
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2003-09-18 17:27 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
More test inline functions should take const args.
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h Thu Sep 18 10:24:35 2003
+++ b/include/linux/skbuff.h Thu Sep 18 10:24:35 2003
@@ -306,7 +306,7 @@
*
* Returns true if the queue is empty, false otherwise.
*/
-static inline int skb_queue_empty(struct sk_buff_head *list)
+static inline int skb_queue_empty(const struct sk_buff_head *list)
{
return list->next == (struct sk_buff *)list;
}
@@ -357,7 +357,7 @@
* one of multiple shared copies of the buffer. Cloned buffers are
* shared data so must not be written to under normal circumstances.
*/
-static inline int skb_cloned(struct sk_buff *skb)
+static inline int skb_cloned(const struct sk_buff *skb)
{
return skb->cloned && atomic_read(&skb_shinfo(skb)->dataref) != 1;
}
@@ -369,7 +369,7 @@
* Returns true if more than one person has a reference to this
* buffer.
*/
-static inline int skb_shared(struct sk_buff *skb)
+static inline int skb_shared(const struct sk_buff *skb)
{
return atomic_read(&skb->users) != 1;
}
@@ -477,7 +477,7 @@
*
* Return the length of an &sk_buff queue.
*/
-static inline __u32 skb_queue_len(struct sk_buff_head *list_)
+static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
{
return list_->qlen;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] more const in skbuff
2003-09-18 17:27 [PATCH] more const in skbuff Stephen Hemminger
@ 2003-09-18 20:42 ` Mitchell Blank Jr
2003-09-20 7:42 ` David S. Miller
0 siblings, 1 reply; 3+ messages in thread
From: Mitchell Blank Jr @ 2003-09-18 20:42 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, netdev
Stephen Hemminger wrote:
> -static inline int skb_cloned(struct sk_buff *skb)
> +static inline int skb_cloned(const struct sk_buff *skb)
> {
> return skb->cloned && atomic_read(&skb_shinfo(skb)->dataref) != 1;
> }
Are you sure that atomic_read() is garaunteed to take a const pointer?
My understanding is that an arch could in theory take a spinlock (although
none do currently)
If it is garaunteed to take a const pointer then please fix the inline in
include/asm-parisc/atomic.h or your patch will create a lot of warnings on
that architecture.
Other than that this patch is a strict subset of the "small skbuff.[ch]
tweaks" patch I posted here 2 weeks ago:
http://oss.sgi.com/projects/netdev/archive/2003-09/msg00036.html
Never heard from davem one way or the other on that one.
-Mitch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] more const in skbuff
2003-09-18 20:42 ` Mitchell Blank Jr
@ 2003-09-20 7:42 ` David S. Miller
0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2003-09-20 7:42 UTC (permalink / raw)
To: Mitchell Blank Jr; +Cc: shemminger, netdev
On Thu, 18 Sep 2003 13:42:53 -0700
Mitchell Blank Jr <mitch@sfgoth.com> wrote:
> Are you sure that atomic_read() is garaunteed to take a const pointer?
> My understanding is that an arch could in theory take a spinlock (although
> none do currently)
>
> If it is garaunteed to take a const pointer then please fix the inline in
> include/asm-parisc/atomic.h or your patch will create a lot of warnings on
> that architecture.
I think it is, we decided a bit ago that spinlock based atomics
were a bad idea, and even with that the spinlock atomic_t implementations
do not take the lock in their atomic_read() implementation, they merely
wait to get a sample with the lock clear.
> Other than that this patch is a strict subset of the "small skbuff.[ch]
> tweaks" patch I posted here 2 weeks ago:
> http://oss.sgi.com/projects/netdev/archive/2003-09/msg00036.html
> Never heard from davem one way or the other on that one.
Stuff often slips through the cracks from time to time, silence
doesn't necessary mean outright rejection so resend.
I'm going to apply Stephen's patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-20 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-18 17:27 [PATCH] more const in skbuff Stephen Hemminger
2003-09-18 20:42 ` Mitchell Blank Jr
2003-09-20 7:42 ` David S. Miller
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).