From 3c3ed070502bbfec387ded2c43d5e4559ca24a63 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 Mar 2012 09:12:39 +0200 Subject: [PATCH] White space spring cleaning Lets squash them all, with a bit of tooling help. Signed-off-by: Jens Axboe --- backend.c | 8 ++++---- cairo_text_helpers.c | 4 ++-- cairo_text_helpers.h | 2 +- cconv.c | 8 ++++---- client.c | 2 +- filesetup.c | 4 ++-- gclient.c | 8 ++++---- gcompat.h | 2 +- gerror.c | 11 +++++------ gfio.c | 18 +++++++++--------- graph.c | 43 ++++++++++++++++++++++--------------------- io_u.c | 6 +++--- ioengines.c | 8 ++++---- iolog.c | 7 +++---- options.c | 12 +++++------- options.h | 1 + parse.c | 7 +++---- printing.c | 12 ++++++------ profile.c | 2 +- server.c | 8 ++++---- stat.c | 12 ++++++------ tickmarks.c | 18 +++++++++--------- 22 files changed, 100 insertions(+), 103 deletions(-) diff --git a/backend.c b/backend.c index 1f5f3c7f..319bd253 100644 --- a/backend.c +++ b/backend.c @@ -335,8 +335,8 @@ static int break_on_this_error(struct thread_data *td, enum fio_ddir ddir, return 1; if (td_non_fatal_error(err)) { - /* - * Continue with the I/Os in case of + /* + * Continue with the I/Os in case of * a non fatal error. */ update_error_count(td, err); @@ -1091,9 +1091,9 @@ static void *thread_main(void *data) memcpy(&td->tv_cache, &td->start, sizeof(td->start)); if (td->o.ratemin[0] || td->o.ratemin[1]) { - memcpy(&td->lastrate[0], &td->bw_sample_time, + memcpy(&td->lastrate[0], &td->bw_sample_time, sizeof(td->bw_sample_time)); - memcpy(&td->lastrate[1], &td->bw_sample_time, + memcpy(&td->lastrate[1], &td->bw_sample_time, sizeof(td->bw_sample_time)); } diff --git a/cairo_text_helpers.c b/cairo_text_helpers.c index 89b9aa23..4ab3ac97 100644 --- a/cairo_text_helpers.c +++ b/cairo_text_helpers.c @@ -12,7 +12,7 @@ static void draw_aligned_text(cairo_t *cr, const char *font, double x, double y, double factor, direction; cairo_text_extents_t extents; - switch(alignment) { + switch (alignment) { case CENTERED: direction = -1.0; factor = 0.5; @@ -58,7 +58,7 @@ void draw_left_justified_text(cairo_t *cr, const char *font, draw_aligned_text(cr, font, x, y, fontsize, text, LEFT_JUSTIFIED); } -void draw_vertical_centered_text(cairo_t *cr, const char * font, double x, +void draw_vertical_centered_text(cairo_t *cr, const char *font, double x, double y, double fontsize, const char *text) { diff --git a/cairo_text_helpers.h b/cairo_text_helpers.h index f8157d4c..014001ad 100644 --- a/cairo_text_helpers.h +++ b/cairo_text_helpers.h @@ -12,7 +12,7 @@ void draw_left_justified_text(cairo_t *cr, const char *font, double x, double y, double fontsize, const char *text); -void draw_vertical_centered_text(cairo_t *cr, const char * font, double x, +void draw_vertical_centered_text(cairo_t *cr, const char *font, double x, double y, double fontsize, const char *text); #endif diff --git a/cconv.c b/cconv.c index 14ee9c5b..502cf82e 100644 --- a/cconv.c +++ b/cconv.c @@ -191,8 +191,8 @@ void convert_thread_options_to_cpu(struct thread_options *o, for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) o->percentile_list[i].u.f = fio_uint64_to_double(le64_to_cpu(top->percentile_list[i].u.i)); #if 0 - uint8_t cpumask[FIO_TOP_STR_MAX]; - uint8_t verify_cpumask[FIO_TOP_STR_MAX]; + uint8_t cpumask[FIO_TOP_STR_MAX]; + uint8_t verify_cpumask[FIO_TOP_STR_MAX]; #endif } @@ -370,8 +370,8 @@ void convert_thread_options_to_net(struct thread_options_pack *top, for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) top->percentile_list[i].u.i = __cpu_to_le64(fio_double_to_uint64(o->percentile_list[i].u.f)); #if 0 - uint8_t cpumask[FIO_TOP_STR_MAX]; - uint8_t verify_cpumask[FIO_TOP_STR_MAX]; + uint8_t cpumask[FIO_TOP_STR_MAX]; + uint8_t verify_cpumask[FIO_TOP_STR_MAX]; #endif } diff --git a/client.c b/client.c index ed8f51e0..d1357cbb 100644 --- a/client.c +++ b/client.c @@ -472,7 +472,7 @@ int fio_clients_connect(void) #ifdef WIN32 WSADATA wsd; - WSAStartup(MAKEWORD(2,2), &wsd); + WSAStartup(MAKEWORD(2, 2), &wsd); #endif dprint(FD_NET, "client: connect all\n"); diff --git a/filesetup.c b/filesetup.c index f3d38290..166ace8c 100644 --- a/filesetup.c +++ b/filesetup.c @@ -94,9 +94,9 @@ static int extend_file(struct thread_data *td, struct fio_file *f) r = fallocate(f->fd, FALLOC_FL_KEEP_SIZE, 0, f->real_file_size); - if (r != 0) { + if (r != 0) td_verror(td, errno, "fallocate"); - } + break; #endif /* FIO_HAVE_LINUX_FALLOCATE */ default: diff --git a/gclient.c b/gclient.c index 1042eafb..d551351a 100644 --- a/gclient.c +++ b/gclient.c @@ -426,7 +426,7 @@ static void gfio_update_client_eta(struct fio_client *client, struct jobs_eta *j sprintf(dst, " - %s", eta_str); } - + gfio_update_thread_status(ge, output, perc); gdk_threads_leave(); } @@ -514,7 +514,7 @@ static void gfio_update_all_eta(struct jobs_eta *je) sprintf(dst, " - %s", eta_str); } - + gfio_update_thread_status_all(ui, output, perc); gdk_threads_leave(); } @@ -963,7 +963,7 @@ static void gfio_show_latency_buckets(struct gfio_client *gc, GtkWidget *vbox, */ if (start == -1U) return; - + tree_view = gfio_output_lat_buckets(&io_u_lat[start], &ranges[start], end - start + 1); ge->lat_bucket_graph = setup_lat_bucket_graph("Latency Buckets", &io_u_lat[start], &ranges[start], end - start + 1, 700.0, 300.0); @@ -980,7 +980,7 @@ static void gfio_show_latency_buckets(struct gfio_client *gc, GtkWidget *vbox, gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &gfio_color_white); gtk_container_add(GTK_CONTAINER(completion_vbox), drawing_area); g_signal_connect(G_OBJECT(drawing_area), GFIO_DRAW_EVENT, G_CALLBACK(on_expose_lat_drawing_area), ge->lat_bucket_graph); - g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->lat_bucket_graph); + g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->lat_bucket_graph); gtk_box_pack_start(GTK_BOX(hbox), tree_view, TRUE, TRUE, 3); } diff --git a/gcompat.h b/gcompat.h index 8b8461a8..e0f74443 100644 --- a/gcompat.h +++ b/gcompat.h @@ -12,7 +12,7 @@ void gtk_combo_box_text_append_text(GtkComboBoxText *combo_box, const gchar *tex void gtk_combo_box_text_insert_text(GtkComboBoxText *combo_box, gint position, const gchar *text); void gtk_combo_box_text_prepend_text(GtkComboBoxText *combo_box, const gchar *text); void gtk_combo_box_text_remove(GtkComboBoxText *combo_box, gint position); -gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); +gchar *gtk_combo_box_text_get_active_text(GtkComboBoxText *combo_box); #define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX #endif /* GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 24 */ diff --git a/gerror.c b/gerror.c index 98b51a8b..30367381 100644 --- a/gerror.c +++ b/gerror.c @@ -9,7 +9,7 @@ #include "gerror.h" static void on_info_bar_response(GtkWidget *widget, gint response, - gpointer data) + gpointer data) { struct gui *ui = (struct gui *) data; @@ -25,16 +25,15 @@ static void report_error(struct gui_entry *ge, GError *error) if (ui->error_info_bar == NULL) { ui->error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK, - GTK_RESPONSE_OK, - NULL); + GTK_RESPONSE_OK, NULL); g_signal_connect(ui->error_info_bar, "response", G_CALLBACK(on_info_bar_response), ui); gtk_info_bar_set_message_type(GTK_INFO_BAR(ui->error_info_bar), - GTK_MESSAGE_ERROR); - + GTK_MESSAGE_ERROR); + ui->error_label = gtk_label_new(error->message); GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(ui->error_info_bar)); gtk_container_add(GTK_CONTAINER(container), ui->error_label); - + gtk_box_pack_start(GTK_BOX(ui->vbox), ui->error_info_bar, FALSE, FALSE, 0); gtk_widget_show_all(ui->vbox); } else { diff --git a/gfio.c b/gfio.c index 6b6d2b82..d80e41e0 100644 --- a/gfio.c +++ b/gfio.c @@ -1,7 +1,7 @@ /* * gfio - gui front end for fio - the flexible io tester * - * Copyright (C) 2012 Stephen M. Cameron + * Copyright (C) 2012 Stephen M. Cameron * Copyright (C) 2012 Jens Axboe * * The license below covers all files distributed with fio unless otherwise @@ -406,11 +406,11 @@ static void ge_widget_destroy(GtkWidget *w, gpointer data) static void gfio_quit(struct gui *ui) { - gtk_main_quit(); + gtk_main_quit(); } static void quit_clicked(__attribute__((unused)) GtkWidget *widget, - __attribute__((unused)) gpointer data) + gpointer data) { struct gui *ui = (struct gui *) data; @@ -471,7 +471,7 @@ static void gfio_start_server(struct gui *ui) } static void start_job_clicked(__attribute__((unused)) GtkWidget *widget, - gpointer data) + gpointer data) { struct gui_entry *ge = data; struct gfio_client *gc = ge->client; @@ -876,7 +876,7 @@ static int do_file_open_with_tab(struct gui *ui, const gchar *uri) if (get_connection_details(ge)) { if (ge_is_new) gtk_widget_destroy(ge->vbox); - + return 1; } @@ -1016,7 +1016,7 @@ static void connect_job_entry(GtkWidget *w, gpointer data) { struct gui *ui = (struct gui *) data; struct gui_entry *ge; - + ge = get_ge_from_cur_tab(ui); if (ge) connect_clicked(w, ge); @@ -1420,7 +1420,7 @@ static GtkWidget *new_client_page(struct gui_entry *ge) setup_graphs(&ge->graphs); /* - * Set up alignments for widgets at the bottom of ui, + * Set up alignments for widgets at the bottom of ui, * align bottom left, expand horizontally but not vertically */ bottom_align = gtk_alignment_new(0, 1, 1, 0); @@ -1507,7 +1507,7 @@ static GtkWidget *new_main_page(struct gui *ui) setup_graphs(&ui->graphs); /* - * Set up alignments for widgets at the bottom of ui, + * Set up alignments for widgets at the bottom of ui, * align bottom left, expand horizontally but not vertically */ bottom_align = gtk_alignment_new(0, 1, 1, 0); @@ -1670,7 +1670,7 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) gtk_settings_set_long_property(settings, "gtk_tooltip_timeout", 10, "gfio setting"); g_type_init(); gdk_color_parse("white", &gfio_color_white); - + ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(ui->window), "fio"); gtk_window_set_default_size(GTK_WINDOW(ui->window), 1024, 768); diff --git a/graph.c b/graph.c index ba013da4..81b1524d 100644 --- a/graph.c +++ b/graph.c @@ -1,7 +1,7 @@ /* * gfio - gui front end for fio - the flexible io tester * - * Copyright (C) 2012 Stephen M. Cameron + * Copyright (C) 2012 Stephen M. Cameron * * The license below covers all files distributed with fio unless otherwise * noted in the file itself. @@ -87,10 +87,10 @@ struct graph { graph_axis_unit_change_callback y_axis_unit_change_callback; unsigned int base_offset; unsigned int dont_graph_all_zeroes; - double left_extra; - double right_extra; - double top_extra; - double bottom_extra; + double left_extra; + double right_extra; + double top_extra; + double bottom_extra; double xtick_zero; double xtick_delta; @@ -263,7 +263,7 @@ static void draw_bars(struct graph *bg, cairo_t *cr, struct graph_label *lb, cairo_close_path(cr); cairo_fill(cr); cairo_stroke(cr); - bar_num++; + bar_num++; } } @@ -271,11 +271,11 @@ static void graph_draw_common(struct graph *g, cairo_t *cr, double *x1, double *y1, double *x2, double *y2) { cairo_set_source_rgb(cr, 0, 0, 0); - cairo_set_line_width (cr, 0.8); + cairo_set_line_width(cr, 0.8); - *x1 = 0.10 * g->xdim; + *x1 = 0.10 * g->xdim; *x2 = 0.95 * g->xdim; - *y1 = 0.10 * g->ydim; + *y1 = 0.10 * g->ydim; *y2 = 0.90 * g->ydim; cairo_move_to(cr, *x1, *y1); @@ -459,7 +459,7 @@ void bar_graph_draw(struct graph *bg, cairo_t *cr) draw_bars(bg, cr, lb, label_offset, bar_width, mindata, maxdata); // draw_centered_text(cr, label_offset + (bar_width / 2.0 + bar_width * 0.1), bg->ydim * 0.93, draw_centered_text(cr, bg->font, x1 + space_per_label * (i + 0.5), bg->ydim * 0.93, - 12.0, lb->label); + 12.0, lb->label); i++; } cairo_stroke(cr); @@ -498,7 +498,7 @@ static double find_xy_value(struct graph *g, xy_value_extractor getvalue, double first = 0; answer = tmp; } - answer = cmp(tmp, answer); + answer = cmp(tmp, answer); } } @@ -618,7 +618,7 @@ static struct graph_label *graph_find_label(struct graph *bg, { struct flist_head *entry; struct graph_label *i; - + flist_for_each(entry, &bg->label_list) { i = flist_entry(entry, struct graph_label, list); @@ -632,7 +632,7 @@ static struct graph_label *graph_find_label(struct graph *bg, graph_label_t graph_add_label(struct graph *bg, const char *label) { struct graph_label *i; - + i = graph_find_label(bg, label); if (i) return i; /* already present. */ @@ -818,7 +818,7 @@ static void graph_free_values(struct graph_label *l) while (!flist_empty(&l->value_list)) { i = flist_entry(l->value_list.next, struct graph_value, list); graph_value_drop(l, i); - } + } } static void graph_free_labels(struct graph *g) @@ -830,7 +830,7 @@ static void graph_free_labels(struct graph *g) flist_del(&i->list); graph_free_values(i); free(i); - } + } } void graph_set_color(struct graph *gr, graph_label_t label, double red, @@ -878,13 +878,14 @@ void line_graph_set_data_count_limit(struct graph *g, int per_label_limit) g->per_label_limit = per_label_limit; } -void graph_add_extra_space(struct graph *g, double left_percent, double right_percent, - double top_percent, double bottom_percent) +void graph_add_extra_space(struct graph *g, double left_percent, + double right_percent, double top_percent, + double bottom_percent) { - g->left_extra = left_percent; - g->right_extra = right_percent; - g->top_extra = top_percent; - g->bottom_extra = bottom_percent; + g->left_extra = left_percent; + g->right_extra = right_percent; + g->top_extra = top_percent; + g->bottom_extra = bottom_percent; } /* diff --git a/io_u.c b/io_u.c index a4f378d8..273cc91c 100644 --- a/io_u.c +++ b/io_u.c @@ -78,7 +78,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u) mask = -1UL; else mask = ((1UL << this_blocks) - 1) << bit; - + if (!(f->file_map[idx] & mask)) break; @@ -310,7 +310,7 @@ static int get_next_block(struct thread_data *td, struct io_u *io_u, ret = 1; } } - + if (!ret) { if (offset != -1ULL) io_u->offset = offset; @@ -1427,7 +1427,7 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, io_u_log_error(td, io_u); } if (icd->error && td_non_fatal_error(icd->error) && - (td->o.continue_on_error & td_error_type(io_u->ddir, icd->error))) { + (td->o.continue_on_error & td_error_type(io_u->ddir, icd->error))) { /* * If there is a non_fatal error, then add to the error count * and clear all the errors. diff --git a/ioengines.c b/ioengines.c index bb7833f1..b3c2e51f 100644 --- a/ioengines.c +++ b/ioengines.c @@ -234,7 +234,7 @@ int td_io_getevents(struct thread_data *td, unsigned int min, unsigned int max, out: if (r >= 0) { /* - * Reflect that our submitted requests were retrieved with + * Reflect that our submitted requests were retrieved with * whatever OS async calls are in the underlying engine. */ td->io_u_in_flight -= r; @@ -360,14 +360,14 @@ int td_io_commit(struct thread_data *td) if (!td->cur_depth || !td->io_u_queued) return 0; - io_u_mark_depth(td, td->io_u_queued); + io_u_mark_depth(td, td->io_u_queued); if (td->io_ops->commit) { ret = td->io_ops->commit(td); if (ret) td_verror(td, -ret, "io commit"); } - + /* * Reflect that events were submitted as async IO requests. */ @@ -532,7 +532,7 @@ int do_io_u_trim(struct thread_data *td, struct io_u *io_u) ret = os_trim(f->fd, io_u->offset, io_u->xfer_buflen); if (!ret) - return io_u->xfer_buflen;; + return io_u->xfer_buflen; io_u->error = ret; return 0; diff --git a/iolog.c b/iolog.c index 4818cd45..0e492363 100644 --- a/iolog.c +++ b/iolog.c @@ -110,7 +110,7 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) { struct io_piece *ipo; unsigned long elapsed; - + while (!flist_empty(&td->io_log_list)) { int ret; @@ -141,11 +141,10 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) elapsed = mtime_since_genesis(); if (ipo->delay > elapsed) usec_sleep(td, (ipo->delay - elapsed) * 1000); - } free(ipo); - + if (io_u->ddir != DDIR_WAIT) return 0; } @@ -370,7 +369,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) ipo->fileno = fileno; ipo->file_action = file_action; } - + queue_io_piece(td, ipo); } diff --git a/options.c b/options.c index 161b4163..d051da12 100644 --- a/options.c +++ b/options.c @@ -37,7 +37,7 @@ static int converthexchartoint(char a) { int base; - switch(a) { + switch (a) { case '0'...'9': base = '0'; break; @@ -50,7 +50,7 @@ static int converthexchartoint(char a) default: base = 0; } - return (a - base); + return a - base; } static int bs_cmp(const void *p1, const void *p2) @@ -652,7 +652,7 @@ static int str_verify_pattern_cb(void *data, const char *input) struct thread_data *td = data; long off; int i = 0, j = 0, len, k, base = 10; - char* loc1, * loc2; + char *loc1, *loc2; loc1 = strstr(input, "0x"); loc2 = strstr(input, "0X"); @@ -3014,14 +3014,12 @@ static char *bc_calc(char *str) sprintf(buf, "echo '%s' | %s", tmp, BC_APP); f = popen(buf, "r"); - if (!f) { + if (!f) return NULL; - } ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f); - if (ret <= 0) { + if (ret <= 0) return NULL; - } pclose(f); buf[(tmp - str) + ret - 1] = '\0'; diff --git a/options.h b/options.h index ae51cb3e..28bfe919 100644 --- a/options.h +++ b/options.h @@ -112,5 +112,6 @@ enum opt_category_group { extern struct opt_group *opt_group_from_mask(unsigned int *mask); extern struct opt_group *opt_group_cat_from_mask(unsigned int *mask); extern struct fio_option *fio_option_find(const char *name); +extern unsigned int fio_get_kb_base(void *); #endif diff --git a/parse.c b/parse.c index 545c3de5..63170136 100644 --- a/parse.c +++ b/parse.c @@ -16,7 +16,6 @@ #include "options.h" static struct fio_option *__fio_options; -extern unsigned int fio_get_kb_base(void *); static int vp_cmp(const void *p1, const void *p2) { @@ -47,7 +46,7 @@ static void posval_sort(struct fio_option *o, struct value_pair *vpmap) static void show_option_range(struct fio_option *o, int (*logger)(const char *format, ...)) { - if (o->type == FIO_OPT_FLOAT_LIST){ + if (o->type == FIO_OPT_FLOAT_LIST) { if (isnan(o->minfp) && isnan(o->maxfp)) return; @@ -356,7 +355,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, int first, int more, int curr) { int il, *ilp; - double* flp; + double *flp; long long ull, *ullp; long ul1, ul2; double uf; @@ -479,7 +478,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, o->maxlen); return 1; } - if(!str_to_float(ptr, &uf)){ + if (!str_to_float(ptr, &uf)) { log_err("not a floating point value: %s\n", ptr); return 1; } diff --git a/printing.c b/printing.c index 4058b790..4dcc9861 100644 --- a/printing.c +++ b/printing.c @@ -36,8 +36,8 @@ static void results_draw_page(GtkPrintOperation *operation, cr = gtk_print_context_get_cairo_context(context); - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_set_line_width (cr, 5.0); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_set_line_width(cr, 5.0); cairo_move_to(cr, 0.0, 0.0); cairo_line_to(cr, print_params.width, print_params.height); cairo_move_to(cr, 0.0, print_params.height); @@ -48,8 +48,8 @@ static void results_draw_page(GtkPrintOperation *operation, y = print_params.height / 5.0; sprintf(str, "(%g,%g)", x, y); draw_right_justified_text(cr, "Sans", x, y, 12.0, str); - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_set_line_width (cr, 2.0); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_set_line_width(cr, 2.0); cairo_move_to(cr, x, y - 30.0); cairo_line_to(cr, x, y + 30.0); cairo_move_to(cr, x - 30, y); @@ -59,8 +59,8 @@ static void results_draw_page(GtkPrintOperation *operation, x *= 2.0; sprintf(str, "(%g,%g)", x, y); draw_right_justified_text(cr, "Sans", x, y, 12.0, str); - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_set_line_width (cr, 2.0); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_set_line_width(cr, 2.0); cairo_move_to(cr, x, y - 30.0); cairo_line_to(cr, x, y + 30.0); cairo_move_to(cr, x - 30, y); diff --git a/profile.c b/profile.c index c9758437..74f14fac 100644 --- a/profile.c +++ b/profile.c @@ -42,7 +42,7 @@ int load_profile(const char *profile) static int add_profile_options(struct profile_ops *ops) { struct fio_option *o; - + if (!ops->options) return 0; diff --git a/server.c b/server.c index 27449751..664bb556 100644 --- a/server.c +++ b/server.c @@ -276,7 +276,7 @@ struct fio_net_cmd *fio_net_recv_cmd(int sk) struct cmd_text_pdu *pdu = (struct cmd_text_pdu *) cmdret->payload; char *buf = (char *) pdu->buf; - buf[pdu->buf_len ] = '\0'; + buf[pdu->buf_len] = '\0'; } else if (cmdret->opcode == FIO_NET_CMD_JOB) { struct cmd_job_pdu *pdu = (struct cmd_job_pdu *) cmdret->payload; char *buf = (char *) pdu->buf; @@ -663,7 +663,7 @@ static int handle_command(struct fio_net_cmd *cmd) ret = handle_run_cmd(cmd); break; default: - log_err("fio: unknown opcode: %s\n",fio_server_op(cmd->opcode)); + log_err("fio: unknown opcode: %s\n", fio_server_op(cmd->opcode)); ret = 1; } @@ -692,7 +692,7 @@ static int handle_connection(int sk) if (!flist_empty(&job_list)) timeout = 100; - + ret = poll(&pfd, 1, timeout); if (ret < 0) { if (errno == EINTR) @@ -1512,7 +1512,7 @@ int fio_start_server(char *pidfile) #if defined(WIN32) WSADATA wsd; - WSAStartup(MAKEWORD(2,2), &wsd); + WSAStartup(MAKEWORD(2, 2), &wsd); #endif if (!pidfile) diff --git a/stat.c b/stat.c index 70f9e0a1..ac4a0008 100644 --- a/stat.c +++ b/stat.c @@ -63,12 +63,12 @@ static unsigned int plat_val_to_idx(unsigned int val) /* * Discard the error bits and apply the mask to find the - * index for the buckets in the group + * index for the buckets in the group */ offset = (FIO_IO_U_PLAT_VAL - 1) & (val >> error_bits); /* Make sure the index does not exceed (array size - 1) */ - idx = (base + offset) < (FIO_IO_U_PLAT_NR - 1)? + idx = (base + offset) < (FIO_IO_U_PLAT_NR - 1) ? (base + offset) : (FIO_IO_U_PLAT_NR - 1); return idx; @@ -86,11 +86,11 @@ static unsigned int plat_idx_to_val(unsigned int idx) /* MSB <= (FIO_IO_U_PLAT_BITS-1), cannot be rounded off. Use * all bits of the sample as index */ - if (idx < (FIO_IO_U_PLAT_VAL << 1) ) + if (idx < (FIO_IO_U_PLAT_VAL << 1)) return idx; /* Find the group and compute the minimum value of that group */ - error_bits = (idx >> FIO_IO_U_PLAT_BITS) -1; + error_bits = (idx >> FIO_IO_U_PLAT_BITS) - 1; base = 1 << (error_bits + FIO_IO_U_PLAT_BITS); /* Find its bucket number of the group */ @@ -140,7 +140,7 @@ unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr, * isn't a worry. Also note that this does not work for NaN values. */ if (len > 1) - qsort((void*)plist, len, sizeof(plist[0]), double_cmp); + qsort((void *)plist, len, sizeof(plist[0]), double_cmp); /* * Calculate bucket values, note down max and min values @@ -629,7 +629,7 @@ static void show_ddir_status_terse(struct thread_stat *ts, } static void show_thread_status_terse_v2(struct thread_stat *ts, - struct group_run_stats *rs) + struct group_run_stats *rs) { double io_u_dist[FIO_IO_U_MAP_NR]; double io_u_lat_u[FIO_IO_U_LAT_U_NR]; diff --git a/tickmarks.c b/tickmarks.c index 6a964e31..808de676 100644 --- a/tickmarks.c +++ b/tickmarks.c @@ -3,7 +3,7 @@ #include #include -/* +/* * adapted from Paul Heckbert's algorithm on p 657-659 of * Andrew S. Glassner's book, "Graphics Gems" * ISBN 0-12-286166-3 @@ -128,20 +128,20 @@ static void test_range(double x, double y) printf("Testing range %g - %g\n", x, y); nticks = calc_tickmarks(x, y, 10, &tm); - for (i = 0; i < nticks; i++) { + for (i = 0; i < nticks; i++) printf(" (%s) %g\n", tm[i].string, tm[i].value); - } + printf("\n\n"); free(tm); } int main(int argc, char *argv[]) { - test_range(0.0005, 0.008); - test_range(0.5, 0.8); - test_range(5.5, 8.8); - test_range(50.5, 80.8); - test_range(-20, 20.8); - test_range(-30, 700.8); + test_range(0.0005, 0.008); + test_range(0.5, 0.8); + test_range(5.5, 8.8); + test_range(50.5, 80.8); + test_range(-20, 20.8); + test_range(-30, 700.8); } #endif -- 2.25.1