mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 13:52:02 +00:00
Style police on api.c
This commit is contained in:
parent
2ec0fb9793
commit
8b050083a0
518
api.c
518
api.c
@ -580,19 +580,19 @@ static char *escape_string(char *str, bool isjson)
|
|||||||
count = 0;
|
count = 0;
|
||||||
for (ptr = str; *ptr; ptr++) {
|
for (ptr = str; *ptr; ptr++) {
|
||||||
switch (*ptr) {
|
switch (*ptr) {
|
||||||
case ',':
|
case ',':
|
||||||
case '|':
|
case '|':
|
||||||
case '=':
|
case '=':
|
||||||
if (!isjson)
|
if (!isjson)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
if (isjson)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
count++;
|
count++;
|
||||||
break;
|
break;
|
||||||
case '"':
|
|
||||||
if (isjson)
|
|
||||||
count++;
|
|
||||||
break;
|
|
||||||
case '\\':
|
|
||||||
count++;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,25 +606,25 @@ static char *escape_string(char *str, bool isjson)
|
|||||||
ptr = buf;
|
ptr = buf;
|
||||||
while (*str)
|
while (*str)
|
||||||
switch (*str) {
|
switch (*str) {
|
||||||
case ',':
|
case ',':
|
||||||
case '|':
|
case '|':
|
||||||
case '=':
|
case '=':
|
||||||
if (!isjson)
|
if (!isjson)
|
||||||
|
*(ptr++) = '\\';
|
||||||
|
*(ptr++) = *(str++);
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
if (isjson)
|
||||||
|
*(ptr++) = '\\';
|
||||||
|
*(ptr++) = *(str++);
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
*(ptr++) = '\\';
|
*(ptr++) = '\\';
|
||||||
*(ptr++) = *(str++);
|
*(ptr++) = *(str++);
|
||||||
break;
|
break;
|
||||||
case '"':
|
default:
|
||||||
if (isjson)
|
*(ptr++) = *(str++);
|
||||||
*(ptr++) = '\\';
|
break;
|
||||||
*(ptr++) = *(str++);
|
|
||||||
break;
|
|
||||||
case '\\':
|
|
||||||
*(ptr++) = '\\';
|
|
||||||
*(ptr++) = *(str++);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*(ptr++) = *(str++);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
@ -636,8 +636,7 @@ static struct api_data *api_add_extra(struct api_data *root, struct api_data *ex
|
|||||||
{
|
{
|
||||||
struct api_data *tmp;
|
struct api_data *tmp;
|
||||||
|
|
||||||
if (root)
|
if (root) {
|
||||||
{
|
|
||||||
if (extra) {
|
if (extra) {
|
||||||
// extra tail
|
// extra tail
|
||||||
tmp = extra->prev;
|
tmp = extra->prev;
|
||||||
@ -654,8 +653,7 @@ static struct api_data *api_add_extra(struct api_data *root, struct api_data *ex
|
|||||||
// root prev = extra tail
|
// root prev = extra tail
|
||||||
root->prev = tmp;
|
root->prev = tmp;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
root = extra;
|
root = extra;
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
@ -695,61 +693,61 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
|
|||||||
api_data->data = data;
|
api_data->data = data;
|
||||||
else
|
else
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case API_ESCAPE:
|
case API_ESCAPE:
|
||||||
case API_STRING:
|
case API_STRING:
|
||||||
case API_CONST:
|
case API_CONST:
|
||||||
api_data->data = (void *)malloc(strlen((char *)data) + 1);
|
api_data->data = (void *)malloc(strlen((char *)data) + 1);
|
||||||
strcpy((char*)(api_data->data), (char *)data);
|
strcpy((char*)(api_data->data), (char *)data);
|
||||||
break;
|
break;
|
||||||
case API_INT:
|
case API_INT:
|
||||||
api_data->data = (void *)malloc(sizeof(int));
|
api_data->data = (void *)malloc(sizeof(int));
|
||||||
*((int *)(api_data->data)) = *((int *)data);
|
*((int *)(api_data->data)) = *((int *)data);
|
||||||
break;
|
break;
|
||||||
case API_UINT:
|
case API_UINT:
|
||||||
api_data->data = (void *)malloc(sizeof(unsigned int));
|
api_data->data = (void *)malloc(sizeof(unsigned int));
|
||||||
*((unsigned int *)(api_data->data)) = *((unsigned int *)data);
|
*((unsigned int *)(api_data->data)) = *((unsigned int *)data);
|
||||||
break;
|
break;
|
||||||
case API_UINT32:
|
case API_UINT32:
|
||||||
api_data->data = (void *)malloc(sizeof(uint32_t));
|
api_data->data = (void *)malloc(sizeof(uint32_t));
|
||||||
*((uint32_t *)(api_data->data)) = *((uint32_t *)data);
|
*((uint32_t *)(api_data->data)) = *((uint32_t *)data);
|
||||||
break;
|
break;
|
||||||
case API_UINT64:
|
case API_UINT64:
|
||||||
api_data->data = (void *)malloc(sizeof(uint64_t));
|
api_data->data = (void *)malloc(sizeof(uint64_t));
|
||||||
*((uint64_t *)(api_data->data)) = *((uint64_t *)data);
|
*((uint64_t *)(api_data->data)) = *((uint64_t *)data);
|
||||||
break;
|
break;
|
||||||
case API_DOUBLE:
|
case API_DOUBLE:
|
||||||
case API_ELAPSED:
|
case API_ELAPSED:
|
||||||
case API_MHS:
|
case API_MHS:
|
||||||
case API_MHTOTAL:
|
case API_MHTOTAL:
|
||||||
case API_UTILITY:
|
case API_UTILITY:
|
||||||
case API_FREQ:
|
case API_FREQ:
|
||||||
case API_HS:
|
case API_HS:
|
||||||
api_data->data = (void *)malloc(sizeof(double));
|
api_data->data = (void *)malloc(sizeof(double));
|
||||||
*((double *)(api_data->data)) = *((double *)data);
|
*((double *)(api_data->data)) = *((double *)data);
|
||||||
break;
|
break;
|
||||||
case API_BOOL:
|
case API_BOOL:
|
||||||
api_data->data = (void *)malloc(sizeof(bool));
|
api_data->data = (void *)malloc(sizeof(bool));
|
||||||
*((bool *)(api_data->data)) = *((bool *)data);
|
*((bool *)(api_data->data)) = *((bool *)data);
|
||||||
break;
|
break;
|
||||||
case API_TIMEVAL:
|
case API_TIMEVAL:
|
||||||
api_data->data = (void *)malloc(sizeof(struct timeval));
|
api_data->data = (void *)malloc(sizeof(struct timeval));
|
||||||
memcpy(api_data->data, data, sizeof(struct timeval));
|
memcpy(api_data->data, data, sizeof(struct timeval));
|
||||||
break;
|
break;
|
||||||
case API_TIME:
|
case API_TIME:
|
||||||
api_data->data = (void *)malloc(sizeof(time_t));
|
api_data->data = (void *)malloc(sizeof(time_t));
|
||||||
*(time_t *)(api_data->data) = *((time_t *)data);
|
*(time_t *)(api_data->data) = *((time_t *)data);
|
||||||
break;
|
break;
|
||||||
case API_VOLTS:
|
case API_VOLTS:
|
||||||
case API_TEMP:
|
case API_TEMP:
|
||||||
api_data->data = (void *)malloc(sizeof(float));
|
api_data->data = (void *)malloc(sizeof(float));
|
||||||
*((float *)(api_data->data)) = *((float *)data);
|
*((float *)(api_data->data)) = *((float *)data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
applog(LOG_ERR, "API: unknown1 data type %d ignored", type);
|
applog(LOG_ERR, "API: unknown1 data type %d ignored", type);
|
||||||
api_data->type = API_STRING;
|
api_data->type = API_STRING;
|
||||||
api_data->data_was_malloc = false;
|
api_data->data_was_malloc = false;
|
||||||
api_data->data = (void *)UNKNOWN;
|
api_data->data = (void *)UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
@ -875,67 +873,67 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
|
|||||||
buf = strchr(buf, '\0');
|
buf = strchr(buf, '\0');
|
||||||
|
|
||||||
switch(root->type) {
|
switch(root->type) {
|
||||||
case API_STRING:
|
case API_STRING:
|
||||||
case API_CONST:
|
case API_CONST:
|
||||||
sprintf(buf, "%s%s%s", quote, (char *)(root->data), quote);
|
sprintf(buf, "%s%s%s", quote, (char *)(root->data), quote);
|
||||||
break;
|
break;
|
||||||
case API_ESCAPE:
|
case API_ESCAPE:
|
||||||
original = (char *)(root->data);
|
original = (char *)(root->data);
|
||||||
escape = escape_string((char *)(root->data), isjson);
|
escape = escape_string((char *)(root->data), isjson);
|
||||||
sprintf(buf, "%s%s%s", quote, escape, quote);
|
sprintf(buf, "%s%s%s", quote, escape, quote);
|
||||||
if (escape != original)
|
if (escape != original)
|
||||||
free(escape);
|
free(escape);
|
||||||
break;
|
break;
|
||||||
case API_INT:
|
case API_INT:
|
||||||
sprintf(buf, "%d", *((int *)(root->data)));
|
sprintf(buf, "%d", *((int *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_UINT:
|
case API_UINT:
|
||||||
sprintf(buf, "%u", *((unsigned int *)(root->data)));
|
sprintf(buf, "%u", *((unsigned int *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_UINT32:
|
case API_UINT32:
|
||||||
sprintf(buf, "%"PRIu32, *((uint32_t *)(root->data)));
|
sprintf(buf, "%"PRIu32, *((uint32_t *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_UINT64:
|
case API_UINT64:
|
||||||
sprintf(buf, "%"PRIu64, *((uint64_t *)(root->data)));
|
sprintf(buf, "%"PRIu64, *((uint64_t *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_TIME:
|
case API_TIME:
|
||||||
sprintf(buf, "%lu", *((unsigned long *)(root->data)));
|
sprintf(buf, "%lu", *((unsigned long *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_DOUBLE:
|
case API_DOUBLE:
|
||||||
sprintf(buf, "%f", *((double *)(root->data)));
|
sprintf(buf, "%f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_ELAPSED:
|
case API_ELAPSED:
|
||||||
sprintf(buf, "%.0f", *((double *)(root->data)));
|
sprintf(buf, "%.0f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_UTILITY:
|
case API_UTILITY:
|
||||||
case API_FREQ:
|
case API_FREQ:
|
||||||
case API_MHS:
|
case API_MHS:
|
||||||
sprintf(buf, "%.2f", *((double *)(root->data)));
|
sprintf(buf, "%.2f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_VOLTS:
|
case API_VOLTS:
|
||||||
sprintf(buf, "%.3f", *((float *)(root->data)));
|
sprintf(buf, "%.3f", *((float *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_MHTOTAL:
|
case API_MHTOTAL:
|
||||||
sprintf(buf, "%.4f", *((double *)(root->data)));
|
sprintf(buf, "%.4f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_HS:
|
case API_HS:
|
||||||
sprintf(buf, "%.15f", *((double *)(root->data)));
|
sprintf(buf, "%.15f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_BOOL:
|
case API_BOOL:
|
||||||
sprintf(buf, "%s", *((bool *)(root->data)) ? "true" : "false");
|
sprintf(buf, "%s", *((bool *)(root->data)) ? "true" : "false");
|
||||||
break;
|
break;
|
||||||
case API_TIMEVAL:
|
case API_TIMEVAL:
|
||||||
sprintf(buf, "%ld.%06ld",
|
sprintf(buf, "%ld.%06ld",
|
||||||
((struct timeval *)(root->data))->tv_sec,
|
((struct timeval *)(root->data))->tv_sec,
|
||||||
((struct timeval *)(root->data))->tv_usec);
|
((struct timeval *)(root->data))->tv_usec);
|
||||||
break;
|
break;
|
||||||
case API_TEMP:
|
case API_TEMP:
|
||||||
sprintf(buf, "%.2f", *((float *)(root->data)));
|
sprintf(buf, "%.2f", *((float *)(root->data)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
applog(LOG_ERR, "API: unknown2 data type %d ignored", root->type);
|
applog(LOG_ERR, "API: unknown2 data type %d ignored", root->type);
|
||||||
sprintf(buf, "%s%s%s", quote, UNKNOWN, quote);
|
sprintf(buf, "%s%s%s", quote, UNKNOWN, quote);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = strchr(buf, '\0');
|
buf = strchr(buf, '\0');
|
||||||
@ -1043,92 +1041,92 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
|
|||||||
for (i = 0; codes[i].severity != SEVERITY_FAIL; i++) {
|
for (i = 0; codes[i].severity != SEVERITY_FAIL; i++) {
|
||||||
if (codes[i].code == messageid) {
|
if (codes[i].code == messageid) {
|
||||||
switch (codes[i].severity) {
|
switch (codes[i].severity) {
|
||||||
case SEVERITY_WARN:
|
case SEVERITY_WARN:
|
||||||
severity[0] = 'W';
|
severity[0] = 'W';
|
||||||
break;
|
break;
|
||||||
case SEVERITY_INFO:
|
case SEVERITY_INFO:
|
||||||
severity[0] = 'I';
|
severity[0] = 'I';
|
||||||
break;
|
break;
|
||||||
case SEVERITY_SUCC:
|
case SEVERITY_SUCC:
|
||||||
severity[0] = 'S';
|
severity[0] = 'S';
|
||||||
break;
|
break;
|
||||||
case SEVERITY_ERR:
|
case SEVERITY_ERR:
|
||||||
default:
|
default:
|
||||||
severity[0] = 'E';
|
severity[0] = 'E';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
severity[1] = '\0';
|
severity[1] = '\0';
|
||||||
|
|
||||||
switch(codes[i].params) {
|
switch(codes[i].params) {
|
||||||
case PARAM_GPU:
|
case PARAM_GPU:
|
||||||
case PARAM_PGA:
|
case PARAM_PGA:
|
||||||
case PARAM_CPU:
|
case PARAM_CPU:
|
||||||
sprintf(buf, codes[i].description, paramid);
|
sprintf(buf, codes[i].description, paramid);
|
||||||
break;
|
break;
|
||||||
case PARAM_POOL:
|
case PARAM_POOL:
|
||||||
sprintf(buf, codes[i].description, paramid, pools[paramid]->rpc_url);
|
sprintf(buf, codes[i].description, paramid, pools[paramid]->rpc_url);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
case PARAM_GPUMAX:
|
case PARAM_GPUMAX:
|
||||||
sprintf(buf, codes[i].description, paramid, nDevs - 1);
|
sprintf(buf, codes[i].description, paramid, nDevs - 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_AN_FPGA
|
#ifdef HAVE_AN_FPGA
|
||||||
case PARAM_PGAMAX:
|
case PARAM_PGAMAX:
|
||||||
pga = numpgas();
|
pga = numpgas();
|
||||||
sprintf(buf, codes[i].description, paramid, pga - 1);
|
sprintf(buf, codes[i].description, paramid, pga - 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WANT_CPUMINE
|
#ifdef WANT_CPUMINE
|
||||||
case PARAM_CPUMAX:
|
case PARAM_CPUMAX:
|
||||||
if (opt_n_threads > 0)
|
if (opt_n_threads > 0)
|
||||||
cpu = num_processors;
|
cpu = num_processors;
|
||||||
else
|
else
|
||||||
cpu = 0;
|
cpu = 0;
|
||||||
sprintf(buf, codes[i].description, paramid, cpu - 1);
|
sprintf(buf, codes[i].description, paramid, cpu - 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case PARAM_PMAX:
|
case PARAM_PMAX:
|
||||||
sprintf(buf, codes[i].description, total_pools);
|
sprintf(buf, codes[i].description, total_pools);
|
||||||
break;
|
break;
|
||||||
case PARAM_POOLMAX:
|
case PARAM_POOLMAX:
|
||||||
sprintf(buf, codes[i].description, paramid, total_pools - 1);
|
sprintf(buf, codes[i].description, paramid, total_pools - 1);
|
||||||
break;
|
break;
|
||||||
case PARAM_DMAX:
|
case PARAM_DMAX:
|
||||||
#ifdef HAVE_AN_FPGA
|
#ifdef HAVE_AN_FPGA
|
||||||
pga = numpgas();
|
pga = numpgas();
|
||||||
#endif
|
#endif
|
||||||
#ifdef WANT_CPUMINE
|
#ifdef WANT_CPUMINE
|
||||||
if (opt_n_threads > 0)
|
if (opt_n_threads > 0)
|
||||||
cpu = num_processors;
|
cpu = num_processors;
|
||||||
else
|
else
|
||||||
cpu = 0;
|
cpu = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf(buf, codes[i].description
|
sprintf(buf, codes[i].description
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
, nDevs
|
, nDevs
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_AN_FPGA
|
#ifdef HAVE_AN_FPGA
|
||||||
, pga
|
, pga
|
||||||
#endif
|
#endif
|
||||||
#ifdef WANT_CPUMINE
|
#ifdef WANT_CPUMINE
|
||||||
, cpu
|
, cpu
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case PARAM_CMD:
|
case PARAM_CMD:
|
||||||
sprintf(buf, codes[i].description, JSON_COMMAND);
|
sprintf(buf, codes[i].description, JSON_COMMAND);
|
||||||
break;
|
break;
|
||||||
case PARAM_STR:
|
case PARAM_STR:
|
||||||
sprintf(buf, codes[i].description, param2);
|
sprintf(buf, codes[i].description, param2);
|
||||||
break;
|
break;
|
||||||
case PARAM_BOTH:
|
case PARAM_BOTH:
|
||||||
sprintf(buf, codes[i].description, paramid, param2);
|
sprintf(buf, codes[i].description, paramid, param2);
|
||||||
break;
|
break;
|
||||||
case PARAM_NONE:
|
case PARAM_NONE:
|
||||||
default:
|
default:
|
||||||
strcpy(buf, codes[i].description);
|
strcpy(buf, codes[i].description);
|
||||||
}
|
}
|
||||||
|
|
||||||
root = api_add_string(root, _STATUS, severity, false);
|
root = api_add_string(root, _STATUS, severity, false);
|
||||||
@ -1464,7 +1462,7 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_AN_FPGA
|
#ifdef HAVE_AN_FPGA
|
||||||
if (numpga > 0)
|
if (numpga > 0) {
|
||||||
for (i = 0; i < numpga; i++) {
|
for (i = 0; i < numpga; i++) {
|
||||||
if (isjson && devcount > 0)
|
if (isjson && devcount > 0)
|
||||||
strcat(io_buffer, COMMA);
|
strcat(io_buffer, COMMA);
|
||||||
@ -1473,10 +1471,11 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
|
|||||||
|
|
||||||
devcount++;
|
devcount++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WANT_CPUMINE
|
#ifdef WANT_CPUMINE
|
||||||
if (opt_n_threads > 0)
|
if (opt_n_threads > 0) {
|
||||||
for (i = 0; i < num_processors; i++) {
|
for (i = 0; i < num_processors; i++) {
|
||||||
if (isjson && devcount > 0)
|
if (isjson && devcount > 0)
|
||||||
strcat(io_buffer, COMMA);
|
strcat(io_buffer, COMMA);
|
||||||
@ -1485,6 +1484,7 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
|
|||||||
|
|
||||||
devcount++;
|
devcount++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isjson)
|
if (isjson)
|
||||||
@ -1714,21 +1714,21 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
|
|||||||
struct pool *pool = pools[i];
|
struct pool *pool = pools[i];
|
||||||
|
|
||||||
switch (pool->enabled) {
|
switch (pool->enabled) {
|
||||||
case POOL_DISABLED:
|
case POOL_DISABLED:
|
||||||
status = (char *)DISABLED;
|
status = (char *)DISABLED;
|
||||||
break;
|
break;
|
||||||
case POOL_REJECTING:
|
case POOL_REJECTING:
|
||||||
status = (char *)REJECTING;
|
status = (char *)REJECTING;
|
||||||
break;
|
break;
|
||||||
case POOL_ENABLED:
|
case POOL_ENABLED:
|
||||||
if (pool->idle)
|
if (pool->idle)
|
||||||
status = (char *)DEAD;
|
status = (char *)DEAD;
|
||||||
else
|
else
|
||||||
status = (char *)ALIVE;
|
status = (char *)ALIVE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = (char *)UNKNOWN;
|
status = (char *)UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pool->hdr_path)
|
if (pool->hdr_path)
|
||||||
@ -2395,33 +2395,33 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse
|
|||||||
reason = REASON_NONE;
|
reason = REASON_NONE;
|
||||||
else
|
else
|
||||||
switch(cgpu->device_not_well_reason) {
|
switch(cgpu->device_not_well_reason) {
|
||||||
case REASON_THREAD_FAIL_INIT:
|
case REASON_THREAD_FAIL_INIT:
|
||||||
reason = REASON_THREAD_FAIL_INIT_STR;
|
reason = REASON_THREAD_FAIL_INIT_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_THREAD_ZERO_HASH:
|
case REASON_THREAD_ZERO_HASH:
|
||||||
reason = REASON_THREAD_ZERO_HASH_STR;
|
reason = REASON_THREAD_ZERO_HASH_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_THREAD_FAIL_QUEUE:
|
case REASON_THREAD_FAIL_QUEUE:
|
||||||
reason = REASON_THREAD_FAIL_QUEUE_STR;
|
reason = REASON_THREAD_FAIL_QUEUE_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_DEV_SICK_IDLE_60:
|
case REASON_DEV_SICK_IDLE_60:
|
||||||
reason = REASON_DEV_SICK_IDLE_60_STR;
|
reason = REASON_DEV_SICK_IDLE_60_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_DEV_DEAD_IDLE_600:
|
case REASON_DEV_DEAD_IDLE_600:
|
||||||
reason = REASON_DEV_DEAD_IDLE_600_STR;
|
reason = REASON_DEV_DEAD_IDLE_600_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_DEV_NOSTART:
|
case REASON_DEV_NOSTART:
|
||||||
reason = REASON_DEV_NOSTART_STR;
|
reason = REASON_DEV_NOSTART_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_DEV_OVER_HEAT:
|
case REASON_DEV_OVER_HEAT:
|
||||||
reason = REASON_DEV_OVER_HEAT_STR;
|
reason = REASON_DEV_OVER_HEAT_STR;
|
||||||
break;
|
break;
|
||||||
case REASON_DEV_THERMAL_CUTOFF:
|
case REASON_DEV_THERMAL_CUTOFF:
|
||||||
reason = REASON_DEV_THERMAL_CUTOFF_STR;
|
reason = REASON_DEV_THERMAL_CUTOFF_STR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
reason = REASON_UNKNOWN_STR;
|
reason = REASON_UNKNOWN_STR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ALL counters (and only counters) must start the name with a '*'
|
// ALL counters (and only counters) must start the name with a '*'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user