Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277942
b: refs/heads/master
c: c90681b
h: refs/heads/master
v: v3
  • Loading branch information
Antonio Quartulli authored and Sven Eckelmann committed Nov 20, 2011
1 parent fc8352c commit 35a2d0b
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb7e2a1e20488f91c7007caa080b83b8e4222572
refs/heads/master: c90681b8505946761b55d4981c9c3b56b3c4171b
4 changes: 2 additions & 2 deletions trunk/net/batman-adv/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/* clears the hash */
static void hash_init(struct hashtable_t *hash)
{
int i;
uint32_t i;

for (i = 0 ; i < hash->size; i++) {
INIT_HLIST_HEAD(&hash->table[i]);
Expand All @@ -42,7 +42,7 @@ void hash_destroy(struct hashtable_t *hash)
}

/* allocates and clears the hash */
struct hashtable_t *hash_new(int size)
struct hashtable_t *hash_new(uint32_t size)
{
struct hashtable_t *hash;

Expand Down
13 changes: 7 additions & 6 deletions trunk/net/batman-adv/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *);
/* the hashfunction, should return an index
* based on the key in the data of the first
* argument and the size the second */
typedef int (*hashdata_choose_cb)(const void *, int);
typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t);
typedef void (*hashdata_free_cb)(struct hlist_node *, void *);

struct hashtable_t {
struct hlist_head *table; /* the hashtable itself with the buckets */
spinlock_t *list_locks; /* spinlock for each hash list entry */
int size; /* size of hashtable */
uint32_t size; /* size of hashtable */
};

/* allocates and clears the hash */
struct hashtable_t *hash_new(int size);
struct hashtable_t *hash_new(uint32_t size);

