Browse Source

core: rename default_algorithm to opt_algorithm.

... So it's easier to find when refactoring the configuration system
later on.
refactor
Noel Maersk 11 years ago
parent
commit
3ddf6baad9
  1. 2
      driver-opencl.c
  2. 2
      miner.h
  3. 1
      ocl.h
  4. 20
      sgminer.c

2
driver-opencl.c

@ -1188,7 +1188,7 @@ static void opencl_detect(bool hotplug)
cgpu->threads = 1; cgpu->threads = 1;
#endif #endif
cgpu->virtual_gpu = i; cgpu->virtual_gpu = i;
cgpu->algorithm = *default_algorithm; cgpu->algorithm = *opt_algorithm;
add_cgpu(cgpu); add_cgpu(cgpu);
} }

2
miner.h

@ -1015,7 +1015,7 @@ extern int opt_queue;
extern int opt_scantime; extern int opt_scantime;
extern int opt_expiry; extern int opt_expiry;
extern algorithm_t *default_algorithm; extern algorithm_t *opt_algorithm;
extern cglock_t control_lock; extern cglock_t control_lock;
extern pthread_mutex_t hash_lock; extern pthread_mutex_t hash_lock;

1
ocl.h

@ -37,4 +37,3 @@ extern int clDevicesNum(void);
extern _clState *initCl(unsigned int gpu, char *name, size_t nameSize, algorithm_t *algorithm); extern _clState *initCl(unsigned int gpu, char *name, size_t nameSize, algorithm_t *algorithm);
#endif /* OCL_H */ #endif /* OCL_H */

20
sgminer.c

@ -98,7 +98,7 @@ int opt_queue = 1;
int opt_scantime = 7; int opt_scantime = 7;
int opt_expiry = 28; int opt_expiry = 28;
algorithm_t *default_algorithm; algorithm_t *opt_algorithm;
static const bool opt_time = true; static const bool opt_time = true;
unsigned long long global_hashrate; unsigned long long global_hashrate;
@ -543,7 +543,7 @@ struct pool *add_pool(void)
pool->name = strdup(buf); pool->name = strdup(buf);
/* Algorithm */ /* Algorithm */
pool->algorithm = *default_algorithm; pool->algorithm = *opt_algorithm;
pools = (struct pool **)realloc(pools, sizeof(struct pool *) * (total_pools + 2)); pools = (struct pool **)realloc(pools, sizeof(struct pool *) * (total_pools + 2));
pools[total_pools++] = pool; pools[total_pools++] = pool;
@ -1070,17 +1070,17 @@ static void load_temp_cutoffs()
static char *set_algo(const char *arg) static char *set_algo(const char *arg)
{ {
set_algorithm(default_algorithm, arg); set_algorithm(opt_algorithm, arg);
applog(LOG_INFO, "Set default algorithm to %s", default_algorithm->name); applog(LOG_INFO, "Set default algorithm to %s", opt_algorithm->name);
return NULL; return NULL;
} }
static char *set_nfactor(const char *arg) static char *set_nfactor(const char *arg)
{ {
set_algorithm_nfactor(default_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)", applog(LOG_INFO, "Set algorithm N-factor to %d (N to %d)",
default_algorithm->nfactor, default_algorithm->n); opt_algorithm->nfactor, opt_algorithm->n);
return NULL; return NULL;
} }
@ -4456,8 +4456,8 @@ void write_config(FILE *fcfg)
} }
if (opt_removedisabled) if (opt_removedisabled)
fprintf(fcfg, ",\n\"remove-disabled\" : true"); fprintf(fcfg, ",\n\"remove-disabled\" : true");
if (strcmp(default_algorithm->name, "scrypt") != 0) if (strcmp(opt_algorithm->name, "scrypt") != 0)
fprintf(fcfg, ",\n\"algorithm\" : \"%s\"", json_escape(default_algorithm->name)); fprintf(fcfg, ",\n\"algorithm\" : \"%s\"", json_escape(opt_algorithm->name));
if (opt_api_allow) if (opt_api_allow)
fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", json_escape(opt_api_allow)); fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", json_escape(opt_api_allow));
if (strcmp(opt_api_mcast_addr, API_MCAST_ADDR) != 0) if (strcmp(opt_api_mcast_addr, API_MCAST_ADDR) != 0)
@ -7985,8 +7985,8 @@ int main(int argc, char *argv[])
#endif #endif
/* Default algorithm specified in algorithm.c ATM */ /* Default algorithm specified in algorithm.c ATM */
default_algorithm = (algorithm_t *)alloca(sizeof(algorithm_t)); opt_algorithm = (algorithm_t *)alloca(sizeof(algorithm_t));
set_algorithm(default_algorithm, "scrypt"); set_algorithm(opt_algorithm, "scrypt");
devcursor = 8; devcursor = 8;
logstart = devcursor + 1; logstart = devcursor + 1;

Loading…
Cancel
Save