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;
}
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
On Thu, 18 Sep 2003 13:42:53 -0700
Mitchell Blank Jr [off-list ref] 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.