Debian Codegraph @

src/dex-aio-backend-private.h

raw symbols SCIP
1 /* dex-aio-backend-private.h
2 *
3 * Copyright 2022 Christian Hergert <[email protected]>
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: LGPL-2.1-or-later
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 /*< private >*/
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