From 55e5d76085c1b96d257e2d965969fd9a9f7d76a3 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 9 Jan 2017 11:54:40 -0500 Subject: [PATCH] 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 --- devicemapper/devmapper_log.go | 6 +++--- devicemapper/devmapper_wrapper.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/devicemapper/devmapper_log.go b/devicemapper/devmapper_log.go index 8477e36..76c9756 100644 --- a/devicemapper/devmapper_log.go +++ b/devicemapper/devmapper_log.go @@ -11,9 +11,9 @@ import ( // 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" -// DevmapperLogCallback exports the devmapper log callback for cgo. -//export DevmapperLogCallback -func DevmapperLogCallback(level C.int, file *C.char, line C.int, dmErrnoOrClass C.int, message *C.char) { +// StorageDevmapperLogCallback exports the devmapper log callback for cgo. +//export StorageDevmapperLogCallback +func StorageDevmapperLogCallback(level C.int, file *C.char, line C.int, dmErrnoOrClass C.int, message *C.char) { msg := C.GoString(message) if level < 7 { if strings.Contains(msg, "busy") { diff --git a/devicemapper/devmapper_wrapper.go b/devicemapper/devmapper_wrapper.go index 91fbc85..e37e020 100644 --- a/devicemapper/devmapper_wrapper.go +++ b/devicemapper/devmapper_wrapper.go @@ -8,7 +8,7 @@ package devicemapper #include // FIXME: present only for BLKGETSIZE64, maybe we can remove it? // 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, ...) { @@ -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); 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()