summaryrefslogtreecommitdiffstats
path: root/libdiskconfig/diskconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskconfig/diskconfig.c')
-rw-r--r--libdiskconfig/diskconfig.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/libdiskconfig/diskconfig.c b/libdiskconfig/diskconfig.c
index 66bd0c39b..d5425de03 100644
--- a/libdiskconfig/diskconfig.c
+++ b/libdiskconfig/diskconfig.c
@@ -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, &sect_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;
}