From: Sascha Hauer <s.hauer@pengutronix.de>
To: Aleksander Morgado <aleksander@aleksander.es>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] sandbox: --stdin and --stdout allow max one bidirectional console
Date: Thu, 1 Jun 2017 10:41:15 +0200 [thread overview]
Message-ID: <20170601084115.gufdlfdazlbjgbjy@pengutronix.de> (raw)
In-Reply-To: <CAAP7ucLX93URh+zAvvtg1M_VdFf=wCaiGwW-RB39F=Yta4Czwg@mail.gmail.com>
On Thu, Jun 01, 2017 at 10:28:42AM +0200, Aleksander Morgado wrote:
> > On Wed, May 31, 2017 at 06:12:41PM +0200, Aleksander Morgado wrote:
> >> Allow up to one bidirectional FIFO/file based console in addition to
> >> the default stdin/stdout console that is always registered.
> >>
> >> We avoid opening the FIFO files while parsing the options because the
> >> whole logic may block if e.g. trying to open the --stdout FIFO and
> >> there is no reader in the other end. So instead, we store the --stdout
> >> and --stdin file paths given, and we open both sequentially once all
> >> the options have been parsed. This also allows us to validate that at
> >> most a single pair of --stdin and --stdout paths has been given.
> >> e.g.:
> >> term1 $ mkfifo /tmp/bbstdin
> >> term1 $ mkfifo /tmp/bbstdout
> >> term1 $ ./barebox -I /tmp/bbstdin -O /tmp/bbstdout
> >> (blocks until a reader is available in the stdout FIFO)
> >>
> >> term2 $ cat /tmp/bbstdout & cat > /tmp/bbstdin
> >> (starts reader and writer, which triggers barebox to continue)
> >>
> >> If only one console is activated (CONFIG_CONSOLE_ACTIVATE_ALL=n), the
> >> default stdin/stdout console will be preferred instead of the new
> >> FIFO/file based, which would need to be activated explicitly later on.
> >> e.g.:
> >> barebox@barebox sandbox:/ cs1.active=ioe
> >>
> >> Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
> >> ---
> >> arch/sandbox/os/common.c | 48 +++++++++++++++++++++++++++++++++++++-----------
> >> 1 file changed, 37 insertions(+), 11 deletions(-)
> >
> > The first patch is ok and I applied it. Before this patch though I'd like
> > to have the attached patch. It merely fixes what we already have: The -I
> > and -O options got broken over time, we ended up using the barebox
> > malloc pool before it was initialized.
> >
>
> Ah! I see, just moving the 'O' and 'I' parsing to the second getopt
> makes it work. I actually knew about the malloc pool being prepared in
> between both getopt runs, as my attempts to strdup() the file paths in
> the first run didn't succeed, I just didn't realize it was also
> affecting the other logic :)
>
> > So next we have to create a patch for what you want to do: Have an
> > option to create a bidirectional console in barebox. Can we have a
> > --file-console option that takes two path arguments instead of one, with
> > some separator in between?
> >
>
> Well, is this even needed any more? I'm fine having separate in/out
> consoles registered, as long as they work.
Ah, great, then we're done. I thought your goal was to have a single
console in barebox capable of both input and output.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2017-06-01 8:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 16:12 [PATCH 0/2] Enabling support for the FIFO based console in sandbox Aleksander Morgado
2017-05-31 16:12 ` [PATCH 1/2] sandbox: fix registering multiple consoles Aleksander Morgado
2017-05-31 16:12 ` [PATCH 2/2] sandbox: --stdin and --stdout allow max one bidirectional console Aleksander Morgado
2017-06-01 8:24 ` Sascha Hauer
2017-06-01 8:28 ` Aleksander Morgado
2017-06-01 8:41 ` Sascha Hauer [this message]
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=20170601084115.gufdlfdazlbjgbjy@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=aleksander@aleksander.es \
--cc=barebox@lists.infradead.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