Whamcloud - gitweb
Merge branch 'maint' into next
[tools/e2fsprogs.git] / lib / ext2fs / ext2_io.h
index b9ba0b6..bee75a6 100644 (file)
@@ -26,6 +26,7 @@ ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
 
 typedef struct struct_io_manager *io_manager;
 typedef struct struct_io_channel *io_channel;
+typedef struct struct_io_stats *io_stats;
 
 #define CHANNEL_FLAGS_WRITETHROUGH     0x01
 
@@ -55,6 +56,13 @@ struct struct_io_channel {
        void            *app_data;
 };
 
+struct struct_io_stats {
+       int                     num_fields;
+       int                     reserved;
+       unsigned long long      bytes_read;
+       unsigned long long      bytes_written;
+};
+
 struct struct_io_manager {
        errcode_t magic;
        const char *name;
@@ -68,10 +76,14 @@ struct struct_io_manager {
        errcode_t (*flush)(io_channel channel);
        errcode_t (*write_byte)(io_channel channel, unsigned long offset,
                                int count, const void *data);
-       int             reserved[15];
+       errcode_t (*set_option)(io_channel channel, const char *option, 
+                               const char *arg);
+       errcode_t (*get_stats)(io_channel channel, io_stats *io_stats);
+       int             reserved[14];
 };
 
-#define IO_FLAG_RW     1
+#define IO_FLAG_RW             0x0001
+#define IO_FLAG_EXCLUSIVE      0x0002
 
 /*
  * Convenience functions....
@@ -81,9 +93,15 @@ struct struct_io_manager {
 #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_write_byte(c,b,n,d) ((c)->manager->write_byte((c),b,n,d))
 #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;