From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Sun, 28 Sep 2014 19:48:03 +0200 Subject: [U-Boot] [PATCH] tools: mkimage can read input on /dev/stdin In-Reply-To: References: <20140927125434.B9C8F382279@gemini.denx.de> <20140927132525.7EB02382279@gemini.denx.de> <20140927182436.CD59B3857A9@gemini.denx.de> <20140927215655.365B9380044@gemini.denx.de> <20140928064921.5AE4B382278@gemini.denx.de> Message-ID: <20140928174803.BFD96382278@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Julien, In message you wrote: > > > So if we add support to read from stdin instead from a file where we > > pass the file name as an argument, we should probably do this in a > > consistent way. It would be a frustrating experience to the end user > > to learn that he can use stdin here but not there - so we would > > probably have to rework all these use cases? And how should we > > implement this - would a file name "-" mean stdin (1), or should we > > simply pass "/dev/stdin" as file argument (2)? > > > > With (1), we need to change more code, while (2) could probably be > > pretty transparent. > > If I understand well, your proposition for (1) would be to use mmap(2) > for everything, but use read(2) for the special case "-". I did not mean to suggest this. I probably makes more sense to use the same code everywhere. > I'm not sure it is a good idea. The standard input can be handled like > any other file. And note the input could also be a named pipe, that > you won't be able to mmap. With the patch proposed, it would work just > fine. But the patch would only be a part of the implementation. I think we should see it all together to be able to compare approaches. > Also, in the case you're having several files as input, they will be > consumed one after the other. So if the input is "-d > /dev/stdin:/dev/stdin:/dev/stdin", you can give the three files > through stdin. Ouch. That would be error prone as hell. Not all things that can be done should be done ;-) Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Success covers a multitude of blunders." - George Bernard Shaw