mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 06:18:06 +00:00
Made opt_algorithm to simple variable
This commit is contained in:
parent
e86b72e6e9
commit
3b298478a3
@ -1157,7 +1157,7 @@ static void opencl_detect(bool hotplug)
|
||||
cgpu->threads = 1;
|
||||
#endif
|
||||
cgpu->virtual_gpu = i;
|
||||
cgpu->algorithm = *opt_algorithm;
|
||||
cgpu->algorithm = opt_algorithm;
|
||||
add_cgpu(cgpu);
|
||||
}
|
||||
|
||||
|
2
miner.h
2
miner.h
@ -990,7 +990,7 @@ extern int opt_queue;
|
||||
extern int opt_scantime;
|
||||
extern int opt_expiry;
|
||||
|
||||
extern algorithm_t *opt_algorithm;
|
||||
extern algorithm_t opt_algorithm;
|
||||
|
||||
extern cglock_t control_lock;
|
||||
extern pthread_mutex_t hash_lock;
|
||||
|
23
sgminer.c
23
sgminer.c
@ -98,7 +98,7 @@ int opt_queue = 1;
|
||||
int opt_scantime = 7;
|
||||
int opt_expiry = 28;
|
||||
|
||||
algorithm_t *opt_algorithm;
|
||||
algorithm_t opt_algorithm;
|
||||
|
||||
unsigned long long global_hashrate;
|
||||
unsigned long global_quota_gcd = 1;
|
||||
@ -528,7 +528,7 @@ struct pool *add_pool(void)
|
||||
pool->name = strdup(buf);
|
||||
|
||||
/* Algorithm */
|
||||
pool->algorithm = *opt_algorithm;
|
||||
pool->algorithm = opt_algorithm;
|
||||
|
||||
pools = (struct pool **)realloc(pools, sizeof(struct pool *) * (total_pools + 2));
|
||||
pools[total_pools++] = pool;
|
||||
@ -1117,8 +1117,8 @@ static void load_temp_cutoffs()
|
||||
static char *set_algo(const char *arg)
|
||||
{
|
||||
if ((json_array_index < 0) || (total_pools == 0)) {
|
||||
set_algorithm(opt_algorithm, arg);
|
||||
applog(LOG_INFO, "Set default algorithm to %s", opt_algorithm->name);
|
||||
set_algorithm(&opt_algorithm, arg);
|
||||
applog(LOG_INFO, "Set default algorithm to %s", opt_algorithm.name);
|
||||
} else {
|
||||
set_pool_algorithm(arg);
|
||||
}
|
||||
@ -1129,9 +1129,9 @@ static char *set_algo(const char *arg)
|
||||
static char *set_nfactor(const char *arg)
|
||||
{
|
||||
if ((json_array_index < 0) || (total_pools == 0)) {
|
||||
set_algorithm_nfactor(opt_algorithm, (const uint8_t) atoi(arg));
|
||||
set_algorithm_nfactor(&opt_algorithm, (const uint8_t) atoi(arg));
|
||||
applog(LOG_INFO, "Set algorithm N-factor to %d (N to %d)",
|
||||
opt_algorithm->nfactor, opt_algorithm->n);
|
||||
opt_algorithm.nfactor, opt_algorithm.n);
|
||||
} else {
|
||||
set_pool_nfactor(arg);
|
||||
}
|
||||
@ -4414,7 +4414,7 @@ void write_config(FILE *fcfg)
|
||||
if (strcmp(pool->description, "") != 0) {
|
||||
fprintf(fcfg, ",\n\t\t\"description\" : \"%s\"", json_escape(pool->description));
|
||||
}
|
||||
if (!cmp_algorithm(&pool->algorithm, opt_algorithm)) {
|
||||
if (!cmp_algorithm(&pool->algorithm, &opt_algorithm)) {
|
||||
fprintf(fcfg, ",\n\t\t\"algorithm\" : \"%s\"", json_escape(pool->algorithm.name));
|
||||
}
|
||||
if (pool->prio != i) {
|
||||
@ -4591,8 +4591,8 @@ void write_config(FILE *fcfg)
|
||||
}
|
||||
if (opt_removedisabled)
|
||||
fprintf(fcfg, ",\n\"remove-disabled\" : true");
|
||||
if (strcmp(opt_algorithm->name, "scrypt") != 0)
|
||||
fprintf(fcfg, ",\n\"algorithm\" : \"%s\"", json_escape(opt_algorithm->name));
|
||||
if (strcmp(opt_algorithm.name, "scrypt") != 0)
|
||||
fprintf(fcfg, ",\n\"algorithm\" : \"%s\"", json_escape(opt_algorithm.name));
|
||||
if (opt_api_allow)
|
||||
fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", json_escape(opt_api_allow));
|
||||
if (strcmp(opt_api_mcast_addr, API_MCAST_ADDR) != 0)
|
||||
@ -7409,7 +7409,7 @@ static bool input_pool(bool live)
|
||||
desc = curses_input("Description (optional)");
|
||||
if (strcmp(desc, "-1") == 0) strcpy(desc, "");
|
||||
algo = curses_input("Algorithm (optional)");
|
||||
if (strcmp(algo, "-1") == 0) strcpy(algo, opt_algorithm->name);
|
||||
if (strcmp(algo, "-1") == 0) strcpy(algo, opt_algorithm.name);
|
||||
|
||||
pool = add_pool();
|
||||
|
||||
@ -7919,8 +7919,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/* Default algorithm specified in algorithm.c ATM */
|
||||
opt_algorithm = (algorithm_t *)alloca(sizeof(algorithm_t));
|
||||
set_algorithm(opt_algorithm, "scrypt");
|
||||
set_algorithm(&opt_algorithm, "scrypt");
|
||||
|
||||
devcursor = 8;
|
||||
logstart = devcursor + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user