/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash);
Expand All @@ -57,7 +57,7 @@ static inline void hash_delete(struct hashtable_t *hash,
struct hlist_head *head;
struct hlist_node *node, *node_tmp;
spinlock_t *list_lock; /* spinlock to protect write access */
int i;
uint32_t i;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
Expand Down Expand Up @@ -93,7 +93,8 @@ static inline int hash_add(struct hashtable_t *hash,
hashdata_choose_cb choose,
const void *data, struct hlist_node *data_node)
{
int index, ret = -1;
uint32_t index;
int ret = -1;
struct hlist_head *head;
struct hlist_node *node;
spinlock_t *list_lock; /* spinlock to protect write access */
Expand Down Expand Up @@ -137,7 +138,7 @@ static inline void *hash_remove(struct hashtable_t *hash,
hashdata_compare_cb compare,
hashdata_choose_cb choose, void *data)
{
size_t index;
uint32_t index;
struct hlist_node *node;
struct hlist_head *head;
void *data_save = NULL;
Expand Down
13 changes: 8 additions & 5 deletions trunk/net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void originator_free(struct bat_priv *bat_priv)
struct hlist_head *head;
spinlock_t *list_lock; /* spinlock to protect write access */
struct orig_node *orig_node;
int i;
uint32_t i;

if (!hash)
return;
Expand Down Expand Up @@ -350,7 +350,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
struct hlist_head *head;
spinlock_t *list_lock; /* spinlock to protect write access */
struct orig_node *orig_node;
int i;
uint32_t i;

if (!hash)
return;
Expand Down Expand Up @@ -413,7 +413,8 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
int batman_count = 0;
int last_seen_secs;
int last_seen_msecs;
int i, ret = 0;
uint32_t i;
int ret = 0;

primary_if = primary_if_get_selected(bat_priv);

Expand Down Expand Up @@ -519,7 +520,8 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
int i, ret;
uint32_t i;
int ret;

/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
* if_num */
Expand Down Expand Up @@ -601,7 +603,8 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
struct hlist_head *head;
struct hard_iface *hard_iface_tmp;
struct orig_node *orig_node;
int i, ret;
uint32_t i;
int ret;

/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
* if_num */
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/batman-adv/originator.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num);

/* hashfunction to choose an entry in a hash table of given size */
/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */
static inline int choose_orig(const void *data, int32_t size)
static inline uint32_t choose_orig(const void *data, uint32_t size)
{
const unsigned char *key = data;
uint32_t hash = 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
struct hlist_head *head;
struct orig_node *orig_node;
unsigned long *word;
int i;
uint32_t i;
size_t word_index;

for (i = 0; i < hash->size; i++) {
Expand Down
32 changes: 18 additions & 14 deletions trunk/net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static struct tt_local_entry *tt_local_hash_find(struct bat_priv *bat_priv,
struct hlist_head *head;
struct hlist_node *node;
struct tt_local_entry *tt_local_entry, *tt_local_entry_tmp = NULL;
int index;
uint32_t index;

if (!hash)
return NULL;
Expand Down Expand Up @@ -99,7 +99,7 @@ static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv,
struct hlist_node *node;
struct tt_global_entry *tt_global_entry;
struct tt_global_entry *tt_global_entry_tmp = NULL;
int index;
uint32_t index;

if (!hash)
return NULL;
Expand Down Expand Up @@ -316,7 +316,8 @@ int tt_local_seq_print_text(struct seq_file *seq, void *offset)
struct hlist_head *head;
size_t buf_size, pos;
char *buff;
int i, ret = 0;
uint32_t i;
int ret = 0;

primary_if = primary_if_get_selected(bat_priv);
if (!primary_if) {
Expand Down Expand Up @@ -427,7 +428,7 @@ static void tt_local_purge(struct bat_priv *bat_priv)
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
int i;
uint32_t i;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
Expand Down Expand Up @@ -465,7 +466,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
struct tt_local_entry *tt_local_entry;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
int i;
uint32_t i;

if (!bat_priv->tt_local_hash)
return;
Expand Down Expand Up @@ -592,7 +593,8 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
struct hlist_head *head;
size_t buf_size, pos;
char *buff;
int i, ret = 0;
uint32_t i;
int ret = 0;

primary_if = primary_if_get_selected(bat_priv);
if (!primary_if) {
Expand Down Expand Up @@ -716,7 +718,7 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
struct orig_node *orig_node, const char *message)
{
struct tt_global_entry *tt_global_entry;
int i;
uint32_t i;
struct hashtable_t *hash = bat_priv->tt_global_hash;
struct hlist_node *node, *safe;
struct hlist_head *head;
Expand Down Expand Up @@ -755,7 +757,7 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv)
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
int i;
uint32_t i;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
Expand Down Expand Up @@ -789,7 +791,7 @@ static void tt_global_table_free(struct bat_priv *bat_priv)
struct tt_global_entry *tt_global_entry;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
int i;
uint32_t i;

if (!bat_priv->tt_global_hash)
return;
Expand Down Expand Up @@ -875,7 +877,8 @@ uint16_t tt_global_crc(struct bat_priv *bat_priv, struct orig_node *orig_node)
struct tt_global_entry *tt_global_entry;
struct hlist_node *node;
struct hlist_head *head;
int i, j;
uint32_t i;
int j;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
Expand Down Expand Up @@ -912,7 +915,8 @@ uint16_t tt_local_crc(struct bat_priv *bat_priv)
struct tt_local_entry *tt_local_entry;
struct hlist_node *node;
struct hlist_head *head;
int i, j;
uint32_t i;
int j;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
Expand Down Expand Up @@ -1049,7 +1053,7 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
struct sk_buff *skb = NULL;
uint16_t tt_tot, tt_count;
ssize_t tt_query_size = sizeof(struct tt_query_packet);
int i;
uint32_t i;

if (tt_query_size + tt_len > primary_if->soft_iface->mtu) {
tt_len = primary_if->soft_iface->mtu - tt_query_size;
Expand Down Expand Up @@ -1726,7 +1730,7 @@ void tt_free(struct bat_priv *bat_priv)
* entry */
static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
{
int i;
uint32_t i;
struct hashtable_t *hash = bat_priv->tt_local_hash;
struct hlist_head *head;
struct hlist_node *node;
Expand Down Expand Up @@ -1759,7 +1763,7 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv)
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
int i;
uint32_t i;

if (!hash)
return;
Expand Down
17 changes: 10 additions & 7 deletions trunk/net/batman-adv/vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)

/* hash function to choose an entry in a hash table of given size */
/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */
static int vis_info_choose(const void *data, int size)
static uint32_t vis_info_choose(const void *data, uint32_t size)
{
const struct vis_info *vis_info = data;
const struct vis_packet *packet;
Expand Down Expand Up @@ -96,7 +96,7 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,
struct hlist_head *head;
struct hlist_node *node;
struct vis_info *vis_info, *vis_info_tmp = NULL;
int index;
uint32_t index;

if (!hash)
return NULL;
Expand Down Expand Up @@ -202,7 +202,8 @@ int vis_seq_print_text(struct seq_file *seq, void *offset)
HLIST_HEAD(vis_if_list);
struct if_list_entry *entry;
struct hlist_node *pos, *n;
int i, j, ret = 0;
uint32_t i;
int j, ret = 0;
int vis_server = atomic_read(&bat_priv->vis_mode);
size_t buff_pos, buf_size;
char *buff;
Expand Down Expand Up @@ -556,7 +557,8 @@ static int find_best_vis_server(struct bat_priv *bat_priv,
struct hlist_head *head;
struct orig_node *orig_node;
struct vis_packet *packet;
int best_tq = -1, i;
int best_tq = -1;
uint32_t i;

packet = (struct vis_packet *)info->skb_packet->data;

Expand Down Expand Up @@ -608,7 +610,8 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
struct vis_packet *packet = (struct vis_packet *)info->skb_packet->data;
struct vis_info_entry *entry;
struct tt_local_entry *tt_local_entry;
int best_tq = -1, i;
int best_tq = -1;
uint32_t i;

info->first_seen = jiffies;
packet->vis_type = atomic_read(&bat_priv->vis_mode);
Expand Down Expand Up @@ -696,7 +699,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
* held */
static void purge_vis_packets(struct bat_priv *bat_priv)
{
int i;
uint32_t i;
struct hashtable_t *hash = bat_priv->vis_hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
Expand Down Expand Up @@ -733,7 +736,7 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
struct sk_buff *skb;
struct hard_iface *hard_iface;
uint8_t dstaddr[ETH_ALEN];
int i;
uint32_t i;


packet = (struct vis_packet *)info->skb_packet->data;
Expand Down

0 comments on commit 35a2d0b

Please sign in to comment.