Simon Rettberg
2016-11-17 19:28:07 UTC
Now that I needed to get the type codes of GPT partitions in a script I
decided to add this functionality to busybox fdisk, which had a big
FIXME in the code and just printed 0700 for every partition (and gave me
some headache before I realized this).
Since this adds a big lookup table I made this feature optional and off by
default.
With feature enabled:
function old new delta
.rodata 82378 83602 +1224
static.list_table 1268 1381 +113
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 1337/0) Total: 1337
bytes
text data bss dec hex filename
543392 3899 1920 549211 8615b busybox_old
544729 3899 1920 550548 86694 busybox_unstripped
This also changes the format-specifier from %04x to %04X since, as far as
I can tell, the output format is based on that of gdisk, which also uses
uppercase letters for the type code.
I have some doubt that printing 0700 if this feature is disabled is the
best choice, as this could mislead others as well. Maybe using FFFF
(=unknown GUID type code) or just printing '-' or '?' would make more
sense, but I didn't dare to change this for the sake of backwards
compatibility.
Lastly, I added the embarrassing one-liner I used for creating the lookup
table as a comment, to document where the values come from and make it
easier to update the list in the future. In case this breaks any style
guidelines it might be preferable to move this to some readme file or even
create a more readable external script that does all the magic.
- Simon
decided to add this functionality to busybox fdisk, which had a big
FIXME in the code and just printed 0700 for every partition (and gave me
some headache before I realized this).
Since this adds a big lookup table I made this feature optional and off by
default.
With feature enabled:
function old new delta
.rodata 82378 83602 +1224
static.list_table 1268 1381 +113
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 1337/0) Total: 1337
bytes
text data bss dec hex filename
543392 3899 1920 549211 8615b busybox_old
544729 3899 1920 550548 86694 busybox_unstripped
This also changes the format-specifier from %04x to %04X since, as far as
I can tell, the output format is based on that of gdisk, which also uses
uppercase letters for the type code.
I have some doubt that printing 0700 if this feature is disabled is the
best choice, as this could mislead others as well. Maybe using FFFF
(=unknown GUID type code) or just printing '-' or '?' would make more
sense, but I didn't dare to change this for the sake of backwards
compatibility.
Lastly, I added the embarrassing one-liner I used for creating the lookup
table as a comment, to document where the values come from and make it
easier to update the list in the future. In case this breaks any style
guidelines it might be preferable to move this to some readme file or even
create a more readable external script that does all the magic.
- Simon