Rename "DevmapperLogCallback" to avoid conflicts

Rename the "DevmapperLogCallback" exported-to-C function to
"StorageDevmapperLogCallback", to avoid tripping up anyone who vendors
the library but already has a copy of the "pkg/devicemapper" pkg which
defines the callback with its previous name.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-01-09 11:54:40 -05:00
parent cad8eb40eb
commit 55e5d76085
2 changed files with 5 additions and 5 deletions

View file

@ -11,9 +11,9 @@ import (
// Due to the way cgo works this has to be in a separate file, as devmapper.go has // Due to the way cgo works this has to be in a separate file, as devmapper.go has
// definitions in the cgo block, which is incompatible with using "//export" // definitions in the cgo block, which is incompatible with using "//export"
// DevmapperLogCallback exports the devmapper log callback for cgo. // StorageDevmapperLogCallback exports the devmapper log callback for cgo.
//export DevmapperLogCallback //export StorageDevmapperLogCallback
func DevmapperLogCallback(level C.int, file *C.char, line C.int, dmErrnoOrClass C.int, message *C.char) { func StorageDevmapperLogCallback(level C.int, file *C.char, line C.int, dmErrnoOrClass C.int, message *C.char) {
msg := C.GoString(message) msg := C.GoString(message)
if level < 7 { if level < 7 {
if strings.Contains(msg, "busy") { if strings.Contains(msg, "busy") {

View file

@ -8,7 +8,7 @@ package devicemapper
#include <linux/fs.h> // FIXME: present only for BLKGETSIZE64, maybe we can remove it? #include <linux/fs.h> // FIXME: present only for BLKGETSIZE64, maybe we can remove it?
// FIXME: Can't we find a way to do the logging in pure Go? // FIXME: Can't we find a way to do the logging in pure Go?
extern void DevmapperLogCallback(int level, char *file, int line, int dm_errno_or_class, char *str); extern void StorageDevmapperLogCallback(int level, char *file, int line, int dm_errno_or_class, char *str);
static void log_cb(int level, const char *file, int line, int dm_errno_or_class, const char *f, ...) static void log_cb(int level, const char *file, int line, int dm_errno_or_class, const char *f, ...)
{ {
@ -19,7 +19,7 @@ static void log_cb(int level, const char *file, int line, int dm_errno_or_class,
vsnprintf(buffer, 256, f, ap); vsnprintf(buffer, 256, f, ap);
va_end(ap); va_end(ap);
DevmapperLogCallback(level, (char *)file, line, dm_errno_or_class, buffer); StorageDevmapperLogCallback(level, (char *)file, line, dm_errno_or_class, buffer);
} }
static void log_with_errno_init() static void log_with_errno_init()