xref: /openbmc/qemu/include/io/channel-null.h (revision 7d87775f)
1 /*
2  * QEMU I/O channels null driver
3  *
4  * Copyright (c) 2022 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef QIO_CHANNEL_FILE_H
22 #define QIO_CHANNEL_FILE_H
23 
24 #include "io/channel.h"
25 #include "qom/object.h"
26 
27 #define TYPE_QIO_CHANNEL_NULL "qio-channel-null"
28 OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelNull, QIO_CHANNEL_NULL)
29 
30 
31 /**
32  * QIOChannelNull:
33  *
34  * The QIOChannelNull object provides a channel implementation
35  * that discards all writes and returns EOF for all reads.
36  */
37 
38 struct QIOChannelNull {
39     QIOChannel parent;
40     bool closed;
41 };
42 
43 
44 /**
45  * qio_channel_null_new:
46  *
47  * Create a new IO channel object that discards all writes
48  * and returns EOF for all reads.
49  *
50  * Returns: the new channel object
51  */
52 QIOChannelNull *
53 qio_channel_null_new(void);
54 
55 #endif /* QIO_CHANNEL_NULL_H */
56