summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Harden <matth@mindspring.com>2008-12-21 22:06:16 -0600
committerJim Meyering <meyering@redhat.com>2008-12-26 10:57:05 +0100
commit5c065bb0cb979dff21c474c0ff45b0c9013791d4 (patch)
tree4f47a9ffc3e455d145c8e75d49fe962094c1a703
parent680afe675159bab05b45ddebfc79eac5f7cd5bc5 (diff)
downloadcoreutils-5c065bb0cb979dff21c474c0ff45b0c9013791d4.tar.xz
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.
-rw-r--r--NEWS3
-rw-r--r--doc/coreutils.texi8
-rw-r--r--src/dd.c12
3 files changed, 22 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 717af04cd..f605330e7 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU coreutils NEWS -*- outline -*-
** New features
+ dd accepts iflag=cio and oflag=cio to open the file in CIO (concurrent I/O)
+ mode where this feature is available.
+
ls --color now highlights hard linked files, too
stat -f recognizes the Lustre file system type
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 9047925e3..387377345 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7729,6 +7729,14 @@ If you combine this flag with the @samp{of=@var{file}} operand,
you should also specify @samp{conv=notrunc} unless you want the
output file to be truncated before being appended to.
+@item cio
+@opindex cio
+@cindex concurrent I/O
+Use concurrent I/O mode for data. This mode performs direct I/O
+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.
+
@item direct
@opindex direct
@cindex direct I/O
diff --git a/src/dd.c b/src/dd.c
index e54cc14df..763961261 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -66,6 +66,12 @@ static void process_signals (void);
# define SIGINFO SIGUSR1
#endif
+/* This may belong in GNULIB's fcntl module instead.
+ Define O_CIO to 0 if it is not supported by this OS. */
+#ifndef O_CIO
+# define O_CIO 0
+#endif
+
#if ! HAVE_FDATASYNC
# define fdatasync(fd) (errno = ENOSYS, -1)
#endif
@@ -264,6 +270,7 @@ enum
/* Use a value that is larger than that of any other O_ symbol. */
O_FULLBLOCK = ((MAX (O_APPEND,
MAX (O_BINARY,
+ MAX (O_CIO,
MAX (O_DIRECT,
MAX (O_DIRECTORY,
MAX (O_DSYNC,
@@ -272,7 +279,7 @@ enum
MAX (O_NOFOLLOW,
MAX (O_NOLINKS,
MAX (O_NONBLOCK,
- MAX (O_SYNC, O_TEXT)))))))))))) << 1)
+ MAX (O_SYNC, O_TEXT))))))))))))) << 1)
};
/* Ensure that we didn't shift it off the end. */
@@ -288,6 +295,7 @@ static struct symbol_value const flags[] =
{
{"append", O_APPEND},
{"binary", O_BINARY},
+ {"cio", O_CIO},
{"direct", O_DIRECT},
{"directory", O_DIRECTORY},
{"dsync", O_DSYNC},
@@ -508,6 +516,8 @@ Each FLAG symbol may be:\n\
\n\
append append mode (makes sense only for output; conv=notrunc suggested)\n\
"), stdout);
+ if (O_CIO)
+ fputs (_(" cio use concurrent I/O for data\n"), stdout);
if (O_DIRECT)
fputs (_(" direct use direct I/O for data\n"), stdout);
if (O_DIRECTORY)