diff options
author | Denis Vlasenko | 2006-12-26 01:30:59 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-12-26 01:30:59 +0000 |
commit | c4f623ef2a7980a63de7c9f1d539a656b83f10e7 (patch) | |
tree | a294e28b0112052cb9d58b403554b3390e76f50c /e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h | |
parent | 64c54025842f205ad722675105b88044a5b6845a (diff) | |
download | busybox-c4f623ef2a7980a63de7c9f1d539a656b83f10e7.zip busybox-c4f623ef2a7980a63de7c9f1d539a656b83f10e7.tar.gz |
put small subset of e2fsprogs back in the tree:
lsattr, chattr, fsck. Old e2fsprogs tree is in
e2fsprogs/old_e2fsprogs/*.
Diffstat (limited to 'e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h')
-rw-r--r-- | e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h new file mode 100644 index 0000000..e6c9630 --- /dev/null +++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h @@ -0,0 +1,114 @@ +/* vi: set sw=4 ts=4: */ +/* + * io.h --- the I/O manager abstraction + * + * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + */ + +#ifndef _EXT2FS_EXT2_IO_H +#define _EXT2FS_EXT2_IO_H + +/* + * ext2_loff_t is defined here since unix_io.c needs it. + */ +#if defined(__GNUC__) || defined(HAS_LONG_LONG) +typedef long long ext2_loff_t; +#else +typedef long ext2_loff_t; +#endif + +/* llseek.c */ +/* ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); */ +#ifdef CONFIG_LFS +# define ext2fs_llseek lseek64 +#else +# define ext2fs_llseek lseek +#endif + +typedef struct struct_io_manager *io_manager; +typedef struct struct_io_channel *io_channel; + +#define CHANNEL_FLAGS_WRITETHROUGH 0x01 + +struct struct_io_channel { + errcode_t magic; + io_manager manager; + char *name; + int block_size; + errcode_t (*read_error)(io_channel channel, + unsigned long block, + int count, + void *data, + size_t size, + int actual_bytes_read, + errcode_t error); + errcode_t (*write_error)(io_channel channel, + unsigned long block, + int count, + const void *data, + size_t size, + int actual_bytes_written, + errcode_t error); + int refcount; + int flags; + int reserved[14]; + void *private_data; + void *app_data; +}; + +struct struct_io_manager { + errcode_t magic; + const char *name; + errcode_t (*open)(const char *name, int flags, io_channel *channel); + errcode_t (*close)(io_channel channel); + errcode_t (*set_blksize)(io_channel channel, int blksize); + errcode_t (*read_blk)(io_channel channel, unsigned long block, + int count, void *data); + errcode_t (*write_blk)(io_channel channel, unsigned long block, + int count, const void *data); + errcode_t (*flush)(io_channel channel); + errcode_t (*write_byte)(io_channel channel, unsigned long offset, + int count, const void *data); + errcode_t (*set_option)(io_channel channel, const char *option, + const char *arg); + int reserved[14]; +}; + +#define IO_FLAG_RW 1 + +/* + * Convenience functions.... + */ +#define io_channel_close(c) ((c)->manager->close((c))) +#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) +#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) +#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) +#define io_channel_flush(c) ((c)->manager->flush((c))) +#define io_channel_bumpcount(c) ((c)->refcount++) + +/* io_manager.c */ +extern errcode_t io_channel_set_options(io_channel channel, + const char *options); +extern errcode_t io_channel_write_byte(io_channel channel, + unsigned long offset, + int count, const void *data); + +/* unix_io.c */ +extern io_manager unix_io_manager; + +/* test_io.c */ +extern io_manager test_io_manager, test_io_backing_manager; +extern void (*test_io_cb_read_blk) + (unsigned long block, int count, errcode_t err); +extern void (*test_io_cb_write_blk) + (unsigned long block, int count, errcode_t err); +extern void (*test_io_cb_set_blksize) + (int blksize, errcode_t err); + +#endif /* _EXT2FS_EXT2_IO_H */ + |