Browse Source

Merge commit '1c11680' into littlefury

Luke Dashjr 12 years ago
parent
commit
2dc02a1047
5 changed files with 18 additions and 0 deletions
  1. 1 0
      driver-cpu.c
  2. 13 0
      logging.h
  3. 1 0
      miner.c
  4. 1 0
      ocl.c
  5. 2 0
      spidevc.c

+ 1 - 0
driver-cpu.c

@@ -33,6 +33,7 @@
 #include "deviceapi.h"
 #include "miner.h"
 #include "bench_block.h"
+#include "logging.h"
 #include "util.h"
 #include "driver-cpu.h"
 

+ 13 - 0
logging.h

@@ -12,6 +12,7 @@
 
 #include "config.h"
 
+#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -28,6 +29,8 @@ enum {
 };
 #endif
 
+#include "util.h"
+
 /* debug flags */
 extern bool opt_debug;
 extern bool opt_debug_console;
@@ -58,6 +61,16 @@ extern void _applog(int prio, const char *str);
 	return rv;  \
 } while (0)
 
+#define appperror(prio, s)  do {  \
+	const char *_tmp43 = bfg_strerror(errno, BST_ERRNO);  \
+	if (s && s[0])  \
+		applog(prio, "%s: %s", s, _tmp43);  \
+	else  \
+		_applog(prio, _tmp43);  \
+} while (0)
+
+#define perror(s)  appperror(LOG_ERR, s)
+
 extern void _bfg_clean_up(void);
 
 #define quit(status, fmt, ...) do { \

+ 1 - 0
miner.c

@@ -60,6 +60,7 @@
 
 #include "compat.h"
 #include "deviceapi.h"
+#include "logging.h"
 #include "miner.h"
 #include "findnonce.h"
 #include "adl.h"

+ 1 - 0
ocl.c

@@ -35,6 +35,7 @@
 
 #include "deviceapi.h"
 #include "findnonce.h"
+#include "logging.h"
 #include "ocl.h"
 
 /* Platform API */

+ 2 - 0
spidevc.c

@@ -42,6 +42,8 @@
 #include <linux/i2c-dev.h>
 #include <sys/stat.h>
 
+#include "logging.h"
+
 static volatile unsigned *gpio;
 
 bool spi_init(void)