Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF)
Change-Id: I52fce957db06c281e2618daa4e2ecba19974f2eb
This commit is contained in:
parent
4f07a1f826
commit
8aeb6e244a
|
@ -171,17 +171,23 @@ extern "C" {
|
|||
/*
|
||||
* Simplified macro to send an error log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGE
|
||||
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGE
|
||||
#define LOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGE LOGE
|
||||
#define LOGE ALOGE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOGE_IF
|
||||
#define LOGE_IF(cond, ...) \
|
||||
#ifndef ALOGE_IF
|
||||
#define ALOGE_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#define ALOGE_IF LOGE_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGE_IF
|
||||
#define LOGE_IF ALOGE_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -242,9 +248,12 @@ extern "C" {
|
|||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* error priority.
|
||||
*/
|
||||
#ifndef IF_ALOGE
|
||||
#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGE
|
||||
#define IF_LOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
|
||||
#define IF_ALOGE IF_LOGE
|
||||
#define IF_LOGE IF_ALOGE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#define ALOGD(...) ALOG("D", __VA_ARGS__)
|
||||
#define ALOGI(...) ALOG("I", __VA_ARGS__)
|
||||
#define ALOGW(...) ALOG("W", __VA_ARGS__)
|
||||
#define LOGE(...) ALOG("E", __VA_ARGS__)
|
||||
#define LOG_ALWAYS_FATAL(...) do { LOGE(__VA_ARGS__); exit(1); } while (0)
|
||||
#define ALOGE(...) ALOG("E", __VA_ARGS__)
|
||||
#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0)
|
||||
#endif
|
||||
|
||||
#endif // _CUTILS_LOGHACK_H
|
||||
|
|
|
@ -189,7 +189,7 @@ int property_get(const char *key, char *value, const char *default_value)
|
|||
strcpy(value, recvBuf+1);
|
||||
len = strlen(value);
|
||||
} else {
|
||||
LOGE("Got strange response to property_get request (%d)\n",
|
||||
ALOGE("Got strange response to property_get request (%d)\n",
|
||||
recvBuf[0]);
|
||||
assert(0);
|
||||
return -1;
|
||||
|
|
|
@ -144,7 +144,7 @@ int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord,
|
|||
&& p_rs->read_end == p_rs->buffer_end
|
||||
) {
|
||||
// this should never happen
|
||||
//LOGE("max record length exceeded\n");
|
||||
//ALOGE("max record length exceeded\n");
|
||||
assert (0);
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
|
|
|
@ -30,12 +30,12 @@ bool socket_peer_is_trusted(int fd)
|
|||
int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len);
|
||||
|
||||
if (n != 0) {
|
||||
LOGE("could not get socket credentials: %s\n", strerror(errno));
|
||||
ALOGE("could not get socket credentials: %s\n", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((cr.uid != AID_ROOT) && (cr.uid != AID_SHELL)) {
|
||||
LOGE("untrusted userid on other end of socket: userid %d\n", cr.uid);
|
||||
ALOGE("untrusted userid on other end of socket: userid %d\n", cr.uid);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ static int send_request(int fd, int sendStdio, int argc, const char **argv)
|
|||
{
|
||||
#ifndef HAVE_ANDROID_OS
|
||||
// not supported on simulator targets
|
||||
//LOGE("zygote_* not supported on simulator targets");
|
||||
//ALOGE("zygote_* not supported on simulator targets");
|
||||
return -1;
|
||||
#else /* HAVE_ANDROID_OS */
|
||||
uint32_t pid;
|
||||
|
|
|
@ -62,7 +62,7 @@ kb_to_lba(uint32_t len_kb, uint32_t sect_size)
|
|||
lba = (lba + (uint64_t)sect_size - 1) & ~((uint64_t)sect_size - 1);
|
||||
lba /= (uint64_t)sect_size;
|
||||
if (lba >= 0xffffffffULL)
|
||||
LOGE("Error converting kb -> lba. 32bit overflow, expect weirdness");
|
||||
ALOGE("Error converting kb -> lba. 32bit overflow, expect weirdness");
|
||||
return (uint32_t)(lba & 0xffffffffULL);
|
||||
}
|
||||
|
||||
|
@ -75,12 +75,12 @@ mk_pri_pentry(struct disk_info *dinfo, struct part_info *pinfo, int pnum,
|
|||
struct pc_partition *pentry;
|
||||
|
||||
if (pnum >= PC_NUM_BOOT_RECORD_PARTS) {
|
||||
LOGE("Maximum number of primary partition exceeded.");
|
||||
ALOGE("Maximum number of primary partition exceeded.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(item = alloc_wl(sizeof(struct pc_partition)))) {
|
||||
LOGE("Unable to allocate memory for partition entry.");
|
||||
ALOGE("Unable to allocate memory for partition entry.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
|
|||
uint32_t len; /* in lba units */
|
||||
|
||||
if (!(item = alloc_wl(sizeof(struct pc_boot_record)))) {
|
||||
LOGE("Unable to allocate memory for EBR.");
|
||||
ALOGE("Unable to allocate memory for EBR.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
|
|||
len = kb_to_lba(pinfo->len_kb, dinfo->sect_size);
|
||||
else {
|
||||
if (pnext) {
|
||||
LOGE("Only the last partition can be specified to fill the disk "
|
||||
ALOGE("Only the last partition can be specified to fill the disk "
|
||||
"(name = '%s')", pinfo->name);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
if ((temp_wr = mk_pri_pentry(dinfo, NULL, cnt, &cur_lba)))
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
else {
|
||||
LOGE("Cannot create primary extended partition.");
|
||||
ALOGE("Cannot create primary extended partition.");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
if (temp_wr)
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
else {
|
||||
LOGE("Cannot create partition %d (%s).", cnt, pinfo->name);
|
||||
ALOGE("Cannot create partition %d (%s).", cnt, pinfo->name);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
cur_lba = 0;
|
||||
memset(&blank, 0, sizeof(struct part_info));
|
||||
if (!(temp_wr = mk_pri_pentry(dinfo, &blank, cnt, &cur_lba))) {
|
||||
LOGE("Cannot create blank partition %d.", cnt);
|
||||
ALOGE("Cannot create blank partition %d.", cnt);
|
||||
goto fail;
|
||||
}
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
|
@ -279,7 +279,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
return wr_list;
|
||||
|
||||
nospace:
|
||||
LOGE("Not enough space to add parttion '%s'.", pinfo->name);
|
||||
ALOGE("Not enough space to add parttion '%s'.", pinfo->name);
|
||||
|
||||
fail:
|
||||
wlist_free(wr_list);
|
||||
|
@ -310,13 +310,13 @@ find_mbr_part(struct disk_info *dinfo, const char *name)
|
|||
num++;
|
||||
|
||||
if (!(dev_name = malloc(MAX_NAME_LEN))) {
|
||||
LOGE("Cannot allocate memory.");
|
||||
ALOGE("Cannot allocate memory.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
num = snprintf(dev_name, MAX_NAME_LEN, "%s%d", dinfo->device, num);
|
||||
if (num >= MAX_NAME_LEN) {
|
||||
LOGE("Device name is too long?!");
|
||||
ALOGE("Device name is too long?!");
|
||||
free(dev_name);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ parse_len(const char *str, uint64_t *plen)
|
|||
tmp[sizeof(tmp)-1] = '\0';
|
||||
len_str = strlen(tmp);
|
||||
if (!len_str) {
|
||||
LOGE("Invalid disk length specified.");
|
||||
ALOGE("Invalid disk length specified.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,13 @@ parse_len(const char *str, uint64_t *plen)
|
|||
|
||||
*plen = strtoull(tmp, NULL, 0);
|
||||
if (!*plen) {
|
||||
LOGE("Invalid length specified: %s", str);
|
||||
ALOGE("Invalid length specified: %s", str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*plen == (uint64_t)-1) {
|
||||
if (multiple > 1) {
|
||||
LOGE("Size modifier illegal when len is -1");
|
||||
ALOGE("Size modifier illegal when len is -1");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
|
@ -80,7 +80,7 @@ parse_len(const char *str, uint64_t *plen)
|
|||
*plen *= multiple;
|
||||
|
||||
if (*plen > 0xffffffffULL) {
|
||||
LOGE("Length specified is too large!: %llu KB", *plen);
|
||||
ALOGE("Length specified is too large!: %llu KB", *plen);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ load_partitions(cnode *root, struct disk_info *dinfo)
|
|||
pinfo->flags |= PART_ACTIVE_FLAG;
|
||||
|
||||
if (!(tmp = config_str(partnode, "type", NULL))) {
|
||||
LOGE("Partition type required: %s", pinfo->name);
|
||||
ALOGE("Partition type required: %s", pinfo->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ load_partitions(cnode *root, struct disk_info *dinfo)
|
|||
} else if (!strcmp(tmp, "fat32")) {
|
||||
pinfo->type = PC_PART_TYPE_FAT32;
|
||||
} else {
|
||||
LOGE("Unsupported partition type found: %s", tmp);
|
||||
ALOGE("Unsupported partition type found: %s", tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -146,13 +146,13 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
const char *tmp;
|
||||
|
||||
if (!(dinfo = malloc(sizeof(struct disk_info)))) {
|
||||
LOGE("Could not malloc disk_info");
|
||||
ALOGE("Could not malloc disk_info");
|
||||
return NULL;
|
||||
}
|
||||
memset(dinfo, 0, sizeof(struct disk_info));
|
||||
|
||||
if (!(dinfo->part_lst = malloc(MAX_NUM_PARTS * sizeof(struct part_info)))) {
|
||||
LOGE("Could not malloc part_lst");
|
||||
ALOGE("Could not malloc part_lst");
|
||||
goto fail;
|
||||
}
|
||||
memset(dinfo->part_lst, 0,
|
||||
|
@ -160,33 +160,33 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
|
||||
config_load_file(root, fn);
|
||||
if (root->first_child == NULL) {
|
||||
LOGE("Could not read config file %s", fn);
|
||||
ALOGE("Could not read config file %s", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(devroot = config_find(root, "device"))) {
|
||||
LOGE("Could not find device section in config file '%s'", fn);
|
||||
ALOGE("Could not find device section in config file '%s'", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!(tmp = config_str(devroot, "path", path_override))) {
|
||||
LOGE("device path is requried");
|
||||
ALOGE("device path is requried");
|
||||
goto fail;
|
||||
}
|
||||
dinfo->device = strdup(tmp);
|
||||
|
||||
/* find the partition scheme */
|
||||
if (!(tmp = config_str(devroot, "scheme", NULL))) {
|
||||
LOGE("partition scheme is required");
|
||||
ALOGE("partition scheme is required");
|
||||
goto fail;
|
||||
} else if (!strcmp(tmp, "mbr")) {
|
||||
dinfo->scheme = PART_SCHEME_MBR;
|
||||
} else if (!strcmp(tmp, "gpt")) {
|
||||
LOGE("'gpt' partition scheme not supported yet.");
|
||||
ALOGE("'gpt' partition scheme not supported yet.");
|
||||
goto fail;
|
||||
} else {
|
||||
LOGE("Unknown partition scheme specified: %s", tmp);
|
||||
ALOGE("Unknown partition scheme specified: %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -194,30 +194,30 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
tmp = config_str(devroot, "sector_size", "512");
|
||||
dinfo->sect_size = strtol(tmp, NULL, 0);
|
||||
if (!dinfo->sect_size) {
|
||||
LOGE("Invalid sector size: %s", tmp);
|
||||
ALOGE("Invalid sector size: %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* first lba where the partitions will start on disk */
|
||||
if (!(tmp = config_str(devroot, "start_lba", NULL))) {
|
||||
LOGE("start_lba must be provided");
|
||||
ALOGE("start_lba must be provided");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(dinfo->skip_lba = strtol(tmp, NULL, 0))) {
|
||||
LOGE("Invalid starting LBA (or zero): %s", tmp);
|
||||
ALOGE("Invalid starting LBA (or zero): %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Number of LBAs on disk */
|
||||
if (!(tmp = config_str(devroot, "num_lba", NULL))) {
|
||||
LOGE("num_lba is required");
|
||||
ALOGE("num_lba is required");
|
||||
goto fail;
|
||||
}
|
||||
dinfo->num_lba = strtoul(tmp, NULL, 0);
|
||||
|
||||
if (!(partnode = config_find(devroot, "partitions"))) {
|
||||
LOGE("Device must specify partition list");
|
||||
ALOGE("Device must specify partition list");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -244,12 +244,12 @@ sync_ptable(int fd)
|
|||
sync();
|
||||
|
||||
if (fstat(fd, &stat)) {
|
||||
LOGE("Cannot stat, errno=%d.", errno);
|
||||
ALOGE("Cannot stat, errno=%d.", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (S_ISBLK(stat.st_mode) && ((rv = ioctl(fd, BLKRRPART, NULL)) < 0)) {
|
||||
LOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno);
|
||||
ALOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -281,12 +281,12 @@ validate(struct disk_info *dinfo)
|
|||
return -1;
|
||||
|
||||
if ((fd = open(dinfo->device, O_RDWR)) < 0) {
|
||||
LOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno);
|
||||
ALOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fstat(fd, &stat)) {
|
||||
LOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno);
|
||||
ALOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -299,19 +299,19 @@ validate(struct disk_info *dinfo)
|
|||
if (S_ISBLK(stat.st_mode)) {
|
||||
/* get the sector size and make sure we agree */
|
||||
if (ioctl(fd, BLKSSZGET, §_sz) < 0) {
|
||||
LOGE("Cannot get sector size (errno=%d)", errno);
|
||||
ALOGE("Cannot get sector size (errno=%d)", errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!sect_sz || sect_sz != dinfo->sect_size) {
|
||||
LOGE("Device sector size is zero or sector sizes do not match!");
|
||||
ALOGE("Device sector size is zero or sector sizes do not match!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* allow the user override the "disk size" if they provided num_lba */
|
||||
if (!dinfo->num_lba) {
|
||||
if (ioctl(fd, BLKGETSIZE64, &disk_size) < 0) {
|
||||
LOGE("Could not get block device size (errno=%d)", errno);
|
||||
ALOGE("Could not get block device size (errno=%d)", errno);
|
||||
goto fail;
|
||||
}
|
||||
/* XXX: we assume that the disk has < 2^32 sectors :-) */
|
||||
|
@ -321,7 +321,7 @@ validate(struct disk_info *dinfo)
|
|||
} else if (S_ISREG(stat.st_mode)) {
|
||||
ALOGI("Requesting operation on a regular file, not block device.");
|
||||
if (!dinfo->sect_size) {
|
||||
LOGE("Sector size for regular file images cannot be zero");
|
||||
ALOGE("Sector size for regular file images cannot be zero");
|
||||
goto fail;
|
||||
}
|
||||
if (dinfo->num_lba)
|
||||
|
@ -331,7 +331,7 @@ validate(struct disk_info *dinfo)
|
|||
disk_size = (uint64_t)stat.st_size;
|
||||
}
|
||||
} else {
|
||||
LOGE("Device does not refer to a regular file or a block device!");
|
||||
ALOGE("Device does not refer to a regular file or a block device!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -350,12 +350,12 @@ validate(struct disk_info *dinfo)
|
|||
if (part->len_kb != (uint32_t)-1) {
|
||||
total_size += part->len_kb * 1024;
|
||||
} else if (part->len_kb == 0) {
|
||||
LOGE("Zero-size partition '%s' is invalid.", part->name);
|
||||
ALOGE("Zero-size partition '%s' is invalid.", part->name);
|
||||
goto fail;
|
||||
} else {
|
||||
/* the partition requests the rest of the disk. */
|
||||
if (cnt + 1 != dinfo->num_parts) {
|
||||
LOGE("Only the last partition in the list can request to fill "
|
||||
ALOGE("Only the last partition in the list can request to fill "
|
||||
"the rest of disk.");
|
||||
goto fail;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ validate(struct disk_info *dinfo)
|
|||
|
||||
if ((part->type != PC_PART_TYPE_LINUX) &&
|
||||
(part->type != PC_PART_TYPE_FAT32)) {
|
||||
LOGE("Unknown partition type (0x%x) encountered for partition "
|
||||
ALOGE("Unknown partition type (0x%x) encountered for partition "
|
||||
"'%s'\n", part->type, part->name);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ validate(struct disk_info *dinfo)
|
|||
|
||||
/* only matters for disks, not files */
|
||||
if (S_ISBLK(stat.st_mode) && total_size > disk_size) {
|
||||
LOGE("Total requested size of partitions (%llu) is greater than disk "
|
||||
ALOGE("Total requested size of partitions (%llu) is greater than disk "
|
||||
"size (%llu).", total_size, disk_size);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ validate_and_config(struct disk_info *dinfo, int *fd, struct write_list **lst)
|
|||
case PART_SCHEME_GPT:
|
||||
/* not supported yet */
|
||||
default:
|
||||
LOGE("Uknown partition scheme.");
|
||||
ALOGE("Uknown partition scheme.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ apply_disk_config(struct disk_info *dinfo, int test)
|
|||
int rv;
|
||||
|
||||
if (validate_and_config(dinfo, &fd, &wr_lst) != 0) {
|
||||
LOGE("Configuration is invalid.");
|
||||
ALOGE("Configuration is invalid.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -523,10 +523,10 @@ find_part_device(struct disk_info *dinfo, const char *name)
|
|||
case PART_SCHEME_MBR:
|
||||
return find_mbr_part(dinfo, name);
|
||||
case PART_SCHEME_GPT:
|
||||
LOGE("GPT is presently not supported");
|
||||
ALOGE("GPT is presently not supported");
|
||||
break;
|
||||
default:
|
||||
LOGE("Unknown partition table scheme");
|
||||
ALOGE("Unknown partition table scheme");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,18 +42,18 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
|
||||
ALOGI("Writing RAW image '%s' to '%s' (offset=%llu)", src, dst, offset);
|
||||
if ((src_fd = open(src, O_RDONLY)) < 0) {
|
||||
LOGE("Could not open %s for reading (errno=%d).", src, errno);
|
||||
ALOGE("Could not open %s for reading (errno=%d).", src, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!test) {
|
||||
if ((dst_fd = open(dst, O_RDWR)) < 0) {
|
||||
LOGE("Could not open '%s' for read/write (errno=%d).", dst, errno);
|
||||
ALOGE("Could not open '%s' for read/write (errno=%d).", dst, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (lseek64(dst_fd, offset, SEEK_SET) != offset) {
|
||||
LOGE("Could not seek to offset %lld in %s.", offset, dst);
|
||||
ALOGE("Could not seek to offset %lld in %s.", offset, dst);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
/* XXX: Should we not even bother with EINTR? */
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
LOGE("Error (%d) while reading from '%s'", errno, src);
|
||||
ALOGE("Error (%d) while reading from '%s'", errno, src);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
/* XXX: Should we not even bother with EINTR? */
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
LOGE("Error (%d) while writing to '%s'", errno, dst);
|
||||
ALOGE("Error (%d) while writing to '%s'", errno, dst);
|
||||
goto fail;
|
||||
}
|
||||
if (!tmp)
|
||||
|
@ -94,7 +94,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
}
|
||||
|
||||
if (!done) {
|
||||
LOGE("Exited read/write loop without setting flag! WTF?!");
|
||||
ALOGE("Exited read/write loop without setting flag! WTF?!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ main(int argc, char *argv[])
|
|||
struct disk_info *dinfo;
|
||||
|
||||
if (argc < 2) {
|
||||
LOGE("usage: %s <conf file>", argv[0]);
|
||||
ALOGE("usage: %s <conf file>", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ alloc_wl(uint32_t data_len)
|
|||
struct write_list *item;
|
||||
|
||||
if (!(item = malloc(sizeof(struct write_list) + data_len))) {
|
||||
LOGE("Unable to allocate memory.");
|
||||
ALOGE("Unable to allocate memory.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,13 @@ wlist_commit(int fd, struct write_list *lst, int test)
|
|||
{
|
||||
for(; lst; lst = lst->next) {
|
||||
if (lseek64(fd, lst->offset, SEEK_SET) != (loff_t)lst->offset) {
|
||||
LOGE("Cannot seek to the specified position (%lld).", lst->offset);
|
||||
ALOGE("Cannot seek to the specified position (%lld).", lst->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!test) {
|
||||
if (write(fd, lst->data, lst->len) != (int)lst->len) {
|
||||
LOGE("Failed writing %u bytes at position %lld.", lst->len,
|
||||
ALOGE("Failed writing %u bytes at position %lld.", lst->len,
|
||||
lst->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ int ifc_clear_ipv6_addresses(const char *name) {
|
|||
|
||||
ret = ifc_del_address(ifname, addrstr, prefixlen);
|
||||
if (ret) {
|
||||
LOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname,
|
||||
ALOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname,
|
||||
strerror(-ret));
|
||||
lasterror = ret;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ int CodeCache::cache( const AssemblyKeyBase& keyBase,
|
|||
const long base = long(assembly->base());
|
||||
const long curr = base + long(assembly->size());
|
||||
err = cacheflush(base, curr, 0);
|
||||
LOGE_IF(err, "__ARM_NR_cacheflush error %s\n",
|
||||
ALOGE_IF(err, "__ARM_NR_cacheflush error %s\n",
|
||||
strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ int GGLAssembler::scanline(const needs_t& needs, context_t const* c)
|
|||
needs.p, needs.n, needs.t[0], needs.t[1], per_fragment_ops);
|
||||
|
||||
if (err) {
|
||||
LOGE("Error while generating ""%s""\n", name);
|
||||
ALOGE("Error while generating ""%s""\n", name);
|
||||
disassemble(name);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ int RegisterAllocator::RegisterFile::obtain()
|
|||
}
|
||||
// this is not an error anymore because, we'll try again with
|
||||
// a lower optimization level.
|
||||
//LOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n");
|
||||
//ALOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n");
|
||||
if (i >= nbreg) {
|
||||
mStatus |= OUT_OF_REGISTERS;
|
||||
// we return SP so we can more easily debug things
|
||||
|
|
|
@ -536,7 +536,7 @@ void GGLAssembler::mul_factor( component_t& d,
|
|||
}
|
||||
}
|
||||
|
||||
LOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs);
|
||||
ALOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs);
|
||||
|
||||
int vreg = v.reg;
|
||||
int freg = f.reg;
|
||||
|
@ -574,7 +574,7 @@ void GGLAssembler::mul_factor_add( component_t& d,
|
|||
int as = a.h;
|
||||
int ms = vs+fs;
|
||||
|
||||
LOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as);
|
||||
ALOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as);
|
||||
|
||||
integer_t add(a.reg, a.h, a.flags);
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ void GGLAssembler::downshift(
|
|||
int dbits = dh - dl;
|
||||
int dithering = 0;
|
||||
|
||||
LOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits);
|
||||
ALOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits);
|
||||
|
||||
if (sbits>dbits) {
|
||||
// see if we need to dither
|
||||
|
|
|
@ -778,7 +778,7 @@ void GGLAssembler::filter16(
|
|||
break;
|
||||
default:
|
||||
// unsupported format, do something sensical...
|
||||
LOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx);
|
||||
ALOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx);
|
||||
LDRH(AL, texel.reg, txPtr.reg);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ static void pick_scanline(context_t* c)
|
|||
err = gCodeCache.cache(a->key(), a);
|
||||
}
|
||||
if (ggl_unlikely(err)) {
|
||||
LOGE("error generating or caching assembly. Reverting to NOP.");
|
||||
ALOGE("error generating or caching assembly. Reverting to NOP.");
|
||||
c->scanline = scanline_noop;
|
||||
c->init_y = init_y_noop;
|
||||
c->step_y = step_y__nop;
|
||||
|
@ -1761,7 +1761,7 @@ void init_y_error(context_t* c, int32_t y0)
|
|||
// woooops, shoud never happen,
|
||||
// fail gracefully (don't display anything)
|
||||
init_y_noop(c, y0);
|
||||
LOGE("color-buffer has an invalid format!");
|
||||
ALOGE("color-buffer has an invalid format!");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -218,7 +218,7 @@ int CommandListener::ListCmd::runCommand(SocketClient *cli, int argc, char **arg
|
|||
|
||||
char *buf;
|
||||
if (asprintf(&buf, "%s %s", (*it), p_v) < 0) {
|
||||
LOGE("Failed to allocate memory");
|
||||
ALOGE("Failed to allocate memory");
|
||||
free((*it));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ bool Controller::isKernelModuleLoaded(const char *modtag) {
|
|||
FILE *fp = fopen("/proc/modules", "r");
|
||||
|
||||
if (!fp) {
|
||||
LOGE("Unable to open /proc/modules (%s)", strerror(errno));
|
||||
ALOGE("Unable to open /proc/modules (%s)", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ int DhcpClient::start(Controller *c) {
|
|||
|
||||
sockaddr_in addr;
|
||||
if ((mListenerSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||
LOGE("Failed to create DHCP listener socket");
|
||||
ALOGE("Failed to create DHCP listener socket");
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ int DhcpClient::start(Controller *c) {
|
|||
addr.sin_port = htons(DhcpClient::STATUS_MONITOR_PORT);
|
||||
|
||||
if (bind(mListenerSocket, (struct sockaddr *) &addr, sizeof(addr))) {
|
||||
LOGE("Failed to bind DHCP listener socket");
|
||||
ALOGE("Failed to bind DHCP listener socket");
|
||||
close(mListenerSocket);
|
||||
mListenerSocket = -1;
|
||||
pthread_mutex_unlock(&mLock);
|
||||
|
@ -90,14 +90,14 @@ int DhcpClient::start(Controller *c) {
|
|||
}
|
||||
|
||||
if (mServiceManager->start(svc)) {
|
||||
LOGE("Failed to start dhcp service");
|
||||
ALOGE("Failed to start dhcp service");
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mListener = new DhcpListener(mController, mListenerSocket, mHandlers);
|
||||
if (mListener->startListener()) {
|
||||
LOGE("Failed to start listener");
|
||||
ALOGE("Failed to start listener");
|
||||
#if 0
|
||||
mServiceManager->stop("dhcpcd");
|
||||
return -1;
|
||||
|
|
|
@ -110,7 +110,7 @@ void NetworkManager::onInterfaceConnected(Controller *c) {
|
|||
ALOGD("Controller %s interface %s connected", c->getName(), c->getBoundInterface());
|
||||
|
||||
if (mDhcp->start(c)) {
|
||||
LOGE("Failed to start DHCP (%s)", strerror(errno));
|
||||
ALOGE("Failed to start DHCP (%s)", strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ int OpenVpnController::enable() {
|
|||
char tmp[64];
|
||||
|
||||
if (!mPropMngr->get("vpn.gateway", tmp, sizeof(tmp))) {
|
||||
LOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno));
|
||||
ALOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
snprintf(svc, sizeof(svc), "openvpn:--remote %s 1194", tmp);
|
||||
|
|
|
@ -38,22 +38,22 @@ StringProperty::StringProperty(const char *name, bool ro, int elements) :
|
|||
Property(name, ro, Property::Type_STRING, elements) {
|
||||
}
|
||||
int StringProperty::set(int idx, int value) {
|
||||
LOGE("Integer 'set' called on string property!");
|
||||
ALOGE("Integer 'set' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::set(int idx, struct in_addr *value) {
|
||||
LOGE("IpAddr 'set' called on string property!");
|
||||
ALOGE("IpAddr 'set' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::get(int idx, int *buffer) {
|
||||
LOGE("Integer 'get' called on string property!");
|
||||
ALOGE("Integer 'get' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::get(int idx, struct in_addr *buffer) {
|
||||
LOGE("IpAddr 'get' called on string property!");
|
||||
ALOGE("IpAddr 'get' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -90,22 +90,22 @@ IntegerProperty::IntegerProperty(const char *name, bool ro, int elements) :
|
|||
}
|
||||
|
||||
int IntegerProperty::set(int idx, const char *value) {
|
||||
LOGE("String 'set' called on integer property!");
|
||||
ALOGE("String 'set' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::set(int idx, struct in_addr *value) {
|
||||
LOGE("IpAddr 'set' called on integer property!");
|
||||
ALOGE("IpAddr 'set' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::get(int idx, char *buffer, size_t max) {
|
||||
LOGE("String 'get' called on integer property!");
|
||||
ALOGE("String 'get' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::get(int idx, struct in_addr *buffer) {
|
||||
LOGE("IpAddr 'get' called on integer property!");
|
||||
ALOGE("IpAddr 'get' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -141,22 +141,22 @@ IPV4AddressProperty::IPV4AddressProperty(const char *name, bool ro, int elements
|
|||
}
|
||||
|
||||
int IPV4AddressProperty::set(int idx, const char *value) {
|
||||
LOGE("String 'set' called on ipv4 property!");
|
||||
ALOGE("String 'set' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::set(int idx, int value) {
|
||||
LOGE("Integer 'set' called on ipv4 property!");
|
||||
ALOGE("Integer 'set' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::get(int idx, char *buffer, size_t max) {
|
||||
LOGE("String 'get' called on ipv4 property!");
|
||||
ALOGE("String 'get' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::get(int idx, int *buffer) {
|
||||
LOGE("Integer 'get' called on ipv4 property!");
|
||||
ALOGE("Integer 'get' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ int PropertyManager::attachProperty(const char *ns_name, Property *p) {
|
|||
if (lookupProperty_UNLOCKED(ns, p->getName())) {
|
||||
errno = EADDRINUSE;
|
||||
pthread_mutex_unlock(&mLock);
|
||||
LOGE("Failed to register property %s.%s (%s)",
|
||||
ALOGE("Failed to register property %s.%s (%s)",
|
||||
ns_name, p->getName(), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ int PropertyManager::detachProperty(const char *ns_name, Property *p) {
|
|||
pthread_mutex_lock(&mLock);
|
||||
if (!(ns = lookupNamespace_UNLOCKED(ns_name))) {
|
||||
pthread_mutex_unlock(&mLock);
|
||||
LOGE("Namespace '%s' not found", ns_name);
|
||||
ALOGE("Namespace '%s' not found", ns_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ int PropertyManager::detachProperty(const char *ns_name, Property *p) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s.%s not found", ns_name, p->getName());
|
||||
ALOGE("Property %s.%s not found", ns_name, p->getName());
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
|
@ -130,7 +130,7 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) {
|
|||
errno = 0;
|
||||
tmp = strtol(value, (char **) NULL, 10);
|
||||
if (errno) {
|
||||
LOGE("Failed to convert '%s' to int", value);
|
||||
ALOGE("Failed to convert '%s' to int", value);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -138,13 +138,13 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) {
|
|||
} else if (p->getType() == Property::Type_IPV4) {
|
||||
struct in_addr tmp;
|
||||
if (!inet_aton(value, &tmp)) {
|
||||
LOGE("Failed to convert '%s' to ipv4", value);
|
||||
ALOGE("Failed to convert '%s' to ipv4", value);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return p->set(idx, &tmp);
|
||||
} else {
|
||||
LOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
ALOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
p->getType());
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
@ -179,7 +179,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) {
|
|||
}
|
||||
strncpy(buffer, inet_ntoa(tmp), max);
|
||||
} else {
|
||||
LOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
ALOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
p->getType());
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
@ -215,7 +215,7 @@ int PropertyManager::set(const char *name, const char *value) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s not found", name);
|
||||
ALOGE("Property %s not found", name);
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
|
@ -246,7 +246,7 @@ const char *PropertyManager::get(const char *name, char *buffer, size_t max) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s not found", name);
|
||||
ALOGE("Property %s not found", name);
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
|
|
|
@ -68,18 +68,18 @@ int Supplicant::start() {
|
|||
}
|
||||
|
||||
if (mServiceManager->start(SUPPLICANT_SERVICE_NAME)) {
|
||||
LOGE("Error starting supplicant (%s)", strerror(errno));
|
||||
ALOGE("Error starting supplicant (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
wpa_ctrl_cleanup();
|
||||
if (connectToSupplicant()) {
|
||||
LOGE("Error connecting to supplicant (%s)\n", strerror(errno));
|
||||
ALOGE("Error connecting to supplicant (%s)\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (retrieveInterfaceName()) {
|
||||
LOGE("Error retrieving interface name (%s)\n", strerror(errno));
|
||||
ALOGE("Error retrieving interface name (%s)\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ int Supplicant::connectToSupplicant() {
|
|||
|
||||
mCtrl = wpa_ctrl_open("tiwlan0"); // XXX:
|
||||
if (mCtrl == NULL) {
|
||||
LOGE("Unable to open connection to supplicant on \"%s\": %s",
|
||||
ALOGE("Unable to open connection to supplicant on \"%s\": %s",
|
||||
"tiwlan0", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ int Supplicant::connectToSupplicant() {
|
|||
mListener = new SupplicantListener(mHandlers, mMonitor);
|
||||
|
||||
if (mListener->startListener()) {
|
||||
LOGE("Error - unable to start supplicant listener");
|
||||
ALOGE("Error - unable to start supplicant listener");
|
||||
stop();
|
||||
return -1;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ int Supplicant::getRssi(int *buffer) {
|
|||
char *s;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing RSSI");
|
||||
ALOGE("Error parsing RSSI");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
@ -333,13 +333,13 @@ int Supplicant::getLinkSpeed() {
|
|||
char *s;
|
||||
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing LINKSPEED");
|
||||
ALOGE("Error parsing LINKSPEED");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing LINKSPEED");
|
||||
ALOGE("Error parsing LINKSPEED");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
@ -452,26 +452,26 @@ int Supplicant::setupConfig() {
|
|||
if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) {
|
||||
return 0;
|
||||
} else if (errno != ENOENT) {
|
||||
LOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
ALOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
srcfd = open(SUPP_CONFIG_TEMPLATE, O_RDONLY);
|
||||
if (srcfd < 0) {
|
||||
LOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
ALOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
destfd = open(SUPP_CONFIG_FILE, O_CREAT|O_WRONLY, 0660);
|
||||
if (destfd < 0) {
|
||||
close(srcfd);
|
||||
LOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
ALOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((nread = read(srcfd, buf, sizeof(buf))) != 0) {
|
||||
if (nread < 0) {
|
||||
LOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
ALOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
close(srcfd);
|
||||
close(destfd);
|
||||
unlink(SUPP_CONFIG_FILE);
|
||||
|
@ -484,7 +484,7 @@ int Supplicant::setupConfig() {
|
|||
close(srcfd);
|
||||
|
||||
if (chown(SUPP_CONFIG_FILE, AID_SYSTEM, AID_WIFI) < 0) {
|
||||
LOGE("Error changing group ownership of %s to %d: %s",
|
||||
ALOGE("Error changing group ownership of %s to %d: %s",
|
||||
SUPP_CONFIG_FILE, AID_WIFI, strerror(errno));
|
||||
unlink(SUPP_CONFIG_FILE);
|
||||
return -1;
|
||||
|
@ -507,7 +507,7 @@ int Supplicant::setNetworkVar(int networkId, const char *var, const char *val) {
|
|||
|
||||
len = sizeof(reply) -1;
|
||||
if (sendCommand("SAVE_CONFIG", reply, &len)) {
|
||||
LOGE("Error saving config after %s = %s", var, val);
|
||||
ALOGE("Error saving config after %s = %s", var, val);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -46,7 +46,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
// p
|
||||
char *q = index(p, '\'');
|
||||
if (!q) {
|
||||
LOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
ALOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
return;
|
||||
}
|
||||
mSsid = (char *) malloc((q - p) +1);
|
||||
|
@ -59,7 +59,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
// ^
|
||||
// p
|
||||
if (!(q = index(p, ' '))) {
|
||||
LOGE("Unable to decode frequency\n");
|
||||
ALOGE("Unable to decode frequency\n");
|
||||
return;
|
||||
}
|
||||
*q = '\0';
|
||||
|
@ -73,7 +73,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
|
||||
char *q = index(p, '\'');
|
||||
if (!q) {
|
||||
LOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
ALOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
return;
|
||||
}
|
||||
mSsid = (char *) malloc((q - p) +1);
|
||||
|
|
|
@ -42,9 +42,9 @@ SupplicantConnectedEvent::SupplicantConnectedEvent(int level, char *event,
|
|||
else
|
||||
mReassociated = true;
|
||||
} else
|
||||
LOGE("Unable to decode re-assocation");
|
||||
ALOGE("Unable to decode re-assocation");
|
||||
} else
|
||||
LOGE("Unable to decode event");
|
||||
ALOGE("Unable to decode event");
|
||||
}
|
||||
|
||||
SupplicantConnectedEvent::SupplicantConnectedEvent(const char *bssid,
|
||||
|
|
|
@ -48,7 +48,7 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) {
|
|||
size_t nread = buflen - 1;
|
||||
|
||||
if ((rc = wpa_ctrl_recv(mMonitor, buf, &nread))) {
|
||||
LOGE("wpa_ctrl_recv failed (%s)", strerror(errno));
|
||||
ALOGE("wpa_ctrl_recv failed (%s)", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ SupplicantStatus *SupplicantStatus::createStatus(char *data, int len) {
|
|||
else if (!strcmp(value, "IDLE"))
|
||||
state = SupplicantState::IDLE;
|
||||
else
|
||||
LOGE("Unknown supplicant state '%s'", value);
|
||||
ALOGE("Unknown supplicant state '%s'", value);
|
||||
} else
|
||||
ALOGD("Ignoring unsupported status token '%s'", token);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ bool TiwlanEventListener::onDataAvailable(SocketClient *cli) {
|
|||
struct ipc_ev_data *data;
|
||||
|
||||
if (!(data = (struct ipc_ev_data *) malloc(sizeof(struct ipc_ev_data)))) {
|
||||
LOGE("Failed to allocate packet (out of memory)");
|
||||
ALOGE("Failed to allocate packet (out of memory)");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (recv(cli->getSocket(), data, sizeof(struct ipc_ev_data), 0) < 0) {
|
||||
LOGE("recv failed (%s)", strerror(errno));
|
||||
ALOGE("recv failed (%s)", strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,14 +84,14 @@ int TiwlanWifiController::loadFirmware() {
|
|||
|
||||
return 0;
|
||||
} else if (!strcmp(DRIVER_PROP_NAME, "failed")) {
|
||||
LOGE("Firmware load failed");
|
||||
ALOGE("Firmware load failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
usleep(200000);
|
||||
}
|
||||
property_set(DRIVER_PROP_NAME, "timeout");
|
||||
LOGE("Firmware load timed out");
|
||||
ALOGE("Firmware load timed out");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,13 @@ int TiwlanWifiController::startDriverEventListener() {
|
|||
struct sockaddr_in addr;
|
||||
|
||||
if (mListenerSock != -1) {
|
||||
LOGE("Listener already started!");
|
||||
ALOGE("Listener already started!");
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((mListenerSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||
LOGE("socket failed (%s)", strerror(errno));
|
||||
ALOGE("socket failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -117,14 +117,14 @@ int TiwlanWifiController::startDriverEventListener() {
|
|||
if (bind(mListenerSock,
|
||||
(struct sockaddr *) &addr,
|
||||
sizeof(addr)) < 0) {
|
||||
LOGE("bind failed (%s)", strerror(errno));
|
||||
ALOGE("bind failed (%s)", strerror(errno));
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
mEventListener = new TiwlanEventListener(mListenerSock);
|
||||
|
||||
if (mEventListener->startListener()) {
|
||||
LOGE("Error starting driver listener (%s)", strerror(errno));
|
||||
ALOGE("Error starting driver listener (%s)", strerror(errno));
|
||||
goto out_err;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -111,7 +111,7 @@ int WifiController::enable() {
|
|||
ALOGI("Powering up");
|
||||
sendStatusBroadcast("Powering up WiFi hardware");
|
||||
if (powerUp()) {
|
||||
LOGE("Powerup failed (%s)", strerror(errno));
|
||||
ALOGE("Powerup failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ int WifiController::enable() {
|
|||
ALOGI("Loading driver");
|
||||
sendStatusBroadcast("Loading WiFi driver");
|
||||
if (loadKernelModule(mModulePath, mModuleArgs)) {
|
||||
LOGE("Kernel module load failed (%s)", strerror(errno));
|
||||
ALOGE("Kernel module load failed (%s)", strerror(errno));
|
||||
goto out_powerdown;
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ int WifiController::enable() {
|
|||
ALOGI("Loading firmware");
|
||||
sendStatusBroadcast("Loading WiFI firmware");
|
||||
if (loadFirmware()) {
|
||||
LOGE("Firmware load failed (%s)", strerror(errno));
|
||||
ALOGE("Firmware load failed (%s)", strerror(errno));
|
||||
goto out_powerdown;
|
||||
}
|
||||
}
|
||||
|
@ -138,13 +138,13 @@ int WifiController::enable() {
|
|||
ALOGI("Starting WPA Supplicant");
|
||||
sendStatusBroadcast("Starting WPA Supplicant");
|
||||
if (mSupplicant->start()) {
|
||||
LOGE("Supplicant start failed (%s)", strerror(errno));
|
||||
ALOGE("Supplicant start failed (%s)", strerror(errno));
|
||||
goto out_unloadmodule;
|
||||
}
|
||||
}
|
||||
|
||||
if (Controller::bindInterface(mSupplicant->getInterfaceName())) {
|
||||
LOGE("Error binding interface (%s)", strerror(errno));
|
||||
ALOGE("Error binding interface (%s)", strerror(errno));
|
||||
goto out_unloadmodule;
|
||||
}
|
||||
|
||||
|
@ -173,13 +173,13 @@ int WifiController::enable() {
|
|||
out_unloadmodule:
|
||||
if (mModuleName[0] != '\0' && !isKernelModuleLoaded(mModuleName)) {
|
||||
if (unloadKernelModule(mModuleName)) {
|
||||
LOGE("Unable to unload module after failure!");
|
||||
ALOGE("Unable to unload module after failure!");
|
||||
}
|
||||
}
|
||||
|
||||
out_powerdown:
|
||||
if (powerDown()) {
|
||||
LOGE("Unable to powerdown after failure!");
|
||||
ALOGE("Unable to powerdown after failure!");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ int WifiController::setSuspend(bool suspend) {
|
|||
|
||||
ALOGD("Stopping Supplicant driver");
|
||||
if (mSupplicant->stopDriver()) {
|
||||
LOGE("Error stopping driver (%s)", strerror(errno));
|
||||
ALOGE("Error stopping driver (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ int WifiController::setSuspend(bool suspend) {
|
|||
ALOGD("Resuming");
|
||||
|
||||
if (mSupplicant->startDriver()) {
|
||||
LOGE("Error resuming driver (%s)", strerror(errno));
|
||||
ALOGE("Error resuming driver (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ int WifiController::disable() {
|
|||
if (mSupplicant->isStarted()) {
|
||||
sendStatusBroadcast("Stopping WPA Supplicant");
|
||||
if (mSupplicant->stop()) {
|
||||
LOGE("Supplicant stop failed (%s)", strerror(errno));
|
||||
ALOGE("Supplicant stop failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
|
@ -278,7 +278,7 @@ int WifiController::disable() {
|
|||
if (mModuleName[0] != '\0' && isKernelModuleLoaded(mModuleName)) {
|
||||
sendStatusBroadcast("Unloading WiFi driver");
|
||||
if (unloadKernelModule(mModuleName)) {
|
||||
LOGE("Unable to unload module (%s)", strerror(errno));
|
||||
ALOGE("Unable to unload module (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ int WifiController::disable() {
|
|||
if (isPoweredUp()) {
|
||||
sendStatusBroadcast("Powering down WiFi hardware");
|
||||
if (powerDown()) {
|
||||
LOGE("Powerdown failed (%s)", strerror(errno));
|
||||
ALOGE("Powerdown failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ void WifiController::onScanResultsEvent(SupplicantScanResultsEvent *evt) {
|
|||
char *reply;
|
||||
|
||||
if (!(reply = (char *) malloc(4096))) {
|
||||
LOGE("Out of memory");
|
||||
ALOGE("Out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ void WifiController::onStatusPollInterval() {
|
|||
pthread_mutex_lock(&mLock);
|
||||
int rssi;
|
||||
if (mSupplicant->getRssi(&rssi)) {
|
||||
LOGE("Failed to get rssi (%s)", strerror(errno));
|
||||
ALOGE("Failed to get rssi (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,13 +43,13 @@ WifiNetwork::WifiNetwork(WifiController *c, Supplicant *suppl, const char *data)
|
|||
char *flags;
|
||||
|
||||
if (!(id = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract network id");
|
||||
ALOGE("Failed to extract network id");
|
||||
if (!(ssid = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract ssid");
|
||||
ALOGE("Failed to extract ssid");
|
||||
if (!(bssid = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract bssid");
|
||||
ALOGE("Failed to extract bssid");
|
||||
if (!(flags = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract flags");
|
||||
ALOGE("Failed to extract flags");
|
||||
|
||||
// ALOGD("id '%s', ssid '%s', bssid '%s', flags '%s'", id, ssid, bssid,
|
||||
// flags ? flags :"null");
|
||||
|
@ -215,7 +215,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "key_mgmt", buffer, len)) {
|
||||
if (WifiNetwork::parseKeyManagementMask(buffer, &mask)) {
|
||||
LOGE("Error parsing key_mgmt (%s)", strerror(errno));
|
||||
ALOGE("Error parsing key_mgmt (%s)", strerror(errno));
|
||||
} else {
|
||||
mKeyManagement = mask;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "proto", buffer, len)) {
|
||||
if (WifiNetwork::parseProtocolsMask(buffer, &mask)) {
|
||||
LOGE("Error parsing proto (%s)", strerror(errno));
|
||||
ALOGE("Error parsing proto (%s)", strerror(errno));
|
||||
} else {
|
||||
mProtocols = mask;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "auth_alg", buffer, len)) {
|
||||
if (WifiNetwork::parseAuthAlgorithmsMask(buffer, &mask)) {
|
||||
LOGE("Error parsing auth_alg (%s)", strerror(errno));
|
||||
ALOGE("Error parsing auth_alg (%s)", strerror(errno));
|
||||
} else {
|
||||
mAuthAlgorithms = mask;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "pairwise", buffer, len)) {
|
||||
if (WifiNetwork::parsePairwiseCiphersMask(buffer, &mask)) {
|
||||
LOGE("Error parsing pairwise (%s)", strerror(errno));
|
||||
ALOGE("Error parsing pairwise (%s)", strerror(errno));
|
||||
} else {
|
||||
mPairwiseCiphers = mask;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "group", buffer, len)) {
|
||||
if (WifiNetwork::parseGroupCiphersMask(buffer, &mask)) {
|
||||
LOGE("Error parsing group (%s)", strerror(errno));
|
||||
ALOGE("Error parsing group (%s)", strerror(errno));
|
||||
} else {
|
||||
mGroupCiphers = mask;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ int WifiNetwork::refresh() {
|
|||
|
||||
return 0;
|
||||
out_err:
|
||||
LOGE("Refresh failed (%s)",strerror(errno));
|
||||
ALOGE("Refresh failed (%s)",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -453,12 +453,12 @@ int WifiNetwork::setEnabled(bool enabled) {
|
|||
|
||||
if (enabled) {
|
||||
if (getPriority() == -1) {
|
||||
LOGE("Cannot enable network when priority is not set");
|
||||
ALOGE("Cannot enable network when priority is not set");
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
if (getKeyManagement() == KeyManagementMask::UNKNOWN) {
|
||||
LOGE("Cannot enable network when KeyManagement is not set");
|
||||
ALOGE("Cannot enable network when KeyManagement is not set");
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -58,13 +58,13 @@ int WifiScanner::stop() {
|
|||
char c = 0;
|
||||
|
||||
if (write(mCtrlPipe[1], &c, 1) != 1) {
|
||||
LOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
ALOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *ret;
|
||||
if (pthread_join(mThread, &ret)) {
|
||||
LOGE("Error joining to scanner thread (%s)", strerror(errno));
|
||||
ALOGE("Error joining to scanner thread (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void WifiScanner::run() {
|
|||
}
|
||||
|
||||
if ((rc = select(mCtrlPipe[0] + 1, &read_fds, NULL, NULL, &to)) < 0) {
|
||||
LOGE("select failed (%s) - sleeping for one scanner period", strerror(errno));
|
||||
ALOGE("select failed (%s) - sleeping for one scanner period", strerror(errno));
|
||||
sleep(mPeriod);
|
||||
continue;
|
||||
} else if (!rc) {
|
||||
|
|
|
@ -50,13 +50,13 @@ int WifiStatusPoller::stop() {
|
|||
char c = 0;
|
||||
|
||||
if (write(mCtrlPipe[1], &c, 1) != 1) {
|
||||
LOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
ALOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *ret;
|
||||
if (pthread_join(mThread, &ret)) {
|
||||
LOGE("Error joining to listener thread (%s)", strerror(errno));
|
||||
ALOGE("Error joining to listener thread (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
close(mCtrlPipe[0]);
|
||||
|
@ -92,7 +92,7 @@ void WifiStatusPoller::run() {
|
|||
max = mCtrlPipe[0];
|
||||
|
||||
if ((rc = select(max + 1, &read_fds, NULL, NULL, &to)) < 0) {
|
||||
LOGE("select failed (%s)", strerror(errno));
|
||||
ALOGE("select failed (%s)", strerror(errno));
|
||||
sleep(1);
|
||||
continue;
|
||||
} else if (!rc) {
|
||||
|
|
|
@ -34,7 +34,7 @@ int main() {
|
|||
|
||||
NetworkManager *nm;
|
||||
if (!(nm = NetworkManager::Instance())) {
|
||||
LOGE("Unable to create NetworkManager");
|
||||
ALOGE("Unable to create NetworkManager");
|
||||
exit (-1);
|
||||
};
|
||||
|
||||
|
@ -47,12 +47,12 @@ int main() {
|
|||
|
||||
|
||||
if (NetworkManager::Instance()->run()) {
|
||||
LOGE("Unable to Run NetworkManager (%s)", strerror(errno));
|
||||
ALOGE("Unable to Run NetworkManager (%s)", strerror(errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (cl->startListener()) {
|
||||
LOGE("Unable to start CommandListener (%s)", strerror(errno));
|
||||
ALOGE("Unable to start CommandListener (%s)", strerror(errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue