* dosio.c -- Disk I/O module for the ext2fs/DOS library.
*
* Copyright (c) 1997 by Theodore Ts'o.
- *
+ *
* Copyright (c) 1997 Mark Habersack
- * This file may be distributed under the terms of the GNU Public License.
*
+ * %Begin-Header%
+ * 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 <bios.h>
#include <string.h>
-#include <stdlib.h>
#include <ctype.h>
#include <io.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#include <linux/types.h>
+#include <ext2fs/ext2_types.h>
#include "utils.h"
#include "dosio.h"
#include "et/com_err.h"
static errcode_t dos_flush(io_channel channel);
static struct struct_io_manager struct_dos_manager = {
- EXT2_ET_MAGIC_IO_MANAGER,
- "DOS I/O Manager",
- dos_open,
- dos_close,
- dos_set_blksize,
- dos_read_blk,
- dos_write_blk,
- dos_flush
+ .magic = EXT2_ET_MAGIC_IO_MANAGER,
+ .name = "DOS I/O Manager",
+ .open = dos_open,
+ .close = dos_close,
+ .set_blksize = dos_set_blksize,
+ .read_blk = dos_read_blk,
+ .write_blk = dos_write_blk,
+ .flush = dos_flush
};
+
io_manager dos_io_manager = &struct_dos_manager;
/*
PARTITION *part;
PTABLE_ENTRY *pent;
PARTITION **newparts;
-
+
if(!dev)
{
_dio_error = ERR_BADDEV;
if(!HW_OK())
{
_dio_error = ERR_HARDWARE;
- if (part)
- free(part);
+ free(part->dev);
+ free(part);
return EFAULT;
}
if(!HW_OK())
{
_dio_error = ERR_HARDWARE;
- if (part)
- free(part);
+ free(part->dev);
+ free(part);
return EFAULT;
}
{
_dio_error = part->pno == 0xFE ? ERR_EMPTYPART :
part->pno == 0xFD ? ERR_LINUXSWAP : ERR_NOTEXT2FS;
- if (part)
- free(part);
+ free(part->dev);
+ free(part);
return ENODEV;
}
static errcode_t dos_close(io_channel channel)
{
- if (channel->name)
- free(channel->name);
- if (channel)
- free(channel);
+ free(channel->name);
+ free(channel);
return 0;
}