Re: Fix for maestro in 2.3.99-preX

From: Olaf Titz (olaf@bigred.inka.de)
Date: Tue Apr 18 2000 - 04:13:55 EST


> FYI: There is "compatmac.h" in 2.2.x exactly for this purpose! Feel

you mean ...in 2.3.x...

The problem with this file is precisely that it is _not_ in 2.2 (and
2.0). It would have to be maintained separately, so people who want to
install a newer driver on an older kernel can just grab the latest
version of this file.

The concept sounds good. Here are some compatibility definitions I'm
already using, straight from the CIPE sources:

/* 2.0 */

#define net_device device
#define ip_select_ident(h,d) (h)->id=htons(ip_id_count++)

typedef unsigned short mm_segment_t;

#define register_netdevice register_netdev
#define unregister_netdevice unregister_netdev

/* not compatible with 2.2, but 2.0.x with x<30 vs x>30 */
#ifdef SO_BINDTODEVICE
  #define iproute(t,o,d) ip_rt_route(t,o,d)
#else
  #define iproute(t,o,d) ip_rt_route(t,o)
#endif

#if LINUX_VERSION_CODE < 131102 /* < 2.0.30 */
  #include <linux/config.h>
  #ifdef CONFIG_IP_FORWARD
    #define ipforward(s,d,o,t) ip_forward(s,d,o,t)
  #else
    #error "Requires IP forwarding enabled in kernel"
  #endif
#else /* >= 2.0.30 */
  #define ipforward(s,d,o,t) (sysctl_ip_forward ? ip_forward(s,d,o,t) : -1)
#endif

__inline__ void dev_init_buffers(struct net_device *dev)
{
    int i;
    for (i = 0; i < DEV_NUMBUFFS; i++) {
        skb_queue_head_init(&dev->buffs[i]);
    }
}

#define kfreeskb(s,t) kfree_skb(s,t)
#define saddr(skb) ((skb)->saddr)
#define daddr(skb) ((skb)->daddr)

/* 2.2 */

#define net_device device
#define ip_select_ident(h,d) (h)->id=htons(ip_id_count++)

#define kfreeskb(s,t) kfree_skb(s)
#define saddr(skb) ((skb)->nh.iph->saddr)
#define daddr(skb) ((skb)->nh.iph->daddr)

/* 2.3 */

#define kfreeskb(s,t) kfree_skb(s)
#define saddr(skb) ((skb)->nh.iph->saddr)
#define daddr(skb) ((skb)->nh.iph->daddr)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:12 EST