Home | History | Annotate | Download | only in gpt-utils

Lines Matching refs:gpt

53 #define LOG_TAG "gpt-utils"
56 #include "gpt-utils.h"
72 /* GPT defines */
174 * \brief Search within GPT for partition entry with the given name
199 /* Partition names in GPT are UTF-16 - ignoring UTF-16 2nd byte */
215 * \brief Swaps boot chain in GPT partition entries array
273 * \brief Sets secondary GPT boot chain
297 fprintf(stderr, "Failed to get GPT device block size: %s\n",
304 fprintf(stderr, "Failed to allocate memory to hold GPT block\n");
310 fprintf(stderr, "Getting secondary GPT header offset failed: %s\n",
316 /* Read primary GPT header from block dev */
320 fprintf(stderr, "Failed to read primary GPT header from blk dev\n");
332 "Failed to alloc memory for GPT partition entries array\n");
336 /* Read primary GPT partititon entries array from block dev */
343 fprintf(stderr, "Primary GPT partition entries array CRC invalid\n");
348 /* Read secondary GPT header from block dev */
372 /* Write the modified GPT header back to block dev */
375 /* Write the modified GPT partititon entries array back to block dev */
390 * \brief Checks GPT state (header signature and CRC)
393 * \param [in] gpt GPT header to be checked
394 * \param [out] state GPT header state
400 static int gpt_get_state(int fd, enum gpt_instance gpt, enum gpt_state *state)
411 fprintf(stderr, "Failed to get GPT device block size: %s\n",
420 if (gpt == PRIMARY_GPT)
425 fprintf(stderr, "gpt_get_state:Seek to end of GPT part fail\n");
456 * \brief Sets GPT header state (used to corrupt and fix GPT signature)
459 * \param [in] gpt GPT header to be checked
460 * \param [in] state GPT header state to set (GPT_OK or GPT_BAD_SIGNATURE)
466 static int gpt_set_state(int fd, enum gpt_instance gpt, enum gpt_state state)
475 fprintf(stderr, "Failed to get GPT device block size: %s\n",
481 fprintf(stderr, "Failed to alloc memory for gpt header\n");
484 if (gpt == PRIMARY_GPT)
489 fprintf(stderr, "Failed to seek to end of GPT device\n");
494 fprintf(stderr, "Failed to r/w gpt header\n");
645 //cannot have a backup GPT which is what we use for failsafe
735 //dev_path is the path to the block device that contains the GPT image that
738 //be invoked only once on /dev/block/mmcblk1 since it holds the GPT image
770 fprintf(stderr, "%s: Getting GPT headers state failed\n",
777 fprintf(stderr, "%s: GPT headers CRC corruption detected, aborting\n",
783 fprintf(stderr, "%s: Both GPT headers corrupted, aborting\n",
789 /* Check internal update stage according GPT headers' state */
833 //Fix up the backup GPT table so that it actually points to
841 "%s: Setting secondary GPT to backup boot failed\n",
843 /* No backup partitions - do not corrupt GPT, do not flag error */
848 //corrupt the primary GPT so that the backup(which now points to
852 fprintf(stderr, "%s: Corrupting primary GPT header failed\n",
877 //Fix the primary GPT header so that is used
882 fprintf(stderr, "%s: Fixing primary GPT header failed\n",
886 //Corrupt the scondary GPT header
889 fprintf(stderr, "%s: Corrupting secondary GPT header failed\n",
896 //primary/backup GPT headers once again point to the same set of
902 fprintf(stderr, "%s: Setting secondary GPT to normal boot failed\n",
909 fprintf(stderr, "%s: Fixing secondary GPT header failed\n",
1054 //represents the GPT disk the partition resides on. In the case of emmc it
1137 ALOGE("%s: Failed to get GPT dev block size : %s",
1147 //Write the GPT header present in the passed in buffer back to the
1170 ALOGE("%s: Failed to get gpt header offset",__func__);
1176 ALOGE("%s: Failed to write back GPT header", __func__);
1184 //Read out the GPT header for the disk that contains the partition partname
1214 ALOGE("%s: Failed to get gpt block size for %s",
1222 ALOGE("%s: Failed to allocate memory for gpt header",
1231 ALOGE("%s: Failed to get gpt header offset",
1236 ALOGE("%s: Failed to read GPT header from device",
1251 //passed in buffer which contains the gpt header.
1272 ALOGE("%s: Failed to get gpt block size for",
1315 ALOGE("%s: Failed to get gpt block size for",
1487 //Update the partition CRC value in the primary GPT header
1489 //Update the partition CRC value in the backup GPT header
1522 ALOGI("%s: Writing back primary GPT header", __func__);
1525 ALOGE("%s: Failed to update primary GPT header",
1532 ALOGE("%s: Failed to write primary GPT partition arr",