aboutsummaryrefslogtreecommitdiffstats
path: root/src/loader
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2014-01-20 13:57:12 +0000
committerJosé Fonseca <[email protected]>2014-01-20 13:57:12 +0000
commitd43260b59e1db8261bf581f5316d7634b7102ff6 (patch)
treea89c5d414b5f715cd0138c8e0e6b91958d774f80 /src/loader
parent9ab553cf528a78931dfac404ef08f0c6cf881c30 (diff)
logger: s/\<log\>/log_/
Currently the MSVC build is broken because of conflicting definitions of 'log' function. I didn't investigate thoroughly, but I suspect the it is conflicting standard math.h's log. log_ is admittedly not a great name, but it is better than a broken build. A better one can be used in a follow-on build.
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/loader.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 6fe8c8fc453..1b24c04840c 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -87,7 +87,7 @@ static void default_logger(int level, const char *fmt, ...)
}
}
-static void (*log)(int level, const char *fmt, ...) = default_logger;
+static void (*log_)(int level, const char *fmt, ...) = default_logger;
#ifdef HAVE_LIBUDEV
#include <libudev.h>
@@ -99,13 +99,13 @@ udev_device_new_from_fd(struct udev *udev, int fd)
struct stat buf;
if (fstat(fd, &buf) < 0) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d", fd);
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d", fd);
return NULL;
}
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
if (device == NULL) {
- log(_LOADER_WARNING,
+ log_(_LOADER_WARNING,
"MESA-LOADER: could not create udev device for fd %d", fd);
return NULL;
}
@@ -130,14 +130,14 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
parent = udev_device_get_parent(device);
if (parent == NULL) {
- log(_LOADER_WARNING, "MESA-LOADER: could not get parent device");
+ log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device");
goto out;
}
pci_id = udev_device_get_property_value(parent, "PCI_ID");
if (pci_id == NULL ||
sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) {
- log(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID");
+ log_(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID");
*chip_id = -1;
goto out;
}
@@ -167,11 +167,11 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
version = drmGetVersion(fd);
if (!version) {
- log(_LOADER_WARNING, "MESA-LOADER: invalid drm fd");
+ log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd");
return FALSE;
}
if (!version->name) {
- log(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name");
+ log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name");
drmFreeVersion(version);
return FALSE;
}
@@ -187,7 +187,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
gp.value = chip_id;
ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915");
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915");
*chip_id = -1;
}
}
@@ -202,7 +202,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
info.value = (unsigned long) chip_id;
ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (ret) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon");
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon");
*chip_id = -1;
}
}
@@ -275,12 +275,12 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
drmVersionPtr version = drmGetVersion(fd);
if (!version) {
- log(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
+ log_(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
return NULL;
}
driver = strndup(version->name, version->name_len);
- log(_LOADER_INFO, "using driver %s for %d", driver, fd);
+ log_(_LOADER_INFO, "using driver %s for %d", driver, fd);
drmFreeVersion(version);
#endif
@@ -308,7 +308,7 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
}
out:
- log(driver ? _LOADER_INFO : _LOADER_WARNING,
+ log_(driver ? _LOADER_INFO : _LOADER_WARNING,
"pci id for fd %d: %04x:%04x, driver %s",
fd, vendor_id, chip_id, driver);
return driver;
@@ -317,5 +317,5 @@ out:
void
loader_set_logger(void (*logger)(int level, const char *fmt, ...))
{
- log = logger;
+ log_ = logger;
}