From 7583ffbc4d0e41b92f1fba8228673a54cc941564 Mon Sep 17 00:00:00 2001 From: nick Date: Fri, 1 Feb 2013 15:06:47 +0000 Subject: [PATCH 1/5] flexnbd: constantize the quiet log level --- src/mode.c | 12 ++++++------ src/mode.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mode.c b/src/mode.c index ffaeb3f..5df59c9 100644 --- a/src/mode.c +++ b/src/mode.c @@ -215,7 +215,7 @@ void read_serve_param( int c, char **ip_addr, char **ip_port, char **file, char *default_deny = 1; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; @@ -255,7 +255,7 @@ void read_listen_param( int c, *default_deny = 1; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; @@ -289,7 +289,7 @@ void read_readwrite_param( int c, char **ip_addr, char **ip_port, char **bind_ad *bind_addr = optarg; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; @@ -311,7 +311,7 @@ void read_sock_param( int c, char **sock, char *help_text ) *sock = optarg; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; @@ -356,7 +356,7 @@ void read_mirror_param( *bind_addr = optarg; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; @@ -378,7 +378,7 @@ void read_break_param( int c, char **sock ) *sock = optarg; break; case 'q': - log_level = 4; + log_level = QUIET_LOG_LEVEL; break; case 'v': log_level = VERBOSE_LOG_LEVEL; diff --git a/src/mode.h b/src/mode.h index 8df2e9a..4b96b4a 100644 --- a/src/mode.h +++ b/src/mode.h @@ -66,6 +66,8 @@ void mode(char* mode, int argc, char **argv); # define VERBOSE_LOG_LEVEL 1 #endif +#define QUIET_LOG_LEVEL 4 + #define OPT_QUIET "quiet" #define SOPT_QUIET "q" #define GETOPT_QUIET GETOPT_FLAG( OPT_QUIET, 'q' ) From 1afba29b63f4d72fc00d4870146fd65562169ac0 Mon Sep 17 00:00:00 2001 From: nick Date: Fri, 1 Feb 2013 15:20:43 +0000 Subject: [PATCH 2/5] flexnbd: Normalise some variable declarations --- src/flexnbd.c | 4 ++-- src/flexnbd.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/flexnbd.c b/src/flexnbd.c index 9c34f5a..7194e94 100644 --- a/src/flexnbd.c +++ b/src/flexnbd.c @@ -82,7 +82,7 @@ struct flexnbd * flexnbd_create_serving( char* s_ip_address, char* s_port, char* s_file, - char *s_ctrl_sock, + char* s_ctrl_sock, int default_deny, int acl_entries, char** s_acl_entries, @@ -109,7 +109,7 @@ struct flexnbd * flexnbd_create_listening( char* s_ip_address, char* s_port, char* s_file, - char *s_ctrl_sock, + char* s_ctrl_sock, int default_deny, int acl_entries, char** s_acl_entries ) diff --git a/src/flexnbd.h b/src/flexnbd.h index 6feb077..f378322 100644 --- a/src/flexnbd.h +++ b/src/flexnbd.h @@ -31,19 +31,19 @@ struct flexnbd * flexnbd_create_serving( char* s_ip_address, char* s_port, char* s_file, - char *s_ctrl_sock, + char* s_ctrl_sock, int default_deny, int acl_entries, char** s_acl_entries, int max_nbd_clients); struct flexnbd * flexnbd_create_listening( - char* s_ip_address, - char* s_port, + char* s_ip_address, + char* s_port, char* s_file, - char *s_ctrl_sock, + char* s_ctrl_sock, int default_deny, - int acl_entries, + int acl_entries, char** s_acl_entries ); void flexnbd_destroy( struct flexnbd * ); From 719bd30071009014352501d16d829487b84fece7 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 5 Feb 2013 09:44:59 +0000 Subject: [PATCH 3/5] Add a minimal Makefile that lets 'make' and 'make clean' do the Right Thing --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..93aa996 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +all: + rake build + +clean: + rake clean From 0b3a71bb0303560763d5dbc9b29bf1ba109f9796 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 5 Feb 2013 13:27:48 +0000 Subject: [PATCH 4/5] flexnbd: Allocate the right amount of memory for a struct client --- src/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index 79bfb0b..a35d162 100644 --- a/src/client.c +++ b/src/client.c @@ -25,7 +25,7 @@ struct client *client_create( struct server *serve, int socket ) struct client *c; - c = xmalloc( sizeof( struct server ) ); + c = xmalloc( sizeof( struct client ) ); c->stopped = 0; c->socket = socket; c->serve = serve; From 184a13bc9f1ac59ba077682ec32933ef7bb24b44 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 5 Feb 2013 13:46:55 +0000 Subject: [PATCH 5/5] Add an all-debug task to the makefile --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 93aa996..a143b6c 100644 --- a/Makefile +++ b/Makefile @@ -3,5 +3,8 @@ all: rake build +all-debug: + DEBUG=1 rake build + clean: rake clean