* [PATCH] sort target list in grub-mkimage help output to make it easier to read
@ 2013-12-07 13:27 Andrey Borzenkov
2013-12-09 23:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Borzenkov @ 2013-12-07 13:27 UTC (permalink / raw)
To: grub-devel
---
util/mkimage.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/util/mkimage.c b/util/mkimage.c
index ad12f8a..94f7edb 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -959,21 +959,27 @@ grub_util_get_target_name (const struct grub_install_image_target_desc *t)
char *
grub_install_get_image_targets_string (void)
{
+ const char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (image_targets));
int format_len = 0;
char *formats;
char *ptr;
unsigned i;
for (i = 0; i < ARRAY_SIZE (image_targets); i++)
- format_len += strlen (image_targets[i].names[0]) + 2;
+ {
+ arr[i] = image_targets[i].names[0];
+ format_len += strlen (image_targets[i].names[0]) + 2;
+ }
ptr = formats = xmalloc (format_len);
+ qsort (arr, ARRAY_SIZE (image_targets), sizeof (char *), grub_qsort_strcmp);
for (i = 0; i < ARRAY_SIZE (image_targets); i++)
{
- strcpy (ptr, image_targets[i].names[0]);
- ptr += strlen (image_targets[i].names[0]);
+ strcpy (ptr, arr[i]);
+ ptr += strlen (arr[i]);
*ptr++ = ',';
*ptr++ = ' ';
}
ptr[-2] = 0;
+ free (arr);
return formats;
}
--
tg: (f585c90..) u/grub-mkimage-sort-targets (depends on: master)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sort target list in grub-mkimage help output to make it easier to read
2013-12-07 13:27 [PATCH] sort target list in grub-mkimage help output to make it easier to read Andrey Borzenkov
@ 2013-12-09 23:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 10:52 ` Andrey Borzenkov
2014-04-03 18:14 ` Andrey Borzenkov
0 siblings, 2 replies; 4+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-12-09 23:49 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
What about similar architectures with dissimilar name? Like i386-efi and
x86_64-efi ? And do we really want arm to come first with most common
platforms ending somewhere in the middle?
On 07.12.2013 14:27, Andrey Borzenkov wrote:
> ---
> util/mkimage.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/util/mkimage.c b/util/mkimage.c
> index ad12f8a..94f7edb 100644
> --- a/util/mkimage.c
> +++ b/util/mkimage.c
> @@ -959,21 +959,27 @@ grub_util_get_target_name (const struct grub_install_image_target_desc *t)
> char *
> grub_install_get_image_targets_string (void)
> {
> + const char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (image_targets));
> int format_len = 0;
> char *formats;
> char *ptr;
> unsigned i;
> for (i = 0; i < ARRAY_SIZE (image_targets); i++)
> - format_len += strlen (image_targets[i].names[0]) + 2;
> + {
> + arr[i] = image_targets[i].names[0];
> + format_len += strlen (image_targets[i].names[0]) + 2;
> + }
> ptr = formats = xmalloc (format_len);
> + qsort (arr, ARRAY_SIZE (image_targets), sizeof (char *), grub_qsort_strcmp);
> for (i = 0; i < ARRAY_SIZE (image_targets); i++)
> {
> - strcpy (ptr, image_targets[i].names[0]);
> - ptr += strlen (image_targets[i].names[0]);
> + strcpy (ptr, arr[i]);
> + ptr += strlen (arr[i]);
> *ptr++ = ',';
> *ptr++ = ' ';
> }
> ptr[-2] = 0;
> + free (arr);
>
> return formats;
> }
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sort target list in grub-mkimage help output to make it easier to read
2013-12-09 23:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-12-10 10:52 ` Andrey Borzenkov
2014-04-03 18:14 ` Andrey Borzenkov
1 sibling, 0 replies; 4+ messages in thread
From: Andrey Borzenkov @ 2013-12-10 10:52 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
В Tue, 10 Dec 2013 00:49:55 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:
> What about similar architectures with dissimilar name? Like i386-efi and
> x86_64-efi ? And do we really want arm to come first with most common
> platforms ending somewhere in the middle?
My use case is - when I get error from grub-mkimage about invalid
parameter, sorted list allows me to quickly check whether entered
parameter was correct or not. In which cases are listing i386-efi
together with x86_64-efi or ordering list according to "platform
commonality" useful? Just asking if I miss something obvious?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sort target list in grub-mkimage help output to make it easier to read
2013-12-09 23:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 10:52 ` Andrey Borzenkov
@ 2014-04-03 18:14 ` Andrey Borzenkov
1 sibling, 0 replies; 4+ messages in thread
From: Andrey Borzenkov @ 2014-04-03 18:14 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: phcoder
[-- Attachment #1: Type: text/plain, Size: 413 bytes --]
В Tue, 10 Dec 2013 00:49:55 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:
> What about similar architectures with dissimilar name? Like i386-efi and
> x86_64-efi ? And do we really want arm to come first with most common
> platforms ending somewhere in the middle?
That's exactly what grub-install does in help output. Any reason
grub-mkimage should behave differently?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-03 18:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 13:27 [PATCH] sort target list in grub-mkimage help output to make it easier to read Andrey Borzenkov
2013-12-09 23:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 10:52 ` Andrey Borzenkov
2014-04-03 18:14 ` Andrey Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).