Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Pass lmc(4) through 'unifdef -U__FreeBSD__ -U__b...



details:   https://anonhg.NetBSD.org/src/rev/ec3717722c09
branches:  trunk
changeset: 747475:ec3717722c09
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Sep 16 21:14:15 2009 +0000

description:
Pass lmc(4) through 'unifdef -U__FreeBSD__ -U__bsdi__ -U__OpenBSD__
-U__linux__ -D__NetBSD__ -UNETGRAPH' to shorten this driver by
>2500 lines.  objdump -D does not reveal any differences in the
compiled code.

diffstat:

 sys/dev/pci/if_lmc.c |  2298 +-------------------------------------------------
 sys/dev/pci/if_lmc.h |   312 +------
 2 files changed, 13 insertions(+), 2597 deletions(-)

diffs (truncated from 3054 to 300 lines):

diff -r a9da434c4bf3 -r ec3717722c09 sys/dev/pci/if_lmc.c
--- a/sys/dev/pci/if_lmc.c      Wed Sep 16 20:58:07 2009 +0000
+++ b/sys/dev/pci/if_lmc.c      Wed Sep 16 21:14:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lmc.c,v 1.47 2009/05/06 09:25:15 cegger Exp $ */
+/* $NetBSD: if_lmc.c,v 1.48 2009/09/16 21:14:15 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2002-2006 David Boggs. <boggs%boggs.palo-alto.ca.us@localhost>
@@ -72,77 +72,9 @@
  *
  * Send bug reports and improvements to <boggs%boggs.palo-alto.ca.us@localhost>.
  */
-#if defined(__FreeBSD__)
-# include <sys/param.h>        /* OS version */
-# include "opt_inet.h" /* INET */
-# include "opt_inet6.h"        /* INET6 */
-# include "opt_netgraph.h" /* NETGRAPH */
-# if defined(HAVE_KERNEL_OPTION_HEADERS)
-#  include "opt_device_polling.h" /* DEVICE_POLLING */
-# else
-#  include "opt_global.h" /* ALTQ, DEVICE_POLLING */
-# endif
-# include "opt_bpf.h"  /* DEV_BPF */
-# define NBPFILTER DEV_BPF
-# define IOREF_CSR 1   /* 1=IO refs; 0=MEM refs */
-# define IFNET 1
-# define NETDEV 0
-# define NAPI 0
-# define SPPP 1
-# define P2P 0
-# define GEN_HDLC 0
-# define SYNC_PPP 0
-#
-# include <sys/systm.h>
-# include <sys/kernel.h>
-# include <sys/malloc.h>
-# include <sys/mbuf.h>
-# include <sys/socket.h>
-# include <sys/sockio.h>
-# include <sys/mutex.h>
-# include <sys/module.h>
-# include <sys/bus.h>
-# include <net/if.h>
-# include <net/if_types.h>
-# include <net/if_media.h>
-# include <net/netisr.h>
-# include <sys/bus.h>
-# include <machine/resource.h>
-# include <machine/clock.h>
-# include <sys/rman.h>
-# include <vm/vm.h>
-# include <vm/pmap.h>
-# include <dev/pci/pcivar.h>
-# if NETGRAPH
-#  include <netgraph/ng_message.h>
-#  include <netgraph/netgraph.h>
-# endif
-# if INET || INET6
-#  include <netinet/in.h>
-#  include <netinet/in_var.h>
-# endif
-# if SPPP
-#  include <net/if_sppp.h>
-# endif
-# if NBPFILTER
-#  include <net/bpf.h>
-# endif
-# if !defined(NETGRAPH)
-#  define NETGRAPH 0
-# endif
-# if !defined(DEVICE_POLLING)
-#  define DEVICE_POLLING 0
-# endif
-# if !defined(ALTQ)
-#  define ALTQ 0
-# endif
-/* and finally... */
-# include <dev/lmc/if_lmc.h>
-#endif /*__FreeBSD__*/
-
-#if defined(__NetBSD__)
+
 # include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.47 2009/05/06 09:25:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.48 2009/09/16 21:14:15 dyoung Exp $");
 # include <sys/param.h>        /* OS version */
 # include "opt_inet.h" /* INET6, INET */
 # include "opt_altq_enabled.h" /* ALTQ */
@@ -193,171 +125,9 @@
 # endif
 /* and finally... */
 # include "if_lmc.h"
