* Copyright (C) 2002 Theodore Ts'o.
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
+#include "config.h"
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
static errcode_t inode_flush(io_channel channel);
static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
int size, const void *data);
-static errcode_t inode_read_blk64(io_channel channel,
+static errcode_t inode_read_blk64(io_channel channel,
unsigned long long block, int count, void *data);
-static errcode_t inode_write_blk64(io_channel channel,
+static errcode_t inode_write_blk64(io_channel channel,
unsigned long long block, int count, const void *data);
-
+
static struct struct_io_manager struct_inode_manager = {
EXT2_ET_MAGIC_IO_MANAGER,
"Inode I/O Manager",
&data->file);
if (retval)
goto cleanup;
-
+
*channel = io;
return 0;
cleanup:
- if (data) {
+ if (io && io->name)
+ ext2fs_free_mem(&io->name);
+ if (data)
ext2fs_free_mem(&data);
- }
if (io)
ext2fs_free_mem(&io);
return retval;
return 0;
retval = ext2fs_file_close(data->file);
-
+
ext2fs_free_mem(&channel->private_data);
if (channel->name)
ext2fs_free_mem(&channel->name);
return ext2fs_file_write(data->file, buf, count, 0);
}
-static errcode_t inode_write_blk(io_channel channel, unsigned long block,
+static errcode_t inode_write_blk(io_channel channel, unsigned long block,
int count, const void *buf)
{
return inode_write_blk64(channel, block, count, buf);
}
/*
- * Flush data buffers to disk.
+ * Flush data buffers to disk.
*/
static errcode_t inode_flush(io_channel channel)
{
struct inode_private_data *data;
-
+
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
data = (struct inode_private_data *) channel->private_data;
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);