aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@google.com>2018-03-06 13:07:37 -0800
committerBill Richardson <wfrichar@google.com>2018-03-06 13:07:37 -0800
commit5a91e250b372e796b2dbad85c540d600542a6c30 (patch)
tree93f018cf06901d233b5fc3cd26add9c4a058e1f7
parent641e3bf10361351830c471d9228e66cbd20b61b4 (diff)
downloadandroid-5a91e250b372e796b2dbad85c540d600542a6c30.tar.gz
Add LOG_TAG for libnos_datagram functions
So they're easier to spot in the logcat output. Change-Id: Ia0d7714e09d9983aec1a4dc633f141bee5835a53 Signed-off-by: Bill Richardson <wfrichar@google.com>
-rw-r--r--citadel/libnos_datagram/citadel.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/citadel/libnos_datagram/citadel.c b/citadel/libnos_datagram/citadel.c
index 9c8a058..2bcb53b 100644
--- a/citadel/libnos_datagram/citadel.c
+++ b/citadel/libnos_datagram/citadel.c
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libnos_datagram"
+#include <cutils/log.h>
#include <nos/device.h>
#include <ctype.h>
@@ -21,7 +23,6 @@
#include <fcntl.h>
#include <getopt.h>
#include <linux/types.h>
-#include <log/log.h>
#include <poll.h>
#include <stdarg.h>
#include <stdint.h>
@@ -46,12 +47,6 @@ struct citadel_ioc_tpm_datagram {
#define DEV_CITADEL "/dev/citadel0"
-static void aperror(const char* msg) {
- char buffer[80];
- strerror_r(errno, buffer, sizeof(buffer));
- ALOGE("%s: %s", msg, buffer);
-}
-
static uint8_t in_buf[MAX_DEVICE_TRANSFER];
static int read_datagram(void *ctx, uint32_t command, uint8_t *buf, uint32_t len) {
struct citadel_ioc_tpm_datagram dg = {
@@ -81,7 +76,7 @@ static int read_datagram(void *ctx, uint32_t command, uint8_t *buf, uint32_t len
ret = ioctl(fd, CITADEL_IOC_TPM_DATAGRAM, &dg);
if (ret < 0) {
- aperror("can't send spi message");
+ ALOGE("can't send spi message: %s", strerror(errno));
return -errno;
}
@@ -120,7 +115,7 @@ static int write_datagram(void *ctx, uint32_t command, const uint8_t *buf, uint3
ret = ioctl(fd, CITADEL_IOC_TPM_DATAGRAM, &dg);
if (ret < 0) {
- aperror("can't send spi message");
+ ALOGE("can't send spi message: %s", strerror(errno));
return -errno;
}
@@ -133,7 +128,7 @@ static void wait_for_interrupt(void *ctx) {
// poll() was used because select() doesn't work here for some reason.
if (poll(&fds, 1 /*nfds*/, -1) < 0) {
- aperror("poll");
+ ALOGE("poll: %s", strerror(errno));
}
}
@@ -154,7 +149,7 @@ static int reset(void *ctx) {
ret = ioctl(fd, CITADEL_IOC_RESET);
if (ret < 0) {
- aperror("can't reset Citadel");
+ ALOGE("can't reset Citadel: %s", strerror(errno));
return -errno;
}
return 0;
@@ -174,7 +169,7 @@ static void close_device(void *ctx) {
}
if (close(fd) < 0)
- aperror("Problem closing device (ignored)");
+ ALOGE("Problem closing device (ignored): %s", strerror(errno));
free(ctx);
}
@@ -183,13 +178,13 @@ int nos_device_open(const char *device_name, struct nos_device *dev) {
fd = open(device_name ? device_name : DEV_CITADEL, O_RDWR);
if (fd < 0) {
- aperror("can't open device");
+ ALOGE("can't open device: %s", strerror(errno));
return -errno;
}
new_fd = (int *)malloc(sizeof(int));
if (!new_fd) {
- aperror("can't malloc new fd");
+ ALOGE("can't malloc new fd: %s", strerror(errno));
close(fd);
return -ENOMEM;
}