File indexing completed on 2025-05-11 08:24:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifdef HAVE_CONFIG_H
0037 #include "config.h"
0038 #endif
0039
0040 #include <stdio.h>
0041 #include <inttypes.h>
0042
0043 #include <rtems.h>
0044 #include <rtems/bdpart.h>
0045
0046 static void rtems_bdpart_type_to_string(
0047 const uuid_t type,
0048 char str [37]
0049 )
0050 {
0051 uuid_unparse_lower( type, str);
0052 }
0053
0054 void rtems_bdpart_dump( const rtems_bdpart_partition *pt, size_t count)
0055 {
0056 size_t i = 0;
0057
0058 printf(
0059 "-------------------------------------------------------------------------------\n"
0060 " PARTITION TABLE\n"
0061 "------------+------------+-----------------------------------------------------\n"
0062 " BEGIN | LAST | TYPE\n"
0063 "------------+------------+-----------------------------------------------------\n"
0064 );
0065
0066 for (i = 0; i < count; ++i) {
0067 const rtems_bdpart_partition *p = pt + i;
0068 const char *type = NULL;
0069 char type_buffer [52];
0070 uint8_t type_mbr = 0;
0071
0072 if (rtems_bdpart_to_mbr_partition_type( p->type, &type_mbr)) {
0073 switch (type_mbr) {
0074 case RTEMS_BDPART_MBR_FAT_12:
0075 type = "FAT 12";
0076 break;
0077 case RTEMS_BDPART_MBR_FAT_16:
0078 type = "FAT 16";
0079 break;
0080 case RTEMS_BDPART_MBR_FAT_16_LBA:
0081 type = "FAT 16 LBA";
0082 break;
0083 case RTEMS_BDPART_MBR_FAT_32:
0084 type = "FAT 32";
0085 break;
0086 case RTEMS_BDPART_MBR_FAT_32_LBA:
0087 type = "FAT 32 LBA";
0088 break;
0089 case RTEMS_BDPART_MBR_DATA:
0090 type = "DATA";
0091 break;
0092 default:
0093 snprintf( type_buffer, sizeof( type_buffer), "0x%02" PRIx8, type_mbr);
0094 type = type_buffer;
0095 break;
0096 }
0097 } else {
0098 rtems_bdpart_type_to_string( p->type, type_buffer);
0099 type = type_buffer;
0100 }
0101
0102 printf(
0103 " %10" PRIu32 " | %10" PRIu32 " |%52s\n",
0104 p->begin,
0105 p->end - 1U,
0106 type
0107 );
0108 }
0109
0110 puts( "------------+------------+-----------------------------------------------------");
0111 }