[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: listing partguid of a device
From:       daggs <daggs () gmx ! com>
Date:       2024-03-18 17:53:52
Message-ID: trinity-5bc13dad-4189-43a9-8765-8005a09d792a-1710784431911 () 3c-app-mailcom-bs08
[Download RAW message or body]

> Greetings,
>
> I wonder if there is a way to use busybox to list partguid of a device?
> busybox's blkid cannot do it while stock blkid can.
>
> Thanks.
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>

short answer, seems like thats a no.
in case someone needs such support, I'm attaching a patch that I wrote for=
 gdisk that prints the part guids.

Dagg

["add_part_guid_to_gdisk.patch" (text/x-patch)]

--- util-linux/fdisk_gpt.c	2021-12-26 18:53:21.000000000 +0200
+++ util-linux/fdisk_gpt.c	2024-03-15 15:49:37.958500769 +0200
@@ -72,7 +72,7 @@ gpt_print_guid(uint8_t *buf)
 		buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
 }

-static void
+static int
 gpt_print_wide36(uint16_t *s)
 {
 #if ENABLE_UNICODE_SUPPORT
@@ -88,6 +88,7 @@ gpt_print_wide36(uint16_t *s)
 	wc[i] = 0;
 	if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
 		fputs_stdout(printable_string(buf));
+	return i;
 #else
 	char buf[37];
 	int i = 0;
@@ -99,13 +100,14 @@ gpt_print_wide36(uint16_t *s)
 	}
 	buf[i] = '\0';
 	fputs_stdout(buf);
+	return i;
 #endif
 }

 static void
 gpt_list_table(int xtra UNUSED_PARAM)
 {
-	int i;
+	int i, printed_len;
 	char numstr6[6];

 	smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY")[0] = '\0';
@@ -129,7 +131,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
  * and then (code>>8) matches what you need to put into MBR's type field for such a partition.
  * To print those codes, we'd need a GUID lookup table. Lets just drop the "Code" column instead:
  */
-	puts("Number  Start (sector)    End (sector)  Size Name");
+	puts("Number  Start (sector)    End (sector)  Size Name                                 Part GUID");
 	//    123456 123456789012345 123456789012345 12345 abc
 	for (i = 0; i < n_parts; i++) {
 		gpt_partition *p = gpt_part(i);
@@ -142,7 +144,10 @@ gpt_list_table(int xtra UNUSED_PARAM)
 				(unsigned long long)SWAP_LE64(p->lba_end),
 				numstr6
 			);
-			gpt_print_wide36(p->name36);
+			printed_len = ARRAY_SIZE(p->name36) - gpt_print_wide36(p->name36);
+			while (printed_len-- >= 0)
+				bb_putchar(' ');
+			gpt_print_guid(p->part_guid);
 			bb_putchar('\n');
 		}
 	}


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic