| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include "dex-object-private.h" |
| 24 |
#include "dex-future.h" |
| 25 |
|
| 26 |
G_BEGIN_DECLS |
| 27 |
|
| 28 |
#define DEX_TYPE_AIO_BACKEND (dex_aio_backend_get_type()) |
| 29 |
#define DEX_AIO_BACKEND(object) (G_TYPE_CHECK_INSTANCE_CAST(object, DEX_TYPE_AIO_BACKEND, DexAioBackend)) |
| 30 |
#define DEX_IS_AIO_BACKEND(object) (G_TYPE_CHECK_INSTANCE_TYPE(object, DEX_TYPE_AIO_BACKEND)) |
| 31 |
#define DEX_AIO_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, DEX_TYPE_AIO_BACKEND, DexAioBackendClass)) |
| 32 |
#define DEX_AIO_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, DEX_TYPE_AIO_BACKEND, DexAioBackendClass)) |
| 33 |
|
| 34 |
typedef struct _DexAioBackend DexAioBackend; |
| 35 |
typedef struct _DexAioBackendClass DexAioBackendClass; |
| 36 |
typedef struct _DexAioContext DexAioContext; |
| 37 |
|
| 38 |
struct _DexAioBackend |
| 39 |
{ |
| 40 |
DexObject parent_instance; |
| 41 |
}; |
| 42 |
|
| 43 |
struct _DexAioBackendClass |
| 44 |
{ |
| 45 |
DexObjectClass parent_class; |
| 46 |
|
| 47 |
DexAioContext *(*create_context) (DexAioBackend *aio_backend); |
| 48 |
DexFuture *(*close) (DexAioBackend *aio_backend, |
| 49 |
DexAioContext *aio_context, |
| 50 |
int fd); |
| 51 |
DexFuture *(*open) (DexAioBackend *aio_backend, |
| 52 |
DexAioContext *aio_context, |
| 53 |
const char *path, |
| 54 |
int flags, |
| 55 |
int mode); |
| 56 |
DexFuture *(*read) (DexAioBackend *aio_backend, |
| 57 |
DexAioContext *aio_context, |
| 58 |
int fd, |
| 59 |
gpointer buffer, |
| 60 |
gsize count, |
| 61 |
goffset offset); |
| 62 |
DexFuture *(*write) (DexAioBackend *aio_backend, |
| 63 |
DexAioContext *aio_context, |
| 64 |
int fd, |
| 65 |
gconstpointer buffer, |
| 66 |
gsize count, |
| 67 |
goffset offset); |
| 68 |
}; |
| 69 |
|
| 70 |
struct _DexAioContext |
| 71 |
{ |
| 72 |
GSource parent_source; |
| 73 |
DexAioBackend *aio_backend; |
| 74 |
|
| 75 |
}; |
| 76 |
|
| 77 |
GType dex_aio_backend_get_type (void); |
| 78 |
DexAioBackend *dex_aio_backend_get_default (void); |
| 79 |
DexAioContext *dex_aio_backend_create_context (DexAioBackend *aio_backend); |
| 80 |
DexFuture *dex_aio_backend_close (DexAioBackend *aio_backend, |
| 81 |
DexAioContext *aio_context, |
| 82 |
int fd); |
| 83 |
DexFuture *dex_aio_backend_open (DexAioBackend *aio_backend, |
| 84 |
DexAioContext *aio_context, |
| 85 |
const char *path, |
| 86 |
int flags, |
| 87 |
int mode); |
| 88 |
DexFuture *dex_aio_backend_read (DexAioBackend *aio_backend, |
| 89 |
DexAioContext *aio_context, |
| 90 |
int fd, |
| 91 |
gpointer buffer, |
| 92 |
gsize count, |
| 93 |
goffset offset); |
| 94 |
DexFuture *dex_aio_backend_write (DexAioBackend *aio_backend, |
| 95 |
DexAioContext *aio_context, |
| 96 |
int fd, |
| 97 |
gconstpointer buffer, |
| 98 |
gsize count, |
| 99 |
goffset offset); |
| 100 |
|
| 101 |
G_END_DECLS |