Add a new io_channel open flag, IO_FLAG_EXCLUSIVE,which requests that
the device be opened in exclusive (O_EXCL) mode. Add support to the unix_io
implementation for this flag.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 Theodore Ts'o <tytso@mit.edu>
+ * ext2_io.h (IO_FLAG_EXCLUSIVE), unix_io.c (unix_open): Add new
+ io_channel open flag, IO_FLAG_EXCLUSIVE, which requests
+ that the device be opened in exclusive (O_EXCL) mode.
+
* ext2fs.h: Fix documentation so that BLOCK_FLAG_TRAVERSE is
BLOCK_FLAG_DEPTH_TRAVERSE. (Addresses Debian Bug #351268)
int reserved[14];
};
-#define IO_FLAG_RW 1
+#define IO_FLAG_RW 0x0001
+#define IO_FLAG_EXCLUSIVE 0x0002
/*
* Convenience functions....
goto cleanup;
open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
+ if (flags & IO_FLAG_EXCLUSIVE)
+ open_flags |= O_EXCL;
#ifdef HAVE_OPEN64
data->dev = open64(io->name, open_flags);
#else