tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Re: iflag/oflag for dd(1)



On Mar 17,  3:45pm, manu%netbsd.org@localhost (Emmanuel Dreyfus) wrote:
-- Subject: Re: [PATCH] Re: iflag/oflag for dd(1)

| On Tue, Mar 17, 2015 at 11:40:08AM -0400, Christos Zoulas wrote:
| > O_CREAT:
| > 	It is already in the oflag, there is no way to clear it.
| 
| The code I wrote haa s oflag overrinding the default O_CREAT. Is that
| wrong?

Ok, keep it then. I guess perhaps mention in the man page that doing oflag=
kills O_CREAT and requires that the file exists.

| > O_RDWR:
| > 	It is already in the oflag, there is no way to clear it.
| > 	It does not make a lot of sense for the iflag
| 
| Except if you have some fancy filesystem that behaves differently 
| when file are open R/W.

I would s/fancy/busted/ :-) And setting write in iflag is broken.
Plus or'ing thing in O_ACCMODE does not make a lot of sense. Unfortunately
historically O_RDONLY = 0, O_WRONLY = 1, and O_RDWR = 2. It would have been
nice if O_RDONLY = 1, O_WRONLY = 2, and O_RDWR = 3, but it is not.

| > 
| > O_TRUNC:
| > 	For oflag it will lead to confusion with conv=notrunc and no way
| > 	to clear it. Two ways to do the same thing.
| 
| I noted it in the man page: O_TRUNC is added unless you have oseek, seek
| or notrunc. 

I would not object keeping it... For oflag.

| > O_APPEND:
| > 	This is useful for oflag I guess, not for iflag...
| 
| You suggest it should be filtered out only for iflag?

Yes, I think it does not make sense for iflag...

christos


Home | Main Index | Thread Index | Old Index