Fixed an autoconf error.
[linux-2.6.git] / support / patch-click-1.6.0-linux-2.6.27.10
1 --- click-1.6.0-27/lib/ino.cc.orig      2007-09-11 15:39:22.000000000 -0400
2 +++ click-1.6.0-27/lib/ino.cc   2009-01-20 22:34:50.000000000 -0500
3 @@ -34,6 +34,16 @@
4      _generation = 0;
5  }
6  
7 +#define DT_UNKNOWN      0
8 +#define DT_FIFO         1
9 +#define DT_CHR          2
10 +#define DT_DIR          4
11 +#define DT_BLK          6
12 +#define DT_REG          8
13 +#define DT_LNK          10
14 +#define DT_SOCK         12
15 +#define DT_WHT          14
16 +
17  void
18  ClickIno::cleanup()
19  {
20 --- click-1.6.0-27/include/clicknet/ip.h.orig   2007-07-16 19:47:50.000000000 -0400
21 +++ click-1.6.0-27/include/clicknet/ip.h        2009-01-19 16:01:43.000000000 -0500
22 @@ -5,6 +5,7 @@
23  #include <click/cxxprotect.h>
24  CLICK_CXX_PROTECT
25  #if CLICK_LINUXMODULE
26 +#include <linux/autoconf.h>
27  # include <net/checksum.h>
28  # include <linux/in.h>
29  #else
30 --- click-1.6.0-27/include/click/packet.hh.orig 2007-09-07 16:11:26.000000000 -0400
31 +++ click-1.6.0-27/include/click/packet.hh      2009-01-27 10:13:43.000000000 -0500
32 @@ -452,7 +452,7 @@
33  Packet::mac_header() const
34  {
35  #if CLICK_LINUXMODULE
36 -    return skb()->mac.raw;
37 +    return skb_mac_header(skb());
38  #else
39      return _mac;
40  #endif
41 @@ -462,7 +462,7 @@
42  Packet::network_header() const
43  {
44  #if CLICK_LINUXMODULE
45 -    return skb()->nh.raw;
46 +    return skb_network_header(skb());
47  #else
48      return _nh;
49  #endif
50 @@ -472,7 +472,7 @@
51  Packet::transport_header() const
52  {
53  #if CLICK_LINUXMODULE
54 -    return skb()->h.raw;
55 +    return skb_transport_header(skb());
56  #else
57      return _h;
58  #endif
59 @@ -567,7 +567,7 @@
60  # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 13)
61      memcpy(&skb()->stamp, &timestamp, 8);
62  # else
63 -    skb_set_timestamp(skb(), &timestamp.timeval());
64 +    memcpy(&skb()->tstamp, &timestamp, 8);
65  # endif
66  #else
67      _timestamp = timestamp;
68 @@ -904,7 +904,7 @@
69  Packet::set_mac_header(const unsigned char *h)
70  {
71  #if CLICK_LINUXMODULE  /* Linux kernel module */
72 -    skb()->mac.raw = const_cast<unsigned char *>(h);
73 +    skb()->mac_header = const_cast<unsigned char *>(h);
74  #else                          /* User-space and BSD kernel module */
75      _mac = const_cast<unsigned char *>(h);
76  #endif
77 @@ -914,8 +914,8 @@
78  Packet::set_mac_header(const unsigned char *h, uint32_t len)
79  {
80  #if CLICK_LINUXMODULE  /* Linux kernel module */
81 -    skb()->mac.raw = const_cast<unsigned char *>(h);
82 -    skb()->nh.raw = const_cast<unsigned char *>(h) + len;
83 +    skb()->mac_header = const_cast<unsigned char *>(h);
84 +    skb()->network_header = const_cast<unsigned char *>(h) + len;
85  #else                          /* User-space and BSD kernel module */
86      _mac = const_cast<unsigned char *>(h);
87      _nh = const_cast<unsigned char *>(h) + len;
88 @@ -956,8 +956,8 @@
89  Packet::set_network_header(const unsigned char *h, uint32_t len)
90  {
91  #if CLICK_LINUXMODULE  /* Linux kernel module */
92 -    skb()->nh.raw = const_cast<unsigned char *>(h);
93 -    skb()->h.raw = const_cast<unsigned char *>(h) + len;
94 +    skb()->network_header = const_cast<unsigned char *>(h);
95 +    skb()->transport_header = const_cast<unsigned char *>(h) + len;
96  #else                          /* User-space and BSD kernel module */
97      _nh = const_cast<unsigned char *>(h);
98      _h = const_cast<unsigned char *>(h) + len;
99 @@ -968,7 +968,7 @@
100  Packet::set_network_header_length(uint32_t len)
101  {
102  #if CLICK_LINUXMODULE  /* Linux kernel module */
103 -    skb()->h.raw = skb()->nh.raw + len;
104 +    skb()->transport_header = skb()->network_header + len;
105  #else                          /* User-space and BSD kernel module */
106      _h = _nh + len;
107  #endif
108 @@ -1076,9 +1076,9 @@
109    _h += (_h ? shift : 0);
110  #else
111    struct sk_buff *mskb = skb();
112 -  mskb->mac.raw += (mskb->mac.raw ? shift : 0);
113 -  mskb->nh.raw += (mskb->nh.raw ? shift : 0);
114 -  mskb->h.raw += (mskb->h.raw ? shift : 0);
115 +  mskb->mac_header += (mskb->mac_header ? shift : 0);
116 +  mskb->network_header += (mskb->network_header ? shift : 0);
117 +  mskb->transport_header += (mskb->transport_header ? shift : 0);
118  #endif
119  }
120  
121 --- click-1.6.0-27/include/click/config-linuxmodule.h.orig      2009-01-19 15:07:24.000000000 -0500
122 +++ click-1.6.0-27/include/click/config-linuxmodule.h   2009-01-28 16:05:44.000000000 -0500
123 @@ -27,7 +27,7 @@
124  #define HAVE_FAST_CHECKSUM 1
125  
126  /* Define if 'int64_t' is typedefed to 'long' in linuxmodule. */
127 -#define HAVE_INT64_IS_LONG_LINUXMODULE 1
128 +/* #undef HAVE_INT64_IS_LONG_LINUXMODULE */
129  
130  /* Define if 'int64_t' is typedefed to 'long long' in linuxmodule. */
131  #define HAVE_INT64_IS_LONG_LONG_LINUXMODULE 1
132 @@ -87,12 +87,10 @@
133  #endif
134  
135  /* Include integer type definitions. */
136 -#if !HAVE_LINUXMODULE_2_6
137  # include <linux/autoconf.h>
138 -#endif
139  #include <linux/types.h>
140  typedef ptrdiff_t intptr_t;
141 -typedef unsigned long uintptr_t; /* XXX? */
142 +//typedef unsigned long uintptr_t; /* XXX? */
143  
144  /* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_LINUXMODULE. */
145  #ifdef HAVE_INT64_IS_LONG_LINUXMODULE
146 --- click-1.6.0-27/linuxmodule/Makefile.orig    2009-01-19 15:15:55.000000000 -0500
147 +++ click-1.6.0-27/linuxmodule/Makefile 2009-01-28 16:15:43.000000000 -0500
148 @@ -5,12 +5,12 @@
149  subdir := linuxmodule
150  conf_auxdir = $(top_srcdir)
151  
152 -prefix = /usr/local
153 -exec_prefix = ${prefix}
154 -bindir = /usr/local/bin
155 -sbindir = /usr/local/sbin
156 -libdir = /usr/local/lib
157 -linuxdir = /d/kernels/linux-2.6.27.10-click
158 +prefix = /d/click/click-1.6.0-27/inst
159 +exec_prefix = /d/click/click-1.6.0-27/inst
160 +bindir = /d/click/click-1.6.0-27/inst/bin
161 +sbindir = /d/click/click-1.6.0-27/inst/sbin
162 +libdir = /d/click/click-1.6.0-27/inst/lib
163 +linuxdir = /d/kernels/linux-2.6.27.10-clickport
164  
165  LIB_CXX_OBJS = string.o straccum.o nameinfo.o \
166         bitvector.o vectorv.o templatei.o bighashmap_arena.o \
167 @@ -53,7 +53,7 @@
168  ##########################################################################
169  ## LINUX 2.6                                                           ##
170  
171 -KERNELPATH = /d/kernels/linux-2.6.27.10-click
172 +KERNELPATH = /d/kernels/linux-2.6.27.10-clickport
173  
174  ifeq ($(KBUILD_EXTMOD),)
175  top_srcdir := ..
176 @@ -95,7 +95,7 @@
177  
178  CLICKDEFS = -DHAVE_CONFIG_H 
179  CLICKINCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
180 -       -I$(srcdir) -I$(top_srcdir) -I$(linuxdir)/include
181 +       -I$(srcdir) -I$(top_srcdir) -I$(linuxdir)/include -I$(linuxdir)/include/asm/mach-default
182  
183  CXXCOMPILE = $(CLICKCXX) $(LINUXCFLAGS) $(CLICKCPPFLAGS) $(CLICKCFLAGS) \
184         $(CLICKCXXFLAGS) $(CLICKDEFS) $(CLICKINCLUDES) $(CLICKDEPCFLAGS)
185 --- click-1.6.0-27/linuxmodule/sched.cc.orig    2007-08-28 19:01:58.000000000 -0400
186 +++ click-1.6.0-27/linuxmodule/sched.cc 2009-01-26 16:55:57.000000000 -0500
187 @@ -228,7 +228,7 @@
188    click_thread_priority = priority;
189    if (click_thread_pids)
190      for (int i = 0; i < click_thread_pids->size(); i++) {
191 -      struct task_struct *task = find_task_by_pid((*click_thread_pids)[i]);
192 +      struct task_struct *task = find_task_by_vpid((*click_thread_pids)[i]);
193        if (task)
194         TASK_PRIO(task) = priority;
195      }
196 @@ -429,7 +429,7 @@
197      SOFT_SPIN_LOCK(&click_thread_lock);
198      for (int i = 0; i < click_thread_pids->size(); i++) {
199        printk("<1>click:   router thread pid %d\n", (*click_thread_pids)[i]);
200 -      struct task_struct *ct = find_task_by_pid((*click_thread_pids)[i]);
201 +      struct task_struct *ct = find_task_by_vpid((*click_thread_pids)[i]);
202        if (ct)
203           printk("<1>click:   state %d, EIP %08x\n", (int) ct->state, KSTK_EIP(ct));
204      }
205 --- click-1.6.0-27/linuxmodule/proclikefs.c.orig        2007-07-16 19:47:50.000000000 -0400
206 +++ click-1.6.0-27/linuxmodule/proclikefs.c     2009-01-26 17:17:09.000000000 -0500
207 @@ -20,6 +20,7 @@
208  #undef CLICK_LINUXMODULE
209  #include <linux/version.h>
210  #include <linux/autoconf.h>
211 +#include <linux/list.h>
212  #ifndef EXPORT_SYMTAB
213  # define EXPORT_SYMTAB
214  #endif
215 @@ -73,7 +74,7 @@
216      char name[1];
217  };
218  
219 -static LIST_HEAD(fs_list);
220 +static struct list_head fs_list;
221  static spinlock_t fslist_lock;
222  extern spinlock_t inode_lock;
223  extern spinlock_t sb_lock;
224 @@ -357,7 +358,7 @@
225         fo->unlocked_ioctl = (void *) return_EIO;
226         fo->compat_ioctl = (void *) return_EIO;
227         fo->aio_fsync = (void *) return_EIO;
228 -       fo->sendfile = (void *) return_EIO;
229 +       //fo->sendfile = (void *) return_EIO;
230         fo->check_flags = (void *) return_EIO;
231         fo->flock = (void *) return_EIO;
232  #endif
233 @@ -533,10 +534,12 @@
234  int
235  init_module(void)
236  {
237 -    proclikefs_null_super_operations.read_inode = proclikefs_read_inode;
238 +    //proclikefs_null_super_operations.read_inode = proclikefs_read_inode;
239      proclikefs_null_super_operations.put_super = proclikefs_put_super;
240      proclikefs_null_root_inode_operations.lookup = proclikefs_null_root_lookup;
241      spin_lock_init(&fslist_lock);
242 +    INIT_LIST_HEAD(&fs_list);
243 +    printk (KERN_CRIT "Initializing module\n");
244      return 0;
245  }
246  
247 --- click-1.6.0-27/linuxmodule/Makefile.in.orig 2007-09-12 18:26:17.000000000 -0400
248 +++ click-1.6.0-27/linuxmodule/Makefile.in      2009-01-27 12:21:27.000000000 -0500
249 @@ -95,7 +95,7 @@
250  
251  CLICKDEFS = @DEFS@ 
252  CLICKINCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
253 -       -I$(srcdir) -I$(top_srcdir) -I$(linuxdir)/include
254 +       -I$(srcdir) -I$(top_srcdir) -I$(linuxdir)/include -I$(linuxdir)/include/asm/mach-default
255  
256  CXXCOMPILE = $(CLICKCXX) $(LINUXCFLAGS) $(CLICKCPPFLAGS) $(CLICKCFLAGS) \
257         $(CLICKCXXFLAGS) $(CLICKDEFS) $(CLICKINCLUDES) $(CLICKDEPCFLAGS)
258 --- click-1.6.0-27/elements/linuxmodule/tohost.cc.orig  2007-08-31 11:21:55.000000000 -0400
259 +++ click-1.6.0-27/elements/linuxmodule/tohost.cc       2009-01-26 16:52:00.000000000 -0500
260 @@ -143,7 +143,7 @@
261  
262      // do not call eth_type_trans; it changes pkt_type! Instead, do its work
263      // directly.
264 -    skb->mac.raw = skb->data;
265 +    skb->mac_header = skb->data;
266      skb_pull(skb, 14);
267  
268  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
269 --- click-1.6.0-27/elements/linuxmodule/fromdevice.cc.orig      2007-08-29 04:01:48.000000000 -0400
270 +++ click-1.6.0-27/elements/linuxmodule/fromdevice.cc   2009-01-26 14:38:07.000000000 -0500
271 @@ -258,7 +258,7 @@
272         assert(skb_shared(skb) == 0); /* else skb = skb_clone(skb, GFP_ATOMIC); */
273  
274         /* Retrieve the MAC header. */
275 -       skb_push(skb, skb->data - skb->mac.raw);
276 +       skb_push(skb, skb->data - skb_mac_header(skb));
277  
278         Packet *p = Packet::make(skb);
279         _queue[_tail] = p; /* hand it to run_task */
280 --- click-1.6.0-27/elements/linuxmodule/fromhost.cc.orig        2007-07-16 19:47:50.000000000 -0400
281 +++ click-1.6.0-27/elements/linuxmodule/fromhost.cc     2009-01-26 15:16:05.000000000 -0500
282 @@ -121,7 +121,7 @@
283      used = this;
284      
285      // check for existing device
286 -    _dev = dev_get_by_name(_devname.c_str());
287 +    _dev = dev_get_by_name(&init_net, _devname.c_str());
288      if (_dev) {
289         if (_dev->open != fl_open) {
290             dev_put(_dev);
291 @@ -175,16 +175,16 @@
292  
293      ifr.ifr_hwaddr.sa_family = _dev->type;
294      memcpy(ifr.ifr_hwaddr.sa_data, _macaddr.data(), 6);
295 -    if ((res = dev_ioctl(SIOCSIFHWADDR, &ifr)) < 0)
296 +    if ((res = dev_ioctl(&init_net, SIOCSIFHWADDR, &ifr)) < 0)
297         errh->error("error %d setting hardware address for device '%s'", res, _devname.c_str());
298  
299      sin->sin_family = AF_INET;
300      sin->sin_addr = _destaddr;
301 -    if (res >= 0 && (res = devinet_ioctl(SIOCSIFADDR, &ifr)) < 0)
302 +    if (res >= 0 && (res = devinet_ioctl(&init_net,SIOCSIFADDR, &ifr)) < 0)
303         errh->error("error %d setting address for device '%s'", res, _devname.c_str());
304  
305      sin->sin_addr = _destmask;
306 -    if (res >= 0 && (res = devinet_ioctl(SIOCSIFNETMASK, &ifr)) < 0)
307 +    if (res >= 0 && (res = devinet_ioctl(&init_net,SIOCSIFNETMASK, &ifr)) < 0)
308         errh->error("error %d setting netmask for device '%s'", res, _devname.c_str());
309  
310      set_fs(oldfs);
311 @@ -202,9 +202,9 @@
312      mm_segment_t oldfs = get_fs();
313      set_fs(get_ds());
314  
315 -    (void) dev_ioctl(SIOCGIFFLAGS, &ifr);
316 +    (void) dev_ioctl(&init_net, SIOCGIFFLAGS, &ifr);
317      ifr.ifr_flags = (up > 0 ? ifr.ifr_flags | flags : ifr.ifr_flags & ~flags);
318 -    if ((res = dev_ioctl(SIOCSIFFLAGS, &ifr)) < 0 && errh)
319 +    if ((res = dev_ioctl(&init_net, SIOCSIFFLAGS, &ifr)) < 0 && errh)
320         errh->error("error %d bringing %s device '%s'", res, (up > 0 ? "up" : "down"), dev->name);
321  
322      set_fs(oldfs);
323 --- click-1.6.0-27/elements/linuxmodule/anydevice.cc.orig       2007-08-29 04:03:55.000000000 -0400
324 +++ click-1.6.0-27/elements/linuxmodule/anydevice.cc    2009-01-21 14:44:39.000000000 -0500
325 @@ -49,7 +49,7 @@
326  int
327  AnyDevice::find_device(AnyDeviceMap *adm, ErrorHandler *errh)
328  {
329 -    _dev = dev_get_by_name(_devname.c_str());
330 +    _dev = dev_get_by_name(&init_net,_devname.c_str());
331      _devname_exists = (bool) _dev;
332      if (!_dev)
333         _dev = dev_get_by_ether_address(_devname, this);
334 @@ -233,7 +233,7 @@
335         return 0;
336      read_lock(&dev_base_lock);
337      net_device *dev;
338 -    for (dev = dev_base; dev; dev = dev->next)
339 +    for_each_netdev(&init_net, dev)//for (dev = dev_base; dev; dev = dev->next)
340         if ((dev->type == ARPHRD_ETHER || dev->type == ARPHRD_80211)
341             && memcmp(en, dev->dev_addr, 6) == 0) {
342             dev_hold(dev);      // dev_get_by_name does dev_hold; so
343 --- click-1.6.0-27/elements/linuxmodule/todevice.cc.orig        2007-09-14 12:19:28.000000000 -0400
344 +++ click-1.6.0-27/elements/linuxmodule/todevice.cc     2009-01-26 16:50:39.000000000 -0500
345 @@ -21,6 +21,8 @@
346   * legally binding.
347   */
348  
349 +#include <linux/autoconf.h>
350 +#include <linux/version.h>
351  #include <click/config.h>
352  #include <click/glue.hh>
353  #include "polldevice.hh"
354 @@ -243,12 +245,12 @@
355      }
356  # else
357      local_bh_disable();
358 -    if (!spin_trylock(&_dev->xmit_lock)) {
359 +    if (!spin_trylock(&_dev->_tx[0]._xmit_lock)) {
360         local_bh_enable();
361         _task.fast_reschedule();
362         return false;
363      }
364 -    _dev->xmit_lock_owner = smp_processor_id();
365 +    _dev->_tx[0].xmit_lock_owner = smp_processor_id();
366  # endif
367  #endif
368  
369 @@ -316,7 +318,7 @@
370      // (or until Linux sends another packet) unless we poke
371      // net_bh(), which calls qdisc_restart(). We are not allowed
372      // to call qdisc_restart() ourselves, outside of net_bh().
373 -    if (is_polling && !busy && _dev->qdisc->q.qlen) {
374 +    if (is_polling && !busy && _dev->_tx[0].qdisc->q.qlen) {
375         _dev->tx_eob(_dev);
376         netif_wake_queue(_dev);
377      }
378 @@ -349,8 +351,8 @@
379  # if HAVE_NETIF_TX_LOCK
380      netif_tx_unlock_bh(_dev);
381  # else
382 -    _dev->xmit_lock_owner = -1;
383 -    spin_unlock(&_dev->xmit_lock);
384 +    _dev->_tx[0].xmit_lock_owner = -1;
385 +    spin_unlock(&_dev->_tx[0]._xmit_lock);
386      local_bh_enable();
387  # endif
388  #endif
389 --- click-1.6.0-27/elements/standard/addressinfo.cc.orig        2007-09-12 02:14:04.000000000 -0400
390 +++ click-1.6.0-27/elements/standard/addressinfo.cc     2009-01-21 13:08:40.000000000 -0500
391 @@ -272,7 +272,7 @@
392      // if it's a device name, return a primary IP address
393  #if CLICK_LINUXMODULE
394  # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
395 -    net_device *dev = dev_get_by_name(s.c_str());
396 +    net_device *dev = dev_get_by_name(&init_net,s.c_str());
397      if (dev) {
398         bool found = false;
399         in_device *in_dev = in_dev_get(dev);
400 @@ -383,7 +383,7 @@
401  # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
402  #  define dev_put(dev) /* nada */
403  # endif
404 -    net_device *dev = dev_get_by_name(s.c_str());
405 +    net_device *dev = dev_get_by_name(&init_net,s.c_str());
406      if (dev && (dev->type == ARPHRD_ETHER || dev->type == ARPHRD_80211)) {
407         memcpy(store, dev->dev_addr, 6);
408         dev_put(dev);
409 --- click-1.6.0-27/config-linuxmodule.h.in.orig 2007-09-18 16:24:46.000000000 -0400
410 +++ click-1.6.0-27/config-linuxmodule.h.in      2009-01-28 16:06:28.000000000 -0500
411 @@ -86,12 +86,10 @@
412  #endif
413  
414  /* Include integer type definitions. */
415 -#if !HAVE_LINUXMODULE_2_6
416  # include <linux/autoconf.h>
417 -#endif
418  #include <linux/types.h>
419  typedef ptrdiff_t intptr_t;
420 -typedef unsigned long uintptr_t; /* XXX? */
421 +//typedef unsigned long uintptr_t; /* XXX? */
422  
423  /* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_LINUXMODULE. */
424  #ifdef HAVE_INT64_IS_LONG_LINUXMODULE
425 --- click-1.6.0-27/configure.in.orig    2007-09-18 16:40:01.000000000 -0400
426 +++ click-1.6.0-27/configure.in 2009-01-27 12:14:10.000000000 -0500
427 @@ -12,6 +12,7 @@
428  dnl legally binding.
429  
430  AC_INIT(click, 1.6.0)
431 +set +x +v
432  AC_PREREQ(2.50)
433  AC_CONFIG_HEADER(include/click/config.h:config.h.in include/click/pathvars.h:pathvars.h.in include/click/config-bsdmodule.h:config-bsdmodule.h.in include/click/config-linuxmodule.h:config-linuxmodule.h.in include/click/config-ns.h:config-ns.h.in include/click/config-userlevel.h:config-userlevel.h.in)
434  
435 @@ -848,8 +849,7 @@
436      SAVE_CXX="$CXX"
437      CXX="$KERNEL_CXX"
438      saveflags="$CPPFLAGS"
439 -    CPPFLAGS="$saveflags -D__KERNEL__ -I$linuxdir/include $LINUX_CFLAGS"
440 -
441 +    CPPFLAGS="$saveflags -D__KERNEL__ -I$linuxdir/include -I$linuxdir/include/asm/mach-default $LINUX_CFLAGS" 
442  
443      # CLICK_LINUXMODULE_PROLOGUE()
444      AC_DEFUN([CLICK_LINUXMODULE_PROLOGUE], [[#if HAVE_LINUXMODULE_2_6