]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
unsigned [int] -> uint
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Tue, 19 May 2015 06:53:34 +0000 (08:53 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Mon, 8 Jun 2015 00:24:08 +0000 (02:24 +0200)
32 files changed:
client/commands.c
conf/conf.h
lib/bitops.c
lib/bitops.h
lib/checksum.c
lib/checksum.h
lib/ip.h
lib/mempool.c
lib/printf.c
lib/slab.c
lib/socket.h
lib/xmalloc.c
misc/ips.c
nest/a-path.c
nest/a-set.c
nest/attrs.h
nest/cli.c
nest/cli.h
nest/neighbor.c
nest/proto.c
nest/protocol.h
nest/route.h
nest/rt-attr.c
nest/rt-fib.c
nest/rt-table.c
proto/bgp/attrs.c
proto/bgp/bgp.h
proto/bgp/packets.c
sysdep/bsd/krt-sock.c
sysdep/linux/netlink.c
sysdep/unix/main.c
sysdep/unix/unix.h

index 08e7949a15e406fbc1b4cb31d14a91a6521f5b87..50fcba409ff8eaf3cecca35fd8a2b35059033163 100644 (file)
@@ -38,7 +38,7 @@ static struct cmd_node cmd_root;
 void
 cmd_build_tree(void)
 {
-  unsigned int i;
+  uint i;
 
   cmd_root.plastson = &cmd_root.son;
 
index 6ab53e25c3205eeb5c609875c6c6ba320241a991..515efbb36146d146c075279d090cfd2daf5734cd 100644 (file)
@@ -100,7 +100,7 @@ void cfg_copy_list(list *dest, list *src, unsigned node_size);
 
 /* Lexer */
 
-extern int (*cf_read_hook)(byte *buf, unsigned int max, int fd);
+extern int (*cf_read_hook)(byte *buf, uint max, int fd);
 
 struct symbol {
   struct symbol *next;
index b63274b8f1df30d917cd7f88f9ec1e467e7b3279..81586e8798b15a73e130368d4f1638aee7f8aede 100644 (file)
@@ -17,7 +17,7 @@
  * representation consists of @n ones followed by zeroes.
  */
 u32
-u32_mkmask(unsigned n)
+u32_mkmask(uint n)
 {
   return n ? ~((1 << (32 - n)) - 1) : 0;
 }
index a12f6b609299bfc47e8ada84c19d203614925772..c0ad1a708a08fe0812009fba84f61f353e79f5cf 100644 (file)
@@ -18,7 +18,7 @@
  *     u32_masklen     Inverse operation to u32_mkmask, -1 if not a bitmask.
  */
 
-u32 u32_mkmask(unsigned n);
+u32 u32_mkmask(uint n);
 int u32_masklen(u32 x);
 
 u32 u32_log2(u32 v);
index 18b1f92c07b7fe3f1df8af0ea669221c0a1c367c..b61306b34d70226c9ffbbd39f524eac8eba045b2 100644 (file)
@@ -28,7 +28,7 @@ add32(u32 sum, u32 x)
 }
 
 static u16
-ipsum_calc_block(u32 *buf, unsigned len, u16 isum)
+ipsum_calc_block(u32 *buf, uint len, u16 isum)
 {
   /*
    *  A few simple facts about the IP checksum (see RFC 1071 for detailed
@@ -57,7 +57,7 @@ ipsum_calc_block(u32 *buf, unsigned len, u16 isum)
 }
 
 static u16
-ipsum_calc(void *frag, unsigned len, va_list args)
+ipsum_calc(void *frag, uint len, va_list args)
 {
   u16 sum = 0;
 
@@ -67,7 +67,7 @@ ipsum_calc(void *frag, unsigned len, va_list args)
       frag = va_arg(args, void *);
       if (!frag)
        break;
-      len = va_arg(args, unsigned);
+      len = va_arg(args, uint);
     }
   return sum;
 }
@@ -87,7 +87,7 @@ ipsum_calc(void *frag, unsigned len, va_list args)
  * Result: 1 if the checksum is correct, 0 else.
  */
 int
-ipsum_verify(void *frag, unsigned len, ...)
+ipsum_verify(void *frag, uint len, ...)
 {
   va_list args;
   u16 sum;
@@ -110,7 +110,7 @@ ipsum_verify(void *frag, unsigned len, ...)
  * up checksum calculation as much as possible.
  */
 u16
-ipsum_calculate(void *frag, unsigned len, ...)
+ipsum_calculate(void *frag, uint len, ...)
 {
   va_list args;
   u16 sum;
index 81515543235f78f55e2332a1cf2b672c889c3298..16cbcce5a10d7ce4bd364c20df2c4422830c93d5 100644 (file)
@@ -14,7 +14,7 @@
  *     fragments finished by NULL pointer.
  */
 
-int ipsum_verify(void *frag, unsigned len, ...);
-u16 ipsum_calculate(void *frag, unsigned len, ...);
+int ipsum_verify(void *frag, uint len, ...);
+u16 ipsum_calculate(void *frag, uint len, ...);
 
 #endif
index 45e073d9f31c5476bee67a654dbb8b67647aacbf..90bb7f8acf4148fed7069e533fea588d5fe4b282 100644 (file)
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -471,11 +471,11 @@ int ip6_pton(char *a, ip6_addr *o);
 #define ipa_in_net(x,n,p) (ipa_zero(ipa_and(ipa_xor((n),(x)),ipa_mkmask(p))))
 #define net_in_net(n1,l1,n2,l2) (((l1) >= (l2)) && (ipa_zero(ipa_and(ipa_xor((n1),(n2)),ipa_mkmask(l2)))))
 
-char *ip_scope_text(unsigned);
+char *ip_scope_text(uint);
 
 struct prefix {
   ip_addr addr;
-  unsigned int len;
+  uint len;
 };
 
 
index ec9854a9b55231ae03ed78ef73f93b339d830535..a8281041d8affa4cc1fbc6eb1546dfe00363520e 100644 (file)
@@ -27,7 +27,7 @@
 
 struct lp_chunk {
   struct lp_chunk *next;
-  unsigned int size;
+  uint size;
   uintptr_t data_align[0];
   byte data[0];
 };
@@ -37,7 +37,7 @@ struct linpool {
   byte *ptr, *end;
   struct lp_chunk *first, *current, **plast;   /* Normal (reusable) chunks */
   struct lp_chunk *first_large;                        /* Large chunks */
-  unsigned chunk_size, threshold, total, total_large;
+  uint chunk_size, threshold, total, total_large;
 };
 
 static void lp_free(resource *);
@@ -64,7 +64,7 @@ static struct resclass lp_class = {
  * @blk.
  */
 linpool
-*lp_new(pool *p, unsigned blk)
+*lp_new(pool *p, uint blk)
 {
   linpool *m = ralloc(p, &lp_class);
   m->plast = &m->first;
@@ -88,7 +88,7 @@ linpool
  * size chunk, an "overflow" chunk is created for it instead.
  */
 void *
-lp_alloc(linpool *m, unsigned size)
+lp_alloc(linpool *m, uint size)
 {
   byte *a = (byte *) BIRD_ALIGN((unsigned long) m->ptr, CPU_STRUCT_ALIGN);
   byte *e = a + size;
@@ -146,7 +146,7 @@ lp_alloc(linpool *m, unsigned size)
  * how to allocate strings without any space overhead.
  */
 void *
-lp_allocu(linpool *m, unsigned size)
+lp_allocu(linpool *m, uint size)
 {
   byte *a = m->ptr;
   byte *e = a + size;
@@ -168,7 +168,7 @@ lp_allocu(linpool *m, unsigned size)
  * clears the allocated memory block.
  */
 void *
-lp_allocz(linpool *m, unsigned size)
+lp_allocz(linpool *m, uint size)
 {
   void *z = lp_alloc(m, size);
 
index a1c3612954dd4052a94771fcea9f95a955a9b547..e4cc3006797541975b1dc3df554d983bbf407b9c 100644 (file)
@@ -355,7 +355,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
                } else if (flags & SIGN)
                        num = va_arg(args, int);
                else
-                       num = va_arg(args, unsigned int);
+                       num = va_arg(args, uint);
                str = number(str, num, base, field_width, precision, flags, size);
                if (!str)
                        return -1;
index 31529c309c0dda80d9fb56657892b54b80f01ffb..5c414f9e126ceba7f4786f3600a2bbdfe05f4ea1 100644 (file)
@@ -51,7 +51,7 @@ static size_t slab_memsize(resource *r);
 
 struct slab {
   resource r;
-  unsigned size;
+  uint size;
   list objs;
 };
 
@@ -71,7 +71,7 @@ struct sl_obj {
 };
 
 slab *
-sl_new(pool *p, unsigned size)
+sl_new(pool *p, uint size)
 {
   slab *s = ralloc(p, &sl_class);
   s->size = size;
@@ -144,7 +144,7 @@ slab_memsize(resource *r)
 
 struct slab {
   resource r;
-  unsigned obj_size, head_size, objs_per_slab, num_empty_heads, data_size;
+  uint obj_size, head_size, objs_per_slab, num_empty_heads, data_size;
   list empty_heads, partial_heads, full_heads;
 };
 
@@ -185,10 +185,10 @@ struct sl_alignment {                     /* Magic structure for testing of alignment */
  * objects of size @size can be allocated.
  */
 slab *
-sl_new(pool *p, unsigned size)
+sl_new(pool *p, uint size)
 {
   slab *s = ralloc(p, &sl_class);
-  unsigned int align = sizeof(struct sl_alignment);
+  uint align = sizeof(struct sl_alignment);
   if (align < sizeof(int))
     align = sizeof(int);
   s->data_size = size;
@@ -214,7 +214,7 @@ sl_new_head(slab *s)
   struct sl_head *h = xmalloc(SLAB_SIZE);
   struct sl_obj *o = (struct sl_obj *)((byte *)h+s->head_size);
   struct sl_obj *no;
-  unsigned int n = s->objs_per_slab;
+  uint n = s->objs_per_slab;
 
   h->first_free = o;
   h->num_full = 0;
index 683cdde3d873e67b05960709043d74f73556011f..fbea92aa79570775d354335b10e593e79e82c26e 100644 (file)
@@ -20,7 +20,7 @@ typedef struct birdsock {
   int type;                            /* Socket type */
   void *data;                          /* User data */
   ip_addr saddr, daddr;                        /* IPA_NONE = unspecified */
-  unsigned sport, dport;               /* 0 = unspecified (for IP: protocol type) */
+  uint sport, dport;                   /* 0 = unspecified (for IP: protocol type) */
   int tos;                             /* TOS / traffic class, -1 = default */
   int priority;                                /* Local socket priority, -1 = default */
   int ttl;                             /* Time To Live, -1 = default */
@@ -28,20 +28,20 @@ typedef struct birdsock {
   struct iface *iface;                 /* Interface; specify this for broad/multicast sockets */
 
   byte *rbuf, *rpos;                   /* NULL=allocate automatically */
-  unsigned rbsize;
+  uint rbsize;
   int (*rx_hook)(struct birdsock *, int size); /* NULL=receiving turned off, returns 1 to clear rx buffer */
 
   byte *tbuf, *tpos;                   /* NULL=allocate automatically */
   byte *ttx;                           /* Internal */
-  unsigned tbsize;
+  uint tbsize;
   void (*tx_hook)(struct birdsock *);
 
   void (*err_hook)(struct birdsock *, int); /* errno or zero if EOF */
 
   /* Information about received datagrams (UDP, RAW), valid in rx_hook */
   ip_addr faddr, laddr;                        /* src (From) and dst (Local) address of the datagram */
-  unsigned fport;                      /* src port of the datagram */
-  unsigned lifindex;                   /* local interface that received the datagram */
+  uint fport;                          /* src port of the datagram */
+  uint lifindex;                       /* local interface that received the datagram */
   /* laddr and lifindex are valid only if SKF_LADDR_RX flag is set to request it */
 
   int af;                              /* Address family (AF_INET, AF_INET6 or 0 for non-IP) of fd */
@@ -59,8 +59,8 @@ sock *sock_new(pool *);                       /* Allocate new socket */
 
 int sk_open(sock *);                   /* Open socket */
 int sk_rx_ready(sock *s);
-int sk_send(sock *, unsigned len);     /* Send data, <0=err, >0=ok, 0=sleep */
-int sk_send_to(sock *, unsigned len, ip_addr to, unsigned port); /* sk_send to given destination */
+int sk_send(sock *, uint len);         /* Send data, <0=err, >0=ok, 0=sleep */
+int sk_send_to(sock *, uint len, ip_addr to, uint port); /* sk_send to given destination */
 void sk_reallocate(sock *);            /* Free and allocate tbuf & rbuf */
 void sk_set_rbsize(sock *s, uint val); /* Resize RX buffer */
 void sk_set_tbsize(sock *s, uint val); /* Resize TX buffer, keeping content */
index da2f09419fea800d17901ae7cbad572deb0fcdc8..10bf28cfece73159fe8743397e2a7f1c9edea918 100644 (file)
@@ -24,7 +24,7 @@
  * Wherever possible, please use the memory resources instead.
  */
 void *
-xmalloc(unsigned size)
+xmalloc(uint size)
 {
   void *p = malloc(size);
   if (p)
@@ -44,7 +44,7 @@ xmalloc(unsigned size)
  * Wherever possible, please use the memory resources instead.
  */
 void *
-xrealloc(void *ptr, unsigned size)
+xrealloc(void *ptr, uint size)
 {
   void *p = realloc(ptr, size);
   if (p)
index 7ea6c71b3db77f53409832c1dc853e0b4a2013cb..467cc25dab0e4d45016d1e9a2c5efa535c08163e 100644 (file)
@@ -23,7 +23,7 @@ int h[65536];
  *     = ((1-1/k)^k)^a which we can approximate by e^-a.
  */
 
-unsigned int hf(unsigned int n)
+uint hf(uint n)
 {
 #if 0
        n = (n ^ (n >> 16)) & 0xffff;
@@ -58,7 +58,7 @@ main(int argc, char **argv)
 
        while (max--)
          {
-           unsigned int i, e;
+           uint i, e;
            if (scanf("%x/%d", &i, &e) != 2)
              if (feof(stdin))
                break;
index dc36e6538951f1c3ca3401290b40e6663c4449ea..c9c5aefb5a71058c9980deb4b5ad350cf1d10ee2 100644 (file)
@@ -124,7 +124,7 @@ as_path_convert_to_new(struct adata *path, byte *dst, int req_as)
 }
 
 void
-as_path_format(struct adata *path, byte *buf, unsigned int size)
+as_path_format(struct adata *path, byte *buf, uint size)
 {
   byte *p = path->data;
   byte *e = p + path->length;
index 42ef9b06352c675f5e66a095d31bc82db06caefa..a61160223753a508e06d75fb99e00715ba7ffaf8 100644 (file)
@@ -32,7 +32,7 @@
  * the buffer to indicate truncation.
  */
 int
-int_set_format(struct adata *set, int way, int from, byte *buf, unsigned int size)
+int_set_format(struct adata *set, int way, int from, byte *buf, uint size)
 {
   u32 *z = (u32 *) set->data;
   byte *end = buf + size - 24;
@@ -113,7 +113,7 @@ ec_format(byte *buf, u64 ec)
 }
 
 int
-ec_set_format(struct adata *set, int from, byte *buf, unsigned int size)
+ec_set_format(struct adata *set, int from, byte *buf, uint size)
 {
   u32 *z = int_set_get_data(set);
   byte *end = buf + size - 24;
index b6e067cb8c6fc144d2b69d4f1a936d6d02626e4f..1d005a6a9269c8c6ccf8cbe923ac3bcfab404f8f 100644 (file)
@@ -30,7 +30,7 @@ struct f_tree;
 struct adata *as_path_prepend(struct linpool *pool, struct adata *olda, u32 as);
 int as_path_convert_to_old(struct adata *path, byte *dst, int *new_used);
 int as_path_convert_to_new(struct adata *path, byte *dst, int req_as);
-void as_path_format(struct adata *path, byte *buf, unsigned int size);
+void as_path_format(struct adata *path, byte *buf, uint size);
 int as_path_getlen(struct adata *path);
 int as_path_getlen_int(struct adata *path, int bs);
 int as_path_get_first(struct adata *path, u32 *orig_as);
@@ -95,9 +95,9 @@ static inline u64 ec_ip4(u64 kind, u64 key, u64 val)
 static inline u64 ec_generic(u64 key, u64 val)
 { return (key << 32) | val; }
 
-int int_set_format(struct adata *set, int way, int from, byte *buf, unsigned int size);
+int int_set_format(struct adata *set, int way, int from, byte *buf, uint size);
 int ec_format(byte *buf, u64 ec);
-int ec_set_format(struct adata *set, int from, byte *buf, unsigned int size);
+int ec_set_format(struct adata *set, int from, byte *buf, uint size);
 int int_set_contains(struct adata *list, u32 val);
 int ec_set_contains(struct adata *list, u64 val);
 struct adata *int_set_add(struct linpool *pool, struct adata *list, u32 val);
index 11f98794d82a6c840fc9c7bbaab3962d50fccb2f..83e79616f8c42d02f45ff9e16fe352a087072c37 100644 (file)
@@ -163,7 +163,7 @@ static void
 cli_copy_message(cli *c)
 {
   byte *p, *q;
-  unsigned int cnt = 2;
+  uint cnt = 2;
 
   if (c->ring_overflow)
     {
@@ -230,12 +230,12 @@ cli_written(cli *c)
 
 
 static byte *cli_rh_pos;
-static unsigned int cli_rh_len;
+static uint cli_rh_len;
 static int cli_rh_trick_flag;
 struct cli *this_cli;
 
 static int
-cli_cmd_read_hook(byte *buf, unsigned int max, UNUSED int fd)
+cli_cmd_read_hook(byte *buf, uint max, UNUSED int fd)
 {
   if (!cli_rh_trick_flag)
     {
@@ -330,7 +330,7 @@ static list cli_log_hooks;
 static int cli_log_inited;
 
 void
-cli_set_log_echo(cli *c, unsigned int mask, unsigned int size)
+cli_set_log_echo(cli *c, uint mask, uint size)
 {
   if (c->ring_buf)
     {
@@ -351,7 +351,7 @@ cli_set_log_echo(cli *c, unsigned int mask, unsigned int size)
 }
 
 void
-cli_echo(unsigned int class, byte *msg)
+cli_echo(uint class, byte *msg)
 {
   unsigned len, free, i, l;
   cli *c;
index 396656e8417d88f4a65280af17e89a2e15824e3b..92f3c3d75262486c0560b20af940abbf6e8bfce2 100644 (file)
@@ -40,10 +40,10 @@ typedef struct cli {
   struct linpool *parser_pool;         /* Pool used during parsing */
   byte *ring_buf;                      /* Ring buffer for asynchronous messages */
   byte *ring_end, *ring_read, *ring_write;     /* Pointers to the ring buffer */
-  unsigned int ring_overflow;          /* Counter of ring overflows */
-  unsigned int log_mask;               /* Mask of allowed message levels */
-  unsigned int log_threshold;          /* When free < log_threshold, store only important messages */
-  unsigned int async_msg_size;         /* Total size of async messages queued in tx_buf */
+  uint ring_overflow;                  /* Counter of ring overflows */
+  uint log_mask;                       /* Mask of allowed message levels */
+  uint log_threshold;                  /* When free < log_threshold, store only important messages */
+  uint async_msg_size;                 /* Total size of async messages queued in tx_buf */
 } cli;
 
 extern pool *cli_pool;
@@ -55,7 +55,7 @@ extern struct cli *this_cli;          /* Used during parsing */
 
 void cli_printf(cli *, int, char *, ...);
 #define cli_msg(x...) cli_printf(this_cli, x)
-void cli_set_log_echo(cli *, unsigned int mask, unsigned int size);
+void cli_set_log_echo(cli *, uint mask, uint size);
 
 /* Functions provided to sysdep layer */
 
@@ -64,7 +64,7 @@ void cli_init(void);
 void cli_free(cli *);
 void cli_kick(cli *);
 void cli_written(cli *);
-void cli_echo(unsigned int class, byte *msg);
+void cli_echo(uint class, byte *msg);
 
 static inline int cli_access_restricted(void)
 {
index 48b6b6ac888805e3ea13f265e594e23f0b040838..1685d67e3bbfa4b36ae549cbc8f7898db7fcc23d 100644 (file)
@@ -49,7 +49,7 @@
 static slab *neigh_slab;
 static list sticky_neigh_list, neigh_hash_table[NEIGH_HASH_SIZE];
 
-static inline unsigned int
+static inline uint
 neigh_hash(struct proto *p, ip_addr *a)
 {
   return (p->hash_key ^ ipa_hash(*a)) & (NEIGH_HASH_SIZE-1);
@@ -126,7 +126,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
 {
   neighbor *n;
   int class, scope = -1;
-  unsigned int h = neigh_hash(p, a);
+  uint h = neigh_hash(p, a);
   struct iface *i;
   struct ifa *addr;
 
index 44cfb637f4249f75d9011c1067630bfa65d369a0..6531083cf804d9027e470b8211fb086bdaced45c 100644 (file)
@@ -1488,7 +1488,7 @@ proto_show_basic_info(struct proto *p)
 }
 
 void
-proto_cmd_show(struct proto *p, unsigned int verbose, int cnt)
+proto_cmd_show(struct proto *p, uint verbose, int cnt)
 {
   byte buf[256], tbuf[TM_DATETIME_BUFFER_SIZE];
 
@@ -1524,7 +1524,7 @@ proto_cmd_show(struct proto *p, unsigned int verbose, int cnt)
 }
 
 void
-proto_cmd_disable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
+proto_cmd_disable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
 {
   if (p->disabled)
     {
@@ -1540,7 +1540,7 @@ proto_cmd_disable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
 }
 
 void
-proto_cmd_enable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
+proto_cmd_enable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
 {
   if (!p->disabled)
     {
@@ -1555,7 +1555,7 @@ proto_cmd_enable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
 }
 
 void
-proto_cmd_restart(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
+proto_cmd_restart(struct proto *p, uint arg UNUSED, int cnt UNUSED)
 {
   if (p->disabled)
     {
@@ -1573,7 +1573,7 @@ proto_cmd_restart(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
 }
 
 void
-proto_cmd_reload(struct proto *p, unsigned int dir, int cnt UNUSED)
+proto_cmd_reload(struct proto *p, uint dir, int cnt UNUSED)
 {
   if (p->disabled)
     {
@@ -1615,19 +1615,19 @@ proto_cmd_reload(struct proto *p, unsigned int dir, int cnt UNUSED)
 }
 
 void
-proto_cmd_debug(struct proto *p, unsigned int mask, int cnt UNUSED)
+proto_cmd_debug(struct proto *p, uint mask, int cnt UNUSED)
 {
   p->debug = mask;
 }
 
 void
-proto_cmd_mrtdump(struct proto *p, unsigned int mask, int cnt UNUSED)
+proto_cmd_mrtdump(struct proto *p, uint mask, int cnt UNUSED)
 {
   p->mrtdump = mask;
 }
 
 static void
-proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, unsigned int, int), unsigned int arg)
+proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uint, int), uint arg)
 {
   if (s->class != SYM_PROTO)
     {
@@ -1640,7 +1640,7 @@ proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, unsigned i
 }
 
 static void
-proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, unsigned int, int), unsigned int arg)
+proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uint, int), uint arg)
 {
   int cnt = 0;
 
@@ -1660,8 +1660,8 @@ proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, unsigned int, int)
 }
 
 void
-proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, unsigned int, int),
-               int restricted, unsigned int arg)
+proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int),
+               int restricted, uint arg)
 {
   if (restricted && cli_access_restricted())
     return;
index 8660cc2c51cb30d87880783f40517f23f421cff8..a51e9afd66f3875b3a07717d0cde82e94ce73d61 100644 (file)
@@ -261,15 +261,15 @@ void proto_graceful_restart_unlock(struct proto *p);
 void proto_show_limit(struct proto_limit *l, const char *dsc);
 void proto_show_basic_info(struct proto *p);
 
-void proto_cmd_show(struct proto *, unsigned int, int);
-void proto_cmd_disable(struct proto *, unsigned int, int);
-void proto_cmd_enable(struct proto *, unsigned int, int);
-void proto_cmd_restart(struct proto *, unsigned int, int);
-void proto_cmd_reload(struct proto *, unsigned int, int);
-void proto_cmd_debug(struct proto *, unsigned int, int);
-void proto_cmd_mrtdump(struct proto *, unsigned int, int);
-
-void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, unsigned int, int), int restricted, unsigned int arg);
+void proto_cmd_show(struct proto *, uint, int);
+void proto_cmd_disable(struct proto *, uint, int);
+void proto_cmd_enable(struct proto *, uint, int);
+void proto_cmd_restart(struct proto *, uint, int);
+void proto_cmd_reload(struct proto *, uint, int);
+void proto_cmd_debug(struct proto *, uint, int);
+void proto_cmd_mrtdump(struct proto *, uint, int);
+
+void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int), int restricted, uint arg);
 struct proto *proto_get_named(struct symbol *, struct protocol *);
 
 #define CMD_RELOAD     0
index 2e6bf74110b48dd2a519d37373eb5a92056c885d..8f3c7c9a887e5736d8c7d049bd561c760d920a0f 100644 (file)
@@ -47,7 +47,7 @@ struct fib_iterator {                 /* See lib/slists.h for an explanation */
   byte efef;                           /* 0xff to distinguish between iterator and node */
   byte pad[3];
   struct fib_node *node;               /* Or NULL if freshly merged */
-  unsigned int hash;
+  uint hash;
 };
 
 typedef void (*fib_init_func)(struct fib_node *);
@@ -56,11 +56,11 @@ struct fib {
   pool *fib_pool;                      /* Pool holding all our data */
   slab *fib_slab;                      /* Slab holding all fib nodes */
   struct fib_node **hash_table;                /* Node hash table */
-  unsigned int hash_size;              /* Number of hash table entries (a power of two) */
-  unsigned int hash_order;             /* Binary logarithm of hash_size */
-  unsigned int hash_shift;             /* 16 - hash_log */
-  unsigned int entries;                        /* Number of entries */
-  unsigned int entries_min, entries_max;/* Entry count limits (else start rehashing) */
+  uint hash_size;                      /* Number of hash table entries (a power of two) */
+  uint hash_order;                     /* Binary logarithm of hash_size */
+  uint hash_shift;                     /* 16 - hash_log */
+  uint entries;                                /* Number of entries */
+  uint entries_min, entries_max;       /* Entry count limits (else start rehashing) */
   fib_init_func init;                  /* Constructor */
 };
 
@@ -78,7 +78,7 @@ void fit_put(struct fib_iterator *, struct fib_node *);
 
 #define FIB_WALK(fib, z) do {                                  \
        struct fib_node *z, **ff = (fib)->hash_table;           \
-       unsigned int count = (fib)->hash_size;                  \
+       uint count = (fib)->hash_size;                          \
        while (count--)                                         \
          for(z = *ff++; z; z=z->next)
 
@@ -88,8 +88,8 @@ void fit_put(struct fib_iterator *, struct fib_node *);
 
 #define FIB_ITERATE_START(fib, it, z) do {                     \
        struct fib_node *z = fit_get(fib, it);                  \
-       unsigned int count = (fib)->hash_size;                  \
-       unsigned int hpos = (it)->hash;                         \
+       uint count = (fib)->hash_size;                          \
+       uint hpos = (it)->hash;                                 \
        for(;;) {                                               \
          if (!z)                                               \
             {                                                  \
@@ -435,7 +435,7 @@ typedef struct eattr {
 #define EAF_TEMP 0x80                  /* A temporary attribute (the one stored in the tmp attr list) */
 
 struct adata {
-  unsigned int length;                 /* Length of data */
+  uint length;                         /* Length of data */
   byte data[0];
 };
 
@@ -475,7 +475,7 @@ void ea_sort(ea_list *);            /* Sort entries in all sub-lists */
 unsigned ea_scan(ea_list *);           /* How many bytes do we need for merged ea_list */
 void ea_merge(ea_list *from, ea_list *to); /* Merge sub-lists to allocated buffer */
 int ea_same(ea_list *x, ea_list *y);   /* Test whether two ea_lists are identical */
-unsigned int ea_hash(ea_list *e);      /* Calculate 16-bit hash value */
+uint ea_hash(ea_list *e);      /* Calculate 16-bit hash value */
 ea_list *ea_append(ea_list *to, ea_list *what);
 void ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max);
 
index c55372082953ef64761cde699437c8720fc67a7d..85a192c8cfde7a9db511e17079f21bbb1aa8dfae 100644 (file)
@@ -98,7 +98,7 @@ rte_src_init(void)
   HASH_INIT(src_hash, rta_pool, RSH_INIT_ORDER);
 }
 
-static inline int u32_cto(unsigned int x) { return ffs(~x) - 1; }
+static inline int u32_cto(uint x) { return ffs(~x) - 1; }
 
 static inline u32
 rte_src_alloc_id(void)
@@ -195,10 +195,10 @@ rt_prune_sources(void)
  *     Multipath Next Hop
  */
 
-static inline unsigned int
+static inline uint
 mpnh_hash(struct mpnh *x)
 {
-  unsigned int h = 0;
+  uint h = 0;
   for (; x; x = x->next)
     h ^= ipa_hash(x->gw);
 
@@ -666,7 +666,7 @@ ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **names,
 }
 
 static inline void
-opaque_format(struct adata *ad, byte *buf, unsigned int size)
+opaque_format(struct adata *ad, byte *buf, uint size)
 {
   byte *bound = buf + size - 10;
   int i;
@@ -838,7 +838,7 @@ ea_dump(ea_list *e)
  * ea_hash() takes an extended attribute list and calculated a hopefully
  * uniformly distributed hash value from its contents.
  */
-inline unsigned int
+inline uint
 ea_hash(ea_list *e)
 {
   u32 h = 0;
@@ -900,10 +900,10 @@ ea_append(ea_list *to, ea_list *what)
  *     rta's
  */
 
-static unsigned int rta_cache_count;
-static unsigned int rta_cache_size = 32;
-static unsigned int rta_cache_limit;
-static unsigned int rta_cache_mask;
+static uint rta_cache_count;
+static uint rta_cache_size = 32;
+static uint rta_cache_limit;
+static uint rta_cache_mask;
 static rta **rta_hash_table;
 
 static void
@@ -917,7 +917,7 @@ rta_alloc_hash(void)
   rta_cache_mask = rta_cache_size - 1;
 }
 
-static inline unsigned int
+static inline uint
 rta_hash(rta *a)
 {
   return (((uint) (uintptr_t) a->src) ^ ipa_hash(a->gw) ^
@@ -957,7 +957,7 @@ rta_copy(rta *o)
 static inline void
 rta_insert(rta *r)
 {
-  unsigned int h = r->hash_key & rta_cache_mask;
+  uint h = r->hash_key & rta_cache_mask;
   r->next = rta_hash_table[h];
   if (r->next)
     r->next->pprev = &r->next;
@@ -968,8 +968,8 @@ rta_insert(rta *r)
 static void
 rta_rehash(void)
 {
-  unsigned int ohs = rta_cache_size;
-  unsigned int h;
+  uint ohs = rta_cache_size;
+  uint h;
   rta *r, *n;
   rta **oht = rta_hash_table;
 
@@ -1002,7 +1002,7 @@ rta *
 rta_lookup(rta *o)
 {
   rta *r;
-  unsigned int h;
+  uint h;
 
   ASSERT(!(o->aflags & RTAF_CACHED));
   if (o->eattrs)
@@ -1093,7 +1093,7 @@ void
 rta_dump_all(void)
 {
   rta *a;
-  unsigned int h;
+  uint h;
 
   debug("Route attribute cache (%d entries, rehash at %d):\n", rta_cache_count, rta_cache_limit);
   for(h=0; h<rta_cache_size; h++)
index b9c7d2a2451f0038c126b4c95750e5d6f5795f4b..aa5e2357f5cb684c61e9e49105521bfb5274d0b3 100644 (file)
@@ -206,7 +206,7 @@ fib_histogram(struct fib *f)
 void *
 fib_get(struct fib *f, ip_addr *a, int len)
 {
-  unsigned int h = ipa_hash(*a);
+  uint h = ipa_hash(*a);
   struct fib_node **ee = f->hash_table + (h >> f->hash_shift);
   struct fib_node *g, *e = *ee;
   u32 uid = h << 16;
@@ -321,7 +321,7 @@ void
 fib_delete(struct fib *f, void *E)
 {
   struct fib_node *e = E;
-  unsigned int h = fib_hash(f, &e->prefix);
+  uint h = fib_hash(f, &e->prefix);
   struct fib_node **ee = f->hash_table + h;
   struct fib_iterator *it;
 
@@ -442,7 +442,7 @@ fit_put(struct fib_iterator *i, struct fib_node *n)
 void
 fib_check(struct fib *f)
 {
-  unsigned int i, ec, lo, nulls;
+  uint i, ec, lo, nulls;
 
   ec = 0;
   for(i=0; i<f->hash_size; i++)
@@ -452,7 +452,7 @@ fib_check(struct fib *f)
       for(n=f->hash_table[i]; n; n=n->next)
        {
          struct fib_iterator *j, *j0;
-         unsigned int h0 = ipa_hash(n->prefix);
+         uint h0 = ipa_hash(n->prefix);
          if (h0 < lo)
            bug("fib_check: discord in hash chains");
          lo = h0;
@@ -489,7 +489,7 @@ struct fib f;
 
 void dump(char *m)
 {
-  unsigned int i;
+  uint i;
 
   debug("%s ... order=%d, size=%d, entries=%d\n", m, f.hash_order, f.hash_size, f.hash_size);
   for(i=0; i<f.hash_size; i++)
index 24517e2c13f3f082066be3669e7fe3c437e86efe..d5af41c76746e2f17609957c1ea40c31024a64cf 100644 (file)
@@ -182,14 +182,14 @@ rte_trace(struct proto *p, rte *e, int dir, char *msg)
 }
 
 static inline void
-rte_trace_in(unsigned int flag, struct proto *p, rte *e, char *msg)
+rte_trace_in(uint flag, struct proto *p, rte *e, char *msg)
 {
   if (p->debug & flag)
     rte_trace(p, e, '>', msg);
 }
 
 static inline void
-rte_trace_out(unsigned int flag, struct proto *p, rte *e, char *msg)
+rte_trace_out(uint flag, struct proto *p, rte *e, char *msg)
 {
   if (p->debug & flag)
     rte_trace(p, e, '<', msg);
@@ -1880,7 +1880,7 @@ hc_hash(ip_addr a, rtable *dep)
 static inline void
 hc_insert(struct hostcache *hc, struct hostentry *he)
 {
-  unsigned int k = he->hash_key >> hc->hash_shift;
+  uint k = he->hash_key >> hc->hash_shift;
   he->next = hc->hash_table[k];
   hc->hash_table[k] = he;
 }
@@ -1889,7 +1889,7 @@ static inline void
 hc_remove(struct hostcache *hc, struct hostentry *he)
 {
   struct hostentry **hep;
-  unsigned int k = he->hash_key >> hc->hash_shift;
+  uint k = he->hash_key >> hc->hash_shift;
 
   for (hep = &hc->hash_table[k]; *hep != he; hep = &(*hep)->next);
   *hep = he->next;
@@ -2154,7 +2154,7 @@ rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep)
   if (!tab->hostcache)
     rt_init_hostcache(tab);
 
-  unsigned int k = hc_hash(a, dep);
+  uint k = hc_hash(a, dep);
   struct hostcache *hc = tab->hostcache;
   for (he = hc->hash_table[k >> hc->hash_shift]; he != NULL; he = he->next)
     if (ipa_equal(he->addr, a) && (he->tab == dep))
index 72b45d478e4f46178cce45bf9f651e9f89f3baea..d56c017d368bb437feff6c8f457f0c07ce16ac50 100644 (file)
@@ -114,7 +114,7 @@ path_segment_contains(byte *p, int bs, u32 asn)
 
 /* Validates path attribute, removes AS_CONFED_* segments, and also returns path length */
 static int
-validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, unsigned int *ilength)
+validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, uint *ilength)
 {
   int res = 0;
   u8 *a, *dst;
@@ -381,7 +381,7 @@ bgp_attach_attr_wa(ea_list **to, struct linpool *pool, unsigned attr, unsigned l
 }
 
 static int
-bgp_encode_attr_hdr(byte *dst, unsigned int flags, unsigned code, int len)
+bgp_encode_attr_hdr(byte *dst, uint flags, unsigned code, int len)
 {
   int wlen;
 
@@ -473,10 +473,10 @@ bgp_get_attr_len(eattr *a)
  *
  * Result: Length of the attribute block generated or -1 if not enough space.
  */
-unsigned int
+uint
 bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains)
 {
-  unsigned int i, code, type, flags;
+  uint i, code, type, flags;
   byte *start = w;
   int len, rv;
 
@@ -1593,11 +1593,11 @@ bgp_remove_as4_attrs(struct bgp_proto *p, rta *a)
  * by a &rta.
  */
 struct rta *
-bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct linpool *pool, int mandatory)
+bgp_decode_attrs(struct bgp_conn *conn, byte *attr, uint len, struct linpool *pool, int mandatory)
 {
   struct bgp_proto *bgp = conn->bgp;
   rta *a = lp_alloc(pool, sizeof(struct rta));
-  unsigned int flags, code, l, i, type;
+  uint flags, code, l, i, type;
   int errcode;
   byte *z, *attr_start;
   byte seen[256/8];
@@ -1791,7 +1791,7 @@ err:
 int
 bgp_get_attr(eattr *a, byte *buf, int buflen)
 {
-  unsigned int i = EA_ID(a->id);
+  uint i = EA_ID(a->id);
   struct attr_desc *d;
   int len;
 
index f4f21226a8bf71e26487ee1899600d6ed815b144..446fc857dc11269f818f4983e4d31b6cce18a2fd 100644 (file)
@@ -90,7 +90,7 @@ struct bgp_config {
 struct bgp_conn {
   struct bgp_proto *bgp;
   struct birdsock *sk;
-  unsigned int state;                  /* State of connection state machine */
+  uint state;                          /* State of connection state machine */
   struct timer *connect_retry_timer;
   struct timer *hold_timer;
   struct timer *keepalive_timer;
@@ -142,7 +142,7 @@ struct bgp_proto {
   struct timer *startup_timer;         /* Timer used to delay protocol startup due to previous errors (startup_delay) */
   struct timer *gr_timer;              /* Timer waiting for reestablishment after graceful restart */
   struct bgp_bucket **bucket_hash;     /* Hash table of attribute buckets */
-  unsigned int hash_size, hash_count, hash_limit;
+  uint hash_size, hash_count, hash_limit;
   HASH(struct bgp_prefix) prefix_hash; /* Prefixes to be sent */
   slab *prefix_slab;                   /* Slab holding prefix nodes */
   list bucket_queue;                   /* Queue of buckets to send */
@@ -235,7 +235,7 @@ static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = ad
 
 void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
 byte *bgp_attach_attr_wa(struct ea_list **to, struct linpool *pool, unsigned attr, unsigned len);
-struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, unsigned int len, struct linpool *pool, int mandatory);
+struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, uint len, struct linpool *pool, int mandatory);
 int bgp_get_attr(struct eattr *e, byte *buf, int buflen);
 int bgp_rte_better(struct rte *, struct rte *);
 int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best);
@@ -245,7 +245,7 @@ void bgp_init_bucket_table(struct bgp_proto *);
 void bgp_free_bucket(struct bgp_proto *p, struct bgp_bucket *buck);
 void bgp_init_prefix_table(struct bgp_proto *p, u32 order);
 void bgp_free_prefix(struct bgp_proto *p, struct bgp_prefix *bp);
-unsigned int bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains);
+uint bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains);
 void bgp_get_route_info(struct rte *, byte *buf, struct ea_list *attrs);
 
 inline static void bgp_attach_attr_ip(struct ea_list **to, struct linpool *pool, unsigned attr, ip_addr a)
index 4bd68f520e87a8a59fdf030b71529287dc0370b7..378f5ab1a986321d8fdeb967d05947d07f565f6f 100644 (file)
@@ -289,8 +289,8 @@ bgp_create_open(struct bgp_conn *conn, byte *buf)
     }
 }
 
-static unsigned int
-bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsigned int remains)
+static uint
+bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, uint remains)
 {
   byte *start = w;
   ip_addr a;
@@ -648,7 +648,7 @@ bgp_create_end_refresh(struct bgp_conn *conn, byte *buf)
 
 
 static void
-bgp_create_header(byte *buf, unsigned int len, unsigned int type)
+bgp_create_header(byte *buf, uint len, uint type)
 {
   memset(buf, 0xff, 16);               /* Marker */
   put_u16(buf+16, len);
@@ -669,7 +669,7 @@ static int
 bgp_fire_tx(struct bgp_conn *conn)
 {
   struct bgp_proto *p = conn->bgp;
-  unsigned int s = conn->packets_to_send;
+  uint s = conn->packets_to_send;
   sock *sk = conn->sk;
   byte *buf, *pkt, *end;
   int type;
index aaf3b23cec4a668a8308f0f55a8b74e7b513f709..064bae18fca73338e201886e3499b8c668a86181 100644 (file)
@@ -181,7 +181,7 @@ struct ks_msg
 #define GETADDR(p, F) \
   bzero(p, sizeof(*p));\
   if ((addrs & (F)) && ((struct sockaddr *)body)->sa_len) {\
-    unsigned int l = ROUNDUP(((struct sockaddr *)body)->sa_len);\
+    uint l = ROUNDUP(((struct sockaddr *)body)->sa_len);\
     memcpy(p, body, (l > sizeof(*p) ? sizeof(*p) : l));\
     body += l;}
 
@@ -537,7 +537,7 @@ krt_read_ifinfo(struct ks_msg *msg, int scan)
   struct if_msghdr *ifm = (struct if_msghdr *)&msg->rtm;
   void *body = (void *)(ifm + 1);
   struct sockaddr_dl *dl = NULL;
-  unsigned int i;
+  uint i;
   struct iface *iface = NULL, f = {};
   int fl = ifm->ifm_flags;
   int nlen = 0;
index 71f5855400f945660858f9a7b2a18d82a39c6b6d..c4d52255ca837586ddbaf66772a9afad891715f9 100644 (file)
@@ -50,7 +50,7 @@ struct nl_sock
   u32 seq;
   byte *rx_buffer;                     /* Receive buffer */
   struct nlmsghdr *last_hdr;           /* Recently received packet */
-  unsigned int last_size;
+  uint last_size;
 };
 
 #define NL_RX_SIZE 8192
@@ -443,7 +443,7 @@ nl_parse_link(struct nlmsghdr *h, int scan)
   struct iface *ifi;
   char *name;
   u32 mtu;
-  unsigned int fl;
+  uint fl;
 
   if (!(i = nl_checkin(h, sizeof(*i))) || !nl_parse_attrs(IFLA_RTA(i), a, sizeof(a)))
     return;
@@ -1088,7 +1088,7 @@ nl_async_hook(sock *sk, int size UNUSED)
   struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
   struct nlmsghdr *h;
   int x;
-  unsigned int len;
+  uint len;
 
   x = recvmsg(sk->fd, &m, 0);
   if (x < 0)
index 05f7560d3c236afb09f939a810420b9428678012..e31471da3fa33120fa344304b592e561145b2863 100644 (file)
@@ -155,7 +155,7 @@ read_iproute_table(char *file, char *prefix, int max)
 static char *config_name = PATH_CONFIG_FILE;
 
 static int
-cf_read(byte *dest, unsigned int len, int fd)
+cf_read(byte *dest, uint len, int fd)
 {
   int l = read(fd, dest, len);
   if (l < 0)
index 593978ccb7c2d622a45e32a0e96ac9a7691c7076..4e0ff84110e17cb7b87ea95fef8b44dfb5ba8f69 100644 (file)
@@ -119,7 +119,7 @@ void log_switch(int debug, list *l, char *); /* Use l=NULL for initial switch */
 
 struct log_config {
   node n;
-  unsigned int mask;                   /* Classes to log */
+  uint mask;                           /* Classes to log */
   void *fh;                            /* FILE to log to, NULL=syslog */
   int terminal_flag;
 };