2006-03-18 Theodore Ts'o <tytso@mit.edu>
+ * ext2fs.h (EXT2_FLAG_EXCLUSIVE): Define new flag which requests
+ that the io_channel be opened in exclusive mode.
+
+ * openfs.c (ext2fs_open2), initialize.c (ext2fs_initialize): If
+ EXT2_FLAG_EXCLUSIVE is passed to ext2fs_open or
+ ext2fs_initialize, then pass IO_FLAG_EXCLUSIVE to the
+ io_channel open routine.
+
* 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.
#define EXT2_FLAG_SUPER_ONLY 0x800
#define EXT2_FLAG_JOURNAL_DEV_OK 0x1000
#define EXT2_FLAG_IMAGE_FILE 0x2000
+#define EXT2_FLAG_EXCLUSIVE 0x4000
/*
* Special flag in the ext2 inode i_flag field that means that this is
dgrp_t i;
blk_t numblocks;
int rsv_gdt;
+ int io_flags;
char *buf;
if (!param || !param->s_blocks_count)
#ifdef WORDS_BIGENDIAN
fs->flags |= EXT2_FLAG_SWAP_BYTES;
#endif
- retval = manager->open(name, IO_FLAG_RW, &fs->io);
+ io_flags = IO_FLAG_RW;
+ if (flags & EXT2_FLAG_EXCLUSIVE)
+ io_flags |= IO_FLAG_EXCLUSIVE;
+ retval = manager->open(name, io_flags, &fs->io);
if (retval)
goto cleanup;
fs->image_io = fs->io;
ext2_filsys fs;
errcode_t retval;
unsigned long i;
- int j, groups_per_block, blocks_per_group;
+ int j, groups_per_block, blocks_per_group, io_flags;
blk_t group_block, blk;
char *dest, *cp;
struct ext2_group_desc *gdp;
io_options = cp;
}
- retval = manager->open(fs->device_name,
- (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0,
- &fs->io);
+ io_flags = 0;
+ if (flags & EXT2_FLAG_RW)
+ io_flags |= IO_FLAG_RW;
+ if (flags & EXT2_FLAG_EXCLUSIVE)
+ io_flags |= IO_FLAG_EXCLUSIVE;
+ retval = manager->open(fs->device_name, io_flags, &fs->io);
if (retval)
goto cleanup;
if (io_options &&