summaryrefslogtreecommitdiff
path: root/lib/ext2fs/unix_io.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-10-25 04:16:53 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-10-25 04:16:53 +0000
commitc555aebde40afdc0d15d674f2c81c0e05cfded3f (patch)
treeedd6191c9ba2a2f26a4484a94baa89ff5ddde9ce /lib/ext2fs/unix_io.c
parentf13048113f09def05a024470bfeaf44635bf7e98 (diff)
downloade2fsprogs-c555aebde40afdc0d15d674f2c81c0e05cfded3f.tar.gz
Many files:
alloc.c (ext2fs_alloc_block): New function which allocates a block and updates the filesystem accounting records appropriately. ext2_err.et.in: Added new error codes: EXT2_NO_MEMORY, EXT2_INVALID_ARGUMENT, EXT2_BLOCK_ALLOC_FAIL, EXT2_INODE_ALLOC_FAIL, EXT2_NOT_DIRECTORY Change various library files to use these functions instead of EINVAL, ENOENT, etc. ChangeLog, pass1.c, pass3.c: pass3.c (get_lost_and_found): Check error return of EXT2_FILE_NOT_FOUND instead of ENOTDIR pass1.c (pass1_check_directory): Return EXT2_NO_DIRECTORY instead of ENOTDIR expect.icount: Change expected error string to be "Invalid argument passed to ext2 library" instead of just "Invalid argument"
Diffstat (limited to 'lib/ext2fs/unix_io.c')
-rw-r--r--lib/ext2fs/unix_io.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 203ce576..f1d37b52 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -25,9 +25,6 @@
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
#include "et/com_err.h"
#include "ext2fs/ext2_err.h"
@@ -80,19 +77,19 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
return EXT2_ET_BAD_DEVICE_NAME;
io = (io_channel) malloc(sizeof(struct struct_io_channel));
if (!io)
- return ENOMEM;
+ return EXT2_NO_MEMORY;
memset(io, 0, sizeof(struct struct_io_channel));
io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
data = (struct unix_private_data *)
malloc(sizeof(struct unix_private_data));
if (!data) {
- retval = ENOMEM;
+ retval = EXT2_NO_MEMORY;
goto cleanup;
}
io->manager = unix_io_manager;
io->name = malloc(strlen(name)+1);
if (!io->name) {
- retval = ENOMEM;
+ retval = EXT2_NO_MEMORY;
goto cleanup;
}
strcpy(io->name, name);
@@ -107,7 +104,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
data->buf = malloc(io->block_size);
data->buf_block_nr = -1;
if (!data->buf) {
- retval = ENOMEM;
+ retval = EXT2_NO_MEMORY;
goto cleanup;
}
data->dev = open(name, (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY);
@@ -166,7 +163,7 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize)
free(data->buf);
data->buf = malloc(blksize);
if (!data->buf)
- return ENOMEM;
+ return EXT2_NO_MEMORY;
data->buf_block_nr = -1;
}
return 0;