/*{{{ create / destroy */ CacheMng *cache_mng_create (Application *app) { CacheMng *cmng; cmng = g_new0 (CacheMng, 1); cmng->app = app; cmng->h_entries = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, cache_entry_destroy); cmng->q_lru = g_queue_new (); cmng->size = 0; cmng->check_time = time (NULL); cmng->max_size = conf_get_uint (application_get_conf (cmng->app), "filesystem.cache_dir_max_size"); cmng->cache_dir = g_strdup_printf ("%s/%s", conf_get_string (application_get_conf (cmng->app), "filesystem.cache_dir"), CACHE_MNGR_DIR); cmng->cache_hits = 0; cmng->cache_miss = 0; cache_mng_rm_cache_dir (cmng); if (g_mkdir_with_parents (cmng->cache_dir, 0700) != 0) { LOG_err (CMNG_LOG, "Failed to remove directory: %s", cmng->cache_dir); cache_mng_destroy (cmng); return NULL; } return cmng; }
void stats_srv_add_op_history (StatSrv *stat_srv, const gchar *str) { // stats server is disabled if (!conf_get_boolean (application_get_conf (stat_srv->app), "statistics.enabled")) return; // maintain queue size while (g_queue_get_length (stat_srv->q_op_history) + 1 >= conf_get_uint (application_get_conf (stat_srv->app), "statistics.history_size")) { gchar *tmp = g_queue_pop_tail (stat_srv->q_op_history); g_free (tmp); } g_queue_push_head (stat_srv->q_op_history, g_strdup (str)); }
void fileio_write_buffer (FileIO *fop, const char *buf, size_t buf_size, off_t off, fuse_ino_t ino, FileIO_on_buffer_written_cb on_buffer_written_cb, gpointer ctx) { FileWriteData *wdata; // XXX: allow only sequentially write // current written bytes should be always match offset if (off >= 0 && fop->current_size != (guint64)off) { LOG_err (FIO_LOG, INO_H"Write call with offset %"OFF_FMT" is not allowed !", INO_T (ino), off); on_buffer_written_cb (fop, ctx, FALSE, 0); return; } // add data to output buffer evbuffer_add (fop->write_buf, buf, buf_size); fop->current_size += buf_size; LOG_debug (FIO_LOG, INO_H"Write buf size: %zd", INO_T (ino), evbuffer_get_length (fop->write_buf)); // CacheMng cache_mng_store_file_buf (application_get_cache_mng (fop->app), ino, buf_size, off, (unsigned char *) buf, NULL, NULL); // if current write buffer exceeds "part_size" - this is a multipart upload if (evbuffer_get_length (fop->write_buf) >= conf_get_uint (application_get_conf (fop->app), "s3.part_size")) { // init helper struct wdata = g_new0 (FileWriteData, 1); wdata->fop = fop; wdata->buf_size = buf_size; wdata->off = off; wdata->ino = ino; wdata->on_buffer_written_cb = on_buffer_written_cb; wdata->ctx = ctx; // init multipart upload if (!fop->multipart_initiated) { fileio_write_init_multipart (wdata); // else send the current part } else { fileio_write_send_part (wdata); } // or just notify client that we are ready for more data } else { on_buffer_written_cb (fop, ctx, TRUE, buf_size); } }
// got HttpConnection object static void fileio_read_on_con_cb (gpointer client, gpointer ctx) { HttpConnection *con = (HttpConnection *) client; FileReadData *rdata = (FileReadData *) ctx; gboolean res; guint64 part_size; http_connection_acquire (con); part_size = conf_get_uint (application_get_conf (rdata->fop->app), "s3.part_size"); // small file - get the whole file at once if (rdata->fop->file_size < part_size) rdata->request_offset = 0; // calculate offset else { gchar *range_hdr; if (part_size < rdata->size) part_size = rdata->size; rdata->request_offset = rdata->off; range_hdr = g_strdup_printf ("bytes=%"G_GUINT64_FORMAT"-%"G_GUINT64_FORMAT, (gint64)rdata->request_offset, (gint64)(rdata->request_offset + part_size)); http_connection_add_output_header (con, "Range", range_hdr); g_free (range_hdr); } res = http_connection_make_request (con, rdata->fop->fname, "GET", NULL, TRUE, NULL, fileio_read_on_get_cb, rdata ); if (!res) { LOG_err (FIO_LOG, INO_CON_H"Failed to create HTTP request !", INO_T (rdata->ino), con); http_connection_release (con); rdata->on_buffer_read_cb (rdata->ctx, FALSE, NULL, 0); g_free (rdata); return; } }
void menu_request_settings(void) { gint result; GtkDialog * dialog; GtkToggleButton * autostart_studio_button; GtkToggleButton * send_notifications_button; GtkEntry * shell_entry; GtkEntry * terminal_entry; GtkSpinButton * js_delay_spin; GtkEntry * jack_conf_tool_entry; bool autostart; bool notify; const char * shell; const char * terminal; unsigned int js_delay; const char * jack_conf_tool; autostart_studio_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_studio_autostart_checkbutton")); send_notifications_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_send_notifications_checkbutton")); shell_entry = GTK_ENTRY(get_gtk_builder_widget("settings_shell_entry")); terminal_entry = GTK_ENTRY(get_gtk_builder_widget("settings_terminal_entry")); js_delay_spin = GTK_SPIN_BUTTON(get_gtk_builder_widget("settings_js_delay_spin")); jack_conf_tool_entry = GTK_ENTRY(get_gtk_builder_widget("settings_jack_conf_tool_entry")); dialog = GTK_DIALOG(get_gtk_builder_widget("settings_dialog")); if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, &autostart)) { autostart = LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART_DEFAULT; } if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, ¬ify)) { notify = LADISH_CONF_KEY_DAEMON_NOTIFY_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_SHELL, &shell)) { shell = LADISH_CONF_KEY_DAEMON_SHELL_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_TERMINAL, &terminal)) { terminal = LADISH_CONF_KEY_DAEMON_TERMINAL_DEFAULT; } if (!conf_get_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, &js_delay)) { js_delay = LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_JACK_CONF_TOOL, &jack_conf_tool)) { jack_conf_tool = LADISH_CONF_KEY_JACK_CONF_TOOL_DEFAULT; } gtk_toggle_button_set_active(autostart_studio_button, autostart); gtk_toggle_button_set_active(send_notifications_button, notify); gtk_entry_set_text(shell_entry, shell); gtk_entry_set_text(terminal_entry, terminal); gtk_entry_set_text(jack_conf_tool_entry, jack_conf_tool); gtk_spin_button_set_range(js_delay_spin, 0, 1000); gtk_spin_button_set_increments(js_delay_spin, 1, 2); gtk_spin_button_set_value(js_delay_spin, js_delay); gtk_widget_show(GTK_WIDGET(dialog)); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(GTK_WIDGET(dialog)); if (result != GTK_RESPONSE_OK) { return; } autostart = gtk_toggle_button_get_active(autostart_studio_button); notify = gtk_toggle_button_get_active(send_notifications_button); shell = gtk_entry_get_text(shell_entry); terminal = gtk_entry_get_text(terminal_entry); js_delay = gtk_spin_button_get_value(js_delay_spin); jack_conf_tool = gtk_entry_get_text(jack_conf_tool_entry); if (!conf_set_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, autostart) || !conf_set_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, notify) || !conf_set(LADISH_CONF_KEY_DAEMON_SHELL, shell) || !conf_set(LADISH_CONF_KEY_DAEMON_TERMINAL, terminal) || !conf_set_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, js_delay) || !conf_set(LADISH_CONF_KEY_JACK_CONF_TOOL, jack_conf_tool)) { error_message_box(_("Storing settings")); } }
END_TEST START_TEST (test_conf_default) { configuration *conf; int ret; int i; unsigned int u; char c; int bt; int bf; float f; const char *s; int valid; conf = conf_create (); fail_unless (conf != 0); ret = conf_add_group (conf, NULL, head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "agroup", head_group); fail_unless (ret == 0); i = conf_get_int (conf, NULL, "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 1, "Got %d expected %d", i, 1); u = conf_get_uint (conf, NULL, "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 10); c = conf_get_char (conf, NULL, "h_char", &valid); fail_unless (valid == 1); fail_unless (c == 'A'); bf = conf_get_bool (conf, NULL, "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0); bt = conf_get_bool (conf, NULL, "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1); f = conf_get_float (conf, NULL, "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 5.5f) < 0.0001f, "Got %f expected %f", f, 5.5f); s = conf_get_string (conf, NULL, "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "default") == 0); i = conf_get_int (conf, "agroup", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 1, "Got %d expected %d", i, 1); u = conf_get_uint (conf, "agroup", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 10); c = conf_get_char (conf, "agroup", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == 'A'); bf = conf_get_bool (conf, "agroup", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0); bt = conf_get_bool (conf, "agroup", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1); f = conf_get_float (conf, "agroup", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 5.5f) < 0.0001f, "Got %f expected %f", f, 5.5f); s = conf_get_string (conf, "agroup", "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "default") == 0); conf_free (conf); }
END_TEST START_TEST (test_conf_errors) { configuration *conf; int ret; int i; unsigned int u; char c; int bt; int bf; float f; const char *s; int valid; /* * Test Add group errors. */ conf = conf_create (); fail_unless (conf != 0); /* Add group to non conf. */ ret = conf_add_group (NULL, NULL, head_group); fail_unless (ret == -1); conf_free (conf); /* Add two groups with no group name under root. */ conf = conf_create (); fail_unless (conf != 0); ret = conf_add_group (conf, NULL, head_group); fail_unless (ret == 0); ret = conf_add_group (conf, NULL, head_group); fail_unless (ret == -1); conf_free (conf); /* Add group with bad parameter type. */ conf = conf_create (); fail_unless (conf != 0); ret = conf_add_group (conf, NULL, bad_1_group); fail_unless (ret < 0); conf_free (conf); /* * Test load errors. */ conf = conf_create (); fail_unless (conf != 0); /* Load with no groups. */ ret = conf_load (conf, CONFDIR "test.conf"); fail_unless (ret == -1); /* Test filename. */ ret = conf_add_group (conf, "a group", head_group); fail_unless (ret == 0); ret = conf_load (conf, NULL); fail_unless (ret == -1); ret = conf_load (conf, "/dev/null/something"); fail_unless (ret == -1); /* Test group names. */ ret = conf_load (conf, CONFDIR "test_bad1.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad2.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad3.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad4.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad5.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad6.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad7.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad8.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad9.conf"); fail_unless (ret < 0); ret = conf_load (conf, CONFDIR "test_bad10.conf"); fail_unless (ret != 0); ret = conf_add_group (conf, NULL, head_group); fail_unless (ret == 0); ret = conf_load (conf, CONFDIR "test_bad11.conf"); fail_unless (ret == -15, "%d", ret); ret = conf_load (conf, CONFDIR "test_bad12.conf"); fail_unless (ret == -13); ret = conf_load (conf, CONFDIR "test_bad13.conf"); fail_unless (ret != -14); ret = conf_load (conf, CONFDIR "test_bad14.conf"); fail_unless (ret == -17, "%d", ret); conf_free (conf); /* Test getting values */ conf = conf_create (); fail_unless (conf != 0); ret = conf_add_group (conf, "a group", head_group); fail_unless (ret == 0); i = conf_get_int (conf, NULL, "h_int", &valid); fail_unless (valid == 0); u = conf_get_uint (conf, NULL, "h_uint", &valid); fail_unless (valid == 0); c = conf_get_char (conf, NULL, "h_char", &valid); fail_unless (valid == 0); bf = conf_get_bool (conf, NULL, "h_bool_false", &valid); fail_unless (valid == 0); bt = conf_get_bool (conf, NULL, "h_bool_true", &valid); fail_unless (valid == 0); f = conf_get_float (conf, NULL, "h_float", &valid); fail_unless (valid == 0); s = conf_get_string (conf, NULL, "h_string", &valid); fail_unless (valid == 0); i = conf_get_int (conf, "a group", "X_int", &valid); fail_unless (valid == 0); u = conf_get_uint (conf, "a group", "X_uint", &valid); fail_unless (valid == 0); c = conf_get_char (conf, "a group", "X_char", &valid); fail_unless (valid == 0); bf = conf_get_bool (conf, "a group", "X_bool_false", &valid); fail_unless (valid == 0); bt = conf_get_bool (conf, "a group", "X_bool_true", &valid); fail_unless (valid == 0); f = conf_get_float (conf, "a group", "X_float", &valid); fail_unless (valid == 0); s = conf_get_string (conf, "a group", "X_string", &valid); fail_unless (valid == 0); conf_free (conf); }
END_TEST START_TEST (test_conf_file) { configuration *conf; int ret; int i; unsigned int u; char c; int bt; int bf; float f; const char *s; int valid; conf = conf_create (); fail_unless (conf != 0); ret = conf_add_group (conf, NULL, head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "agroup", head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "c group", head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "b group", head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "e group", head_group); fail_unless (ret == 0); ret = conf_add_group (conf, "d group", head_group); fail_unless (ret == 0); ret = conf_load (conf, CONFDIR "test.conf"); fail_unless (ret == 0, "ret = %d", ret); i = conf_get_int (conf, NULL, "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 10, "Got %d expected %d", i, 10); u = conf_get_uint (conf, NULL, "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 55, "Got %u expected %u", u, 55); c = conf_get_char (conf, NULL, "h_char", &valid); fail_unless (valid == 1); fail_unless (c == 'B', "Got %c expected %c", c, 'B'); bf = conf_get_bool (conf, NULL, "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, NULL, "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, NULL, "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f); s = conf_get_string (conf, NULL, "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "Not Default") == 0, "Got %d expected 'Not Default", i); i = conf_get_int (conf, "agroup", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 10, "Got %d expected %d", i, 10); u = conf_get_uint (conf, "agroup", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 75, "Got %u expected %u", u, 75); c = conf_get_char (conf, "agroup", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == 'B', "Got %c expected %c", c, 'B'); bf = conf_get_bool (conf, "agroup", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, "agroup", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, "agroup", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f); s = conf_get_string (conf, "agroup", "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "Not") == 0, "Got '%s' expected 'Not'", s); i = conf_get_int (conf, "b group", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 10, "Got %d expected %d", i, 10); u = conf_get_uint (conf, "b group", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 85, "Got %u expected %u", u, 85); c = conf_get_char (conf, "b group", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == 'B', "Got %c expected %c", c, 'B'); bf = conf_get_bool (conf, "b group", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, "b group", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, "b group", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f + 25.5f) < 0.0001f, "Got %f expected %f", f, -25.5f); s = conf_get_string (conf, "b group", "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "Not Default") == 0, "Got %d expected 'Not Default", i); i = conf_get_int (conf, "c group", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == -16, "Got %d expected %d", i, -16); u = conf_get_uint (conf, "c group", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 16, "Got %u expected %u", u, 16); c = conf_get_char (conf, "c group", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == '\0', "Got %c expected %c", c, '\0'); bf = conf_get_bool (conf, "c group", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, "c group", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, "c group", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f); s = conf_get_string (conf, "c group", "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, " Not Default") == 0, "Got %d expected 'Not Default", s); i = conf_get_int (conf, "d group", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == 100, "Got %d expected %d", i, 100); u = conf_get_uint (conf, "d group", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 100, "Got %u expected %u", u, 100); c = conf_get_char (conf, "d group", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == '\07', "Got %c expected %c", c, '\07'); bf = conf_get_bool (conf, "d group", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, "d group", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, "d group", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f - 100.0f) < 0.0001f, "Got %f expected %f", f, +100.0f); s = conf_get_string (conf, "d group", "h_string", &valid); fail_unless (valid == 1); fail_unless (strcasecmp (s, "\b\v\t\n\r\f\a\\\?\'\"\x10\010") == 0, "Got %d expected 'Not Default", s); i = conf_get_int (conf, "e group", "h_int", &valid); fail_unless (valid == 1); fail_unless (i == -100, "Got %d expected %d", i, -100); u = conf_get_uint (conf, "e group", "h_uint", &valid); fail_unless (valid == 1); fail_unless (u == 0, "Got %u expected %u", u, 0); c = conf_get_char (conf, "e group", "h_char", &valid); fail_unless (valid == 1); fail_unless (c == '\t', "Got %c expected %c", c, '\t'); bf = conf_get_bool (conf, "e group", "h_bool_false", &valid); fail_unless (valid == 1); fail_unless (bf == 0, "Got %d expected %d", bf, 0); bt = conf_get_bool (conf, "e group", "h_bool_true", &valid); fail_unless (valid == 1); fail_unless (bt == 1, "Got %d expected %d", i, 1); f = conf_get_float (conf, "e group", "h_float", &valid); fail_unless (valid == 1); fail_unless (abs (f + 100) < 0.0001f, "Got %f expected %f", f, -100.0f); s = conf_get_string (conf, "e group", "h_string", &valid); fail_unless (valid == 1); fail_unless (strlen (s) == 0, "Got '%s' expected ''", s); conf_free (conf); }
static void stat_srv_on_stats_cb (struct evhttp_request *req, void *ctx) { StatSrv *stat_srv = (StatSrv *) ctx; struct evbuffer *evb = NULL; gint ref = 0; GString *str; struct evhttp_uri *uri; guint32 total_inodes, file_num, dir_num; guint64 read_ops, write_ops, readdir_ops, lookup_ops; guint32 cache_entries; guint64 total_cache_size, cache_hits, cache_miss; struct tm *cur_p; struct tm cur; time_t now; char ts[50]; uri = evhttp_uri_parse (evhttp_request_get_uri (req)); LOG_debug (STAT_LOG, "Incoming request: %s from %s:%d", evhttp_request_get_uri (req), req->remote_host, req->remote_port); if (uri) { const gchar *query; query = evhttp_uri_get_query (uri); if (query) { const gchar *refresh = NULL; struct evkeyvalq q_params; TAILQ_INIT (&q_params); evhttp_parse_query_str (query, &q_params); refresh = http_find_header (&q_params, "refresh"); if (refresh) ref = atoi (refresh); evhttp_clear_headers (&q_params); } evhttp_uri_free (uri); } str = g_string_new (NULL); now = time (NULL); localtime_r (&now, &cur); cur_p = &cur; if (!strftime (ts, sizeof (ts), "%H:%M:%S", cur_p)) ts[0] = '\0'; g_string_append_printf (str, "RioFS version: %s Uptime: %u sec, Now: %s, Log level: %d, Dir cache time: %u sec<BR>", VERSION, (guint32)(now - stat_srv->boot_time), ts, log_level, conf_get_uint (application_get_conf (stat_srv->app), "filesystem.dir_cache_max_time")); // DirTree dir_tree_get_stats (application_get_dir_tree (stat_srv->app), &total_inodes, &file_num, &dir_num); g_string_append_printf (str, "<BR>DirTree: <BR>-Total inodes: %u, Total files: %u, Total directories: %u<BR>", total_inodes, file_num, dir_num); // Fuse rfuse_get_stats (application_get_rfuse (stat_srv->app), &read_ops, &write_ops, &readdir_ops, &lookup_ops); g_string_append_printf (str, "<BR>Fuse: <BR>-Read ops: %"G_GUINT64_FORMAT", Write ops: %"G_GUINT64_FORMAT ", Readdir ops: %"G_GUINT64_FORMAT", Lookup ops: %"G_GUINT64_FORMAT"<BR>", read_ops, write_ops, readdir_ops, lookup_ops); // CacheMng cache_mng_get_stats (application_get_cache_mng (stat_srv->app), &cache_entries, &total_cache_size, &cache_hits, &cache_miss); g_string_append_printf (str, "<BR>CacheMng: <BR>-Total entries: %"G_GUINT32_FORMAT", Total cache size: %"G_GUINT64_FORMAT " bytes, Cache hits: %"G_GUINT64_FORMAT", Cache misses: %"G_GUINT64_FORMAT" <BR>", cache_entries, total_cache_size, cache_hits, cache_miss); g_string_append_printf (str, "<BR>Read workers (%d): <BR>", client_pool_get_client_count (application_get_read_client_pool (stat_srv->app))); client_pool_get_client_stats_info (application_get_read_client_pool (stat_srv->app), str, &print_format_http); g_string_append_printf (str, "<BR>Write workers (%d): <BR>", client_pool_get_client_count (application_get_write_client_pool (stat_srv->app))); client_pool_get_client_stats_info (application_get_write_client_pool (stat_srv->app), str, &print_format_http); g_string_append_printf (str, "<BR>Op workers (%d): <BR>", client_pool_get_client_count (application_get_ops_client_pool (stat_srv->app))); client_pool_get_client_stats_info (application_get_ops_client_pool (stat_srv->app), str, &print_format_http); g_string_append_printf (str, "<BR><BR>Operation history (%u max items): <BR>", conf_get_uint (application_get_conf (stat_srv->app), "statistics.history_size")); g_queue_foreach (stat_srv->q_op_history, (GFunc) stat_srv_print_history_item, str); evb = evbuffer_new (); evbuffer_add_printf (evb, "<HTTP>"); if (ref) { evbuffer_add_printf (evb, "<HEAD><meta http-equiv=\"refresh\" content=\"%d\"></HEAD>", ref); } evbuffer_add_printf (evb, "<BODY>"); evbuffer_add (evb, str->str, str->len); evbuffer_add_printf (evb, "</BODY></HTTP>"); evhttp_send_reply (req, HTTP_OK, "OK", evb); evbuffer_free (evb); g_string_free (str, TRUE); }