-#endif /*__NetBSD__*/
-
-#if defined(__OpenBSD__)
-# include <sys/param.h>        /* OS version */
-/* -DINET  is passed on the compiler command line */
-/* -DINET6 is passed on the compiler command line */
-/* -DALTQ  is passed on the compiler command line */
-# include "bpfilter.h" /* NBPFILTER */
-# define IOREF_CSR 1   /* 1=IO refs; 0=MEM refs */
-# define IFNET 1
-# define NAPI 0
-# define SPPP 1
-# define P2P 0
-# define GEN_HDLC 0
-# define SYNC_PPP 0
-# define NETGRAPH 0
-# define DEVICE_POLLING 0
-#
-# include <sys/systm.h>
-# include <sys/kernel.h>
-# include <sys/conf.h>
-# include <sys/exec.h>
-# include <sys/module.h>
-# include <sys/mbuf.h>
-# include <sys/socket.h>
-# include <sys/sockio.h>
-# include <sys/device.h>
-# include <net/if.h>
-# include <net/if_types.h>
-# include <net/if_media.h>
-# include <net/netisr.h>
-# include <sys/bus.h>
-# include <sys/intr.h>
-# include <machine/lock.h>
-# include <uvm/uvm_extern.h>
-# include <dev/pci/pcivar.h>
-# if INET || INET6
-#  include <netinet/in.h>
-#  include <netinet/in_var.h>
-# endif
-# if SPPP
-#  include <net/if_sppp.h>
-# endif
-# if NBPFILTER
-#  include <net/bpf.h>
-# endif
-# if !defined(ALTQ)
-#  define ALTQ 0
-# endif
-# undef   NETDEV
-# define  NETDEV 0
-/* and finally... */
-# include "if_lmc.h"
-#endif /*__OpenBSD__*/
-
-#if defined(__bsdi__)
-# include <sys/param.h>        /* OS version */
-/* -DINET  is passed on the compiler command line */
-/* -DINET6 is passed on the compiler command line */
-/* -DPPP   is passed on the compiler command line */
-/* -DCISCO_HDLC is passed on the compiler command line */
-/* -DFR    is passed on the compiler command line */
-# if PPP || CISCO_HDLC || FR
-#  define P2P 1
-# else
-#  define P2P 0
-# endif
-# include "bpfilter.h" /* NBPFILTER */
-# define IOREF_CSR 1   /* 1=IO refs; 0=MEM refs */
-# define IFNET 1
-# define NETDEV 0
-# define NAPI 0
-# define ALTQ 0
-# define SPPP 0
-# define GEN_HDLC 0
-# define SYNC_PPP 0
-# define NETGRAPH 0
-# define DEVICE_POLLING 0
-#
-# include <sys/kernel.h>
-# include <sys/malloc.h>
-# include <sys/mbuf.h>
-# include <sys/socket.h>
-# include <sys/sockio.h>
-# include <sys/device.h>
-# include <sys/reboot.h>
-# include <net/if.h>
-# include <net/if_types.h>
-# include <net/if_media.h>
-# include <net/netisr.h>
-# include <net/raw_cb.h>
-# include <vm/vm.h>
-# include <i386/isa/dma.h>
-# include <i386/isa/isavar.h>
-# include <i386/include/cpu.h>
-# include <i386/pci/pci.h>
-# if INET || INET6
-#  include <netinet/in.h>
-#  include <netinet/in_var.h>
-# endif
-# if P2P
-#  include <net/if_p2p.h>
-#  include <sys/ttycom.h>
-# endif
-# if NBPFILTER
-#  include <net/bpf.h>
-# endif
-/* and finally... */
-# include "if_lmc.h"
-#endif /*__bsdi__*/
-
-#if defined(__linux__)
-# include <linux/version.h> /* OS version */
-# include <linux/config.h>
-# if CONFIG_LANMEDIA_GENHDLC
-#  define GEN_HDLC 1
-# else
-#  define GEN_HDLC 0
-# endif
-# if CONFIG_LANMEDIA_SYNCPPP
-#  define SYNC_PPP 1
-# else
-#  define SYNC_PPP 0
-# endif
-# if CONFIG_LANMEDIA_NAPI
-#  define NAPI 1
-# else
-#  define NAPI 0
-# endif
-# define IOREF_CSR 1   /* 1=IO refs; 0=MEM refs */
-# define BSD 0
-# define IFNET 0
-# define NETDEV 1
-# define ALTQ 0
-# define P2P 0
-# define SPPP 0
-# define NETGRAPH 0
-# define NBPFILTER 0
-# define DEVICE_POLLING 0
-#
-# include <asm/byteorder.h>
-# include <asm/semaphore.h>
-# include <asm/uaccess.h>
-# include <linux/delay.h>
-# include <linux/errno.h>
-# include <linux/if_arp.h>
-# include <linux/init.h>
-# include <linux/kernel.h>
-# include <linux/module.h>
-# include <linux/moduleparam.h>
-# include <linux/netdevice.h>
-# include <linux/pci.h>
-# include <linux/sched.h>
-# include <linux/skbuff.h>
-# include <linux/slab.h>
-# include <linux/spinlock.h>
-# if GEN_HDLC
-#  include <linux/hdlc.h>
-# endif
-# if SYNC_PPP
-#  include <net/syncppp.h>
-# endif
-/* and finally... */
-# include "if_lmc.h"
-#endif /* __linux__ */
+
+
+
 
 /* The SROM is a generic 93C46 serial EEPROM (64 words by 16 bits). */
 /* Data is set up before the RISING edge of CLK; CLK is parked low. */
@@ -2640,87 +2410,6 @@
 
 /* End T1E1 card code */
 
-#if NETGRAPH /* FreeBSD */
-
-static struct stack netgraph_stack =
-  {
-  .ioctl    = netgraph_ioctl,
-  .input    = netgraph_input,
-  .output   = netgraph_output,
-  .watchdog = netgraph_watchdog,
-  .open     = netgraph_open,
-  .attach   = netgraph_attach,
-  .detach   = netgraph_detach,
-  };
-
-static int  /* context: process */
-netgraph_ioctl(softc_t *sc, u_long cmd, void *data)
-  {
-  if (sc->config.debug)
-    printf("%s: netgraph_ioctl() was called\n", NAME_UNIT);
-
-  return EINVAL;
-  }
-
-static void  /* context: interrupt */
-netgraph_input(softc_t *sc, struct mbuf *m)
-  {
-  int error;  /* ignore error */
-
-  NG_SEND_DATA_ONLY(error, sc->ng_hook, m);
-  }
-
-static void  /* context: interrupt */
-netgraph_output(softc_t *sc)



Home | Main Index | Thread Index | Old Index