[pve-devel] r5899 - pve-cluster/trunk/data/src
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed May 4 11:47:38 CEST 2011
Author: dietmar
Date: 2011-05-04 11:47:38 +0200 (Wed, 04 May 2011)
New Revision: 5899
Modified:
pve-cluster/trunk/data/src/status.c
Log:
remove trailing whitespace
Modified: pve-cluster/trunk/data/src/status.c
===================================================================
--- pve-cluster/trunk/data/src/status.c 2011-05-04 09:44:01 UTC (rev 5898)
+++ pve-cluster/trunk/data/src/status.c 2011-05-04 09:47:38 UTC (rev 5899)
@@ -161,8 +161,8 @@
}
cfs_clnode_t *cfs_clnode_new(
- const char *name,
- uint32_t nodeid,
+ const char *name,
+ uint32_t nodeid,
uint32_t votes)
{
g_return_val_if_fail(name != NULL, NULL);
@@ -186,20 +186,20 @@
if (clinfo->cluster_name)
g_free(clinfo->cluster_name);
- if (clinfo->nodes_byname)
+ if (clinfo->nodes_byname)
g_hash_table_destroy(clinfo->nodes_byname);
-
+
if (clinfo->nodes_byid)
g_hash_table_destroy(clinfo->nodes_byid);
-
+
g_free(clinfo);
return TRUE;
}
cfs_clinfo_t *cfs_clinfo_new(
- const char *cluster_name,
- uint32_t cman_version)
+ const char *cluster_name,
+ uint32_t cman_version)
{
g_return_val_if_fail(cluster_name != NULL, NULL);
@@ -208,10 +208,10 @@
return NULL;
clinfo->cluster_name = g_strdup(cluster_name);
- clinfo->cman_version = cman_version;
+ clinfo->cman_version = cman_version;
if (!(clinfo->nodes_byid = g_hash_table_new_full(
- g_int32_hash, g_int32_equal, NULL,
+ g_int32_hash, g_int32_equal, NULL,
(GDestroyNotify)cfs_clnode_destroy)))
goto fail;
@@ -224,7 +224,7 @@
cfs_clinfo_destroy(clinfo);
return NULL;
-}
+}
gboolean cfs_clinfo_add_node(
cfs_clinfo_t *clinfo,
@@ -262,7 +262,7 @@
g_string_append_printf(str, "\"cluster\": { ");
g_string_append_printf(str, "\"name\": \"%s\", \"version\": %d, "
- "\"nodes\": %d, \"quorate\": %d ",
+ "\"nodes\": %d, \"quorate\": %d ",
clinfo->cluster_name, clinfo->cman_version,
nodecount, cfs_status.quorate);
@@ -281,7 +281,7 @@
if (i) g_string_append_printf(str, ",\n");
i++;
- g_string_append_printf(str, " \"%s\": { \"id\": %d, \"online\": %d",
+ g_string_append_printf(str, " \"%s\": { \"id\": %d, \"online\": %d",
node->name, node->nodeid, node->online);
@@ -301,7 +301,7 @@
return 0;
}
-static void
+static void
kventry_free(kventry_t *entry)
{
g_return_if_fail(entry != NULL);
@@ -312,13 +312,13 @@
}
static GHashTable *
-kventry_hash_new(void)
+kventry_hash_new(void)
{
return g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
(GDestroyNotify)kventry_free);
}
-static void
+static void
rrdentry_free(rrdentry_t *entry)
{
g_return_if_fail(entry != NULL);
@@ -329,19 +329,19 @@
}
static GHashTable *
-rrdentry_hash_new(void)
+rrdentry_hash_new(void)
{
return g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
(GDestroyNotify)rrdentry_free);
}
-void
+void
cfs_cluster_log_dump(GString *str, const char *user, guint max_entries)
{
clusterlog_dump(cfs_status.clusterlog, str, user, max_entries);
}
-void
+void
cfs_cluster_log(clog_entry_t *entry)
{
g_return_if_fail(entry != NULL);
@@ -372,7 +372,7 @@
cfs_status.memdb_changes = g_hash_table_new(g_str_hash, g_str_equal);
for (int i = 0; i < G_N_ELEMENTS(memdb_change_array); i++) {
- g_hash_table_replace(cfs_status.memdb_changes,
+ g_hash_table_replace(cfs_status.memdb_changes,
memdb_change_array[i].path,
&memdb_change_array[i]);
}
@@ -380,12 +380,12 @@
cfs_status.clusterlog = clusterlog_new();
// fixme:
- clusterlog_add(cfs_status.clusterlog, "root", "cluster", getpid(),
+ clusterlog_add(cfs_status.clusterlog, "root", "cluster", getpid(),
LOG_INFO, "starting cluster log");
g_static_mutex_unlock (&mutex);
}
-
+
void cfs_status_cleanup(void)
{
g_static_mutex_lock (&mutex);
@@ -419,7 +419,7 @@
}
void cfs_status_set_clinfo(
- cfs_clinfo_t *clinfo)
+ cfs_clinfo_t *clinfo)
{
g_return_if_fail(clinfo != NULL);
@@ -431,8 +431,8 @@
cfs_status.clinfo = clinfo;
- cfs_message("update cluster info (cluster name %s, version = %d)",
- clinfo->cluster_name, clinfo->cman_version);
+ cfs_message("update cluster info (cluster name %s, version = %d)",
+ clinfo->cluster_name, clinfo->cman_version);
if (old && old->nodes_byid && clinfo->nodes_byid) {
@@ -462,7 +462,7 @@
g_static_mutex_unlock (&mutex);
}
-static void
+static void
dump_kvstore_versions(
GString *str,
GHashTable *kvhash,
@@ -544,17 +544,17 @@
}
GHashTable *
-vmlist_hash_new(void)
+vmlist_hash_new(void)
{
return g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
(GDestroyNotify)vminfo_free);
}
-gboolean
+gboolean
vmlist_hash_insert_vm(
GHashTable *vmlist,
- int vmtype,
- guint32 vmid,
+ int vmtype,
+ guint32 vmid,
const char *nodename,
gboolean replace)
{
@@ -581,19 +581,19 @@
return TRUE;
}
-void
+void
vmlist_register_vm(
- int vmtype,
- guint32 vmid,
+ int vmtype,
+ guint32 vmid,
const char *nodename)
{
g_return_if_fail(cfs_status.vmlist != NULL);
g_return_if_fail(nodename != NULL);
g_return_if_fail(vmid != 0);
g_return_if_fail(vmtype == VMTYPE_QEMU || vmtype == VMTYPE_OPENVZ);
-
+
cfs_debug("vmlist_register_vm: %s/%u %d", nodename, vmid, vmtype);
-
+
g_static_mutex_lock (&mutex);
cfs_status.vmlist_version++;
@@ -668,8 +668,8 @@
cfs_status.vmlist_version++;
if (cfs_status.vmlist)
- g_hash_table_destroy(cfs_status.vmlist);
-
+ g_hash_table_destroy(cfs_status.vmlist);
+
cfs_status.vmlist = vmlist;
g_static_mutex_unlock (&mutex);
@@ -693,9 +693,9 @@
g_string_append_printf(str,"\"version\": %u\n", cfs_status.vmlist_version);
} else {
g_string_append_printf(str,"\"version\": %u,\n", cfs_status.vmlist_version);
-
+
g_string_append_printf(str,"\"ids\": {\n");
-
+
GHashTableIter iter;
gpointer key, value;
@@ -713,7 +713,7 @@
type = "unknown";
}
- if (!first)
+ if (!first)
g_string_append_printf(str, ",\n");
first = 0;
@@ -730,11 +730,11 @@
return 0;
}
-void
+void
record_memdb_change(const char *path)
{
g_return_if_fail(cfs_status.memdb_changes != 0);
-
+
memdb_change_t *ce;
if ((ce = (memdb_change_t *)g_hash_table_lookup(cfs_status.memdb_changes, path))) {
@@ -742,7 +742,7 @@
}
}
-void
+void
record_memdb_reload(void)
{
for (int i = 0; i < G_N_ELEMENTS(memdb_change_array); i++) {
@@ -750,7 +750,7 @@
}
}
-static gboolean
+static gboolean
kventry_hash_set(
GHashTable *kvhash,
const char *key,
@@ -799,7 +799,7 @@
"RRA:AVERAGE:0.5:180:70", // 3 hour avg - one week
"RRA:AVERAGE:0.5:720:70", // 12 hour avg - one month
"RRA:AVERAGE:0.5:10080:70", // 7 day avg - ony year
-
+
"RRA:MAX:0.5:1:70", // 1 min max - one hour
"RRA:MAX:0.5:30:70", // 30 min max - one day
"RRA:MAX:0.5:180:70", // 3 hour max - one week
@@ -823,7 +823,7 @@
"RRA:AVERAGE:0.5:180:70", // 3 hour avg - one week
"RRA:AVERAGE:0.5:720:70", // 12 hour avg - one month
"RRA:AVERAGE:0.5:10080:70", // 7 day avg - ony year
-
+
"RRA:MAX:0.5:1:70", // 1 min max - one hour
"RRA:MAX:0.5:30:70", // 30 min max - one day
"RRA:MAX:0.5:180:70", // 3 hour max - one week
@@ -841,7 +841,7 @@
"RRA:AVERAGE:0.5:180:70", // 3 hour avg - one week
"RRA:AVERAGE:0.5:720:70", // 12 hour avg - one month
"RRA:AVERAGE:0.5:10080:70", // 7 day avg - ony year
-
+
"RRA:MAX:0.5:1:70", // 1 min max - one hour
"RRA:MAX:0.5:30:70", // 30 min max - one day
"RRA:MAX:0.5:180:70", // 3 hour max - one week
@@ -885,7 +885,7 @@
return data;
}
-static void
+static void
update_rrd_data(
const char *key,
gconstpointer data,
@@ -916,14 +916,14 @@
if (strlen(node) < 1)
goto keyerror;
-
+
if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
mkdir(RRDDIR "/pve2-node", 0755);
int argcount = sizeof(rrd_def_node)/sizeof(void*) - 1;
create_rrd_file(filename, argcount, rrd_def_node);
}
-
+
} else if (strncmp(key, "pve2-vm/", 8) == 0) {
const char *vmid = key + 8;
@@ -941,7 +941,7 @@
int argcount = sizeof(rrd_def_vm)/sizeof(void*) - 1;
create_rrd_file(filename, argcount, rrd_def_vm);
}
-
+
} else if (strncmp(key, "pve2-storage/", 13) == 0) {
const char *node = key + 13;
@@ -971,7 +971,7 @@
int argcount = sizeof(rrd_def_storage)/sizeof(void*) - 1;
create_rrd_file(filename, argcount, rrd_def_storage);
}
-
+
} else {
goto keyerror;
}
@@ -1017,9 +1017,9 @@
uint32_t ctime = GPOINTER_TO_UINT(user_data);
int diff = ctime - entry->time;
-
+
/* remove everything older than 5 minutes */
- int expire = 60*5;
+ int expire = 60*5;
return (diff > expire) ? TRUE : FALSE;
}
@@ -1039,7 +1039,7 @@
}
/* remove old data */
- g_hash_table_foreach_remove(cfs_status.rrdhash, rrd_entry_is_old,
+ g_hash_table_foreach_remove(cfs_status.rrdhash, rrd_entry_is_old,
GUINT_TO_POINTER(ctime));
g_string_set_size(str, 0);
@@ -1065,7 +1065,7 @@
rrd_dump_buf = g_strdup(str->str);
}
-static gboolean
+static gboolean
rrdentry_hash_set(
GHashTable *rrdhash,
const char *key,
@@ -1101,14 +1101,14 @@
return TRUE;
}
-static int
+static int
kvstore_send_update_message(
dfsm_t *dfsm,
const char *key,
gpointer data,
guint32 len)
{
-
+
struct iovec iov[2];
char name[256];
@@ -1140,7 +1140,7 @@
clog_entry_t *entry = (clog_entry_t *)msg;
- uint32_t size = sizeof(clog_entry_t) + entry->node_len +
+ uint32_t size = sizeof(clog_entry_t) + entry->node_len +
entry->ident_len + entry->tag_len + entry->msg_len;
if (msg_len != size) {
@@ -1176,7 +1176,7 @@
return entry;
}
-static gboolean
+static gboolean
kvstore_parse_update_message(
const void *msg,
size_t msg_len,
@@ -1285,7 +1285,7 @@
g_return_val_if_fail(nodeid != 0, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
g_return_val_if_fail(data != NULL, FALSE);
-
+
g_static_mutex_lock (&mutex);
if (!cfs_status.clinfo || !cfs_status.clinfo->nodes_byid)
@@ -1294,9 +1294,9 @@
cfs_clnode_t *clnode = g_hash_table_lookup(cfs_status.clinfo->nodes_byid, &nodeid);
if (!clnode)
goto ret; /* ignore */
-
- cfs_debug("got node %d status update %s", nodeid, key);
+ cfs_debug("got node %d status update %s", nodeid, key);
+
if (strncmp(key, "rrd/", 4) == 0) {
rrdentry_hash_set(cfs_status.rrdhash, key + 4, data, len);
@@ -1309,7 +1309,7 @@
}
kventry_hash_set(clnode->kvhash, key, data, len);
-
+
}
ret:
g_static_mutex_unlock (&mutex);
@@ -1317,7 +1317,7 @@
return TRUE;
}
-static gboolean
+static gboolean
cfs_kvstore_sync(void)
{
g_return_val_if_fail(cfs_status.kvhash != NULL, FALSE);
@@ -1373,7 +1373,7 @@
cfs_critical("cant parse update message");
}
} else if (msg_type == KVSTORE_MESSAGE_LOG) {
- cfs_message("received log"); // fixme: remove
+ cfs_message("received log"); // fixme: remove
const clog_entry_t *entry;
if ((entry = kvstore_parse_log_message(msg, msg_len))) {
clusterlog_insert(cfs_status.clusterlog, entry);
@@ -1394,11 +1394,11 @@
return 1;
}
-static void
+static void
dfsm_confchg(
dfsm_t *dfsm,
gpointer data,
- const struct cpg_address *member_list,
+ const struct cpg_address *member_list,
size_t member_list_entries)
{
g_return_if_fail(dfsm != NULL);
@@ -1437,21 +1437,21 @@
}
static gpointer
-dfsm_get_state(
- dfsm_t *dfsm,
+dfsm_get_state(
+ dfsm_t *dfsm,
gpointer data,
unsigned int *res_len)
{
g_return_val_if_fail(dfsm != NULL, NULL);
-
+
gpointer msg = clusterlog_get_state(cfs_status.clusterlog, res_len);
return msg;
}
-static int
+static int
dfsm_process_update(
- dfsm_t *dfsm,
+ dfsm_t *dfsm,
gpointer data,
dfsm_sync_info_t *syncinfo,
uint32_t nodeid,
@@ -1459,14 +1459,14 @@
const void *msg,
size_t msg_len)
{
- cfs_critical("%s: received unexpected update message", __func__);
+ cfs_critical("%s: received unexpected update message", __func__);
return -1;
}
static int
dfsm_process_state_update(
- dfsm_t *dfsm,
+ dfsm_t *dfsm,
gpointer data,
dfsm_sync_info_t *syncinfo)
{
@@ -1503,7 +1503,7 @@
static int
dfsm_commit(
- dfsm_t *dfsm,
+ dfsm_t *dfsm,
gpointer data,
dfsm_sync_info_t *syncinfo)
{
@@ -1515,7 +1515,7 @@
static int
dfsm_cleanup(
- dfsm_t *dfsm,
+ dfsm_t *dfsm,
gpointer data,
dfsm_sync_info_t *syncinfo)
{
@@ -1538,7 +1538,7 @@
{
g_static_mutex_lock (&mutex);
- cfs_status.kvstore = dfsm_new(NULL, KVSTORE_CPG_GROUP_NAME, G_LOG_DOMAIN,
+ cfs_status.kvstore = dfsm_new(NULL, KVSTORE_CPG_GROUP_NAME, G_LOG_DOMAIN,
0, &kvstore_dfsm_callbacks);
g_static_mutex_unlock (&mutex);
@@ -1555,14 +1555,14 @@
return res;
}
-void
+void
cfs_set_quorate(
- uint32_t quorate,
+ uint32_t quorate,
gboolean quiet)
{
g_static_mutex_lock (&mutex);
- uint32_t prev_quorate = cfs_status.quorate;
+ uint32_t prev_quorate = cfs_status.quorate;
cfs_status.quorate = quorate;
if (!prev_quorate && cfs_status.quorate) {
More information about the pve-devel
mailing list