From 94704ea51d3b522f7de88080837e4c1acc820816 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Wed, 25 Jan 2012 21:30:58 +0100 Subject: [KERNEL] Multi device support --- src/server/server.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/server/server.c') diff --git a/src/server/server.c b/src/server/server.c index 7185e2f..c266f19 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -105,7 +105,8 @@ void *handle_query(void *client_socket) memcpy(reply.handle, request.handle, sizeof(request.handle)); send(sock, (char *) &reply, sizeof(struct dnbd3_reply), 0); - if (sendfile(sock, image_file, (off_t *) &request.offset, request.size) <0) + if (sendfile(sock, image_file, (off_t *) &request.offset, + request.size) < 0) printf("ERROR: sendfile returned -1\n"); break; @@ -118,7 +119,7 @@ void *handle_query(void *client_socket) } close(sock); printf("Client exit.\n"); - pthread_exit((void *)0); + pthread_exit((void *) 0); } int main(int argc, char* argv[]) @@ -157,7 +158,7 @@ int main(int argc, char* argv[]) // parse config file ht_create(); - FILE *config_file = fopen(config_file_name , "r"); + FILE *config_file = fopen(config_file_name, "r"); if (config_file == NULL) { printf("ERROR: Config file not found: %s\n", config_file_name); @@ -166,9 +167,9 @@ int main(int argc, char* argv[]) char line[MAX_FILE_NAME + 1 + MAX_FILE_ID]; char* image_name = NULL; char* image_id = NULL; - while (fgets (line , sizeof(line) , config_file) != NULL ) + while (fgets(line, sizeof(line), config_file) != NULL) { - sscanf (line, "%as %as", &image_name, &image_id); + sscanf(line, "%as %as", &image_name, &image_id); if (ht_insert(image_id, image_name) < 0) { printf("ERROR: Image name or ID is too big\n"); -- cgit v1.2.3-55-g7522