/* Ensure that # of partitions is less than the max we have allocated */
tmpparts = le32_to_cpu(ptable->numparts); if (tmpparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) {
pr_err("Partition numbers exceed the max limit\n"); return -EINVAL;
}
/* Find out length of partition data based on table version */ if (le32_to_cpu(ptable->version) <= SMEM_FLASH_PTABLE_V3) {
len = SMEM_FLASH_PTABLE_HDR_LEN + SMEM_FLASH_PTABLE_MAX_PARTS_V3 * sizeof(struct smem_flash_pentry);
} elseif (le32_to_cpu(ptable->version) == SMEM_FLASH_PTABLE_V4) {
len = SMEM_FLASH_PTABLE_HDR_LEN + SMEM_FLASH_PTABLE_MAX_PARTS_V4 * sizeof(struct smem_flash_pentry);
} else {
pr_err("Unknown ptable version (%d)", le32_to_cpu(ptable->version)); return -EINVAL;
}
/* * Now that the partition table header has been parsed, verified * and the length of the partition table calculated, read the * complete partition table
*/
ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len); if (IS_ERR(ptable)) {
pr_err("Error reading partition table\n"); return PTR_ERR(ptable);
}
for (i = 0; i < tmpparts; i++) {
pentry = &ptable->pentry[i]; if (pentry->name[0] != '\0')
numparts++;
}
parts = kcalloc(numparts, sizeof(*parts), GFP_KERNEL); if (!parts) return -ENOMEM;
for (i = 0, j = 0; i < tmpparts; i++) {
pentry = &ptable->pentry[i]; if (pentry->name[0] == '\0') continue;
name = kstrdup(pentry->name, GFP_KERNEL); if (!name) {
ret = -ENOMEM; goto out_free_parts;
}
/* Convert name to lower case */ for (c = name; *c != '\0'; c++)
*c = tolower(*c);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.