Hi, I had a small discussion with Simon Wunderlich about r1166 and showed him a output intels c compiler to proof that the current code compiles "fine" with it. The output shows a big amount of warnings which were more or less useful. I promised him to send some patches to the mailinglist so more people can have a look at them and check if they are somewhat helpful.
Best regards, Sven Eckelmann
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/linux/kernel.c | 2 +- batman/linux/modules/gateway.c | 6 +++--- batman/linux/modules/gateway24.c | 6 +++--- batman/originator.c | 2 +- batman/originator.h | 2 +- batman/os.h | 20 ++++++++++---------- batman/posix/init.c | 10 +++++----- batman/posix/posix.c | 18 +++++++++--------- batman/posix/tunnel.c | 2 +- batman/profile.c | 4 ++-- batman/profile.h | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/batman/linux/kernel.c b/batman/linux/kernel.c index 1d79013..edf8093 100644 --- a/batman/linux/kernel.c +++ b/batman/linux/kernel.c @@ -193,7 +193,7 @@ int8_t bind_to_iface( int32_t sock, char *dev ) {
-int8_t use_gateway_module() { +int8_t use_gateway_module(char *BATMANUNUSED(dev)) {
int32_t fd;
diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c index b1b346c..7ccbc3f 100644 --- a/batman/linux/modules/gateway.c +++ b/batman/linux/modules/gateway.c @@ -76,7 +76,7 @@ static struct task_struct *kthread_task = NULL;
static struct proc_dir_entry *proc_dir, *clients_file;
-int init_module() +int init_module(void) { /* register our device - kernel assigns a free major number */ if ( ( Major = register_chrdev( 0, DRIVER_DEVICE, &fops ) ) < 0 ) { @@ -111,7 +111,7 @@ int init_module() return(0); }
-void cleanup_module() +void cleanup_module(void) { struct free_client_data *entry, *next; struct gw_client *gw_client; @@ -591,7 +591,7 @@ static int bat_netdev_close( struct net_device *dev ) return( 0 ); }
-static int create_bat_netdev() +static int create_bat_netdev(void) { struct gate_priv *priv;
diff --git a/batman/linux/modules/gateway24.c b/batman/linux/modules/gateway24.c index e26154b..6e91a40 100644 --- a/batman/linux/modules/gateway24.c +++ b/batman/linux/modules/gateway24.c @@ -67,7 +67,7 @@ static struct hashtable_t *wip_hash; static struct hashtable_t *vip_hash; static struct list_head free_client_list;
-int init_module() +int init_module(void) {
printk(KERN_DEBUG "B.A.T.M.A.N. gateway modul\n"); @@ -95,7 +95,7 @@ int init_module() return(0); }
-void cleanup_module() +void cleanup_module(void) { struct gate_priv *priv; struct free_client_data *entry, *next; @@ -545,7 +545,7 @@ static int bat_netdev_close( struct net_device *dev ) return( 0 ); }
-static int create_bat_netdev() +static int create_bat_netdev(void) {
struct gate_priv *priv; diff --git a/batman/originator.c b/batman/originator.c index ffc22fb..73cee8e 100644 --- a/batman/originator.c +++ b/batman/originator.c @@ -429,7 +429,7 @@ void purge_orig(uint32_t curr_time)
-void debug_orig() { +void debug_orig(void) {
struct hash_it_t *hashit = NULL; struct list_head *forw_pos, *orig_pos, *neigh_pos; diff --git a/batman/originator.h b/batman/originator.h index fd50300..1344661 100644 --- a/batman/originator.h +++ b/batman/originator.h @@ -29,5 +29,5 @@ int choose_orig( void *data, int32_t size ); struct orig_node *get_orig_node( uint32_t addr ); void update_orig( struct orig_node *orig_node, struct bat_packet *in, uint32_t neigh, struct batman_if *if_incoming, unsigned char *hna_recv_buff, int16_t hna_buff_len, uint8_t is_duplicate, uint32_t curr_time ); void purge_orig( uint32_t curr_time ); -void debug_orig(); +void debug_orig(void);
diff --git a/batman/os.h b/batman/os.h index 34f49c1..870883a 100644 --- a/batman/os.h +++ b/batman/os.h @@ -36,7 +36,7 @@ void addr_to_string( uint32_t addr, char *str, int32_t len );
-int8_t is_aborted(); +int8_t is_aborted(void); void update_hna(struct orig_node *orig_node, unsigned char *new_hna, int new_hna_len, struct neigh_node *old_router); void handler(int32_t sig); @@ -59,8 +59,8 @@ int8_t set_tun_addr( int32_t fd, uint32_t tun_addr, char *tun_dev ); void apply_init_args(int argc, char *argv[]); void init_interface(struct batman_if *batman_if); void deactivate_interface(struct batman_if *batman_if); -void check_inactive_interfaces(); -void init_interface_gw(); +void check_inactive_interfaces(void); +void init_interface_gw(void);
/* kernel.c */ void set_rp_filter( int32_t state, char* dev ); @@ -70,20 +70,20 @@ int32_t get_send_redirects( char *dev ); void set_forwarding( int32_t state ); int32_t get_forwarding( void ); int8_t bind_to_iface( int32_t sock, char *dev ); -int8_t use_gateway_module(); +int8_t use_gateway_module(char *dev);
/* posix.c */ void print_animation( void ); -void del_default_route(); -void add_default_route(); +void del_default_route(void); +void add_default_route(void); int8_t receive_packet(unsigned char *packet_buff, int32_t packet_buff_len, int16_t *packet_len, uint32_t *neigh, uint32_t timeout, struct batman_if **if_incoming); int8_t send_udp_packet(unsigned char *packet_buff, int packet_buff_len, struct sockaddr_in *broad, int send_sock, struct batman_if *batman_if); -void del_gw_interface(); -void restore_defaults(); -void cleanup(); +void del_gw_interface(void); +void restore_defaults(void); +void cleanup(void);
/* tunnel.c */ -void init_bh_ports(); +void init_bh_ports(void); void *gw_listen(void *arg); void *client_to_gw_tun( void *arg );
diff --git a/batman/posix/init.c b/batman/posix/init.c index fcf34bb..79d5a3b 100644 --- a/batman/posix/init.c +++ b/batman/posix/init.c @@ -44,7 +44,7 @@ int8_t stop;
-int my_daemon() { +int my_daemon(void) {
int fd;
@@ -85,7 +85,7 @@ int my_daemon() {
}
-void create_routing_pipe() +void create_routing_pipe(void) { int fd[2], pipe_opts;
@@ -879,7 +879,7 @@ close_con:
}
-void interface_listen_sockets() +void interface_listen_sockets(void) { struct list_head *list_pos; struct batman_if *batman_if; @@ -1124,7 +1124,7 @@ void init_interface(struct batman_if *batman_if) activate_interface(batman_if); }
-void check_inactive_interfaces() +void check_inactive_interfaces(void) { struct list_head *list_pos; struct batman_if *batman_if; @@ -1143,7 +1143,7 @@ void check_inactive_interfaces()
-void init_interface_gw () { +void init_interface_gw (void) {
int32_t sock_opts, err, skfd; struct ifreq ifr; diff --git a/batman/posix/posix.c b/batman/posix/posix.c index 785d8eb..1a67e13 100644 --- a/batman/posix/posix.c +++ b/batman/posix/posix.c @@ -52,7 +52,7 @@ uint8_t tunnel_running = 0; static pthread_mutex_t batman_clock_mutex = PTHREAD_MUTEX_INITIALIZER;
-void update_internal_clock() +void update_internal_clock(void) { struct tms tp; clock_t current_clock_tick = times(&tp); @@ -61,7 +61,7 @@ void update_internal_clock() last_clock_tick = current_clock_tick; }
-uint32_t get_time_msec() +uint32_t get_time_msec(void) { uint32_t time;
@@ -73,7 +73,7 @@ uint32_t get_time_msec() return time; }
-uint64_t get_time_msec64() +uint64_t get_time_msec64(void) { uint64_t time;
@@ -230,7 +230,7 @@ int32_t rand_num( int32_t limit ) {
-int8_t is_aborted() { +int8_t is_aborted(void) {
return stop != 0;
@@ -245,14 +245,14 @@ void handler( int32_t BATMANUNUSED(sig) ) { }
-void del_default_route() +void del_default_route(void) { curr_gateway = NULL; }
-void add_default_route() +void add_default_route(void) { struct curr_gw_data *curr_gw_data;
@@ -378,7 +378,7 @@ int8_t send_udp_packet(unsigned char *packet_buff, int32_t packet_buff_len, stru }
-void del_gw_interface() +void del_gw_interface(void) { struct batman_if *batman_if = (struct batman_if *)if_list.next; struct batgat_ioc_args args; @@ -410,7 +410,7 @@ void del_gw_interface() } }
-void restore_defaults() { +void restore_defaults(void) {
struct list_head *if_pos, *if_pos_tmp; struct batman_if *batman_if; @@ -520,7 +520,7 @@ void segmentation_fault(int32_t BATMANUNUSED(sig)) {
-void cleanup() { +void cleanup(void) {
int8_t i; struct debug_level_info *debug_level_info; diff --git a/batman/posix/tunnel.c b/batman/posix/tunnel.c index c5557f2..450e16b 100644 --- a/batman/posix/tunnel.c +++ b/batman/posix/tunnel.c @@ -58,7 +58,7 @@
unsigned short bh_udp_ports[] = BH_UDP_PORTS;
-void init_bh_ports() +void init_bh_ports(void) { int i;
diff --git a/batman/profile.c b/batman/profile.c index e96dc67..55b0450 100644 --- a/batman/profile.c +++ b/batman/profile.c @@ -57,7 +57,7 @@ void prof_stop(int32_t index) { }
-void prof_print() { +void prof_print(void) {
int32_t index;
@@ -92,7 +92,7 @@ void prof_stop( int32_t index ) { }
-void prof_print() { +void prof_print(void) {
}
diff --git a/batman/profile.h b/batman/profile.h index 7dc1761..a49be6f 100644 --- a/batman/profile.h +++ b/batman/profile.h @@ -48,4 +48,4 @@ struct prof_container { void prof_init(int32_t index, char *name); void prof_start(int32_t index); void prof_stop(int32_t index); -void prof_print(); +void prof_print(void);
Sry, made an error while splitting the patch. I will resend it soon.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/bsd/kernel.c | 2 +- batman/linux/kernel.c | 2 +- batman/linux/modules/gateway.c | 6 +++--- batman/linux/modules/gateway24.c | 6 +++--- batman/originator.c | 2 +- batman/originator.h | 2 +- batman/os.h | 18 +++++++++--------- batman/posix/init.c | 10 +++++----- batman/posix/posix.c | 18 +++++++++--------- batman/posix/tunnel.c | 2 +- batman/profile.c | 4 ++-- batman/profile.h | 2 +- 12 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/batman/bsd/kernel.c b/batman/bsd/kernel.c index 96fcb98..90076e3 100644 --- a/batman/bsd/kernel.c +++ b/batman/bsd/kernel.c @@ -143,7 +143,7 @@ int8_t use_kernel_module( char *dev ) return -1; }
-int8_t use_gateway_module( char *dev ) +int8_t use_gateway_module(void) { return -1; } diff --git a/batman/linux/kernel.c b/batman/linux/kernel.c index 1d79013..09c24da 100644 --- a/batman/linux/kernel.c +++ b/batman/linux/kernel.c @@ -193,7 +193,7 @@ int8_t bind_to_iface( int32_t sock, char *dev ) {
-int8_t use_gateway_module() { +int8_t use_gateway_module(void) {
int32_t fd;
diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c index b1b346c..7ccbc3f 100644 --- a/batman/linux/modules/gateway.c +++ b/batman/linux/modules/gateway.c @@ -76,7 +76,7 @@ static struct task_struct *kthread_task = NULL;
static struct proc_dir_entry *proc_dir, *clients_file;
-int init_module() +int init_module(void) { /* register our device - kernel assigns a free major number */ if ( ( Major = register_chrdev( 0, DRIVER_DEVICE, &fops ) ) < 0 ) { @@ -111,7 +111,7 @@ int init_module() return(0); }
-void cleanup_module() +void cleanup_module(void) { struct free_client_data *entry, *next; struct gw_client *gw_client; @@ -591,7 +591,7 @@ static int bat_netdev_close( struct net_device *dev ) return( 0 ); }
-static int create_bat_netdev() +static int create_bat_netdev(void) { struct gate_priv *priv;
diff --git a/batman/linux/modules/gateway24.c b/batman/linux/modules/gateway24.c index e26154b..6e91a40 100644 --- a/batman/linux/modules/gateway24.c +++ b/batman/linux/modules/gateway24.c @@ -67,7 +67,7 @@ static struct hashtable_t *wip_hash; static struct hashtable_t *vip_hash; static struct list_head free_client_list;
-int init_module() +int init_module(void) {
printk(KERN_DEBUG "B.A.T.M.A.N. gateway modul\n"); @@ -95,7 +95,7 @@ int init_module() return(0); }
-void cleanup_module() +void cleanup_module(void) { struct gate_priv *priv; struct free_client_data *entry, *next; @@ -545,7 +545,7 @@ static int bat_netdev_close( struct net_device *dev ) return( 0 ); }
-static int create_bat_netdev() +static int create_bat_netdev(void) {
struct gate_priv *priv; diff --git a/batman/originator.c b/batman/originator.c index ffc22fb..73cee8e 100644 --- a/batman/originator.c +++ b/batman/originator.c @@ -429,7 +429,7 @@ void purge_orig(uint32_t curr_time)
-void debug_orig() { +void debug_orig(void) {
struct hash_it_t *hashit = NULL; struct list_head *forw_pos, *orig_pos, *neigh_pos; diff --git a/batman/originator.h b/batman/originator.h index fd50300..1344661 100644 --- a/batman/originator.h +++ b/batman/originator.h @@ -29,5 +29,5 @@ int choose_orig( void *data, int32_t size ); struct orig_node *get_orig_node( uint32_t addr ); void update_orig( struct orig_node *orig_node, struct bat_packet *in, uint32_t neigh, struct batman_if *if_incoming, unsigned char *hna_recv_buff, int16_t hna_buff_len, uint8_t is_duplicate, uint32_t curr_time ); void purge_orig( uint32_t curr_time ); -void debug_orig(); +void debug_orig(void);
diff --git a/batman/os.h b/batman/os.h index 34f49c1..76525bf 100644 --- a/batman/os.h +++ b/batman/os.h @@ -36,7 +36,7 @@ void addr_to_string( uint32_t addr, char *str, int32_t len );
-int8_t is_aborted(); +int8_t is_aborted(void); void update_hna(struct orig_node *orig_node, unsigned char *new_hna, int new_hna_len, struct neigh_node *old_router); void handler(int32_t sig); @@ -59,8 +59,8 @@ int8_t set_tun_addr( int32_t fd, uint32_t tun_addr, char *tun_dev ); void apply_init_args(int argc, char *argv[]); void init_interface(struct batman_if *batman_if); void deactivate_interface(struct batman_if *batman_if); -void check_inactive_interfaces(); -void init_interface_gw(); +void check_inactive_interfaces(void); +void init_interface_gw(void);
/* kernel.c */ void set_rp_filter( int32_t state, char* dev ); @@ -74,16 +74,16 @@ int8_t use_gateway_module();
/* posix.c */ void print_animation( void ); -void del_default_route(); -void add_default_route(); +void del_default_route(void); +void add_default_route(void); int8_t receive_packet(unsigned char *packet_buff, int32_t packet_buff_len, int16_t *packet_len, uint32_t *neigh, uint32_t timeout, struct batman_if **if_incoming); int8_t send_udp_packet(unsigned char *packet_buff, int packet_buff_len, struct sockaddr_in *broad, int send_sock, struct batman_if *batman_if); -void del_gw_interface(); -void restore_defaults(); -void cleanup(); +void del_gw_interface(void); +void restore_defaults(void); +void cleanup(void);
/* tunnel.c */ -void init_bh_ports(); +void init_bh_ports(void); void *gw_listen(void *arg); void *client_to_gw_tun( void *arg );
diff --git a/batman/posix/init.c b/batman/posix/init.c index fcf34bb..79d5a3b 100644 --- a/batman/posix/init.c +++ b/batman/posix/init.c @@ -44,7 +44,7 @@ int8_t stop;
-int my_daemon() { +int my_daemon(void) {
int fd;
@@ -85,7 +85,7 @@ int my_daemon() {
}
-void create_routing_pipe() +void create_routing_pipe(void) { int fd[2], pipe_opts;
@@ -879,7 +879,7 @@ close_con:
}
-void interface_listen_sockets() +void interface_listen_sockets(void) { struct list_head *list_pos; struct batman_if *batman_if; @@ -1124,7 +1124,7 @@ void init_interface(struct batman_if *batman_if) activate_interface(batman_if); }
-void check_inactive_interfaces() +void check_inactive_interfaces(void) { struct list_head *list_pos; struct batman_if *batman_if; @@ -1143,7 +1143,7 @@ void check_inactive_interfaces()
-void init_interface_gw () { +void init_interface_gw (void) {
int32_t sock_opts, err, skfd; struct ifreq ifr; diff --git a/batman/posix/posix.c b/batman/posix/posix.c index 785d8eb..1a67e13 100644 --- a/batman/posix/posix.c +++ b/batman/posix/posix.c @@ -52,7 +52,7 @@ uint8_t tunnel_running = 0; static pthread_mutex_t batman_clock_mutex = PTHREAD_MUTEX_INITIALIZER;
-void update_internal_clock() +void update_internal_clock(void) { struct tms tp; clock_t current_clock_tick = times(&tp); @@ -61,7 +61,7 @@ void update_internal_clock() last_clock_tick = current_clock_tick; }
-uint32_t get_time_msec() +uint32_t get_time_msec(void) { uint32_t time;
@@ -73,7 +73,7 @@ uint32_t get_time_msec() return time; }
-uint64_t get_time_msec64() +uint64_t get_time_msec64(void) { uint64_t time;
@@ -230,7 +230,7 @@ int32_t rand_num( int32_t limit ) {
-int8_t is_aborted() { +int8_t is_aborted(void) {
return stop != 0;
@@ -245,14 +245,14 @@ void handler( int32_t BATMANUNUSED(sig) ) { }
-void del_default_route() +void del_default_route(void) { curr_gateway = NULL; }
-void add_default_route() +void add_default_route(void) { struct curr_gw_data *curr_gw_data;
@@ -378,7 +378,7 @@ int8_t send_udp_packet(unsigned char *packet_buff, int32_t packet_buff_len, stru }
-void del_gw_interface() +void del_gw_interface(void) { struct batman_if *batman_if = (struct batman_if *)if_list.next; struct batgat_ioc_args args; @@ -410,7 +410,7 @@ void del_gw_interface() } }
-void restore_defaults() { +void restore_defaults(void) {
struct list_head *if_pos, *if_pos_tmp; struct batman_if *batman_if; @@ -520,7 +520,7 @@ void segmentation_fault(int32_t BATMANUNUSED(sig)) {
-void cleanup() { +void cleanup(void) {
int8_t i; struct debug_level_info *debug_level_info; diff --git a/batman/posix/tunnel.c b/batman/posix/tunnel.c index c5557f2..450e16b 100644 --- a/batman/posix/tunnel.c +++ b/batman/posix/tunnel.c @@ -58,7 +58,7 @@
unsigned short bh_udp_ports[] = BH_UDP_PORTS;
-void init_bh_ports() +void init_bh_ports(void) { int i;
diff --git a/batman/profile.c b/batman/profile.c index e96dc67..55b0450 100644 --- a/batman/profile.c +++ b/batman/profile.c @@ -57,7 +57,7 @@ void prof_stop(int32_t index) { }
-void prof_print() { +void prof_print(void) {
int32_t index;
@@ -92,7 +92,7 @@ void prof_stop( int32_t index ) { }
-void prof_print() { +void prof_print(void) {
}
diff --git a/batman/profile.h b/batman/profile.h index 7dc1761..a49be6f 100644 --- a/batman/profile.h +++ b/batman/profile.h @@ -48,4 +48,4 @@ struct prof_container { void prof_init(int32_t index, char *name); void prof_start(int32_t index); void prof_stop(int32_t index); -void prof_print(); +void prof_print(void);
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/os.h | 2 +- batman/posix/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/batman/os.h b/batman/os.h index 76525bf..5531bae 100644 --- a/batman/os.h +++ b/batman/os.h @@ -70,7 +70,7 @@ int32_t get_send_redirects( char *dev ); void set_forwarding( int32_t state ); int32_t get_forwarding( void ); int8_t bind_to_iface( int32_t sock, char *dev ); -int8_t use_gateway_module(); +int8_t use_gateway_module(void);
/* posix.c */ void print_animation( void ); diff --git a/batman/posix/init.c b/batman/posix/init.c index 79d5a3b..9ad06f9 100644 --- a/batman/posix/init.c +++ b/batman/posix/init.c @@ -1152,7 +1152,7 @@ void init_interface_gw (void) { struct batman_if *batman_if = (struct batman_if *)if_list.next;
- if ( ( batman_if->udp_tunnel_sock = use_gateway_module( batman_if->dev ) ) < 0 ) { + if ( ( batman_if->udp_tunnel_sock = use_gateway_module() ) < 0 ) {
batman_if->addr.sin_port = htons(GW_PORT);
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/posix/posix.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/batman/posix/posix.c b/batman/posix/posix.c index 1a67e13..048cf94 100644 --- a/batman/posix/posix.c +++ b/batman/posix/posix.c @@ -523,7 +523,6 @@ void segmentation_fault(int32_t BATMANUNUSED(sig)) { void cleanup(void) {
int8_t i; - struct debug_level_info *debug_level_info; struct list_head *debug_pos, *debug_pos_tmp;
@@ -533,8 +532,6 @@ void cleanup(void) {
list_for_each_safe( debug_pos, debug_pos_tmp, (struct list_head *)debug_clients.fd_list[i] ) {
- debug_level_info = list_entry(debug_pos, struct debug_level_info, list); - list_del( (struct list_head *)debug_clients.fd_list[i], debug_pos, (struct list_head_first *)debug_clients.fd_list[i] ); debugFree( debug_pos, 1218 );
--- batman/posix/posix.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/batman/posix/posix.c b/batman/posix/posix.c index 048cf94..17b0667 100644 --- a/batman/posix/posix.c +++ b/batman/posix/posix.c @@ -42,8 +42,6 @@ #define BAT_LOGO_END(x,y) printf("\x1B[8;0H");fflush(NULL);bat_wait( x, y ); /* end of current picture */ #define IOCREMDEV 2
-extern struct vis_if vis_if; - static clock_t last_clock_tick; static float system_tick;
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/batman.h | 2 +- batman/linux/route.c | 2 +- batman/posix/init.c | 2 +- batman/posix/unix_socket.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/batman/batman.h b/batman/batman.h index c69f83a..bac3a82 100644 --- a/batman/batman.h +++ b/batman/batman.h @@ -77,7 +77,7 @@
#define JITTER 100 #define TTL 50 /* Time To Live of broadcast messages */ -#define PURGE_TIMEOUT 200000 /* purge originators after time in ms if no valid packet comes in -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */ +#define PURGE_TIMEOUT 200000u /* purge originators after time in ms if no valid packet comes in -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */ #define TQ_LOCAL_WINDOW_SIZE 64 /* sliding packet range of received originator messages in squence numbers (should be a multiple of our word size) */ #define TQ_GLOBAL_WINDOW_SIZE 10 #define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1 diff --git a/batman/linux/route.c b/batman/linux/route.c index e77fb63..ec5185a 100644 --- a/batman/linux/route.c +++ b/batman/linux/route.c @@ -270,7 +270,7 @@ void add_del_rule(uint32_t network, uint8_t netmask, int8_t rt_table, uint32_t p inet_ntop(AF_INET, &network, str1, sizeof (str1));
if (policy_routing_script != NULL) { - dprintf(policy_routing_pipe, "RULE %s %s %s %i %s %s %i %s %i\n", (rule_action == RULE_DEL ? "del" : "add"), rule_type_to_string[rule_type], str1, netmask, "unused", "unused", prio, iif, rt_table); + dprintf(policy_routing_pipe, "RULE %s %s %s %i %s %s %u %s %i\n", (rule_action == RULE_DEL ? "del" : "add"), rule_type_to_string[rule_type], str1, netmask, "unused", "unused", prio, iif, rt_table); return; }
diff --git a/batman/posix/init.c b/batman/posix/init.c index 79d5a3b..42a8cce 100644 --- a/batman/posix/init.c +++ b/batman/posix/init.c @@ -774,7 +774,7 @@ more_hna: } else if (purge_timeout_opt) {
batch_mode = 1; - snprintf(unix_buff, 20, "q:%i", purge_timeout); + snprintf(unix_buff, 20, "q:%u", purge_timeout);
} else if ( info_output ) {
diff --git a/batman/posix/unix_socket.c b/batman/posix/unix_socket.c index 3dda74e..d522f79 100644 --- a/batman/posix/unix_socket.c +++ b/batman/posix/unix_socket.c @@ -135,7 +135,7 @@ void internal_output(uint32_t sock) dprintf(sock, "unix_socket_path=%s\n", UNIX_PATH); dprintf(sock, "own_ogm_jitter=%i\n", JITTER); dprintf(sock, "default_ttl=%i\n", TTL); - dprintf(sock, "originator_timeout=%i (default: %i)\n", purge_timeout, PURGE_TIMEOUT); + dprintf(sock, "originator_timeout=%u (default: %u)\n", purge_timeout, PURGE_TIMEOUT); dprintf(sock, "tq_local_window_size=%i\n", TQ_LOCAL_WINDOW_SIZE); dprintf(sock, "tq_global_window_size=%i\n", TQ_GLOBAL_WINDOW_SIZE); dprintf(sock, "tq_local_bidirect_send_minimum=%i\n", TQ_LOCAL_BIDRECT_SEND_MINIMUM); @@ -491,7 +491,7 @@ void *unix_listen( void * BATMANUNUSED(arg) ) { dprintf(unix_client->sock, " --aggregation");
if (purge_timeout != PURGE_TIMEOUT) - dprintf(unix_client->sock, " --purge-timeout %i", purge_timeout); + dprintf(unix_client->sock, " --purge-timeout %u", purge_timeout);
list_for_each(debug_pos, &if_list) {
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/allocate.c | 4 ++-- batman/batman.c | 12 ++++++------ batman/list-batman.c | 4 ++-- batman/posix/init.c | 10 +++++----- batman/posix/posix.c | 6 +++--- batman/posix/tunnel.c | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/batman/allocate.c b/batman/allocate.c index 3ae365b..7160daf 100644 --- a/batman/allocate.c +++ b/batman/allocate.c @@ -65,7 +65,7 @@ struct memoryUsage };
-void addMemory( uint32_t length, int32_t tag ) { +static void addMemory( uint32_t length, int32_t tag ) {
struct memoryUsage *walker;
@@ -98,7 +98,7 @@ void addMemory( uint32_t length, int32_t tag ) { }
-void removeMemory( int32_t tag, int32_t freetag ) { +static void removeMemory( int32_t tag, int32_t freetag ) {
struct memoryUsage *walker;
diff --git a/batman/batman.c b/batman/batman.c index a23ef77..ebe5aab 100644 --- a/batman/batman.c +++ b/batman/batman.c @@ -221,7 +221,7 @@ int is_batman_if(char *dev, struct batman_if **batman_if) * if found, delete it from the buf and return 1. * if not found, return 0. */ -int hna_buff_delete(struct hna_element *buf, int *buf_len, struct hna_element *e) +static int hna_buff_delete(struct hna_element *buf, int *buf_len, struct hna_element *e) { int i; int num_elements; @@ -703,7 +703,7 @@ int isBntog(uint32_t neigh, struct orig_node *orig_tog_node)
-int isBidirectionalNeigh(struct orig_node *orig_node, struct orig_node *orig_neigh_node, struct bat_packet *in, uint32_t recv_time, struct batman_if *if_incoming) +static int isBidirectionalNeigh(struct orig_node *orig_node, struct orig_node *orig_neigh_node, struct bat_packet *in, uint32_t recv_time, struct batman_if *if_incoming) {
struct list_head *list_pos; @@ -792,7 +792,7 @@ int isBidirectionalNeigh(struct orig_node *orig_node, struct orig_node *orig_nei
-void generate_vis_packet(void) +static void generate_vis_packet(void) { struct hash_it_t *hashit = NULL; struct orig_node *orig_node; @@ -901,7 +901,7 @@ void generate_vis_packet(void)
-void send_vis_packet(void) +static void send_vis_packet(void) { generate_vis_packet();
@@ -911,7 +911,7 @@ void send_vis_packet(void)
-uint8_t count_real_packets(struct bat_packet *in, uint32_t neigh, struct batman_if *if_incoming) +static uint8_t count_real_packets(struct bat_packet *in, uint32_t neigh, struct batman_if *if_incoming) { struct list_head *list_pos; struct orig_node *orig_node; @@ -961,7 +961,7 @@ uint8_t count_real_packets(struct bat_packet *in, uint32_t neigh, struct batman_ return is_duplicate; }
-void add_del_own_hna_throw(struct hna_node *hna_node, int8_t del) +static void add_del_own_hna_throw(struct hna_node *hna_node, int8_t del) { /* add/delete throw routing entries for own hna */ add_del_route(hna_node->addr, hna_node->netmask, 0, 0, 0, "unknown", BATMAN_RT_TABLE_NETWORKS, ROUTE_TYPE_THROW, del); diff --git a/batman/list-batman.c b/batman/list-batman.c index a34f34b..94c757e 100644 --- a/batman/list-batman.c +++ b/batman/list-batman.c @@ -29,7 +29,7 @@ * This is only for internal list manipulation where we know * the next entries already! */ -void __list_add( struct list_head *new, struct list_head *prev, struct list_head *next ) { +static void __list_add( struct list_head *new, struct list_head *prev, struct list_head *next ) {
new->next = next; prev->next = new; @@ -85,7 +85,7 @@ void list_add_before( struct list_head *prev_node, struct list_head *next_node, * This is only for internal list manipulation where we know * the next entries already! */ -void __list_del( struct list_head *prev, struct list_head *next ) { +static void __list_del( struct list_head *prev, struct list_head *next ) {
prev->next = next;
diff --git a/batman/posix/init.c b/batman/posix/init.c index 42a8cce..c153528 100644 --- a/batman/posix/init.c +++ b/batman/posix/init.c @@ -44,7 +44,7 @@ int8_t stop;
-int my_daemon(void) { +static int my_daemon(void) {
int fd;
@@ -85,7 +85,7 @@ int my_daemon(void) {
}
-void create_routing_pipe(void) +static void create_routing_pipe(void) { int fd[2], pipe_opts;
@@ -879,7 +879,7 @@ close_con:
}
-void interface_listen_sockets(void) +static void interface_listen_sockets(void) { struct list_head *list_pos; struct batman_if *batman_if; @@ -899,7 +899,7 @@ void interface_listen_sockets(void) } }
-int is_interface_up(char *dev) +static int is_interface_up(char *dev) { struct ifreq int_req; int sock; @@ -961,7 +961,7 @@ void deactivate_interface(struct batman_if *batman_if) debug_output(3, "Interface deactivated: %s\n", batman_if->dev); }
-void activate_interface(struct batman_if *batman_if) +static void activate_interface(struct batman_if *batman_if) { struct ifreq int_req; int on = 1, sock_opts; diff --git a/batman/posix/posix.c b/batman/posix/posix.c index 17b0667..3efc541 100644 --- a/batman/posix/posix.c +++ b/batman/posix/posix.c @@ -50,7 +50,7 @@ uint8_t tunnel_running = 0; static pthread_mutex_t batman_clock_mutex = PTHREAD_MUTEX_INITIALIZER;
-void update_internal_clock(void) +static void update_internal_clock(void) { struct tms tp; clock_t current_clock_tick = times(&tp); @@ -84,7 +84,7 @@ uint64_t get_time_msec64(void) }
/* batman animation */ -void sym_print( char x, char y, char *z ) { +static void sym_print( char x, char y, char *z ) {
char i = 0, Z;
@@ -123,7 +123,7 @@ void sym_print( char x, char y, char *z ) {
-void bat_wait( int32_t T, int32_t t ) { +static void bat_wait( int32_t T, int32_t t ) {
struct timeval time;
diff --git a/batman/posix/tunnel.c b/batman/posix/tunnel.c index 450e16b..c8cb1d1 100644 --- a/batman/posix/tunnel.c +++ b/batman/posix/tunnel.c @@ -68,7 +68,7 @@ void init_bh_ports(void)
-int8_t get_tun_ip( struct sockaddr_in *gw_addr, int32_t udp_sock, uint32_t *tun_addr ) { +static int8_t get_tun_ip( struct sockaddr_in *gw_addr, int32_t udp_sock, uint32_t *tun_addr ) {
struct sockaddr_in sender_addr; struct timeval tv; @@ -407,7 +407,7 @@ out: return NULL; }
-struct gw_client *get_ip_addr(struct sockaddr_in *client_addr, struct hashtable_t **wip_hash, struct hashtable_t **vip_hash, struct list_head_first *free_ip_list, uint8_t next_free_ip[]) { +static struct gw_client *get_ip_addr(struct sockaddr_in *client_addr, struct hashtable_t **wip_hash, struct hashtable_t **vip_hash, struct list_head_first *free_ip_list, uint8_t next_free_ip[]) {
struct gw_client *gw_client; struct free_ip *free_ip; @@ -485,19 +485,19 @@ struct gw_client *get_ip_addr(struct sockaddr_in *client_addr, struct hashtable_
/* needed for hash, compares 2 struct gw_client, but only their ip-addresses. assumes that * the ip address is the first/second field in the struct */ -int compare_wip(void *data1, void *data2) +static int compare_wip(void *data1, void *data2) { return ( memcmp( data1, data2, 4 ) ); }
-int compare_vip(void *data1, void *data2) +static int compare_vip(void *data1, void *data2) { return ( memcmp( ((char *)data1) + 4, ((char *)data2) + 4, 4 ) ); }
/* hashfunction to choose an entry in a hash table of given size */ /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ -int choose_wip(void *data, int32_t size) +static int choose_wip(void *data, int32_t size) { unsigned char *key= data; uint32_t hash = 0; @@ -517,7 +517,7 @@ int choose_wip(void *data, int32_t size)
}
-int choose_vip(void *data, int32_t size) +static int choose_vip(void *data, int32_t size) { unsigned char *key= data; uint32_t hash = 0;
--- batman/batman.c | 37 ------------------------------------- 1 files changed, 0 insertions(+), 37 deletions(-)
diff --git a/batman/batman.c b/batman/batman.c index ebe5aab..0c17f33 100644 --- a/batman/batman.c +++ b/batman/batman.c @@ -666,43 +666,6 @@ unsigned char get_gw_class(int down, int up)
-int isDuplicate(struct orig_node *orig_node, uint16_t seqno) -{ - struct list_head *neigh_pos; - struct neigh_node *neigh_node; - - prof_start( PROF_is_duplicate ); - - list_for_each( neigh_pos, &orig_node->neigh_list ) { - - neigh_node = list_entry( neigh_pos, struct neigh_node, list ); - - if ( get_bit_status( neigh_node->real_bits, orig_node->last_real_seqno, seqno ) ) { - - prof_stop( PROF_is_duplicate ); - return 1; - - } - - } - - prof_stop( PROF_is_duplicate ); - - return 0; -} - - - -int isBntog(uint32_t neigh, struct orig_node *orig_tog_node) -{ - if ( ( orig_tog_node->router != NULL ) && ( orig_tog_node->router->addr == neigh ) ) - return 1; - - return 0; -} - - - static int isBidirectionalNeigh(struct orig_node *orig_node, struct orig_node *orig_neigh_node, struct bat_packet *in, uint32_t recv_time, struct batman_if *if_incoming) {
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/profile.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/batman/profile.c b/batman/profile.c index 55b0450..d9eaf13 100644 --- a/batman/profile.c +++ b/batman/profile.c @@ -65,7 +65,7 @@ void prof_print(void) {
for ( index = 0; index < PROF_COUNT; index++ ) {
- debug_output( 5, " %''30s: cpu time = %10.3f, calls = %''10i, avg time per call = %4.10f \n", prof_container[index].name, (float)prof_container[index].total_time/CLOCKS_PER_SEC, prof_container[index].calls, ( (float)prof_container[index].calls == 0 ? 0.0 : ( ( (float)prof_container[index].total_time/CLOCKS_PER_SEC ) / (float)prof_container[index].calls ) ) ); + debug_output( 5, " %''30s: cpu time = %10.3f, calls = %''10i, avg time per call = %4.10f \n", prof_container[index].name, (float)prof_container[index].total_time/CLOCKS_PER_SEC, prof_container[index].calls, ( prof_container[index].calls == 0 ? 0.0 : ( ( (float)prof_container[index].total_time/CLOCKS_PER_SEC ) / (float)prof_container[index].calls ) ) );
}
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/batman.c | 2 +- batman/os.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/batman/batman.c b/batman/batman.c index 0c17f33..392dd1e 100644 --- a/batman/batman.c +++ b/batman/batman.c @@ -255,7 +255,7 @@ static int hna_buff_delete(struct hna_element *buf, int *buf_len, struct hna_ele * a situation where no route is present. */ void update_hna(struct orig_node *orig_node, unsigned char *new_hna, - int new_hna_len, struct neigh_node *old_router) + int16_t new_hna_len, struct neigh_node *old_router) { unsigned char *old_hna; int old_hna_len; diff --git a/batman/os.h b/batman/os.h index 5531bae..da61d18 100644 --- a/batman/os.h +++ b/batman/os.h @@ -38,7 +38,7 @@ void addr_to_string( uint32_t addr, char *str, int32_t len );
int8_t is_aborted(void); void update_hna(struct orig_node *orig_node, unsigned char *new_hna, - int new_hna_len, struct neigh_node *old_router); + int16_t new_hna_len, struct neigh_node *old_router); void handler(int32_t sig); void segmentation_fault(int32_t sig) NO_RETURN; void restore_and_exit(uint8_t is_sigsegv) NO_RETURN;
We should not truncate the file descriptor of /dev/batgat from int32_t to int8_t (return type of use_kernel_module) when we save it as int32_t in batman_if::udp_tunnel_sock.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman/bsd/kernel.c | 2 +- batman/linux/kernel.c | 2 +- batman/os.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/batman/bsd/kernel.c b/batman/bsd/kernel.c index 90076e3..505f551 100644 --- a/batman/bsd/kernel.c +++ b/batman/bsd/kernel.c @@ -143,7 +143,7 @@ int8_t use_kernel_module( char *dev ) return -1; }
-int8_t use_gateway_module(void) +int32_t use_gateway_module(void) { return -1; } diff --git a/batman/linux/kernel.c b/batman/linux/kernel.c index 09c24da..da98197 100644 --- a/batman/linux/kernel.c +++ b/batman/linux/kernel.c @@ -193,7 +193,7 @@ int8_t bind_to_iface( int32_t sock, char *dev ) {
-int8_t use_gateway_module(void) { +int32_t use_gateway_module(void) {
int32_t fd;
diff --git a/batman/os.h b/batman/os.h index da61d18..ee5e536 100644 --- a/batman/os.h +++ b/batman/os.h @@ -70,7 +70,7 @@ int32_t get_send_redirects( char *dev ); void set_forwarding( int32_t state ); int32_t get_forwarding( void ); int8_t bind_to_iface( int32_t sock, char *dev ); -int8_t use_gateway_module(void); +int32_t use_gateway_module(void);
/* posix.c */ void print_animation( void );
There are some remaining remarks, but most of them are wrong (seems to be a icc bug or missing feature for #810er remarks). Thing which should be checked are get_rp_filter, get_send_redirects, get_forwarding, set_rp_filter, set_send_redirects and set_forwarding. These functions use int32_t to represent the state during set or get, but batmand stores the result of all get functions as int8_t in batman.c:batman and struct batman_if....
Best regards, Sven
Hey Sven,
thanks for all the patches! I applied all of them and tried to group them by topic.
best regards, Simon On Mon, Dec 01, 2008 at 07:56:55PM +0100, Sven Eckelmann wrote:
Hi, I had a small discussion with Simon Wunderlich about r1166 and showed him a output intels c compiler to proof that the current code compiles "fine" with it. The output shows a big amount of warnings which were more or less useful. I promised him to send some patches to the mailinglist so more people can have a look at them and check if they are somewhat helpful.
Best regards, Sven Eckelmann _______________________________________________ B.A.T.M.A.N mailing list B.A.T.M.A.N@open-mesh.net https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
b.a.t.m.a.n@lists.open-mesh.org