tech-userlevel archive

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

Re: iflag/oflag for dd(1)






> On Mar 16, 2015, at 12:08 AM, Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> 
> Hello
> 
> Linux's dd(1) has iflag and oflag operands to specify the O_* flags that
> should be given to open(2) for the input and output file. It works like
> this:
> 
> dd if=in.txt of=out.txt oflag=direct,sync
> 
> That tells out.txt should be open with O_RW|O_DIRECT|O_SYNC
> 
> There is the question on how to cope with existing behavior. IMO it
> should behave like this:
> 
> 1) iflag should completely override default O_RDONLY for input open
> flags.
> 
> 2) oflag should only overring O_CREAT in default output open flags:
> O_RW | O_CREAT | (ddflags & (C_SEEK | C_NOTRUNC) ? 0 : O_TRUNC))
> it should become:
> O_RW | oflag | (ddflags & (C_SEEK | C_NOTRUNC) ? 0 : O_TRUNC))
> with unspecifield oflag being set to O_CREAT
> 
> Anyone against adding the feature? I can craft a patch if it is
> desirable.
> 
> -- 
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> manu%netbsd.org@localhost

Sounds pretty cool but not sure when I would use it. 


Home | Main Index | Thread Index | Old Index