Skip to content

Commit 8d66c49

Browse files
author
Steve Block
committed
Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
Bug: 5449033 Change-Id: I9244d927f14c750cd359ebffb1fc1c355a755d5a
1 parent 0fdccb5 commit 8d66c49

22 files changed

+130
-130
lines changed

include/cutils/log.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ extern "C" {
9797
/*
9898
* Simplified macro to send a debug log message using the current LOG_TAG.
9999
*/
100-
#ifndef LOGD
101-
#define LOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
100+
#ifndef ALOGD
101+
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
102102
#endif
103103

104-
#ifndef LOGD_IF
105-
#define LOGD_IF(cond, ...) \
104+
#ifndef ALOGD_IF
105+
#define ALOGD_IF(cond, ...) \
106106
( (CONDITION(cond)) \
107107
? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
108108
: (void)0 )
@@ -168,8 +168,8 @@ extern "C" {
168168
* Conditional based on whether the current LOG_TAG is enabled at
169169
* debug priority.
170170
*/
171-
#ifndef IF_LOGD
172-
#define IF_LOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
171+
#ifndef IF_ALOGD
172+
#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
173173
#endif
174174

175175
/*

libcutils/buffer.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ ssize_t bufferWrite(Buffer* buffer, int fd) {
104104
if (bytesWritten >= 0) {
105105
buffer->remaining -= bytesWritten;
106106

107-
LOGD("Buffer bytes written: %d", (int) bytesWritten);
108-
LOGD("Buffer size: %d", (int) buffer->size);
109-
LOGD("Buffer remaining: %d", (int) buffer->remaining);
107+
ALOGD("Buffer bytes written: %d", (int) bytesWritten);
108+
ALOGD("Buffer size: %d", (int) buffer->size);
109+
ALOGD("Buffer remaining: %d", (int) buffer->remaining);
110110

111111
return buffer->remaining;
112112
}

libcutils/loghack.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define ALOG(level, ...) \
2929
((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__))
3030
#define ALOGV(...) ALOG("V", __VA_ARGS__)
31-
#define LOGD(...) ALOG("D", __VA_ARGS__)
31+
#define ALOGD(...) ALOG("D", __VA_ARGS__)
3232
#define LOGI(...) ALOG("I", __VA_ARGS__)
3333
#define LOGW(...) ALOG("W", __VA_ARGS__)
3434
#define LOGE(...) ALOG("E", __VA_ARGS__)

libcutils/mq.c

+17-17
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static void peerUnlock(Peer* peer) {
263263

264264
/** Frees a simple, i.e. header-only, outgoing packet. */
265265
static void outgoingPacketFree(OutgoingPacket* packet) {
266-
LOGD("Freeing outgoing packet.");
266+
ALOGD("Freeing outgoing packet.");
267267
free(packet);
268268
}
269269

@@ -435,7 +435,7 @@ static void peerProxyHandleError(PeerProxy* peerProxy, char* functionName) {
435435
// Log interruptions but otherwise ignore them.
436436
LOGW("%s() interrupted.", functionName);
437437
} else if (errno == EAGAIN) {
438-
LOGD("EWOULDBLOCK");
438+
ALOGD("EWOULDBLOCK");
439439
// Ignore.
440440
} else {
441441
LOGW("Error returned by %s().", functionName);
@@ -461,7 +461,7 @@ static bool peerProxyWriteFromBuffer(PeerProxy* peerProxy, Buffer* outgoing) {
461461
static void peerProxyWriteBytes(PeerProxy* peerProxy) {
462462
Buffer* buffer = peerProxy->currentPacket->bytes;
463463
if (peerProxyWriteFromBuffer(peerProxy, buffer)) {
464-
LOGD("Bytes written.");
464+
ALOGD("Bytes written.");
465465
peerProxyNextPacket(peerProxy);
466466
}
467467
}
@@ -527,10 +527,10 @@ static void peerProxyWrite(SelectableFd* fd) {
527527
Buffer* outgoingHeader = &peerProxy->outgoingHeader;
528528
bool headerWritten = bufferWriteComplete(outgoingHeader);
529529
if (!headerWritten) {
530-
LOGD("Writing header...");
530+
ALOGD("Writing header...");
531531
headerWritten = peerProxyWriteFromBuffer(peerProxy, outgoingHeader);
532532
if (headerWritten) {
533-
LOGD("Header written.");
533+
ALOGD("Header written.");
534534
}
535535
}
536536

@@ -559,7 +559,7 @@ static void peerProxyWrite(SelectableFd* fd) {
559559
* Sets up a peer proxy's fd before we try to select() it.
560560
*/
561561
static void peerProxyBeforeSelect(SelectableFd* fd) {
562-
LOGD("Before select...");
562+
ALOGD("Before select...");
563563

564564
PeerProxy* peerProxy = (PeerProxy*) fd->data;
565565

@@ -568,7 +568,7 @@ static void peerProxyBeforeSelect(SelectableFd* fd) {
568568
peerUnlock(peerProxy->peer);
569569

570570
if (hasPackets) {
571-
LOGD("Packets found. Setting onWritable().");
571+
ALOGD("Packets found. Setting onWritable().");
572572

573573
fd->onWritable = &peerProxyWrite;
574574
} else {
@@ -579,9 +579,9 @@ static void peerProxyBeforeSelect(SelectableFd* fd) {
579579

580580
/** Prepare to read bytes from the peer. */
581581
static void peerProxyExpectBytes(PeerProxy* peerProxy, Header* header) {
582-
LOGD("Expecting %d bytes.", header->size);
583-
584-
peerProxy->inputState = READING_BYTES;
582+
ALOGD("Expecting %d bytes.", header->size);
583+
584+
peerProxy->inputState = READING_BYTES;
585585
if (bufferPrepareForRead(peerProxy->inputBuffer, header->size) == -1) {
586586
LOGW("Couldn't allocate memory for incoming data. Size: %u",
587587
(unsigned int) header->size);
@@ -963,23 +963,23 @@ static bool peerProxyBufferInput(PeerProxy* peerProxy) {
963963
* Reads input from a peer process.
964964
*/
965965
static void peerProxyRead(SelectableFd* fd) {
966-
LOGD("Reading...");
966+
ALOGD("Reading...");
967967
PeerProxy* peerProxy = (PeerProxy*) fd->data;
968968
int state = peerProxy->inputState;
969969
Buffer* in = peerProxy->inputBuffer;
970970
switch (state) {
971971
case READING_HEADER:
972972
if (peerProxyBufferInput(peerProxy)) {
973-
LOGD("Header read.");
973+
ALOGD("Header read.");
974974
// We've read the complete header.
975975
Header* header = (Header*) in->data;
976976
peerProxyHandleHeader(peerProxy, header);
977977
}
978978
break;
979979
case READING_BYTES:
980-
LOGD("Reading bytes...");
980+
ALOGD("Reading bytes...");
981981
if (peerProxyBufferInput(peerProxy)) {
982-
LOGD("Bytes read.");
982+
ALOGD("Bytes read.");
983983
// We have the complete packet. Notify bytes listener.
984984
peerProxy->peer->onBytes(peerProxy->credentials,
985985
in->data, in->size);
@@ -1030,7 +1030,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
10301030
return;
10311031
}
10321032

1033-
LOGD("Accepted connection as fd %d.", socket);
1033+
ALOGD("Accepted connection as fd %d.", socket);
10341034

10351035
// Get credentials.
10361036
Credentials credentials;
@@ -1118,7 +1118,7 @@ static Peer* localPeer;
11181118

11191119
/** Frees a packet of bytes. */
11201120
static void outgoingPacketFreeBytes(OutgoingPacket* packet) {
1121-
LOGD("Freeing outgoing packet.");
1121+
ALOGD("Freeing outgoing packet.");
11221122
bufferFree(packet->bytes);
11231123
free(packet);
11241124
}
@@ -1270,7 +1270,7 @@ void masterPeerInitialize(BytesListener* bytesListener,
12701270
LOG_ALWAYS_FATAL("bind() error: %s", strerror(errno));
12711271
}
12721272

1273-
LOGD("Listener socket: %d", listenerSocket);
1273+
ALOGD("Listener socket: %d", listenerSocket);
12741274

12751275
// Queue up to 16 connections.
12761276
result = listen(listenerSocket, 16);

libcutils/selector.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Selector* selectorCreate(void) {
9696
LOG_ALWAYS_FATAL("pipe() error: %s", strerror(errno));
9797
}
9898

99-
LOGD("Wakeup fd: %d", selector->wakeupPipe[0]);
99+
ALOGD("Wakeup fd: %d", selector->wakeupPipe[0]);
100100

101101
SelectableFd* wakeupFd = selectorAdd(selector, selector->wakeupPipe[0]);
102102
if (wakeupFd == NULL) {
@@ -169,11 +169,11 @@ static void prepareForSelect(Selector* selector) {
169169

170170
bool inSet = false;
171171
if (maybeAdd(selectableFd, selectableFd->onExcept, exceptFds)) {
172-
LOGD("Selecting fd %d for writing...", selectableFd->fd);
172+
ALOGD("Selecting fd %d for writing...", selectableFd->fd);
173173
inSet = true;
174174
}
175175
if (maybeAdd(selectableFd, selectableFd->onReadable, readFds)) {
176-
LOGD("Selecting fd %d for reading...", selectableFd->fd);
176+
ALOGD("Selecting fd %d for reading...", selectableFd->fd);
177177
inSet = true;
178178
}
179179
if (maybeAdd(selectableFd, selectableFd->onWritable, writeFds)) {
@@ -200,9 +200,9 @@ static void prepareForSelect(Selector* selector) {
200200
*/
201201
static inline void maybeInvoke(SelectableFd* selectableFd,
202202
void (*callback)(SelectableFd*), fd_set* fdSet) {
203-
if (callback != NULL && !selectableFd->remove &&
203+
if (callback != NULL && !selectableFd->remove &&
204204
FD_ISSET(selectableFd->fd, fdSet)) {
205-
LOGD("Selected fd %d.", selectableFd->fd);
205+
ALOGD("Selected fd %d.", selectableFd->fd);
206206
callback(selectableFd);
207207
}
208208
}
@@ -238,13 +238,13 @@ void selectorLoop(Selector* selector) {
238238

239239
prepareForSelect(selector);
240240

241-
LOGD("Entering select().");
241+
ALOGD("Entering select().");
242242

243243
// Select file descriptors.
244244
int result = select(selector->maxFd + 1, &selector->readFds,
245245
&selector->writeFds, &selector->exceptFds, NULL);
246246

247-
LOGD("Exiting select().");
247+
ALOGD("Exiting select().");
248248

249249
setInSelect(selector, false);
250250

libnetutils/dhcpclient.c

+25-25
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void printerr(char *fmt, ...)
7070
vsnprintf(errmsg, sizeof(errmsg), fmt, ap);
7171
va_end(ap);
7272

73-
LOGD("%s", errmsg);
73+
ALOGD("%s", errmsg);
7474
}
7575

7676
const char *dhcp_lasterror()
@@ -151,14 +151,14 @@ static const char *dhcp_type_to_name(uint32_t type)
151151
void dump_dhcp_info(dhcp_info *info)
152152
{
153153
char addr[20], gway[20], mask[20];
154-
LOGD("--- dhcp %s (%d) ---",
154+
ALOGD("--- dhcp %s (%d) ---",
155155
dhcp_type_to_name(info->type), info->type);
156156
strcpy(addr, ipaddr(info->ipaddr));
157157
strcpy(gway, ipaddr(info->gateway));
158-
LOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength);
159-
if (info->dns1) LOGD("dns1: %s", ipaddr(info->dns1));
160-
if (info->dns2) LOGD("dns2: %s", ipaddr(info->dns2));
161-
LOGD("server %s, lease %d seconds",
158+
ALOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength);
159+
if (info->dns1) ALOGD("dns1: %s", ipaddr(info->dns1));
160+
if (info->dns2) ALOGD("dns2: %s", ipaddr(info->dns2));
161+
ALOGD("server %s, lease %d seconds",
162162
ipaddr(info->serveraddr), info->lease);
163163
}
164164

@@ -250,9 +250,9 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
250250
const char *name;
251251
char buf[2048];
252252

253-
LOGD("===== DHCP message:");
253+
ALOGD("===== DHCP message:");
254254
if (len < DHCP_MSG_FIXED_SIZE) {
255-
LOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE);
255+
ALOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE);
256256
return;
257257
}
258258

@@ -264,18 +264,18 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
264264
name = "BOOTREPLY";
265265
else
266266
name = "????";
267-
LOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d",
267+
ALOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d",
268268
name, msg->op, msg->htype, msg->hlen, msg->hops);
269-
LOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d",
269+
ALOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d",
270270
ntohl(msg->xid), ntohs(msg->secs), ntohs(msg->flags), len);
271-
LOGD("ciaddr = %s", ipaddr(msg->ciaddr));
272-
LOGD("yiaddr = %s", ipaddr(msg->yiaddr));
273-
LOGD("siaddr = %s", ipaddr(msg->siaddr));
274-
LOGD("giaddr = %s", ipaddr(msg->giaddr));
271+
ALOGD("ciaddr = %s", ipaddr(msg->ciaddr));
272+
ALOGD("yiaddr = %s", ipaddr(msg->yiaddr));
273+
ALOGD("siaddr = %s", ipaddr(msg->siaddr));
274+
ALOGD("giaddr = %s", ipaddr(msg->giaddr));
275275

276276
c = msg->hlen > 16 ? 16 : msg->hlen;
277277
hex2str(buf, msg->chaddr, c);
278-
LOGD("chaddr = {%s}", buf);
278+
ALOGD("chaddr = {%s}", buf);
279279

280280
for (n = 0; n < 64; n++) {
281281
if ((msg->sname[n] < ' ') || (msg->sname[n] > 127)) {
@@ -293,8 +293,8 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
293293
}
294294
msg->file[127] = 0;
295295

296-
LOGD("sname = '%s'", msg->sname);
297-
LOGD("file = '%s'", msg->file);
296+
ALOGD("sname = '%s'", msg->sname);
297+
ALOGD("file = '%s'", msg->file);
298298

299299
if (len < 4) return;
300300
len -= 4;
@@ -327,7 +327,7 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
327327
name = dhcp_type_to_name(x[2]);
328328
else
329329
name = NULL;
330-
LOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name);
330+
ALOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name);
331331
len -= optsz;
332332
x = x + optsz + 2;
333333
}
@@ -347,28 +347,28 @@ static int send_message(int sock, int if_index, dhcp_msg *msg, int size)
347347
static int is_valid_reply(dhcp_msg *msg, dhcp_msg *reply, int sz)
348348
{
349349
if (sz < DHCP_MSG_FIXED_SIZE) {
350-
if (verbose) LOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE);
350+
if (verbose) ALOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE);
351351
return 0;
352352
}
353353
if (reply->op != OP_BOOTREPLY) {
354-
if (verbose) LOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY);
354+
if (verbose) ALOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY);
355355
return 0;
356356
}
357357
if (reply->xid != msg->xid) {
358-
if (verbose) LOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid),
358+
if (verbose) ALOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid),
359359
ntohl(msg->xid));
360360
return 0;
361361
}
362362
if (reply->htype != msg->htype) {
363-
if (verbose) LOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype);
363+
if (verbose) ALOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype);
364364
return 0;
365365
}
366366
if (reply->hlen != msg->hlen) {
367-
if (verbose) LOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen);
367+
if (verbose) ALOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen);
368368
return 0;
369369
}
370370
if (memcmp(msg->chaddr, reply->chaddr, msg->hlen)) {
371-
if (verbose) LOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr));
371+
if (verbose) ALOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr));
372372
return 0;
373373
}
374374
return 1;
@@ -469,7 +469,7 @@ int dhcp_init_ifc(const char *ifname)
469469
r = receive_packet(s, &reply);
470470
if (r < 0) {
471471
if (errno != 0) {
472-
LOGD("receive_packet failed (%d): %s", r, strerror(errno));
472+
ALOGD("receive_packet failed (%d): %s", r, strerror(errno));
473473
if (errno == ENETDOWN || errno == ENXIO) {
474474
return -1;
475475
}

libnetutils/ifc_utils.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#else
4747
#include <stdio.h>
4848
#include <string.h>
49-
#define LOGD printf
49+
#define ALOGD printf
5050
#define LOGW printf
5151
#endif
5252

@@ -686,7 +686,7 @@ int ifc_remove_host_routes(const char *name)
686686
init_sockaddr_in(&rt.rt_genmask, mask);
687687
addr.s_addr = dest;
688688
if (ioctl(ifc_ctl_sock, SIOCDELRT, &rt) < 0) {
689-
LOGD("failed to remove route for %s to %s: %s",
689+
ALOGD("failed to remove route for %s to %s: %s",
690690
ifname, inet_ntoa(addr), strerror(errno));
691691
}
692692
}
@@ -752,7 +752,7 @@ int ifc_set_default_route(const char *ifname, in_addr_t gateway)
752752
ifc_init();
753753
addr.s_addr = gateway;
754754
if ((result = ifc_create_default_route(ifname, gateway)) < 0) {
755-
LOGD("failed to add %s as default route for %s: %s",
755+
ALOGD("failed to add %s as default route for %s: %s",
756756
inet_ntoa(addr), ifname, strerror(errno));
757757
}
758758
ifc_close();
@@ -773,7 +773,7 @@ int ifc_remove_default_route(const char *ifname)
773773
rt.rt_flags = RTF_UP|RTF_GATEWAY;
774774
init_sockaddr_in(&rt.rt_dst, 0);
775775
if ((result = ioctl(ifc_ctl_sock, SIOCDELRT, &rt)) < 0) {
776-
LOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
776+
ALOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
777777
}
778778
ifc_close();
779779
return result;

0 commit comments

Comments
 (0)