aboutsummaryrefslogtreecommitdiff
path: root/coreutils/dd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* dd: add support for writing to physical drivesRon Yorston2024-08-021-0/+17
| | | | | | | | | | | | | | | A common use of 'dd' is to copy boot images to removable media. This didn't work on Windows because opening a physical drive failed with the default flags used by 'dd'. If the output file is a physical drive remove incompatible flags. Writing to a physical drive requires elevated privileges and the drive must be offline. Adds 80 bytes. (GitHub issue #435)
* Merge branch 'busybox' into mergeRon Yorston2023-08-101-1/+1
|\
| * introduce and use exitcode_tDenys Vlasenko2023-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta strings_main 422 420 -2 setfattr_main 175 173 -2 brctl_main 1548 1546 -2 makedevs_main 979 975 -4 rev_main 337 332 -5 getfattr_main 307 302 -5 cut_main 1201 1196 -5 cksum_main 398 393 -5 umount_main 573 565 -8 ln_main 516 508 -8 expand_main 660 652 -8 df_main 1068 1060 -8 renice_main 346 332 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/13 up/down: 0/-76) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2023-07-131-1/+1
|\|
| * Update applet size estimatesDenys Vlasenko2023-07-101-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | dd: omit direct flagRon Yorston2023-04-181-4/+19
| | | | | | | | | | | | | | | | O_DIRECT isn't supported with open(2) on Microsoft Windows. All code related to the 'direct' input/output flag can be omitted. Saves 160 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2023-01-051-2/+18
|\|
| * Fix non-Linux buildsSamuel Thibault2022-11-291-2/+18
| | | | | | | | | | | | | | | | | | | | | | Various tools are Linuxish and should thus only attempted to build on Linux only. Some features are also Linux-only. Also, libresolv is used on all GNU platforms, notably GNU/Hurd and GNU/kfreeBSD. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-08-171-2/+2
|\|
| * dd: tweak --helpDenys Vlasenko2021-08-151-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: rename update_dev_fd() as update_special_fd()Ron Yorston2021-06-071-1/+1
| | | | | | | | Avoid confusion between special devices and /dev/fd.
* | Merge branch 'busybox' into mergeRon Yorston2021-05-141-18/+32
|\|
| * dd: support iflag=count_bytesRafał Miłecki2021-04-131-18/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows passing amount of bytes in the count= function old new delta packed_usage 33599 33617 +18 static.iflag_words 29 41 +12 dd_main 1601 1607 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 36/0) Total: 36 bytes Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | tls: avoid unnecessary changes to POSIX build, part 2Ron Yorston2021-01-251-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On reflection, the previous commit may have been ill-advised. There are many calls to open_read_close() and most shouldn't be able to access special devices. (Though in practice only a few are enabled in busybox-w32.) Nonetheless, I've implemented a new mechanism which uses the macro MINGW_SPECIAL() to mark calls to functions that are allowed to access special devices. An unrelated change is to avoid compiling fputs_stdout() in coreutils/printf.c for the POSIX build.
* | Merge branch 'busybox' into mergeRon Yorston2021-01-141-33/+83
|\|
| * dd: support for O_DIRECT i/oDenys Vlasenko2020-12-141-31/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on patch by Akash Hadke <hadkeakash4@gmail.com> function old new delta dd_read - 66 +66 clear_O_DIRECT - 55 +55 write_and_stats 102 135 +33 dd_main 1578 1601 +23 static.oflag_words 19 26 +7 static.iflag_words 22 29 +7 packed_usage 33665 33668 +3 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 5/0 up/down: 194/0) Total: 194 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | dd: fix handling of 'conv=notrunc seek=N'Ron Yorston2020-05-201-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e6680912a (dd: create a sparse file when seek=N is used) broke the use of 'conv=notrunc seek=N' to modify existing files. Rename seek_sparse() to make_sparse() and: - add an argument to specify the start of the sparse region; - call make_sparse() before ftruncate(); - call make_sparse() only if: * we can determine the size of the file; * the file is not open in append mode; * the file is being extended. This should fix GitHub issue #186.
* | dd: create a sparse file when seek=N is usedRon Yorston2020-03-241-0/+3
| | | | | | | | | | | | | | When the seek=N argument is used mark the file as sparse and set the range that is sparse. See https://stackoverflow.com/questions/4011508/how-to-create-a-sparse-file-on-ntfs
* | Merge branch 'busybox' into mergeRon Yorston2019-05-271-13/+13
|\|
| * dd: fix handling of short result of full_write(), closes 11711Denys Vlasenko2019-05-141-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | $ dd bs=1G <sda1 of=/dev/sda1 dd: error writing '/dev/sda1': No space left on device 1+0 records in 0+0 records out 999292928 bytes (953.0MB) copied, 0.784617 seconds, 1.2GB/s function old new delta write_and_stats 99 102 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-03-121-6/+10
|\|
| * dd: add 'oflag=append'Rostislav Skudnov2019-02-141-6/+10
| | | | | | | | | | Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-1/+1
|\|
| * config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-11-281-22/+43
|\|
| * dd: do not have 'ocount' variable if ibs/obs support is not enabledDenys Vlasenko2018-10-301-13/+20
| | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 32964 32961 -3 dd_main 1033 1021 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-15) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: add 'oflag=seek_bytes'Rostislav Skudnov2018-10-301-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow specifying position in the output file in bytes instead of obs-sized blocks, improve compatibility with GNU dd. function old new delta dd_main 1632 1693 +61 packed_usage 33130 33150 +20 static.oflag_words - 12 +12 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 93/0) Total: 93 bytes Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: save a few bytes in device file supportRon Yorston2018-03-231-6/+1
| |
* | win32: restrict visibility of special devicesRon Yorston2018-03-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling of the special devices /dev/zero and /dev/urandom was inconsistent: - they could be used as arguments to 'cat' but not 'od'; - they could not be used in shell redirection. Restrict the use of these devices to two places: - as input files to 'dd' with the 'if=' argument; - internally within 'shred'. See GitHub issue #98.
* | dd: mention /dev/zero and /dev/urandom in help messageRon Yorston2018-03-061-0/+3
| |
* | dd: use new device handling to implement /dev/zero and /dev/urandomRon Yorston2018-02-221-13/+10
| | | | | | | | | | | | Replace internal support for /dev/zero with the newly introduced device handling in open/read. This reduces the differences between busybox-w32 and upstream.
* | Merge branch 'busybox' into mergeRon Yorston2018-02-131-13/+31
|\|
| * dd: add 'fullblock' iflagNicholas Clark2018-01-251-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a fullblock iflag for improved compatibility with GNU dd. The new iflag can be used to ensure that dd calls retrieve the expected amount of data when reading from pipes or unusual filesystems. function old new delta packed_usage 32249 32334 +85 dd_main 1582 1632 +50 static.iflag_words 12 22 +10 ------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 145/0) Total: 145 bytes Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: fixed partial count logicDenys Vlasenko2018-01-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | $ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $? 8+0 records in 7+0 records out <=========== FIXED, was 7+1 805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s 1 function old new delta write_and_stats 97 99 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: exit with 1 if last write was incompleteDenys Vlasenko2018-01-101-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | $ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $? 8+0 records in 7+1 records out 805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s 1 <=========== FIXED function old new delta write_and_stats 96 97 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | dd: silence warning on 64-bit systemsRon Yorston2017-08-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | On 64-bit systems size_t may be larger than unsigned long, resulting in a warning when -1L is cast to size_t. There's little to be gained from allowing obs and ibs take values larger than will fit in a signed long as the subsequent malloc will probably fail. Limit their range to ULONG_MAX/2. Signed-off-by: Ron Yorston <rmy@pobox.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-08-221-1/+1
|\|
| * config: do not use `a' quoting in help textsDenys Vlasenko2017-08-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-241-16/+16
|\|
| * config: deindent all help textsDenys Vlasenko2017-07-211-15/+15
| | | | | | | | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-181-4/+3
|\|
| * dd: fix status=none. Closes 10066Denys Vlasenko2017-07-141-4/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-05-291-4/+4
|\|
| * dd: call fsync() only once before exiting if conv=fsync is specifiedRostislav Skudnov2017-03-161-4/+4
| | | | | | | | | | Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-02-081-2/+2
|\|
| * Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-11-291-2/+4
|\|
| * Convert all coreutils/* applets to "new style" applet definitionsDenys Vlasenko2016-11-231-2/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-05-161-1/+3
|\|