From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH 2/4] Accept environment variables on the command line for Xen.
Date: Thu, 12 Dec 2013 19:48:05 +0400 [thread overview]
Message-ID: <20131212194805.5d81a2e7@opensuse.site> (raw)
In-Reply-To: <20131212153722.GC1431@riva.ucam.org>
В Thu, 12 Dec 2013 15:37:22 +0000
Colin Watson <cjwatson@ubuntu.com> пишет:
> * grub-core/kern/xen/init.c (fetch_command_line_word): New function.
> (parse_command_line): Likewise.
> (grub_machine_init): Call parse_command_line.
> ---
> ChangeLog | 8 ++++++++
> grub-core/kern/xen/init.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 52 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 766fe4b..fc86601 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,13 @@
> 2013-12-12 Colin Watson <cjwatson@ubuntu.com>
>
> + Accept environment variables on the command line for Xen.
> +
Thank you!
It may make sense to generalize it to other archs. At least EFI
definitely comes in mind. In this case platform specific part is only
to fetch parameter string(s). What about
- move fetch_command_line_word and parse_command_line to separate file
that is included for specific platforms only
- make each platform that can accept fetch parameters in platform
specific way and call common code (parse_command_line)
Does it make sense?
I will add EFI part then later.
> + * grub-core/kern/xen/init.c (fetch_command_line_word): New function.
> + (parse_command_line): Likewise.
> + (grub_machine_init): Call parse_command_line.
> +
> +2013-12-12 Colin Watson <cjwatson@ubuntu.com>
> +
> Add an option to exclude devices from search results.
>
> * grub-core/commands/search.c (struct search_ctx): Add excludes and
> diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
> index 1d8eaec..eb9b8b3 100644
> --- a/grub-core/kern/xen/init.c
> +++ b/grub-core/kern/xen/init.c
> @@ -525,6 +525,48 @@ map_all_pages (void)
> grub_mm_init_region ((void *) heap_start, heap_end - heap_start);
> }
>
> +static char *
> + (char *pos, char **word)
> +{
> + while (grub_isspace (*pos))
> + pos++;
> +
> + if (!*pos)
> + return NULL;
> +
> + *word = pos;
> + while (*pos && !grub_isspace (*pos))
> + pos++;
> + if (*pos)
> + *pos++ = '\0';
> + return pos;
> +}
> +
> +static void
> +parse_command_line (void)
> +{
> + char *cmd_line;
> + char *pos, *word;
> +
> + cmd_line = grub_malloc (MAX_GUEST_CMDLINE + 1);
> + grub_memcpy (cmd_line, grub_xen_start_page_addr->cmd_line,
> + MAX_GUEST_CMDLINE);
> + cmd_line[MAX_GUEST_CMDLINE] = '\0';
> + pos = cmd_line;
> + while ((pos = fetch_command_line_word (pos, &word)) != NULL)
> + {
> + char *equals;
> +
> + equals = grub_strchr (word, '=');
> + if (!equals)
> + continue;
> +
> + *equals = '\0';
> + grub_env_set (word, equals + 1);
> + }
> + grub_free (cmd_line);
> +}
> +
> extern char _end[];
>
> void
> @@ -547,6 +589,8 @@ grub_machine_init (void)
> grub_xendisk_init ();
>
> grub_boot_init ();
> +
> + parse_command_line ();
> }
>
> void
next prev parent reply other threads:[~2013-12-12 15:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 15:36 [PATCH 0/4] Turn-key PV-GRUB2 installation Colin Watson
2013-12-12 15:37 ` [PATCH 1/4] Add an option to exclude devices from search results Colin Watson
2013-12-13 12:27 ` [Xen-devel] " Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 13:18 ` Colin Watson
2013-12-13 15:40 ` [PATCH] add --boot-directory option to grub-mkstandalone Andrey Borzenkov
2013-12-20 12:16 ` Colin Watson
2013-12-21 10:29 ` Andrey Borzenkov
2013-12-21 10:37 ` Andrey Borzenkov
2013-12-22 17:20 ` [Xen-devel] [PATCH 1/4] Add an option to exclude devices from search results Jordan Uggla
2013-12-12 15:37 ` [PATCH 2/4] Accept environment variables on the command line for Xen Colin Watson
2013-12-12 15:48 ` Andrey Borzenkov [this message]
2013-12-12 16:11 ` Colin Watson
2013-12-12 16:15 ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:13 ` Vladimir 'phcoder' Serbinenko
2013-12-12 17:12 ` Andrey Borzenkov
2013-12-12 17:58 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 19:12 ` Colin Watson
2013-12-12 19:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 15:37 ` [PATCH 3/4] Build grub.xen Colin Watson
2013-12-12 16:24 ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:39 ` Colin Watson
2013-12-12 16:45 ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:49 ` Fwd: " Vladimir 'phcoder' Serbinenko
2013-12-12 17:36 ` Colin Watson
2013-12-12 17:41 ` Andrey Borzenkov
2013-12-12 18:08 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 11:56 ` Colin Watson
2013-12-13 12:19 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 15:37 ` [PATCH 4/4] Improve installation on Xen Colin Watson
2013-12-12 16:23 ` [Xen-devel] " Vladimir 'phcoder' Serbinenko
2013-12-13 11:58 ` Colin Watson
2013-12-16 11:42 ` [Xen-devel] [PATCH 0/4] Turn-key PV-GRUB2 installation Ian Campbell
2013-12-16 12:05 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131212194805.5d81a2e7@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).