extern "C include" {
#include <linux/config.h>
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#  define MODVERSIONS /* force it on */
#endif

#include <linux/modversions.h>
#include <linux/modules/mii.ver> /* redefine "export_function" to include CRC */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include "cyclone.h" //cyc_call macros

  //these functions are gcc internals that are used liberally in the kernel
  extern int __builtin_constant_p(int a);
  extern int __builtin_expect(long a, long b);
}
cyclone_override {
  struct net_device
  {
    char			name[IFNAMSIZ]@zeroterm;
    unsigned long		rmem_end;	/* shmem "recv" end	*/
    unsigned long		rmem_start;	/* shmem "recv" start	*/
    unsigned long		mem_end;	/* shared mem end	*/
    unsigned long		mem_start;	/* shared mem start	*/
    unsigned long		base_addr;	/* device I/O address	*/
    unsigned int		irq;		/* device IRQ number	*/
    unsigned char		if_port;	/* Selectable AUI, TP,..*/
    unsigned char		dma;		/* DMA channel		*/
    unsigned long		state;
    struct net_device	*next; //NKS -- inaccurate, but this driver should never access the next device
    int			(*init)(struct net_device *dev);
    struct net_device	*next_sched;
    int			ifindex;
    int			iflink;
    struct net_device_stats* (*get_stats)(struct net_device *dev);//NKS qual 'a
    struct iw_statistics*	(*get_wireless_stats)(struct net_device *dev);
    struct iw_handler_def *	wireless_handlers;
    unsigned long		trans_start;	/* Time (in jiffies) of last Tx	*/
    unsigned long		last_rx;	/* Time of last Rx	*/
    unsigned short		flags;	/* interface flags (a la BSD)	*/
    unsigned short		gflags;
    unsigned short          priv_flags; /* Like 'flags' but invisible to userspace. */
    unsigned short          unused_alignment_fixer; /* Because we need priv_flags,*/
    unsigned		mtu;	/* interface MTU value		*/
    unsigned short		type;	/* interface hardware type	*/
    unsigned short		hard_header_len;	/* hardware hdr length	*/
    void			*priv;	/* pointer to private data	*/
    struct net_device	*master; /* Pointer to master device of a group,*/
    unsigned char		broadcast[MAX_ADDR_LEN];	/* hw bcast add	*/
    unsigned char		dev_addr[MAX_ADDR_LEN];	/* hw address	*/
    unsigned char		addr_len;	/* hardware address length	*/
    struct dev_mc_list	*mc_list;	/* Multicast mac addresses	*/
    int			mc_count;	/* Number of installed mcasts	*/
    int			promiscuity;
    int			allmulti;
    int			watchdog_timeo;
    struct timer_list	watchdog_timer;
    void 			*atalk_ptr;	/* AppleTalk link 	*/
    void			*ip_ptr;	/* IPv4 specific data	*/  
    void                    *dn_ptr;        /* DECnet specific data */
    void                    *ip6_ptr;       /* IPv6 specific data */
    void			*ec_ptr;	/* Econet specific data	*/
    struct list_head	poll_list;	/* Link to poll list	*/
    int			quota;
    int			weight;
    struct Qdisc		*qdisc;
    struct Qdisc		*qdisc_sleeping;
    struct Qdisc		*qdisc_list;
    struct Qdisc		*qdisc_ingress;
    unsigned long		tx_queue_len;	/* Max frames per queue allowed */
    spinlock_t		xmit_lock;
    int			xmit_lock_owner;
    spinlock_t		queue_lock;
    atomic_t		refcnt;
    int			deadbeaf;
    int			features;
    void			(*uninit)(struct net_device *dev);
    void			(*destructor)(struct net_device *dev);
    int			(*open)(struct net_device *dev); //NKS qual 'a
    int			(*stop)(struct net_device *dev); //NKS qual 'a
    int			(*hard_start_xmit) (struct sk_buff *skb,
					    struct net_device *dev); //NKS qual 'a
    int			(*poll) (struct net_device *dev, int *quota); //NKS qual 'a
    int			(*hard_header) (struct sk_buff *skb,
					struct net_device *dev, 
					unsigned short type,
					void *daddr,
					void *saddr,
					unsigned len);
    int			(*rebuild_header)(struct sk_buff *skb);
    void			(*set_multicast_list)(struct net_device *dev);//NKS qual 'a
    int			(*set_mac_address)(struct net_device *dev,
					   void *addr);
    int			(*do_ioctl)(struct net_device *dev,
				    struct ifreq *ifr, int cmd);
    int			(*set_config)(struct net_device *dev,
				      struct ifmap *map);
    int			(*hard_header_cache)(struct neighbour *neigh,
					     struct hh_cache *hh);
    void			(*header_cache_update)(struct hh_cache *hh,
						       struct net_device *dev,
						       unsigned char *  haddr);
    int			(*change_mtu)(struct net_device *dev, int new_mtu);
    void			(*tx_timeout) (struct net_device *dev);
    void			(*vlan_rx_register)(struct net_device *dev,
						    struct vlan_group *grp);
    void			(*vlan_rx_add_vid)(struct net_device *dev,
						   unsigned short vid);
    void			(*vlan_rx_kill_vid)(struct net_device *dev,
						    unsigned short vid);
    int			(*hard_header_parse)(struct sk_buff *skb,
					     unsigned char *haddr);
    int			(*neigh_setup)(struct net_device *dev, struct neigh_parms *);
    int			(*accept_fastpath)(struct net_device *, struct dst_entry*);
    struct module *owner;
    struct net_bridge_port	*br_port;
#ifdef CONFIG_NET_FASTROUTE
    rwlock_t		fastpath_lock;
    struct dst_entry	*fastpath[NETDEV_FASTROUTE_HMASK+1];
#endif
#ifdef CONFIG_NET_DIVERT
    struct divert_blk	*divert;
#endif /* CONFIG_NET_DIVERT */
  };
 
  struct module_symbol
  {
    unsigned long value __attribute__((no_throw));
    const char *@nozeroterm name;
  };
 
  extern int cyc_runtime_register_thread(struct _tls_slot<`r> *`r slot) __attribute__((no_throw));
  extern int cyc_runtime_unregister_thread() __attribute__((no_throw));
 
  extern int cyc_runtime_register_thread_dbg(struct _tls_slot<`r> *`r slot, const char *fname) __attribute__((no_throw));
  extern int cyc_runtime_unregister_thread_dbg(const char *fname) __attribute__((no_throw));

  extern int foobar(void *a) __attribute__((no_throw));

  struct _tls_slot<`r::R> {
    unsigned int pid;
    unsigned int usage_count;
    tls_record_t *`r record;
  };
}
export { * }





/*
#if defined(EXPORT_SYMTAB)
  #undef EXPORT_SYMBOL //prevent cyc driver from using EXPORT_SYMBOL
  #define __CYC_EXPORT_SYMBOL(sym, str)                   \
  const char __kstrtab_##sym[]@zeroterm			\
  __attribute__((section(".kstrtab"))) = str;		\
  const struct module_symbol __ksymtab_##sym \
  __attribute__((section("__ksymtab"))) =			\
  { (void*)&sym, __kstrtab_##sym }
  
  #define CYC_EXPORT_SYMBOL(var)  __CYC_EXPORT_SYMBOL(var, __MODULE_STRING(__VERSIONED_SYMBOL(var)))
  
  #endif
*/
