Many files:
  ext2_io.h (io_channel_write_byte): Add new interface to allow callers
  	to write specific byte ranges.  This is an optional interface, which
  	not all IO channels may implement.
  unix_io.c (unix_write_byte): test_io.c (test_write_byte): Add
  	implementation of the write_byte function.
  closefs.c (write_primary_superblock, ext2fs_flush): Add a new function
  	which writes the primary superblock.  If the IO channel supports
  	writing raw bytes directly, only fields which were modified are
  	written to the disk.  This makes it safe(r) to use utilities like
  	tune2fs on a mounted filesystem.
  freefs.c (ext2fs_free): Free the original superblock if it is available.
  openfs.c (ext2fs_open): Store a copy of the original superblock when
  	opening it.
  ext2fs.h: Add a field to store the original superblock in the ext2
  	context structure.

diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 19c6926..142d149 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -73,6 +73,8 @@
 static errcode_t unix_write_blk(io_channel channel, unsigned long block,
 				int count, const void *data);
 static errcode_t unix_flush(io_channel channel);
+static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
+				int size, const void *data);
 
 static struct struct_io_manager struct_unix_manager = {
 	EXT2_ET_MAGIC_IO_MANAGER,
@@ -82,7 +84,8 @@
 	unix_set_blksize,
 	unix_read_blk,
 	unix_write_blk,
-	unix_flush
+	unix_flush,
+	unix_write_byte
 };
 
 io_manager unix_io_manager = &struct_unix_manager;
@@ -509,6 +512,36 @@
 	return retval;
 }
 
+static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
+				 int size, const void *buf)
+{
+	struct unix_private_data *data;
+	struct unix_cache *cache;
+	errcode_t	retval = 0, retval2;
+	char		*cp;
+	int		i, writethrough;
+	size_t		actual;
+
+	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
+	data = (struct unix_private_data *) channel->private_data;
+	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
+
+	/*
+	 * Flush out the cache completely
+	 */
+	if ((retval = flush_cached_blocks(channel, data, 1)))
+		return retval;
+
+	if (lseek(data->dev, offset, SEEK_SET) < 0)
+		return errno;
+	
+	actual = write(data->dev, buf, size);
+	if (actual != size)
+		return EXT2_ET_SHORT_WRITE;
+
+	return 0;
+}
+
 /*
  * Flush data buffers to disk.  
  */