source: MondoRescue/branches/2.2.5/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h@ 1765

Last change on this file since 1765 was 1765, checked in by Bruno Cornec, 16 years ago

Update to busybox 1.7.2

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * io.h --- the I/O manager abstraction
4 *
5 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
6 *
7 * %Begin-Header%
8 * This file may be redistributed under the terms of the GNU Public
9 * License.
10 * %End-Header%
11 */
12
13#ifndef _EXT2FS_EXT2_IO_H
14#define _EXT2FS_EXT2_IO_H
15
16/*
17 * ext2_loff_t is defined here since unix_io.c needs it.
18 */
19#if defined(__GNUC__) || defined(HAS_LONG_LONG)
20typedef long long ext2_loff_t;
21#else
22typedef long ext2_loff_t;
23#endif
24
25/* llseek.c */
26/* ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); */
27#ifdef CONFIG_LFS
28# define ext2fs_llseek lseek64
29#else
30# define ext2fs_llseek lseek
31#endif
32
33typedef struct struct_io_manager *io_manager;
34typedef struct struct_io_channel *io_channel;
35
36#define CHANNEL_FLAGS_WRITETHROUGH 0x01
37
38struct struct_io_channel {
39 errcode_t magic;
40 io_manager manager;
41 char *name;
42 int block_size;
43 errcode_t (*read_error)(io_channel channel,
44 unsigned long block,
45 int count,
46 void *data,
47 size_t size,
48 int actual_bytes_read,
49 errcode_t error);
50 errcode_t (*write_error)(io_channel channel,
51 unsigned long block,
52 int count,
53 const void *data,
54 size_t size,
55 int actual_bytes_written,
56 errcode_t error);
57 int refcount;
58 int flags;
59 int reserved[14];
60 void *private_data;
61 void *app_data;
62};
63
64struct struct_io_manager {
65 errcode_t magic;
66 const char *name;
67 errcode_t (*open)(const char *name, int flags, io_channel *channel);
68 errcode_t (*close)(io_channel channel);
69 errcode_t (*set_blksize)(io_channel channel, int blksize);
70 errcode_t (*read_blk)(io_channel channel, unsigned long block,
71 int count, void *data);
72 errcode_t (*write_blk)(io_channel channel, unsigned long block,
73 int count, const void *data);
74 errcode_t (*flush)(io_channel channel);
75 errcode_t (*write_byte)(io_channel channel, unsigned long offset,
76 int count, const void *data);
77 errcode_t (*set_option)(io_channel channel, const char *option,
78 const char *arg);
79 int reserved[14];
80};
81
82#define IO_FLAG_RW 1
83
84/*
85 * Convenience functions....
86 */
87#define io_channel_close(c) ((c)->manager->close((c)))
88#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
89#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
90#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
91#define io_channel_flush(c) ((c)->manager->flush((c)))
92#define io_channel_bumpcount(c) ((c)->refcount++)
93
94/* io_manager.c */
95extern errcode_t io_channel_set_options(io_channel channel,
96 const char *options);
97extern errcode_t io_channel_write_byte(io_channel channel,
98 unsigned long offset,
99 int count, const void *data);
100
101/* unix_io.c */
102extern io_manager unix_io_manager;
103
104/* test_io.c */
105extern io_manager test_io_manager, test_io_backing_manager;
106extern void (*test_io_cb_read_blk)
107 (unsigned long block, int count, errcode_t err);
108extern void (*test_io_cb_write_blk)
109 (unsigned long block, int count, errcode_t err);
110extern void (*test_io_cb_set_blksize)
111 (int blksize, errcode_t err);
112
113#endif /* _EXT2FS_EXT2_IO_H */
114
Note: See TracBrowser for help on using the repository browser.