Re: strcut casts unsigned long

Javier Martinez Canillas <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
>>
>> I have C question on skbuff.h.
>> skb->_skb_dst is defined as unsigned long and dst_entry is struct.
>>
>> Why strct dst_entry casts unsigned long skb->_skb_dst?
>>
>> See below
>>
>> static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
>> {
>>        return (struct dst_entry *)skb->_skb_dst;
>> }

In the kernel, logical addresses are stored in variables of type
unsigned long or void *. Thats why _skb_dst is of type unsigned long.

>>
>> Appreciate any answer!
>>
>> --henry
>
> skb->_skb_dst can be a pointer to both destination cache or  routing
> table . We could type cast to any of those .
>
> -Ratheesh
>
>

As Ratheesh said _skb_dst could be a pointer to two diferent data
structures, that is why _skb_dst is not defined as a struct type.

Best regards,

-----------------------------------------
Javier Martínez Canillas
+595 981 88 66 58
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.