partition/gpt: Replace PRI?LBA with PRI?OFF

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-07-16 21:35:25 +08:00 committed by Petro Karashchenko
parent 4484d04a8d
commit c211954a42
1 changed files with 3 additions and 12 deletions

View File

@ -41,15 +41,6 @@
#define GPT_LBA_TO_BLOCK(lba, blk) ((le64toh(lba) * 512 + (blk) -1) / (blk)) #define GPT_LBA_TO_BLOCK(lba, blk) ((le64toh(lba) * 512 + (blk) -1) / (blk))
#define GPT_MIN(x, y) (((x) < (y)) ? (x) : (y)) #define GPT_MIN(x, y) (((x) < (y)) ? (x) : (y))
/* Helper macro for printing lba addresses according to the sys/types.h */
#if defined(CONFIG_FS_LARGEFILE) && defined(CONFIG_HAVE_LONG_LONG)
#define PRIxLBA PRIx64
#define PRIdLBA PRId64
#else
#define PRIxLBA PRIx32
#define PRIdLBA PRId32
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -296,7 +287,7 @@ static int gpt_header_is_valid(FAR struct partition_state_s *state,
if (le64toh(gpt->my_lba) != lba) if (le64toh(gpt->my_lba) != lba)
{ {
ferr("GPT: my_lba incorrect: %" PRIx64 " != %" PRIxLBA "\n", ferr("GPT: my_lba incorrect: %" PRIx64 " != %" PRIxOFF "\n",
le64toh(gpt->my_lba), lba); le64toh(gpt->my_lba), lba);
return -EINVAL; return -EINVAL;
} }
@ -306,14 +297,14 @@ static int gpt_header_is_valid(FAR struct partition_state_s *state,
lastlba = gpt_last_lba(state); lastlba = gpt_last_lba(state);
if (le64toh(gpt->first_usable_lba) > lastlba) if (le64toh(gpt->first_usable_lba) > lastlba)
{ {
ferr("GPT: first_usable_lba incorrect: %" PRId64 " > %" PRIdLBA "\n", ferr("GPT: first_usable_lba incorrect: %" PRId64 " > %" PRIdOFF "\n",
le64toh(gpt->first_usable_lba), lastlba); le64toh(gpt->first_usable_lba), lastlba);
return -EINVAL; return -EINVAL;
} }
if (le64toh(gpt->last_usable_lba) > lastlba) if (le64toh(gpt->last_usable_lba) > lastlba)
{ {
ferr("GPT: last_usable_lba incorrect: %" PRId64 " > %" PRIdLBA "\n", ferr("GPT: last_usable_lba incorrect: %" PRId64 " > %" PRIdOFF "\n",
le64toh(gpt->last_usable_lba), lastlba); le64toh(gpt->last_usable_lba), lastlba);
return -EINVAL; return -EINVAL;
} }