[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add concurrent I/O support to gnu dd
From: |
Jim Meyering |
Subject: |
Re: Add concurrent I/O support to gnu dd |
Date: |
Fri, 26 Dec 2008 12:04:54 +0100 |
"Matt Harden" <address@hidden> wrote:
> On Sat, Dec 20, 2008 at 09:55:55AM +0100, Jim Meyering wrote:
...
>> I'd rather not make this change to gnulib's fcntl.in.h
>> right now, since it would make code that tests for the existence
>> of O_CIO using "#ifndef O_CIO" mistakenly determine that
>> it's supported.
>> So please move that change into dd.c.
>
> You have the exact same situation with O_DIRECT, O_DSYNC, O_NDELAY,
> and the rest right now. I'm sure you're well aware of that however,
> so I've gone ahead and done what you asked.
>
> Patch in git format-patch format attached.
>
> Thanks,
> Matt
>
>>From 1b910012141aa389dd4f057f535fc5bf5dbe8368 Mon Sep 17 00:00:00 2001
> From: Matt Harden <address@hidden>
> Date: Sun, 21 Dec 2008 22:06:16 -0600
> Subject: [PATCH] dd: add support for opening files in Concurrent I/O (CIO)
> mode
>
> * src/dd.c (O_CIO): New flag.
> * src/dd.c (O_FULLBLOCK): Add O_CIO to the list of flags that
> O_FULLBLOCK should be greater than.
> * src/dd.c (flags): Give the name "cio" to the new O_CIO flag, mirroring
> the treatment of O_DIRECT.
> * src/dd.c (usage): Add a description of the new flag when it is available.
> * doc/coreutils.text (dd invocation): Describe the new flag.
> * NEWS: Mention the new feature.
Thanks!
Applied with this tweak to get past a "make distcheck" failure.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d716e99..3873773 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7733,7 +7733,7 @@ dd invocation
@opindex cio
@cindex concurrent I/O
Use concurrent I/O mode for data. This mode performs direct I/O
-and drops the POSIX requirement to serialize all I/O to the same file.
+and drops the @acronym{POSIX} requirement to serialize all I/O to the same
file.
A file cannot be opened in CIO mode and with a standard open at the
same time.
> Also I noticed I had left O_CIO out of the section that chooses a unique
> value for O_FULLBLOCK so I added it there as well.
Good catch. I've added the following to ensure we keep things in sync:
(along the way I noticed/fixed where a definition of diff in the
environment could cause a false-positive "make distcheck" failure)
>From 29fbc7528d3d57561b75a819f6ad34cb9e73900b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 26 Dec 2008 12:00:18 +0100
Subject: [PATCH] maint: ensure dd's computation of O_FULLBLOCK uses all O_
symbol names
* src/dd.c (O_FULLBLOCK): Use a more uniform initializer, that makes
it easier to extract all O_ symbol names.
* maint.mk (syntax-check-rules): Also search for sc_ rules in cfg.mk.
(sc_root_tests): Ensure that this rule sets $diff.
* cfg.mk (sc_dd_O_FLAGS): New rule.
---
cfg.mk | 13 +++++++++++++
maint.mk | 4 ++--
src/dd.c | 3 ++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 9de10ce..17d8732 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -43,3 +43,16 @@ gnulib_dir = /gnulib
export VERBOSE = yes
old_NEWS_hash = e56dee27333ad86eaf0aa7ac7d04fca5 -
+
+# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
+dd = $(srcdir)/src/dd.c
+sc_dd_O_FLAGS:
+ { echo O_FULLBLOCK; perl -nle '/MAX \((O_\w*),/ and print $$1' \
+ $(dd); } | sort > address@hidden
+ { echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
+ $(dd); } | sort > address@hidden
+ diff -u address@hidden address@hidden || diff=1 || diff=;
\
+ rm -f address@hidden address@hidden;
\
+ test "$$diff" \
+ && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
+ exit 1; } || :
diff --git a/maint.mk b/maint.mk
index 7a9649e..82a526c 100644
--- a/maint.mk
+++ b/maint.mk
@@ -70,7 +70,7 @@ export LC_ALL = C
# Collect the names of rules starting with `sc_'.
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
- $(srcdir)/$(ME))
+ $(srcdir)/$(ME) $(srcdir)/cfg.mk)
.PHONY: $(syntax-check-rules)
local-checks-available = \
@@ -318,7 +318,7 @@ sc_root_tests:
$(srcdir)/tests/Makefile.am \
| sed 's/^ *//;/^root_tests =/d' \
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
- diff -u $$t1 $$t2 || diff=1; \
+ diff -u $$t1 $$t2 || diff=1 || diff=; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
diff --git a/src/dd.c b/src/dd.c
index 7639612..d683c5d 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -279,7 +279,8 @@ enum
MAX (O_NOFOLLOW,
MAX (O_NOLINKS,
MAX (O_NONBLOCK,
- MAX (O_SYNC, O_TEXT))))))))))))) << 1)
+ MAX (O_SYNC,
+ MAX (O_TEXT, 0)))))))))))))) << 1)
};
/* Ensure that we didn't shift it off the end. */
--
1.6.1.rc3.359.g43db1