Browse Source

misc: Replace all remaining instances of 'cgminer' with 'sgminer'.

sed again.
nfactor-troky
Noel Maersk 11 years ago
parent
commit
50066cf3c7
  1. BIN
      MCast.class
  2. 4
      MCast.java
  3. 2
      adl.c
  4. 2
      api-example.c
  5. 2
      api-example.php
  6. 2
      api-example.py
  7. 20
      api.c
  8. 2
      bench_block.h
  9. 2
      driver-opencl.c
  10. 14
      miner.h
  11. 22
      miner.php
  12. 4
      ocl.c
  13. 46
      sgminer.c
  14. 40
      util.c
  15. 4
      util.h

BIN
MCast.class

Binary file not shown.

4
MCast.java

@ -53,7 +53,7 @@ class MCast implements Runnable
System.err.println("usAge: java MCast [-v] [code [toaddr [port [replyport [wait]]]]]"); System.err.println("usAge: java MCast [-v] [code [toaddr [port [replyport [wait]]]]]");
System.err.println(" -v=report elapsed ms to last reply"); System.err.println(" -v=report elapsed ms to last reply");
System.err.println(" Anything below missing or blank will use it's default"); System.err.println(" Anything below missing or blank will use it's default");
System.err.println(" code=X in cgminer-X-Port default="+MCAST_CODE); System.err.println(" code=X in sgminer-X-Port default="+MCAST_CODE);
System.err.println(" toaddr=multicast address default="+MCAST_ADDR); System.err.println(" toaddr=multicast address default="+MCAST_ADDR);
System.err.println(" port=multicast port default="+MCAST_PORT); System.err.println(" port=multicast port default="+MCAST_PORT);
System.err.println(" replyport=local post to listen for replies default="+MCAST_REPORT); System.err.println(" replyport=local post to listen for replies default="+MCAST_REPORT);
@ -188,7 +188,7 @@ class MCast implements Runnable
{ {
try try
{ {
String message = new String("cgminer-" + code + "-" + report); String message = new String("sgminer-" + code + "-" + report);
MulticastSocket socket = null; MulticastSocket socket = null;
DatagramPacket packet = null; DatagramPacket packet = null;

2
adl.c

@ -790,7 +790,7 @@ int gpu_fanpercent(int gpu)
/* Recursive calling applog causes a hang, so disable messages */ /* Recursive calling applog causes a hang, so disable messages */
applog(LOG_WARNING, "GPU %d stopped reporting fanspeed due to driver corruption", gpu); applog(LOG_WARNING, "GPU %d stopped reporting fanspeed due to driver corruption", gpu);
if (opt_restart) { if (opt_restart) {
applog(LOG_WARNING, "Restart enabled, will attempt to restart cgminer"); applog(LOG_WARNING, "Restart enabled, will attempt to restart sgminer");
applog(LOG_WARNING, "You can disable this with the --no-restart option"); applog(LOG_WARNING, "You can disable this with the --no-restart option");
app_restart(); app_restart();
} }

2
api-example.c

@ -8,7 +8,7 @@
*/ */
/* Compile: /* Compile:
* gcc api-example.c -Icompat/jansson-2.5 -Icompat/libusb-1.0/libusb -o cgminer-api * gcc api-example.c -Icompat/jansson-2.5 -Icompat/libusb-1.0/libusb -o sgminer-api
*/ */
#include "config.h" #include "config.h"

2
api-example.php

@ -1,6 +1,6 @@
<?php <?php
# #
# Sample Socket I/O to CGMiner API # Sample Socket I/O to sgminer API
# #
function getsock($addr, $port) function getsock($addr, $port)
{ {

2
api-example.py

@ -7,7 +7,7 @@
# Foundation; either version 3 of the License, or (at your option) any later # Foundation; either version 3 of the License, or (at your option) any later
# version. See COPYING for more details. # version. See COPYING for more details.
#Short Python Example for connecting to The Cgminer API #Short Python Example for connecting to The sgminer API
#Written By: setkeh <https://github.com/setkeh> #Written By: setkeh <https://github.com/setkeh>
#Thanks to Jezzz for all his Support. #Thanks to Jezzz for all his Support.
#NOTE: When adding a param with a pipe | in bash or ZSH you must wrap the arg in quotes #NOTE: When adding a param with a pipe | in bash or ZSH you must wrap the arg in quotes

20
api.c

@ -379,7 +379,7 @@ struct CODES {
{ SEVERITY_ERR, MSG_NOGPUADL,PARAM_GPU, "GPU %d does not have ADL" }, { SEVERITY_ERR, MSG_NOGPUADL,PARAM_GPU, "GPU %d does not have ADL" },
{ SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " MIN_INTENSITY_STR " - " MAX_INTENSITY_STR }, { SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " MIN_INTENSITY_STR " - " MAX_INTENSITY_STR },
{ SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" }, { SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" },
{ SEVERITY_SUCC, MSG_MINECONFIG,PARAM_NONE, "CGMiner config" }, { SEVERITY_SUCC, MSG_MINECONFIG,PARAM_NONE, "sgminer config" },
{ SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" }, { SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" },
{ SEVERITY_SUCC, MSG_GPUMEM, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported success" }, { SEVERITY_SUCC, MSG_GPUMEM, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported success" },
{ SEVERITY_ERR, MSG_GPUEERR, PARAM_BOTH, "Setting GPU %d clock to (%s) reported failure" }, { SEVERITY_ERR, MSG_GPUEERR, PARAM_BOTH, "Setting GPU %d clock to (%s) reported failure" },
@ -409,13 +409,13 @@ struct CODES {
{ SEVERITY_SUCC, MSG_REMPOOL, PARAM_BOTH, "Removed pool %d:'%s'" }, { SEVERITY_SUCC, MSG_REMPOOL, PARAM_BOTH, "Removed pool %d:'%s'" },
{ SEVERITY_SUCC, MSG_NOTIFY, PARAM_NONE, "Notify" }, { SEVERITY_SUCC, MSG_NOTIFY, PARAM_NONE, "Notify" },
{ SEVERITY_SUCC, MSG_DEVDETAILS,PARAM_NONE, "Device Details" }, { SEVERITY_SUCC, MSG_DEVDETAILS,PARAM_NONE, "Device Details" },
{ SEVERITY_SUCC, MSG_MINESTATS,PARAM_NONE, "CGMiner stats" }, { SEVERITY_SUCC, MSG_MINESTATS,PARAM_NONE, "sgminer stats" },
{ SEVERITY_ERR, MSG_MISCHK, PARAM_NONE, "Missing check cmd" }, { SEVERITY_ERR, MSG_MISCHK, PARAM_NONE, "Missing check cmd" },
{ SEVERITY_SUCC, MSG_CHECK, PARAM_NONE, "Check command" }, { SEVERITY_SUCC, MSG_CHECK, PARAM_NONE, "Check command" },
{ SEVERITY_ERR, MSG_MISBOOL, PARAM_NONE, "Missing parameter: true/false" }, { SEVERITY_ERR, MSG_MISBOOL, PARAM_NONE, "Missing parameter: true/false" },
{ SEVERITY_ERR, MSG_INVBOOL, PARAM_NONE, "Invalid parameter should be true or false" }, { SEVERITY_ERR, MSG_INVBOOL, PARAM_NONE, "Invalid parameter should be true or false" },
{ SEVERITY_SUCC, MSG_FOO, PARAM_BOOL, "Failover-Only set to %s" }, { SEVERITY_SUCC, MSG_FOO, PARAM_BOOL, "Failover-Only set to %s" },
{ SEVERITY_SUCC, MSG_MINECOIN,PARAM_NONE, "CGMiner coin" }, { SEVERITY_SUCC, MSG_MINECOIN,PARAM_NONE, "sgminer coin" },
{ SEVERITY_SUCC, MSG_DEBUGSET,PARAM_NONE, "Debug settings" }, { SEVERITY_SUCC, MSG_DEBUGSET,PARAM_NONE, "Debug settings" },
{ SEVERITY_SUCC, MSG_SETCONFIG,PARAM_SET, "Set config '%s' to %d" }, { SEVERITY_SUCC, MSG_SETCONFIG,PARAM_SET, "Set config '%s' to %d" },
{ SEVERITY_ERR, MSG_UNKCON, PARAM_STR, "Unknown config '%s'" }, { SEVERITY_ERR, MSG_UNKCON, PARAM_STR, "Unknown config '%s'" },
@ -2197,7 +2197,7 @@ static void poolpriority(struct io_data *io_data, __maybe_unused SOCKETTYPE c, c
char *ptr, *next; char *ptr, *next;
int i, pr, prio = 0; int i, pr, prio = 0;
// TODO: all cgminer code needs a mutex added everywhere for change // TODO: all sgminer code needs a mutex added everywhere for change
// access to total_pools and also parts of the pools[] array, // access to total_pools and also parts of the pools[] array,
// just copying total_pools here wont solve that // just copying total_pools here wont solve that
@ -2725,7 +2725,7 @@ void dosave(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, b
ptr = NULL; ptr = NULL;
} }
static int itemstats(struct io_data *io_data, int i, char *id, struct cgminer_stats *stats, struct cgminer_pool_stats *pool_stats, struct api_data *extra, struct cgpu_info *cgpu, bool isjson) static int itemstats(struct io_data *io_data, int i, char *id, struct sgminer_stats *stats, struct sgminer_pool_stats *pool_stats, struct api_data *extra, struct cgpu_info *cgpu, bool isjson)
{ {
struct api_data *root = NULL; struct api_data *root = NULL;
char buf[TMPBUFSIZ]; char buf[TMPBUFSIZ];
@ -2795,7 +2795,7 @@ static void minerstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
extra = NULL; extra = NULL;
sprintf(id, "%s%d", cgpu->drv->name, cgpu->device_id); sprintf(id, "%s%d", cgpu->drv->name, cgpu->device_id);
i = itemstats(io_data, i, id, &(cgpu->cgminer_stats), NULL, extra, cgpu, isjson); i = itemstats(io_data, i, id, &(cgpu->sgminer_stats), NULL, extra, cgpu, isjson);
} }
} }
@ -2803,7 +2803,7 @@ static void minerstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
struct pool *pool = pools[j]; struct pool *pool = pools[j];
sprintf(id, "POOL%d", j); sprintf(id, "POOL%d", j);
i = itemstats(io_data, i, id, &(pool->cgminer_stats), &(pool->cgminer_pool_stats), NULL, NULL, isjson); i = itemstats(io_data, i, id, &(pool->sgminer_stats), &(pool->sgminer_pool_stats), NULL, NULL, isjson);
} }
if (isjson && io_open) if (isjson && io_open)
@ -3437,7 +3437,7 @@ static void *quit_thread(__maybe_unused void *userdata)
mutex_unlock(&quit_restart_lock); mutex_unlock(&quit_restart_lock);
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "API: killing cgminer"); applog(LOG_DEBUG, "API: killing sgminer");
kill_work(); kill_work();
@ -3451,7 +3451,7 @@ static void *restart_thread(__maybe_unused void *userdata)
mutex_unlock(&quit_restart_lock); mutex_unlock(&quit_restart_lock);
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "API: restarting cgminer"); applog(LOG_DEBUG, "API: restarting sgminer");
app_restart(); app_restart();
@ -3503,7 +3503,7 @@ static void mcast()
bool addrok; bool addrok;
char group; char group;
char expect[] = "cgminer-"; // first 8 bytes constant char expect[] = "sgminer-"; // first 8 bytes constant
char *expect_code; char *expect_code;
size_t expect_code_len; size_t expect_code_len;
char buf[1024]; char buf[1024];

2
bench_block.h

@ -2,7 +2,7 @@
#define __BENCH_BLOCK_H__ 1 #define __BENCH_BLOCK_H__ 1
// Random work pulled from a pool // Random work pulled from a pool
#define CGMINER_BENCHMARK_BLOCK \ #define SGMINER_BENCHMARK_BLOCK \
0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0xD8, 0x07, 0x17, 0xC9, 0x13, 0x6F, 0xDC, 0xBE, 0xDE, 0xB7, \ 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0xD8, 0x07, 0x17, 0xC9, 0x13, 0x6F, 0xDC, 0xBE, 0xDE, 0xB7, \
0xB2, 0x14, 0xEF, 0xD1, 0x72, 0x7F, 0xA3, 0x72, 0xB2, 0x5D, 0x88, 0xF0, 0x00, 0x00, 0x05, 0xAA, \ 0xB2, 0x14, 0xEF, 0xD1, 0x72, 0x7F, 0xA3, 0x72, 0xB2, 0x5D, 0x88, 0xF0, 0x00, 0x00, 0x05, 0xAA, \
0x00, 0x00, 0x00, 0x00, 0x92, 0x8B, 0x4C, 0x77, 0xF5, 0xB2, 0xE6, 0x56, 0x96, 0x27, 0xE0, 0x66, \ 0x00, 0x00, 0x00, 0x00, 0x92, 0x8B, 0x4C, 0x77, 0xF5, 0xB2, 0xE6, 0x56, 0x96, 0x27, 0xE0, 0x66, \

2
driver-opencl.c

@ -1119,7 +1119,7 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu); applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) { if (!failmessage) {
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this."); applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer."); applog(LOG_ERR, "Try restarting sgminer.");
failmessage = true; failmessage = true;
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
char *buf; char *buf;

14
miner.h

@ -403,7 +403,7 @@ enum dev_reason {
#define MIN_SEC_UNSET 99999999 #define MIN_SEC_UNSET 99999999
struct cgminer_stats { struct sgminer_stats {
uint32_t getwork_calls; uint32_t getwork_calls;
struct timeval getwork_wait; struct timeval getwork_wait;
struct timeval getwork_wait_max; struct timeval getwork_wait_max;
@ -411,7 +411,7 @@ struct cgminer_stats {
}; };
// Just the actual network getworks to the pool // Just the actual network getworks to the pool
struct cgminer_pool_stats { struct sgminer_pool_stats {
uint32_t getwork_calls; uint32_t getwork_calls;
uint32_t getwork_attempts; uint32_t getwork_attempts;
struct timeval getwork_wait; struct timeval getwork_wait;
@ -436,7 +436,7 @@ struct cgminer_pool_stats {
}; };
struct cgpu_info { struct cgpu_info {
int cgminer_id; int sgminer_id;
struct device_drv *drv; struct device_drv *drv;
int device_id; int device_id;
char *name; char *name;
@ -517,7 +517,7 @@ struct cgpu_info {
int dev_comms_error_count; int dev_comms_error_count;
int dev_throttle_count; int dev_throttle_count;
struct cgminer_stats cgminer_stats; struct sgminer_stats sgminer_stats;
pthread_rwlock_t qlock; pthread_rwlock_t qlock;
struct work *queued_work; struct work *queued_work;
@ -951,7 +951,7 @@ extern bool opt_protocol;
extern bool have_longpoll; extern bool have_longpoll;
extern char *opt_kernel_path; extern char *opt_kernel_path;
extern char *opt_socks_proxy; extern char *opt_socks_proxy;
extern char *cgminer_path; extern char *sgminer_path;
extern bool opt_fail_only; extern bool opt_fail_only;
extern bool opt_autofan; extern bool opt_autofan;
extern bool opt_autoengine; extern bool opt_autoengine;
@ -1214,8 +1214,8 @@ struct pool {
double last_share_diff; double last_share_diff;
uint64_t best_diff; uint64_t best_diff;
struct cgminer_stats cgminer_stats; struct sgminer_stats sgminer_stats;
struct cgminer_pool_stats cgminer_pool_stats; struct sgminer_pool_stats sgminer_pool_stats;
/* The last block this particular pool knows about */ /* The last block this particular pool knows about */
char prev_block[32]; char prev_block[32];

22
miner.php

@ -22,7 +22,7 @@ $doctype = "<!DOCTYPE html>\n";
$title = 'Mine'; $title = 'Mine';
# #
# Set $readonly to true to force miner.php to be readonly # Set $readonly to true to force miner.php to be readonly
# Set $readonly to false then it will check cgminer 'privileged' # Set $readonly to false then it will check sgminer 'privileged'
$readonly = false; $readonly = false;
# #
# Set $userlist to null to allow anyone access or read API-README # Set $userlist to null to allow anyone access or read API-README
@ -44,7 +44,7 @@ $checklastshare = true;
# N.B. also if $readonly is true, it will not display the fields # N.B. also if $readonly is true, it will not display the fields
$poolinputs = false; $poolinputs = false;
# #
# Set $rigs to an array of your cgminer rigs that are running # Set $rigs to an array of your sgminer rigs that are running
# format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name' # format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name'
$rigs = array('127.0.0.1:4028'); $rigs = array('127.0.0.1:4028');
# #
@ -54,16 +54,16 @@ $mcast = false;
# Set $mcastexpect to at least how many rigs you expect it to find # Set $mcastexpect to at least how many rigs you expect it to find
$mcastexpect = 0; $mcastexpect = 0;
# #
# API Multicast address all cgminers are listening on # API Multicast address all sgminers are listening on
$mcastaddr = '224.0.0.75'; $mcastaddr = '224.0.0.75';
# #
# API Multicast UDP port all cgminers are listening on # API Multicast UDP port all sgminers are listening on
$mcastport = 4028; $mcastport = 4028;
# #
# The code all cgminers expect in the Multicast message sent # The code all sgminers expect in the Multicast message sent
$mcastcode = 'FTW'; $mcastcode = 'FTW';
# #
# UDP port cgminers are to reply on (by request) # UDP port sgminers are to reply on (by request)
$mcastlistport = 4027; $mcastlistport = 4027;
# #
# Set $mcasttimeout to the number of seconds (floating point) # Set $mcasttimeout to the number of seconds (floating point)
@ -437,7 +437,7 @@ function mcastrigs()
return; return;
} }
$buf = "cgminer-$mcastcode-$mcastlistport"; $buf = "sgminer-$mcastcode-$mcastlistport";
socket_sendto($mcast_soc, $buf, strlen($buf), 0, $mcastaddr, $mcastport); socket_sendto($mcast_soc, $buf, strlen($buf), 0, $mcastaddr, $mcastport);
socket_close($mcast_soc); socket_close($mcast_soc);
@ -1569,7 +1569,7 @@ function rigbutton($rig, $rigname, $when, $row)
# #
function showrigs($anss, $headname, $rigname) function showrigs($anss, $headname, $rigname)
{ {
$dthead = array($headname => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1, 'API' => 1, 'CGMiner' => 1); $dthead = array($headname => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1, 'API' => 1, 'sgminer' => 1);
showhead('', $dthead); showhead('', $dthead);
foreach ($anss as $rig => $ans) foreach ($anss as $rig => $ans)
@ -1850,8 +1850,8 @@ function pagebuttons($rig, $pg)
$rg = ''; $rg = '';
if (count($rigs) > 1) if (count($rigs) > 1)
$rg = " Rig $rig"; $rg = " Rig $rig";
echo "<input type=button value='Restart' onclick='prc(\"restart&rig=$rig\",\"Restart CGMiner$rg\")'>"; echo "<input type=button value='Restart' onclick='prc(\"restart&rig=$rig\",\"Restart sgminer$rg\")'>";
echo "&nbsp;<input type=button value='Quit' onclick='prc(\"quit&rig=$rig\",\"Quit CGMiner$rg\")'>"; echo "&nbsp;<input type=button value='Quit' onclick='prc(\"quit&rig=$rig\",\"Quit sgminer$rg\")'>";
} }
refreshbuttons(); refreshbuttons();
if (isset($_SESSION[$ses])) if (isset($_SESSION[$ses]))
@ -1881,7 +1881,7 @@ function doOne($rig, $preprocess)
if ($notify) if ($notify)
$cmds['notify'] = 'device status'; $cmds['notify'] = 'device status';
$cmds['config'] = 'cgminer config'; $cmds['config'] = 'sgminer config';
process($cmds, $rig); process($cmds, $rig);

4
ocl.c

@ -47,8 +47,8 @@ char *file_contents(const char *filename, int *length)
/* Try in the optional kernel path or installed prefix first */ /* Try in the optional kernel path or installed prefix first */
f = fopen(fullpath, "rb"); f = fopen(fullpath, "rb");
if (!f) { if (!f) {
/* Then try from the path cgminer was called */ /* Then try from the path sgminer was called */
strcpy(fullpath, cgminer_path); strcpy(fullpath, sgminer_path);
strcat(fullpath, filename); strcat(fullpath, filename);
f = fopen(fullpath, "rb"); f = fopen(fullpath, "rb");
} }

46
sgminer.c

@ -142,7 +142,7 @@ int opt_tcp_keepalive;
#endif #endif
char *opt_kernel_path; char *opt_kernel_path;
char *cgminer_path; char *sgminer_path;
#define QUIET (opt_quiet || opt_realquiet) #define QUIET (opt_quiet || opt_realquiet)
@ -256,7 +256,7 @@ static struct stratum_share *stratum_shares = NULL;
char *opt_socks_proxy = NULL; char *opt_socks_proxy = NULL;
static const char def_conf[] = "cgminer.conf"; static const char def_conf[] = "sgminer.conf";
static char *default_config; static char *default_config;
static bool config_loaded; static bool config_loaded;
static int include_count; static int include_count;
@ -960,7 +960,7 @@ static struct opt_table opt_config_table[] = {
"Allow API access only to the given list of [G:]IP[/Prefix] addresses[/subnets]"), "Allow API access only to the given list of [G:]IP[/Prefix] addresses[/subnets]"),
OPT_WITH_ARG("--api-description", OPT_WITH_ARG("--api-description",
set_api_description, NULL, NULL, set_api_description, NULL, NULL,
"Description placed in the API status header, default: cgminer version"), "Description placed in the API status header, default: sgminer version"),
OPT_WITH_ARG("--api-groups", OPT_WITH_ARG("--api-groups",
set_api_groups, NULL, NULL, set_api_groups, NULL, NULL,
"API one letter groups G:cmd:cmd[,P:cmd:*...] defining the cmds a groups can use"), "API one letter groups G:cmd:cmd[,P:cmd:*...] defining the cmds a groups can use"),
@ -1001,7 +1001,7 @@ static struct opt_table opt_config_table[] = {
"Change multipool strategy from failover to even share balance"), "Change multipool strategy from failover to even share balance"),
OPT_WITHOUT_ARG("--benchmark", OPT_WITHOUT_ARG("--benchmark",
opt_set_bool, &opt_benchmark, opt_set_bool, &opt_benchmark,
"Run cgminer in benchmark mode - produces no shares"), "Run sgminer in benchmark mode - produces no shares"),
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
OPT_WITHOUT_ARG("--compact", OPT_WITHOUT_ARG("--compact",
opt_set_bool, &opt_compact, opt_set_bool, &opt_compact,
@ -2632,7 +2632,7 @@ out:
static bool get_upstream_work(struct work *work, CURL *curl) static bool get_upstream_work(struct work *work, CURL *curl)
{ {
struct pool *pool = work->pool; struct pool *pool = work->pool;
struct cgminer_pool_stats *pool_stats = &(pool->cgminer_pool_stats); struct sgminer_pool_stats *pool_stats = &(pool->sgminer_pool_stats);
struct timeval tv_elapsed; struct timeval tv_elapsed;
json_t *val = NULL; json_t *val = NULL;
bool rc = false; bool rc = false;
@ -2836,7 +2836,7 @@ static double le256todouble(const void *target)
*/ */
static void calc_diff(struct work *work, double known) static void calc_diff(struct work *work, double known)
{ {
struct cgminer_pool_stats *pool_stats = &(work->pool->cgminer_pool_stats); struct sgminer_pool_stats *pool_stats = &(work->pool->sgminer_pool_stats);
double difficulty; double difficulty;
int intdiff; int intdiff;
@ -2876,7 +2876,7 @@ static void calc_diff(struct work *work, double known)
static void get_benchmark_work(struct work *work) static void get_benchmark_work(struct work *work)
{ {
// Use a random work block pulled from a pool // Use a random work block pulled from a pool
static uint8_t bench_block[] = { CGMINER_BENCHMARK_BLOCK }; static uint8_t bench_block[] = { SGMINER_BENCHMARK_BLOCK };
size_t bench_size = sizeof(*work); size_t bench_size = sizeof(*work);
size_t work_size = sizeof(bench_block); size_t work_size = sizeof(bench_block);
@ -3437,7 +3437,7 @@ static bool stale_work(struct work *work, bool share)
/* Factor in the average getwork delay of this pool, rounding it up to /* Factor in the average getwork delay of this pool, rounding it up to
* the nearest second */ * the nearest second */
getwork_delay = pool->cgminer_pool_stats.getwork_wait_rolling * 5 + 1; getwork_delay = pool->sgminer_pool_stats.getwork_wait_rolling * 5 + 1;
work_expiry -= getwork_delay; work_expiry -= getwork_delay;
if (unlikely(work_expiry < 5)) if (unlikely(work_expiry < 5))
work_expiry = 5; work_expiry = 5;
@ -4626,7 +4626,7 @@ void default_save_file(char *filename)
} }
else else
strcpy(filename, ""); strcpy(filename, "");
strcat(filename, ".cgminer/"); strcat(filename, ".sgminer/");
mkdir(filename, 0777); mkdir(filename, 0777);
#else #else
strcpy(filename, ""); strcpy(filename, "");
@ -5995,8 +5995,8 @@ static void hash_sole_work(struct thr_info *mythr)
struct cgpu_info *cgpu = mythr->cgpu; struct cgpu_info *cgpu = mythr->cgpu;
struct device_drv *drv = cgpu->drv; struct device_drv *drv = cgpu->drv;
struct timeval getwork_start, tv_start, *tv_end, tv_workstart, tv_lastupdate; struct timeval getwork_start, tv_start, *tv_end, tv_workstart, tv_lastupdate;
struct cgminer_stats *dev_stats = &(cgpu->cgminer_stats); struct sgminer_stats *dev_stats = &(cgpu->sgminer_stats);
struct cgminer_stats *pool_stats; struct sgminer_stats *pool_stats;
/* Try to cycle approximately 5 times before each log update */ /* Try to cycle approximately 5 times before each log update */
const long cycle = opt_log_interval / 5 ? : 1; const long cycle = opt_log_interval / 5 ? : 1;
const bool primary = (!mythr->device_thread) || mythr->primary_thread; const bool primary = (!mythr->device_thread) || mythr->primary_thread;
@ -6054,7 +6054,7 @@ static void hash_sole_work(struct thr_info *mythr)
copy_time(&dev_stats->getwork_wait_min, &getwork_start); copy_time(&dev_stats->getwork_wait_min, &getwork_start);
dev_stats->getwork_calls++; dev_stats->getwork_calls++;
pool_stats = &(work->pool->cgminer_stats); pool_stats = &(work->pool->sgminer_stats);
addtime(&getwork_start, &pool_stats->getwork_wait); addtime(&getwork_start, &pool_stats->getwork_wait);
if (time_more(&getwork_start, &pool_stats->getwork_wait_max)) if (time_more(&getwork_start, &pool_stats->getwork_wait_max))
@ -7335,7 +7335,7 @@ void enable_curses(void) {
} }
#endif #endif
static int cgminer_id_count = 0; static int sgminer_id_count = 0;
/* Various noop functions for drivers that don't support or need their /* Various noop functions for drivers that don't support or need their
* variants. */ * variants. */
@ -7442,7 +7442,7 @@ void enable_device(struct cgpu_info *cgpu)
cgpu->deven = DEV_ENABLED; cgpu->deven = DEV_ENABLED;
wr_lock(&devices_lock); wr_lock(&devices_lock);
devices[cgpu->cgminer_id = cgminer_id_count++] = cgpu; devices[cgpu->sgminer_id = sgminer_id_count++] = cgpu;
wr_unlock(&devices_lock); wr_unlock(&devices_lock);
if (hotplug_mode) { if (hotplug_mode) {
@ -7604,11 +7604,11 @@ int main(int argc, char *argv[])
#endif #endif
opt_kernel_path = alloca(PATH_MAX); opt_kernel_path = alloca(PATH_MAX);
strcpy(opt_kernel_path, SGMINER_PREFIX); strcpy(opt_kernel_path, SGMINER_PREFIX);
cgminer_path = alloca(PATH_MAX); sgminer_path = alloca(PATH_MAX);
s = strdup(argv[0]); s = strdup(argv[0]);
strcpy(cgminer_path, dirname(s)); strcpy(sgminer_path, dirname(s));
free(s); free(s);
strcat(cgminer_path, "/"); strcat(sgminer_path, "/");
devcursor = 8; devcursor = 8;
logstart = devcursor + 1; logstart = devcursor + 1;
@ -7675,7 +7675,7 @@ int main(int argc, char *argv[])
case -1: case -1:
applog(LOG_WARNING, "Error in configuration file, partially loaded."); applog(LOG_WARNING, "Error in configuration file, partially loaded.");
if (use_curses) if (use_curses)
applog(LOG_WARNING, "Start cgminer with -T to see what failed to load."); applog(LOG_WARNING, "Start sgminer with -T to see what failed to load.");
break; break;
default: default:
break; break;
@ -7730,7 +7730,7 @@ int main(int argc, char *argv[])
devices[i]->deven = DEV_DISABLED; devices[i]->deven = DEV_DISABLED;
} }
} }
total_devices = cgminer_id_count; total_devices = sgminer_id_count;
} else { } else {
for (i = 0; i < total_devices; ++i) for (i = 0; i < total_devices; ++i)
enable_device(devices[i]); enable_device(devices[i]);
@ -7744,7 +7744,7 @@ int main(int argc, char *argv[])
load_temp_cutoffs(); load_temp_cutoffs();
for (i = 0; i < total_devices; ++i) for (i = 0; i < total_devices; ++i)
devices[i]->cgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET; devices[i]->sgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET;
if (!opt_compact) { if (!opt_compact) {
logstart += most_devices; logstart += most_devices;
@ -7773,8 +7773,8 @@ int main(int argc, char *argv[])
struct pool *pool = pools[i]; struct pool *pool = pools[i];
size_t siz; size_t siz;
pool->cgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET; pool->sgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET;
pool->cgminer_pool_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET; pool->sgminer_pool_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET;
if (!pool->rpc_userpass) { if (!pool->rpc_userpass) {
if (!pool->rpc_user || !pool->rpc_pass) if (!pool->rpc_user || !pool->rpc_pass)
@ -7874,7 +7874,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
if (use_curses) { if (use_curses) {
halfdelay(150); halfdelay(150);
applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s."); applog(LOG_ERR, "Press any key to exit, or sgminer will try again in 15s.");
if (getch() != ERR) if (getch() != ERR)
quit(0, "No servers could be used! Exiting."); quit(0, "No servers could be used! Exiting.");
cbreak(); cbreak();

40
util.c

@ -280,12 +280,12 @@ static int curl_debug_cb(__maybe_unused CURL *handle, curl_infotype type,
case CURLINFO_HEADER_IN: case CURLINFO_HEADER_IN:
case CURLINFO_DATA_IN: case CURLINFO_DATA_IN:
case CURLINFO_SSL_DATA_IN: case CURLINFO_SSL_DATA_IN:
pool->cgminer_pool_stats.net_bytes_received += size; pool->sgminer_pool_stats.net_bytes_received += size;
break; break;
case CURLINFO_HEADER_OUT: case CURLINFO_HEADER_OUT:
case CURLINFO_DATA_OUT: case CURLINFO_DATA_OUT:
case CURLINFO_SSL_DATA_OUT: case CURLINFO_SSL_DATA_OUT:
pool->cgminer_pool_stats.net_bytes_sent += size; pool->sgminer_pool_stats.net_bytes_sent += size;
break; break;
case CURLINFO_TEXT: case CURLINFO_TEXT:
default: default:
@ -419,12 +419,12 @@ json_t *json_rpc_call(CURL *curl, const char *url,
goto err_out; goto err_out;
} }
pool->cgminer_pool_stats.times_sent++; pool->sgminer_pool_stats.times_sent++;
if (curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &byte_count) == CURLE_OK) if (curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &byte_count) == CURLE_OK)
pool->cgminer_pool_stats.bytes_sent += byte_count; pool->sgminer_pool_stats.bytes_sent += byte_count;
pool->cgminer_pool_stats.times_received++; pool->sgminer_pool_stats.times_received++;
if (curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &byte_count) == CURLE_OK) if (curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &byte_count) == CURLE_OK)
pool->cgminer_pool_stats.bytes_received += byte_count; pool->sgminer_pool_stats.bytes_received += byte_count;
if (probing) { if (probing) {
pool->probed = true; pool->probed = true;
@ -451,10 +451,10 @@ json_t *json_rpc_call(CURL *curl, const char *url,
} }
*rolltime = hi.rolltime; *rolltime = hi.rolltime;
pool->cgminer_pool_stats.rolltime = hi.rolltime; pool->sgminer_pool_stats.rolltime = hi.rolltime;
pool->cgminer_pool_stats.hadrolltime = hi.hadrolltime; pool->sgminer_pool_stats.hadrolltime = hi.hadrolltime;
pool->cgminer_pool_stats.canroll = hi.canroll; pool->sgminer_pool_stats.canroll = hi.canroll;
pool->cgminer_pool_stats.hadexpire = hi.hadexpire; pool->sgminer_pool_stats.hadexpire = hi.hadexpire;
val = JSON_LOADS(all_data.buf, &err); val = JSON_LOADS(all_data.buf, &err);
if (!val) { if (!val) {
@ -929,7 +929,7 @@ static void __maybe_unused timersubspec(struct timespec *a, const struct timespe
} }
} }
/* These are cgminer specific sleep functions that use an absolute nanosecond /* These are sgminer specific sleep functions that use an absolute nanosecond
* resolution timer to avoid poor usleep accuracy and overruns. */ * resolution timer to avoid poor usleep accuracy and overruns. */
#ifdef WIN32 #ifdef WIN32
/* Windows start time is since 1601 LOL so convert it to unix epoch 1970. */ /* Windows start time is since 1601 LOL so convert it to unix epoch 1970. */
@ -950,7 +950,7 @@ static void decius_time(lldiv_t *lidiv)
*lidiv = lldiv(li.QuadPart, 10000000); *lidiv = lldiv(li.QuadPart, 10000000);
} }
/* This is a cgminer gettimeofday wrapper. Since we always call gettimeofday /* This is a sgminer gettimeofday wrapper. Since we always call gettimeofday
* with tz set to NULL, and windows' default resolution is only 15ms, this * with tz set to NULL, and windows' default resolution is only 15ms, this
* gives us higher resolution times on windows. */ * gives us higher resolution times on windows. */
void cgtime(struct timeval *tv) void cgtime(struct timeval *tv)
@ -1278,9 +1278,9 @@ static enum send_ret __stratum_send(struct pool *pool, char *s, ssize_t len)
len -= sent; len -= sent;
} }
pool->cgminer_pool_stats.times_sent++; pool->sgminer_pool_stats.times_sent++;
pool->cgminer_pool_stats.bytes_sent += ssent; pool->sgminer_pool_stats.bytes_sent += ssent;
pool->cgminer_pool_stats.net_bytes_sent += ssent; pool->sgminer_pool_stats.net_bytes_sent += ssent;
return SEND_OK; return SEND_OK;
} }
@ -1445,9 +1445,9 @@ char *recv_line(struct pool *pool)
else else
strcpy(pool->sockbuf, ""); strcpy(pool->sockbuf, "");
pool->cgminer_pool_stats.times_received++; pool->sgminer_pool_stats.times_received++;
pool->cgminer_pool_stats.bytes_received += len; pool->sgminer_pool_stats.bytes_received += len;
pool->cgminer_pool_stats.net_bytes_received += len; pool->sgminer_pool_stats.net_bytes_received += len;
out: out:
if (!sret) if (!sret)
clear_sock(pool); clear_sock(pool);
@ -1992,7 +1992,7 @@ static bool socks4_negotiate(struct pool *pool, int sockd, bool socks4a)
port = atoi(pool->stratum_port); port = atoi(pool->stratum_port);
buf[2] = port >> 8; buf[2] = port >> 8;
buf[3] = port & 0xff; buf[3] = port & 0xff;
sprintf(&buf[8], "CGMINER"); sprintf(&buf[8], "SGMINER");
/* See if we've been given an IP address directly to avoid needing to /* See if we've been given an IP address directly to avoid needing to
* resolve it. */ * resolve it. */
@ -2527,7 +2527,7 @@ void RenameThread(const char* name)
#endif #endif
} }
/* cgminer specific wrappers for true unnamed semaphore usage on platforms /* sgminer specific wrappers for true unnamed semaphore usage on platforms
* that support them and for apple which does not. We use a single byte across * that support them and for apple which does not. We use a single byte across
* a pipe to emulate semaphore behaviour there. */ * a pipe to emulate semaphore behaviour there. */
#ifdef __APPLE__ #ifdef __APPLE__

4
util.h

@ -67,7 +67,7 @@ typedef curl_proxytype proxytypes_t;
typedef int proxytypes_t; typedef int proxytypes_t;
#endif /* HAVE_LIBCURL */ #endif /* HAVE_LIBCURL */
/* cgminer locks, a write biased variant of rwlocks */ /* sgminer locks, a write biased variant of rwlocks */
struct cglock { struct cglock {
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
@ -75,7 +75,7 @@ struct cglock {
typedef struct cglock cglock_t; typedef struct cglock cglock_t;
/* cgminer specific unnamed semaphore implementations to cope with osx not /* sgminer specific unnamed semaphore implementations to cope with osx not
* implementing them. */ * implementing them. */
#ifdef __APPLE__ #ifdef __APPLE__
struct cgsem { struct cgsem {

Loading…
Cancel
Save